Skip to content

Commit 7875afa

Browse files
Tom Chungalexdeucher
authored andcommitted
drm/amd/display: Fix brightness level not retained over reboot
[Why] During boot up and resume the DC layer will reset the panel brightness to fix a flicker issue. It will cause the dm->actual_brightness is not the current panel brightness level. (the dm->brightness is the correct panel level) [How] Set the backlight level after do the set mode. Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Fixes: d9e8658 ("drm/amd/display: Simplify brightness initialization") Reported-by: Mark Herbert <mark.herbert42@gmail.com> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3655 Reviewed-by: Sun peng Li <sunpeng.li@amd.com> Signed-off-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 9626890 commit 7875afa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9442,6 +9442,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
94429442
bool mode_set_reset_required = false;
94439443
u32 i;
94449444
struct dc_commit_streams_params params = {dc_state->streams, dc_state->stream_count};
9445+
bool set_backlight_level = false;
94459446

94469447
/* Disable writeback */
94479448
for_each_old_connector_in_state(state, connector, old_con_state, i) {
@@ -9561,6 +9562,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
95619562
acrtc->hw_mode = new_crtc_state->mode;
95629563
crtc->hwmode = new_crtc_state->mode;
95639564
mode_set_reset_required = true;
9565+
set_backlight_level = true;
95649566
} else if (modereset_required(new_crtc_state)) {
95659567
drm_dbg_atomic(dev,
95669568
"Atomic commit: RESET. crtc id %d:[%p]\n",
@@ -9612,6 +9614,19 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
96129614
acrtc->otg_inst = status->primary_otg_inst;
96139615
}
96149616
}
9617+
9618+
/* During boot up and resume the DC layer will reset the panel brightness
9619+
* to fix a flicker issue.
9620+
* It will cause the dm->actual_brightness is not the current panel brightness
9621+
* level. (the dm->brightness is the correct panel level)
9622+
* So we set the backlight level with dm->brightness value after set mode
9623+
*/
9624+
if (set_backlight_level) {
9625+
for (i = 0; i < dm->num_of_edps; i++) {
9626+
if (dm->backlight_dev[i])
9627+
amdgpu_dm_backlight_set_level(dm, i, dm->brightness[i]);
9628+
}
9629+
}
96159630
}
96169631

96179632
static void dm_set_writeback(struct amdgpu_display_manager *dm,

0 commit comments

Comments
 (0)