Skip to content

daemon: Avoid constantly locking ddcutil display handles

Since libddcutil implemented functionality for per-monitor device lock files, other programs that are also using libddcutil (such as the ddcutil CLI itself) were blocked from performing monitor commands because PowerDevil kept all its handles open.

The better way of interacting with libddcutil as a long-running program is to store a DDCA_Display_Ref for each monitor in question, use it to get a temporary display handle, and close it again.

Now we can peacefully coexist with other libddcutil programs, and users can e.g. query their monitor properties again.

As a slight downside, this means it's possible for another program to set display brightness independently without PowerDevil noticing. That seems like a smaller evil though, and can't be fixed by simply using libddcutil itself as it cannot signal any VCP changes. Common infrastructure such as digitaltrails/ddcutil-service or a future kernel DRM interface for DDC/CI could help to mitigate this.

BUG: 481793


Note: Backporting this to the Plasma/6.0 branch won't be trivial, because the ddcutil code has changed quite a bit from @littlesweet's improvements for detecting monitor hot-plugging events. Most of this code should translate to Plasma/6.0 in principle, but we'll run into merge conflicts and it would need to be verified independently after backporting. Not sure if it's worth the extra work, I'm happy to hear opinions on this. (I get that it obviously be neat for new Plasma 6 users if they don't have to wait for another 3-4 months to use ddcutil again.)

Merge request reports