drm/amd/display: Fix invalid context error in dml helper
commit 9984db63742099ee3f3cff35cf71306d10e64356 upstream.
[Why]
"BUG: sleeping function called from invalid context" error.
after:
"drm/amd/display: Protect FPU in dml2_validate()/dml21_validate()"
The populate_dml_plane_cfg_from_plane_state() uses the GFP_KERNEL flag
for memory allocation, which shouldn't be used in atomic contexts.
The allocation is needed only for using another helper function
get_scaler_data_for_plane().
[How]
Modify helpers to pass a pointer to scaler_data within existing context,
eliminating the need for dynamic memory allocation/deallocation
and copying.
Fixes: 366e77cd4923 ("drm/amd/display: Protect FPU in dml2_validate()/dml21_validate()")
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Roman Li <Roman.Li@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit bd3e84bc98f81b44f2c43936bdadc3241d654259)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
19323f414b
commit
d8c4afe783
@@ -929,7 +929,9 @@ static void populate_dml_surface_cfg_from_plane_state(enum dml_project_id dml2_p
|
||||
}
|
||||
}
|
||||
|
||||
static void get_scaler_data_for_plane(const struct dc_plane_state *in, struct dc_state *context, struct scaler_data *out)
|
||||
static struct scaler_data *get_scaler_data_for_plane(
|
||||
const struct dc_plane_state *in,
|
||||
struct dc_state *context)
|
||||
{
|
||||
int i;
|
||||
struct pipe_ctx *temp_pipe = &context->res_ctx.temp_pipe;
|
||||
@@ -950,7 +952,7 @@ static void get_scaler_data_for_plane(const struct dc_plane_state *in, struct dc
|
||||
}
|
||||
|
||||
ASSERT(i < MAX_PIPES);
|
||||
memcpy(out, &temp_pipe->plane_res.scl_data, sizeof(*out));
|
||||
return &temp_pipe->plane_res.scl_data;
|
||||
}
|
||||
|
||||
static void populate_dummy_dml_plane_cfg(struct dml_plane_cfg_st *out, unsigned int location,
|
||||
@@ -1013,11 +1015,7 @@ static void populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st *out
|
||||
const struct dc_plane_state *in, struct dc_state *context,
|
||||
const struct soc_bounding_box_st *soc)
|
||||
{
|
||||
struct scaler_data *scaler_data = kzalloc(sizeof(*scaler_data), GFP_KERNEL);
|
||||
if (!scaler_data)
|
||||
return;
|
||||
|
||||
get_scaler_data_for_plane(in, context, scaler_data);
|
||||
struct scaler_data *scaler_data = get_scaler_data_for_plane(in, context);
|
||||
|
||||
out->CursorBPP[location] = dml_cur_32bit;
|
||||
out->CursorWidth[location] = 256;
|
||||
@@ -1082,8 +1080,6 @@ static void populate_dml_plane_cfg_from_plane_state(struct dml_plane_cfg_st *out
|
||||
out->DynamicMetadataTransmittedBytes[location] = 0;
|
||||
|
||||
out->NumberOfCursors[location] = 1;
|
||||
|
||||
kfree(scaler_data);
|
||||
}
|
||||
|
||||
static unsigned int map_stream_to_dml_display_cfg(const struct dml2_context *dml2,
|
||||
|
||||
Reference in New Issue
Block a user