Commit cbd6d0ea authored by Dorian Vogel's avatar Dorian Vogel Committed by Nate Graham

DDCUtil: Improved DDCUtil support for brightness control over DDC/CI channel for supported monitors

Summary:
Reworked & simplified based on feedback from DDCUtil author in D5381.
Fixed CMakeList to add definitions for use in the code.
Updated the code to use the the ddcutil 0.9.5 C API

Current limitations:
- multiple DDC-capable monitors connected will be used, however only one slider is showed. All monitors will be affected with the same brightness value.
- ddcutil has to be setup so that it can be used as user (1. load i2c-dev on boot, 2. udev rule to affect /dev/i2c-* nodes to the i2c user group, 3. add your user to the i2c group.)

Test Plan:
Tested on X session seems stable
On Wayland, ~~the capabilities enumeration seems a bit inconsistent.~~ Fixed by using "the old capability testing method": test each parameter by trying to read its current value.
Tested with dell 2212HM alone, and also with Magedok t116 as second display on AMD gpu using Mesa.
Using OpenSuse Krypton.

Reviewers: broulik, davidedmundson

Reviewed By: broulik

Subscribers: ngraham, asturmlechner, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8626
parent 8b6faf40
......@@ -50,16 +50,17 @@ find_package(UDev REQUIRED)
find_package(XCB REQUIRED COMPONENTS XCB RANDR DPMS)
option(WITH_DDCUTIL "DDCUtil library support" OFF)
if(WITH_DDCUTIL)
find_package(DDCUtil REQUIRED)
set_package_properties(DDCUtil
PROPERTIES DESCRIPTION "DDCUtil library support"
TYPE OPTIONAL
PURPOSE "Set monitor settings over DDC/CI channel"
)
option(HAVE_DDCUTIL "DDCUtil library support" OFF)
if(HAVE_DDCUTIL)
find_package(DDCUtil REQUIRED)
add_compile_definitions(WITH_DDCUTIL)
set_package_properties(DDCUtil
PROPERTIES DESCRIPTION "DDCUtil library support"
TYPE OPTIONAL
PURPOSE "Set monitor settings over DDC/CI channel"
)
else()
add_feature_info("DDCUtil" "Off" "DDCUtil library support is disabled by default as recomemded by authors, add -DWITH_DDCUTIL=On to enable")
add_feature_info("DDCUtil" HAVE_DDCUTIL "DDCUtil library support is disabled by default as recomended by authors, add -DHAVE_DDCUTIL=On to enable")
endif()
include_directories (
......
......@@ -49,9 +49,8 @@ private:
#endif //ifdef WITH_DDCUTIL
//Per display properties
//destription mapped to vcp values for easy retrieval
QVector<QMap<QString, int> > m_descrToVcp_perDisp;
QVector<QMap<int, QMap<int, QString> > > m_vcpTovcpValueWithDescr_perDisp;
QVector<int> m_usedVcp;
QVector<QVector<uint16_t>> m_supportedVcp_perDisp;
long m_tmpCurrentBrightness;
QTimer m_setBrightnessEventFilter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment