Fix doesn't work on Stoney: c010efb7f0bc0c "drm/amdgpu/display - only update eDP's backlight level when necessary"
Brief summary of the problem:
On Stoney, after picking the following patch, the backlight is still updated on every atomic commit, resulting in poor performance.
c010efb7f0bc0c "drm/amdgpu/display - only update eDP's backlight level when necessary"
The patch added a check so that the backlight is only updated if the requested value is different from the current value. But on Stoney, these values are always different, so the condition is always true. Adding some extra logging:
2021-07-29T00:39:07.898740Z WARNING kernel: [ 28.997423] dm->brightness[0] = 160
2021-07-29T00:39:07.898741Z WARNING kernel: [ 28.997431] dce_abm_get_current_backlight: returning 64000
2021-07-29T00:39:07.898742Z WARNING kernel: [ 28.997434] dc_link_get_backlight_level: returning 64000
2021-07-29T00:39:07.898744Z WARNING kernel: [ 28.997437] amdgpu_dm_backlight_get_level: returning 249
2021-07-29T00:39:07.898745Z DEBUG kernel: [ 28.997442] [drm:dc_link_set_backlight_level] New Backlight level: 41120 (0xA0A0)
2021-07-29T00:39:07.898747Z WARNING kernel: [ 28.997444] dce110_set_backlight_level: backlight_pwm_u16_16 = 41120
2021-07-29T00:39:07.898749Z WARNING kernel: [ 28.997449] dce_driver_set_backlight: backlight_pwm_u16_16 = 41120
2021-07-29T00:39:07.898750Z WARNING kernel: [ 28.997453] dce_driver_set_backlight: active_duty_cycle = 164480000
2021-07-29T00:39:07.898751Z WARNING kernel: [ 28.997456] dce_driver_set_backlight: backlight_16bit = 40156
It looks like when setting the backlight value, the panel_cntl function dce_driver_set_backlight() is used. But when reading the backlight value, the abm function dce_abm_get_current_backlight() is used. IIUC, these functions read and write to different sets of registers (panel_cntl vs abm), which explains why the values never match.
Hardware description:
- CPU/GPU: AMD A4-9120C RADEON R4, 5 COMPUTE CORES 2C+3G
- System Memory: 4GB
- Display(s): Integrated display "AUO Model 615c Serial Number 0"
- Type of Diplay Connection: eDP
System information:
- Distro name and Version: Chrome OS 14116.0.0
- Kernel version: 5.10.53
- Custom kernel: Chrome OS custom kernel, with backported drm changes up to 'drm-next-2021-07-01'
- AMD package version: No package
How to reproduce the issue:
Look at logs to see that the backlight is updated on every atomic commit.
Attached files:
dmesg with drm.debug=0x1ff and extra logging: dmesg.txt