SteamOS icon indicating copy to clipboard operation
SteamOS copied to clipboard

neptune-611: brightness no longer retained between OLED Deck modesets after "drm/amd/display: Fix brightness level not retained over reboot" when HDR is enabled

Open matte-schwartz opened this issue 8 months ago • 7 comments

Your system information

  • Steam client version:
  • SteamOS version: 20250501.1000
  • Opted into Steam client beta?: Yes
  • Opted into SteamOS beta?: Yes
  • Have you checked for updates in Settings > System?: Yes

Please describe your issue in as much detail as possible:

On linux-neptune-611, if HDR is enabled in-game then the brightness slider value in the Steam UI is not retained between modesets for frame limiting. I bisected the issue to https://github.com/torvalds/linux/commit/d83c747a1225dc34c2e837a1b0232e701415b780.

Notably, this issue only happens if you patch the kernel with all of the patches from frog/6.11. If I use the most recent vanilla Arch kernel available in the SteamOS repos, 6.12.8, then the issue does not occur. However, if I add the OLED Deck patches from frog/6.11 on top of it, the issue starts occurring again if I do not revert the bisected commit.

Steps for reproducing this issue:

  1. Launch an HDR game (I used Ori and the Will of the Wisps)
  2. Set brightness to maximum on the right Steam side menu slider
  3. Set a new frame limit on the right Steam side menu slider

The brightness should reset itself between steps 2 and 3, leading to a mismatch in slider position to the actual screen brightness, unless you revert https://github.com/torvalds/linux/commit/d83c747a1225dc34c2e837a1b0232e701415b780

matte-schwartz avatar May 05 '25 08:05 matte-schwartz

personally i've seen no downsides in reverting the bad commit against frog/6.11 while testing locally:
From cdf0b7f61963dd4b6cf256324a423d4f3858e8ac Mon Sep 17 00:00:00 2001
From: Matthew Schwartz <[email protected]>
Date: Fri, 20 Jun 2025 10:54:17 -0700
Subject: [PATCH] Revert "drm/amd/display: Fix brightness level not retained
 over reboot"

This reverts commit d83c747a1225dc34c2e837a1b0232e701415b780.

It interferes with the brightness level after modesetting while HDR is
enabled, so revert for now.

Signed-off-by: Matthew Schwartz <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 ---------------
 1 file changed, 15 deletions(-)

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 2aa68904c354d..159a3f0e4ae8d 100755
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -9524,7 +9524,6 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
        bool mode_set_reset_required = false;
        u32 i;
        struct dc_commit_streams_params params = {dc_state->streams, dc_state->stream_count};
-       bool set_backlight_level = false;
 
        /* Disable writeback */
        for_each_old_connector_in_state(state, connector, old_con_state, i) {
@@ -9644,7 +9643,6 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
                        acrtc->hw_mode = new_crtc_state->mode;
                        crtc->hwmode = new_crtc_state->mode;
                        mode_set_reset_required = true;
-                       set_backlight_level = true;
                } else if (modereset_required(new_crtc_state)) {
                        drm_dbg_atomic(dev,
                                       "Atomic commit: RESET. crtc id %d:[%p]\n",
@@ -9696,19 +9694,6 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
                                acrtc->otg_inst = status->primary_otg_inst;
                }
        }
-
-       /* 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)
-        * So we set the backlight level with dm->brightness value after set mode
-        */
-       if (set_backlight_level) {
-               for (i = 0; i < dm->num_of_edps; i++) {
-                       if (dm->backlight_dev[i])
-                               amdgpu_dm_backlight_set_level(dm, i, dm->brightness[i]);
-               }
-       }
 }
 
 static void dm_set_writeback(struct amdgpu_display_manager *dm,
-- 
2.50.0

and then if the next kernel is 6.15, maybe look into using Mario's new custom brightness curve work: https://lore.kernel.org/amd-gfx/[email protected]/

matte-schwartz avatar Jun 20 '25 17:06 matte-schwartz

this is still broken on linux-neptune-615:

https://github.com/user-attachments/assets/a5866a39-278e-42da-9836-a7a79a0c197e

You can see when I change the brightness slider after the modeset, the panel brightness goes up instead of down, meaning it lost its last brightness position before the modeset.

matte-schwartz avatar Aug 01 '25 23:08 matte-schwartz

this does actually happen on upstream kernels if you enable AMD_PRIVATE_COLOR, so I've reported this as a regression upstream: https://gitlab.freedesktop.org/drm/amd/-/issues/4551

matte-schwartz avatar Sep 03 '25 19:09 matte-schwartz

i sent a patch upstream for this: https://lore.kernel.org/lkml/[email protected]/

matte-schwartz avatar Sep 11 '25 18:09 matte-schwartz

patch has been merged upstream, this can be closed with https://gitlab.freedesktop.org/agd5f/linux/-/commit/01a093f1ec828f7945f8205f6ecc601aa45a12eb backported

matte-schwartz avatar Sep 18 '25 20:09 matte-schwartz