drm/amd/display: drop redundant memset() in get_available_dsc_slices()
Subsystems (3)
PATCH 1/3 drm/amd/display: drop redundant memset() in get_available_dsc_slices()
get_available_dsc_slices() returns the number of indices set, and all of the users of get_available_dsc_slices() don't cross the returned bound when iterating over available_slices[]. So, the memset() in get_available_dsc_slices() is redundant and can be dropped.
--- drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +0 -2
@@ -645,8 +645,6 @@ static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av {int idx =0 ; -memset (available_slices,-1 ,MIN_AVAILABLE_SLICES_SIZE ); -if (slice_caps.bits.NUM_SLICES_1) available_slices[idx++] =1 ;
Signature · 1 line
2.40.1
PATCH 2/3 drm/amd/display: drop unused function set_abm_event()
set_abm_event() is never actually used. So, drop it.
--- drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 12 ------------ drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 2 -- 2 files changed, 14 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +0 -12
@@ -131,17 +131,6 @@ static bool dmub_abm_set_pipe_ex(struct abm *abm, uint32_t otg_inst, uint32_t opreturn ret; } -static bool dmub_abm_set_event_ex (struct abm *abm,unsigned int full_screen,unsigned int video_mode, -unsigned int hdr_mode,unsigned int panel_inst) -{ -bool ret = false; -unsigned int feature_support; - - feature_support =abm_feature_support (abm, panel_inst); - -return ret; -} - static bool dmub_abm_set_backlight_level_pwm_ex(struct abm *abm, unsigned int backlight_pwm_u16_16, unsigned int frame_ramp,
@@ -167,7 +156,6 @@ static const struct abm_funcs abm_funcs = { .init_abm_config = dmub_abm_init_config_ex, .set_abm_pause = dmub_abm_set_pause_ex, .set_pipe_ex = dmub_abm_set_pipe_ex, - .set_abm_event = dmub_abm_set_event_ex, .set_backlight_level_pwm = dmub_abm_set_backlight_level_pwm_ex, };
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +0 -2
@@ -59,8 +59,6 @@ struct abm_funcs {unsigned int otg_inst, unsigned int option, unsigned int panel_inst); -bool (*set_abm_event)(struct abm *abm,unsigned int full_screen,unsigned int video_mode, - unsigned int hdr_mode, unsigned int panel_inst); };#endif
Signature · 1 line
2.40.1
Re: [PATCH 2/3] drm/amd/display: drop unused function set_abm_event()
Quoted 46 lines · Hamza Mahfooz
set_abm_event()is never actually used. So, drop it.Fixes b46c01aa0329 ("drm/amd/display: Refactor ABM feature")Reported-by kernel test robot <[email protected]>Reported-by Tom Rix <[email protected]>Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c | 12 ------------ drivers/gpu/drm/amd/display/dc/inc/hw/abm.h | 2 -- 2 files changed, 14 deletions(-)drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c +0
-12@@ -131,17 +131,6 @@ static bool dmub_abm_set_pipe_ex(struct abm *abm, uint32_t otg_inst, uint32_t opreturn ret; } -static bool dmub_abm_set_event_ex (struct abm *abm,unsigned int full_screen,unsigned int video_mode, -unsigned int hdr_mode,unsigned int panel_inst) -{ -bool ret = false; -unsigned int feature_support; - - feature_support =abm_feature_support (abm, panel_inst); - -return ret; -} - static bool dmub_abm_set_backlight_level_pwm_ex(struct abm *abm, unsigned int backlight_pwm_u16_16, unsigned int frame_ramp,@@ -167,7 +156,6 @@ static const struct abm_funcs abm_funcs = { .init_abm_config = dmub_abm_init_config_ex, .set_abm_pause = dmub_abm_set_pause_ex, .set_pipe_ex = dmub_abm_set_pipe_ex, - .set_abm_event = dmub_abm_set_event_ex, .set_backlight_level_pwm = dmub_abm_set_backlight_level_pwm_ex, };drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +0
-0
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h struct abm_funcs { · line 64
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h +0
-2@@ -59,8 +59,6 @@ struct abm_funcs {unsigned int otg_inst, unsigned int option, unsigned int panel_inst); -bool (*set_abm_event)(struct abm *abm,unsigned int full_screen,unsigned int video_mode, - unsigned int hdr_mode, unsigned int panel_inst); };#endif
PATCH 3/3 drm/amd/display: drop unused count variable in create_eml_sink()
In reply to Hamza MahfoozSince, we are only interested in having drm_edid_override_connector_update(), update the value of connector->edid_blob_ptr. We don't care about the return value of drm_edid_override_connector_update() here. So, drop count.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -6396,9 +6396,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)/* if connector->edid_override valid, pass * it to edid_override to edid_blob_ptr */ -int count; - count =drm_edid_override_connector_update (&aconnector->base); +drm_edid_override_connector_update (&aconnector->base);if (!aconnector->base.edid_blob_ptr) { DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
Signature · 1 line
2.40.1
Re: [PATCH 3/3] drm/amd/display: drop unused count variable in create_eml_sink()
Quoted 17 lines · Hamza Mahfooz
Since, we are only interested in having
drm_edid_override_connector_update(), update the value ofconnector->edid_blob_ptr. We don't care about the return value ofdrm_edid_override_connector_update()here. So, drop count.Fixes 068553e14f86 ("drm/amd/display: assign edid_blob_ptr with edid from debugfs")Reported-by kernel test robot <[email protected]>Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0
-0
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static void create_eml_sink(struct amdgpu_dm_connector *aconnector) · line 6403
Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-2@@ -6396,9 +6396,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)/* if connector->edid_override valid, pass * it to edid_override to edid_blob_ptr */ -int count; - count =drm_edid_override_connector_update (&aconnector->base); +drm_edid_override_connector_update (&aconnector->base);if (!aconnector->base.edid_blob_ptr) { DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
Re: [PATCH 3/3] drm/amd/display: drop unused count variable in create_eml_sink()
In reply to Hamza MahfoozQuoted 6 lines · Hamza Mahfooz
Since, we are only interested in having
drm_edid_override_connector_update(), update the value ofconnector->edid_blob_ptr. We don't care about the return value ofdrm_edid_override_connector_update()here. So, drop count.Fixes 068553e14f86 ("drm/amd/display: assign edid_blob_ptr with edid from debugfs")
The *real* problems with that commit are:
1) It uses drm_edid_override_connector_update() *at all*. Its documentation says:
Only to be used from drm_helper_probe_single_connector_modes() as a fallback for when DDC probe failed during drm_get_edid() and caused the override/firmware EDID to be skipped.
2) It messes with edid_blob_ptr directly. All drivers should stop doing that. It just complicates all the logic in the overrides and the property updates.
BR,
Jani.
Quoted 21 lines
Reported-by kernel test robot <[email protected]>Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-2@@ -6396,9 +6396,8 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)/* if connector->edid_override valid, pass * it to edid_override to edid_blob_ptr */ -int count; - count =drm_edid_override_connector_update (&aconnector->base); +drm_edid_override_connector_update (&aconnector->base);if (!aconnector->base.edid_blob_ptr) { DRM_ERROR("No EDID firmware found on connector: %s ,forcing to OFF!\n",
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Quoted 17 lines · Hamza Mahfooz
get_available_dsc_slices()returns the number of indices set, and all of the users ofget_available_dsc_slices()don't cross the returned bound when iterating over available_slices[]. So, thememset()inget_available_dsc_slices()is redundant and can be dropped.Fixes 97bda0322b8a ("drm/amd/display: Add DSC support for Navi (v2)")Reported-by Christophe JAILLET <[email protected]>Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +0
-0
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av · line 650
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +0
-2@@ -645,8 +645,6 @@ static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av {int idx =0 ; -memset (available_slices,-1 ,MIN_AVAILABLE_SLICES_SIZE ); -if (slice_caps.bits.NUM_SLICES_1) available_slices[idx++] =1 ;
Le 17/05/2023 à 20:33, Hamza Mahfooz a écrit :
Quoted 17 lines
get_available_dsc_slices()returns the number of indices set, and all of the users ofget_available_dsc_slices()don't cross the returned bound when iterating over available_slices[]. So, thememset()inget_available_dsc_slices()is redundant and can be dropped.Fixes 97bda0322b8a ("drm/amd/display: Add DSC support for Navi (v2)")Reported-by Christophe JAILLET <[email protected]>Signed-off-by Hamza Mahfooz <[email protected]>--- drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +0
-0
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av · line 650
Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +0
-2@@ -645,8 +645,6 @@ static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av {int idx =0 ; -memset (available_slices,-1 ,MIN_AVAILABLE_SLICES_SIZE ); -if (slice_caps.bits.NUM_SLICES_1) available_slices[idx++] =1 ;
Thanks for it, it went off my radar.
FWIW: