Skip to content

Commit 4f26c95

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 <[email protected]> Cc: Alex Deucher <[email protected]> Fixes: d9e8658 ("drm/amd/display: Simplify brightness initialization") Reported-by: Mark Herbert <[email protected]> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3655 Reviewed-by: Sun peng Li <[email protected]> Signed-off-by: Tom Chung <[email protected]> Signed-off-by: Zaeem Mohamed <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 7875afa) Cc: [email protected]
1 parent 59b723c commit 4f26c95

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
@@ -9429,6 +9429,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
94299429
bool mode_set_reset_required = false;
94309430
u32 i;
94319431
struct dc_commit_streams_params params = {dc_state->streams, dc_state->stream_count};
9432+
bool set_backlight_level = false;
94329433

94339434
/* Disable writeback */
94349435
for_each_old_connector_in_state(state, connector, old_con_state, i) {
@@ -9548,6 +9549,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
95489549
acrtc->hw_mode = new_crtc_state->mode;
95499550
crtc->hwmode = new_crtc_state->mode;
95509551
mode_set_reset_required = true;
9552+
set_backlight_level = true;
95519553
} else if (modereset_required(new_crtc_state)) {
95529554
drm_dbg_atomic(dev,
95539555
"Atomic commit: RESET. crtc id %d:[%p]\n",
@@ -9599,6 +9601,19 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
95999601
acrtc->otg_inst = status->primary_otg_inst;
96009602
}
96019603
}
9604+
9605+
/* During boot up and resume the DC layer will reset the panel brightness
9606+
* to fix a flicker issue.
9607+
* It will cause the dm->actual_brightness is not the current panel brightness
9608+
* level. (the dm->brightness is the correct panel level)
9609+
* So we set the backlight level with dm->brightness value after set mode
9610+
*/
9611+
if (set_backlight_level) {
9612+
for (i = 0; i < dm->num_of_edps; i++) {
9613+
if (dm->backlight_dev[i])
9614+
amdgpu_dm_backlight_set_level(dm, i, dm->brightness[i]);
9615+
}
9616+
}
96029617
}
96039618

96049619
static void dm_set_writeback(struct amdgpu_display_manager *dm,

0 commit comments

Comments
 (0)