redhat-performance / tuned

Tuning Profile Delivery Mechanism for Linux
GNU General Public License v2.0
814 stars 178 forks source link

Add the ability to change DRM properties in tuned profile #575

Closed superm1 closed 10 months ago

superm1 commented 10 months ago

AMD has a DRM property that is exported by amdgpu that controls Adaptive Backlight Management. This property when enabled will decrease backlight brightness but change pixel brightness to improve power consumption.

It's briefly described in the kernel documentation.

It has a configurable value from 0 through 4 to control how aggressive it is. It's only exported on the eDP connector. It's called abm level.

├───Connectors
│   ├───Connector 0
│   │   ├───Object ID: 83
│   │   ├───Type: eDP
│   │   ├───Status: connected
│   │   ├───Physical size: 290x190 mm
│   │   ├───Subpixel: unknown
│   │   ├───Encoders: {0}
│   │   ├───Modes
│   │   │   ├───2880x1800@60.00 preferred driver phsync nvsync 
│   │   │   ├───1920x1200@60.00 driver phsync nvsync 
│   │   │   ├───1920x1080@60.00 driver phsync nvsync 
│   │   │   ├───1600x1200@60.00 driver phsync nvsync 
│   │   │   ├───1680x1050@60.00 driver phsync nvsync 
│   │   │   ├───1280x1024@60.00 driver phsync nvsync 
│   │   │   ├───1440x900@60.00 driver phsync nvsync 
│   │   │   ├───1280x800@60.00 driver phsync nvsync 
│   │   │   ├───1280x720@60.00 driver phsync nvsync 
│   │   │   ├───1024x768@60.00 driver phsync nvsync 
│   │   │   ├───800x600@60.00 driver phsync nvsync 
│   │   │   └───640x480@60.00 driver phsync nvsync 
│   │   └───Properties
│   │       ├───"EDID" (immutable): blob = 131
│   │       ├───"DPMS": enum {On, Standby, Suspend, Off} = On
│   │       ├───"link-status": enum {Good, Bad} = Good
│   │       ├───"non-desktop" (immutable): range [0, 1] = 0
│   │       ├───"TILE" (immutable): blob = 0
│   │       ├───"CRTC_ID" (atomic): object CRTC = 72
│   │       ├───"scaling mode": enum {None, Full, Center, Full aspect} = None
│   │       ├───"underscan": enum {off, on, auto} = off
│   │       ├───"underscan hborder": range [0, 128] = 0
│   │       ├───"underscan vborder": range [0, 128] = 0
│   │       ├───"max bpc": range [8, 16] = 16
│   │       ├───"abm level": range [0, 4] = 3
│   │       ├───"Colorspace": enum {Default, BT709_YCC, opRGB, BT2020_RGB, BT2020_YCC} = Default
│   │       ├───"HDR_OUTPUT_METADATA": blob = 0
│   │       ├───"vrr_capable" (immutable): range [0, 1] = 0
│   │       ├───"Content Protection": enum {Undesired, Desired, Enabled} = Undesired
│   │       └───"HDCP Content Type": enum {HDCP Type0, HDCP Type1} = HDCP Type0

I feel that tuned should have the ability to enact values for this property based on situational behavior (only on DC, or battery is below some value) and users should be able to set how much they want it to be used.

superm1 commented 10 months ago

I found out that only the DRM master can do this right now (IE the compositor). So for tuned to manipulate this that would need to be loosened up in the kernel first.

superm1 commented 10 months ago

I'm going to close this for now; we'll need to come up with another way to let system wide daemons like tuned manipulate this (maybe a sysfs file). Will revisit it at that point.