RE: [PATCH] drm/amd/display: Fix && vs || typos
[AMD Official Use Only - General] Reviewed-by: Anthony Koo Looks good, my mistake for not noticing this! Thanks, Anthony -Original Message- From: Dan Carpenter Sent: Friday, February 9, 2024 8:03 AM To: SHANMUGAM, SRINIVASAN Cc: Wentland, Harry ; Li, Sun peng (Leo) ; Siqueira, Rodrigo ; Deucher, Alexander ; Koenig, Christian ; Pan, Xinhui ; David Airlie ; Daniel Vetter ; Kazlauskas, Nicholas ; Koo, Anthony ; Pavic, Josip ; Huang, Leon ; Adhuri, Mounika ; Huang, Lewis ; amd-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org; linux-ker...@vger.kernel.org; kernel-janit...@vger.kernel.org Subject: [PATCH] drm/amd/display: Fix && vs || typos These ANDs should be ORs or it will lead to a NULL dereference. Fixes: fb5a3d037082 ("drm/amd/display: Add NULL test for 'timing generator' in 'dcn21_set_pipe()'") Fixes: 886571d217d7 ("drm/amd/display: Fix 'panel_cntl' could be null in 'dcn21_set_backlight_level()'") Signed-off-by: Dan Carpenter --- drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c index 5c7f380a84f9..7252f5f781f0 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c @@ -211,7 +211,7 @@ void dcn21_set_pipe(struct pipe_ctx *pipe_ctx) struct dmcu *dmcu = pipe_ctx->stream->ctx->dc->res_pool->dmcu; uint32_t otg_inst; - if (!abm && !tg && !panel_cntl) + if (!abm || !tg || !panel_cntl) return; otg_inst = tg->inst; @@ -245,7 +245,7 @@ bool dcn21_set_backlight_level(struct pipe_ctx *pipe_ctx, struct panel_cntl *panel_cntl = pipe_ctx->stream->link->panel_cntl; uint32_t otg_inst; - if (!abm && !tg && !panel_cntl) + if (!abm || !tg || !panel_cntl) return false; otg_inst = tg->inst; -- 2.43.0
RE: [PATCH][next] drm/amd/display: fix incorrect assignment due to a typo
Hi Colin, Sorry for any confusion of this code. I think in this case, it seems like the comment is wrong (but original implementation is somewhat wrong as well). Probably the original code implementation makes it unclear. There are three scenarios: 1. Variable refresh active, targeting a fixed rate In this case, the min = max = fixed rate 2. Variable refresh active, with a variable range In this case, the min = minimum refresh rate of the range. And the max = maximum refresh rate of the range. 3. Variable refresh rate is disabled (The case you are modifying) In the disabled case, we want to indicate to the display that the refresh rate is fixed, so we want to program min = max = the base refresh rate. Today there seems to be an implication that max refresh = base refresh, which is not necessarily true. I guess to make the code more clear and correct, the min and max should both be programmed equal to the base refresh rate (nominal field rate from mod_freesync_calc_nominal_field_rate) Does that make sense? Thanks, Anthony -Original Message- From: Colin King Sent: Thursday, April 23, 2020 10:03 AM To: Wentland, Harry ; Li, Sun peng (Leo) ; Deucher, Alexander ; Koenig, Christian ; Zhou, David(ChunMing) ; David Airlie ; Daniel Vetter ; Koo, Anthony ; amd-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org Cc: kernel-janit...@vger.kernel.org; linux-ker...@vger.kernel.org Subject: [PATCH][next] drm/amd/display: fix incorrect assignment due to a typo From: Colin Ian King The assignment to infopacket->sb[7] looks incorrect, the comment states it is the minimum refresh rate yet it is being assigned a value from the maximum refresh rate max_refresh_in_uhz. Fix this by using min_refresh_in_uhz instead. Addresses-Coverity: ("Copy-paste error") Fixes: d2bacc38f6ca ("drm/amd/display: Change infopacket type programming") Signed-off-by: Colin Ian King --- drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c index eb7421e83b86..fe11436536e8 100644 --- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c +++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c @@ -587,7 +587,7 @@ static void build_vrr_infopacket_data_v3(const struct mod_vrr_params *vrr, } else { // Non-fs case, program nominal range /* PB7 = FreeSync Minimum refresh rate (Hz) */ - infopacket->sb[7] = (unsigned char)((vrr->max_refresh_in_uhz + 50) / 100); + infopacket->sb[7] = (unsigned char)((vrr->min_refresh_in_uhz + +50) / 100); /* PB8 = FreeSync Maximum refresh rate (Hz) */ infopacket->sb[8] = (unsigned char)((vrr->max_refresh_in_uhz + 50) / 100); } -- 2.25.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm
Reviewed-by: Anthony Koo -Original Message- From: sunpeng...@amd.com Sent: Monday, October 21, 2019 3:44 PM To: amd-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org; lskre...@gmail.com Cc: Koo, Anthony ; Wentland, Harry ; Li, Sun peng (Leo) Subject: [PATCH v2] drm/amdgpu: Add DC feature mask to disable fractional pwm From: Leo Li [Why] Some LED panel drivers might not like fractional PWM. In such cases, backlight flickering may be observed. [How] Add a DC feature mask to disable fractional PWM, and associate it with the preexisting dc_config flag. The flag is only plumbed through the dmcu firmware, so plumb it through the driver path as well. To disable, add the following to the linux cmdline: amdgpu.dcfeaturemask=0x4 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204957 Signed-off-by: Leo Li --- v2: Add bugzilla link drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ drivers/gpu/drm/amd/display/dc/dce/dce_abm.c | 4 drivers/gpu/drm/amd/include/amd_shared.h | 1 + 3 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 1cf4beb76835..73f917d4d1e1 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -728,6 +728,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) if (amdgpu_dc_feature_mask & DC_MULTI_MON_PP_MCLK_SWITCH_MASK) init_data.flags.multi_mon_pp_mclk_switch = true; + if (amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK) + init_data.flags.disable_fractional_pwm = true; + init_data.flags.power_down_display_on_boot = true; #ifdef CONFIG_DRM_AMD_DC_DCN2_0 diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c index d759fdca7fdb..b8a3fc505c9b 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_abm.c @@ -404,6 +404,10 @@ static bool dce_abm_init_backlight(struct abm *abm) /* Enable the backlight output */ REG_UPDATE(BL_PWM_CNTL, BL_PWM_EN, 1); + /* Disable fractional pwm if configured */ + REG_UPDATE(BL_PWM_CNTL, BL_PWM_FRACTIONAL_EN, + abm->ctx->dc->config.disable_fractional_pwm ? 0 : 1); + /* Unlock group 2 backlight registers */ REG_UPDATE(BL_PWM_GRP1_REG_LOCK, BL_PWM_GRP1_REG_LOCK, 0); diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h index 8889aaceec60..5450ed762b7a 100644 --- a/drivers/gpu/drm/amd/include/amd_shared.h +++ b/drivers/gpu/drm/amd/include/amd_shared.h @@ -143,6 +143,7 @@ enum PP_FEATURE_MASK { enum DC_FEATURE_MASK { DC_FBC_MASK = 0x1, DC_MULTI_MON_PP_MCLK_SWITCH_MASK = 0x2, + DC_DISABLE_FRACTIONAL_PWM_MASK = 0x4, }; enum amd_dpm_forced_level; -- 2.23.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: linux-next: Signed-off-by missing for commits in the drm tree
Hi Stephen, Changes are Signed-off-by: Anthony Koo <anthony@amd.com> Thanks, Anthony -Original Message- From: Stephen Rothwell [mailto:s...@canb.auug.org.au] Sent: Tuesday, May 15, 2018 7:19 PM To: Dave Airlie <airl...@linux.ie>; DRI <dri-devel@lists.freedesktop.org> Cc: Linux-Next Mailing List <linux-n...@vger.kernel.org>; Linux Kernel Mailing List <linux-ker...@vger.kernel.org>; Koo, Anthony <anthony@amd.com>; Wentland, Harry <harry.wentl...@amd.com>; Deucher, Alexander <alexander.deuc...@amd.com> Subject: linux-next: Signed-off-by missing for commits in the drm tree Hi all, Commits f412e8307d0a ("drm/amd/display: Couple bug fixes in stats module") e09b6473c605 ("drm/amd/display: Rename encoder_info_packet to dc_info_packet") 87943159f409 ("drm/amd/display: Only program MSA_TIMING_PARAM if it changed") are missing a Signed-off-by from their author. -- Cheers, Stephen Rothwell ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel