Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support laptop displays - add virtual DDCA implementations to the service. #16

Open
digitaltrails opened this issue Feb 25, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@digitaltrails
Copy link
Owner

digitaltrails commented Feb 25, 2024

Support non-DDC laptop displays by allowing for a virtual implementations of DDC.

Virtual implementations would fake up DDC data for the non DDC device by consulting and altering files under /sys/class or doing whatever is necessary to perform the requested operation.

$ ls /sys/class/backlight/acpi_video0/
actual_brightness  brightness         max_brightness     subsystem/    uevent             
bl_power           device/            power/             type

The actual files and location vary depending on the laptop manufacturer.

For example a call to detect might call the actual detect in libddcutil and then merge that with the results from a virtual implementations inspection of /sys/class/backlight. A call the setvcp on a virtual implementation might translate the set to write to /sys/class/backlight/acpi_video0/brightness

Capabilities enquiries on virtual implementations would just fake up DDC features for what's possible (brightness and maybe contrast).

This could also be done at a higher level in an application, see: vdu_controls/issues/44. Or at a lower level in ddcutil/libddcutil.

@digitaltrails
Copy link
Owner Author

One issue is potential variability and reliability of different hardware and driver combos. It would be disappointing if most laptops didn't bend to this approach, or if the quality of drivers ment the result was a bit of a lottery.

@digitaltrails digitaltrails added the enhancement New feature or request label Feb 25, 2024
@jpetso
Copy link

jpetso commented Mar 2, 2024

KDE's implementation of this can be found in powerdevil for Plasma 6.0. Getting this right is tricky though and at the time of writing, it's still not quite correct.

Furthermore, as the recent Season of KDE project proposal notes, not all displays actually have a backlight. And displays in HDR mode generally also don't allow brightness manipulation that way. Hence the goal to bring it into the compositor, which can distinguish between different display capabilities and employ software dimming (or other effects) if hardware methods aren't supported.

So, it's not just drivers. Even if you do this right, be mindful that your support will still be incomplete.

@digitaltrails
Copy link
Owner Author

Thanks, I had intended to have a look at what powerdevil was doing. I just watched the video Kernel Recipes 2022 - New userspace api for display panel brightness-control (mentioned in a discussion at https://invent.kde.org/). As I haven't purchased a laptop in the last two decades, it was very enlightening, and very discouraging.

As I don't own any laptop hardware (except one 20 year old XP machine), and it looks like I would need to purchase many, I'm probably going to put this on the back burner.

@digitaltrails
Copy link
Owner Author

Maybe a termcap or config.d approach would work ok. Presumably a manufacturer, model and serial can be extracted from the EDID, then a termcap or config.d could identify which files to consult to get/set brightness and max-brightness, plus define any special handling. I guess there might be some need to define what udev rules need to be in place to obtain the necessary permissions.

If a general enough approach can be defined, it would up to others to figure out and contribute definitions for manufacturers and/or models. Users with special cases could add definitions down to the serial-number level. Over time, a termcap or config.d could fill out, plus code and config-syntax to handle weird cases could be added.

Given the current state of play, it's possible a config lookup may also have to involve GPU and GPU-driver.

@digitaltrails digitaltrails self-assigned this Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants