drm/amdgpu/display - only update eDP's backlight level when necessary
authorZhan Liu <zhan.liu@amd.com>
Thu, 8 Jul 2021 04:51:52 +0000 (00:51 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 8 Jul 2021 21:47:28 +0000 (17:47 -0400)
[Why]
The original logic is to update eDP's backlight level
on every amdgpu dm atomic commit, which causes excessive
DMUB write. As a result, when playing game or moving window
around, DMUB timeout and system lagging are observed.

[How]
We only need to update eDP's backlight level when current level
doesn't match requested level.

Signed-off-by: Zhan Liu <zhan.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index f69be12..5cdb0e7 100644 (file)
@@ -9191,7 +9191,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||          \
        defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
        /* restore the backlight level */
-       if (dm->backlight_dev)
+       if (dm->backlight_dev && (amdgpu_dm_backlight_get_level(dm) != dm->brightness[0]))
                amdgpu_dm_backlight_set_level(dm, dm->brightness[0]);
 #endif
        /*