[SoK Proposal] Move brightness control to KWin and add per-screen brightness control
Project abstract
Migrate the brightness control from powerdevil to KWin and make the API fitting for per-screen control
Proposal
The code for changing screen brightness (via sysfs and ddcutil) will be implemented in KWin. The interaction between powerdevil and KWin is yet to be determined. On X11 we might have to support the situation where KWin is not used as the window manager. On wayland, KWin can implement a new DBus interface that can be called by the brightness applet. On X11 if KWin is present, that interface could be used, if not, powerdevil can fallback to its existing implementation.
Once the basic control is working I'll focus on implementing per-screen control.
It can broadly be divided into the following tasks:
- Get a list of all monitors that support changing brightness
- Enumeration needs to be done using
sysfs
andddcutil
- Some corner cases: plasma/powerdevil@761fc8a4 , plasma/powerdevil@567c2578
- Enumeration needs to be done using
- Expose the list to the brightness control applet
- Probably needs a new DBus interface
- Implement a new per-screen DBus API in KWin
- I expect to complete the SDR implementation by the end of SoK
- HDR brightness will likely require a longer timeline, I'll try to atleast get some basic HDR scaffolding in place
References: plasma/kwin#156 (closed), plasma/powerdevil#19 (closed)
Proposed Architecture
I have visualised what I understood from the existing discussions:
graph TB
Action --> Powerdevil
Choice -- "Yes" --> KWin
subgraph Powerdevil
Choice{KWin Present?}
Choice -- "No (On X11)" --> Impl1(Existing Control)
end
subgraph "Applet"
Action[User Action]
end
subgraph KWin
DBI(org.kde.new.DBus.Interface)
DBI --> Impl2(Per-Screen Control)
end
This architecture will most likely change as the project progresses.
Hardware I'll use for testing
- Laptop: Hp eq2040au
- Monitor: Acer Nitro VG271U (HDMI)
I will be publishing blog posts documenting my work.
Timeline
17 Jan - 31 Jan
Deliverables:
- Study the source code of KWin and powerdevil to understand the current implementation
- Have discussions about the final architecture and interaction between KWin and powerdevil
- Set up my development environment and compile KWin and powerdevil
- Search the KDE bugzilla for any brightness control related bugs that can be improved under this project
1 Feb - 29 Feb
Deliverables:
- Work on implementing brightness control code in KWin
- Implement a new DBus interface that will be called by the applet and later extended to support per-screen control
- Brightness control via
sysfs
and DBus integration with the applet will be implemented - Finalize the architecture and work on properly integrating with powerdevil on wayland
- Once the implementation is completed I will publish a blog post detailing my work
1 Mar - 28 Mar
Deliverables:
- Wrap up the brightness control migration and test for regressions
- Work on extending the brightness control interface to support per monitor brightness control
- This will require creating a DBus interface to expose all monitors with controllable brightness (sysfs and ddcutil), implementing it in KWin, brightness applet (and powerdevil if needed)
- Design the DBus interface such that it can be extended with HDR support in the future
28 Mar - 31 Mar
Deliverables:
- Finalize the work and update any necessary documentation
- My focus is on getting the wayland implementation working correctly under SoK. X11 compatibility will happen if there is time left or after SoK.
- Publish a blog post summarizing my work
Foreseen challenges
- There are some corner cases to handle when enumerating screen with controllable brightness, stated above.
- Properly integrating powerdevil with KWin
- The work will involve extensive discussions in the community to ensure the API is robust and no accidental regressions are introduced.
- Decision on how to expose adequate control to the user without overwhelming them with options (in case of HDR)
References / relevant background info
SoK is mainly a learning opportunity for me. I have been using linux for many years now and want to give back to the community. I will use this opportunity to learn more about KWin and linux so that I can contribute more to KDE and related projects in the future.
I have succesfully participated in GSoC before and this project will help me in increasing my knowledge about KWin and the linux display stack.
Proposed Mentor: Xaver Hugl
How to reach you
E-mail: anuthadev@gmail.com
/cc @teams/season-of-kde