drm/amd/display: Trivial swizzle-related code clean-ups
Subsystems (3)
PATCH 1/1 drm/amd/display: Trivial swizzle-related code clean-ups
This is a very trivial code clean-up related to commit 5468c36d6285 ("drm/amd/display: Filter Invalid 420 Modes for HDMI TMDS"). This commit added a validation on driver probe to prevent invalid TMDS modes, but one of the fake properties (swizzle) ended-up causing a warning on driver probe; was reported here: https://gitlab.freedesktop.org/drm/amd/-/issues/2264.
It was fixed by commit 105a8b8698e2 ("drm/amd/display: patch cases with unknown plane state to prevent warning"), but the validation code had a double variable assignment, which we hereby remove. Also, the fix relies in the dcn2{0,1}patch_unknown_plane_state() callbacks, so while at it we took the opportunity to perform a small code clean-up in such routines.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 - drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 8 ++------ drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 6 ++---- 3 files changed, 4 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -1
@@ -6336,7 +6336,6 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc, dc_plane_state->plane_size.surface_size.width = stream->src.width; dc_plane_state->plane_size.chroma_size.height = stream->src.height; dc_plane_state->plane_size.chroma_size.width = stream->src.width; - dc_plane_state->tiling_info.gfx9.swizzle =DC_SW_UNKNOWN ; dc_plane_state->format =SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 ; dc_plane_state->tiling_info.gfx9.swizzle =DC_SW_UNKNOWN ; dc_plane_state->rotation =ROTATION_ANGLE_0 ;
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +2 -6
@@ -2225,14 +2225,10 @@ enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_statenum surface_pixel_format surf_pix_format = plane_state->format;unsigned int bpp =resource_pixel_format_to_bpp (surf_pix_format); -enum swizzle_mode_values swizzle =DC_SW_LINEAR ; - + plane_state->tiling_info.gfx9.swizzle =DC_SW_64KB_S ;if (bpp ==64 ) - swizzle =DC_SW_64KB_D ; -else - swizzle =DC_SW_64KB_S ; + plane_state->tiling_info.gfx9.swizzle =DC_SW_64KB_D ; - plane_state->tiling_info.gfx9.swizzle = swizzle;return DC_OK ; }
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +2 -4
@@ -1393,15 +1393,13 @@ static uint32_t read_pipe_fuses(struct dc_context *ctx)static enum dc_status dcn21_patch_unknown_plane_state (struct dc_plane_state *plane_state) { -enum dc_status result =DC_OK ; -if (plane_state->ctx->dc->debug.disable_dcc ==DCC_ENABLE ) { plane_state->dcc.enable =1 ;/* align to our worst case block width */ plane_state->dcc.meta_pitch = ((plane_state->src_rect.width +1023 ) /1024 ) *1024 ; } - result =dcn20_patch_unknown_plane_state (plane_state); -return result; + +return dcn20_patch_unknown_plane_state (plane_state); }static const struct resource_funcs dcn21_res_pool_funcs = {
Signature · 1 line
2.39.0
Quoted 12 lines · Guilherme G. Piccoli
This is a very trivial code clean-up related to commit
5468c36d6285("drm/amd/display: Filter Invalid 420 Modes for HDMI TMDS"). This commit added a validation on driver probe to prevent invalid TMDS modes, but one of the fake properties (swizzle) ended-up causing a warning on driver probe; was reported here: https://gitlab.freedesktop.org/drm/amd/-/issues/2264.It was fixed by commit
105a8b8698e2("drm/amd/display: patch cases with unknown plane state to prevent warning"), but the validation code had a double variable assignment, which we hereby remove. Also, the fix relies in the dcn2{0,1}patch_unknown_plane_state() callbacks, so while at it we took the opportunity to perform a small code clean-up in such routines.
Quoted 11 lines
Cc Aurabindo Pillai <[email protected]>Cc Daniel Wheeler <[email protected]>Cc Fangzhi Zuo <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Mark Broadworth <[email protected]>Cc Melissa Wen <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Sung Joon Kim <[email protected]>Cc Swapnil Patel <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>
Harry
Quoted 61 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 - drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 8 ++------ drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 6 ++---- 3 files changed, 4 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-1@@ -6336,7 +6336,6 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc, dc_plane_state->plane_size.surface_size.width = stream->src.width; dc_plane_state->plane_size.chroma_size.height = stream->src.height; dc_plane_state->plane_size.chroma_size.width = stream->src.width; - dc_plane_state->tiling_info.gfx9.swizzle =DC_SW_UNKNOWN ; dc_plane_state->format =SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 ; dc_plane_state->tiling_info.gfx9.swizzle =DC_SW_UNKNOWN ; dc_plane_state->rotation =ROTATION_ANGLE_0 ;drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +2
-6@@ -2225,14 +2225,10 @@ enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_statenum surface_pixel_format surf_pix_format = plane_state->format;unsigned int bpp =resource_pixel_format_to_bpp (surf_pix_format); -enum swizzle_mode_values swizzle =DC_SW_LINEAR ; - + plane_state->tiling_info.gfx9.swizzle =DC_SW_64KB_S ;if (bpp ==64 ) - swizzle =DC_SW_64KB_D ; -else - swizzle =DC_SW_64KB_S ; + plane_state->tiling_info.gfx9.swizzle =DC_SW_64KB_D ; - plane_state->tiling_info.gfx9.swizzle = swizzle;return DC_OK ; }drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +2
-4@@ -1393,15 +1393,13 @@ static uint32_t read_pipe_fuses(struct dc_context *ctx)static enum dc_status dcn21_patch_unknown_plane_state (struct dc_plane_state *plane_state) { -enum dc_status result =DC_OK ; -if (plane_state->ctx->dc->debug.disable_dcc ==DCC_ENABLE ) { plane_state->dcc.enable =1 ;/* align to our worst case block width */ plane_state->dcc.meta_pitch = ((plane_state->src_rect.width +1023 ) /1024 ) *1024 ; } - result =dcn20_patch_unknown_plane_state (plane_state); -return result; + +return dcn20_patch_unknown_plane_state (plane_state); }static const struct resource_funcs dcn21_res_pool_funcs = {
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 92 lines · Harry Wentland
Quoted 12 lines · Guilherme G. Piccoli
This is a very trivial code clean-up related to commit
5468c36d6285("drm/amd/display: Filter Invalid 420 Modes for HDMI TMDS"). This commit added a validation on driver probe to prevent invalid TMDS modes, but one of the fake properties (swizzle) ended-up causing a warning on driver probe; was reported here: https://gitlab.freedesktop.org/drm/amd/-/issues/2264.It was fixed by commit
105a8b8698e2("drm/amd/display: patch cases with unknown plane state to prevent warning"), but the validation code had a double variable assignment, which we hereby remove. Also, the fix relies in the dcn2{0,1}patch_unknown_plane_state() callbacks, so while at it we took the opportunity to perform a small code clean-up in such routines.Quoted 11 lines
Cc Aurabindo Pillai <[email protected]>Cc Daniel Wheeler <[email protected]>Cc Fangzhi Zuo <[email protected]>Cc Harry Wentland <[email protected]>Cc Leo Li <[email protected]>Cc Mark Broadworth <[email protected]>Cc Melissa Wen <[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Sung Joon Kim <[email protected]>Cc Swapnil Patel <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>Reviewed-by Harry Wentland <[email protected]>Harry
Quoted 61 lines
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 - drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 8 ++------ drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c | 6 ++---- 3 files changed, 4 insertions(+), 11 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-1@@ -6336,7 +6336,6 @@ static enum dc_status dm_validate_stream_and_context(struct dc *dc, dc_plane_state->plane_size.surface_size.width = stream->src.width; dc_plane_state->plane_size.chroma_size.height = stream->src.height; dc_plane_state->plane_size.chroma_size.width = stream->src.width; - dc_plane_state->tiling_info.gfx9.swizzle =DC_SW_UNKNOWN ; dc_plane_state->format =SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 ; dc_plane_state->tiling_info.gfx9.swizzle =DC_SW_UNKNOWN ; dc_plane_state->rotation =ROTATION_ANGLE_0 ;drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +2
-6@@ -2225,14 +2225,10 @@ enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_statenum surface_pixel_format surf_pix_format = plane_state->format;unsigned int bpp =resource_pixel_format_to_bpp (surf_pix_format); -enum swizzle_mode_values swizzle =DC_SW_LINEAR ; - + plane_state->tiling_info.gfx9.swizzle =DC_SW_64KB_S ;if (bpp ==64 ) - swizzle =DC_SW_64KB_D ; -else - swizzle =DC_SW_64KB_S ; + plane_state->tiling_info.gfx9.swizzle =DC_SW_64KB_D ; - plane_state->tiling_info.gfx9.swizzle = swizzle;return DC_OK ; }drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +2
-4@@ -1393,15 +1393,13 @@ static uint32_t read_pipe_fuses(struct dc_context *ctx)static enum dc_status dcn21_patch_unknown_plane_state (struct dc_plane_state *plane_state) { -enum dc_status result =DC_OK ; -if (plane_state->ctx->dc->debug.disable_dcc ==DCC_ENABLE ) { plane_state->dcc.enable =1 ;/* align to our worst case block width */ plane_state->dcc.meta_pitch = ((plane_state->src_rect.width +1023 ) /1024 ) *1024 ; } - result =dcn20_patch_unknown_plane_state (plane_state); -return result; + +return dcn20_patch_unknown_plane_state (plane_state); }static const struct resource_funcs dcn21_res_pool_funcs = {