<table><tr><td style="">subdiff created this revision.<br />subdiff added projects: KWin, Plasma on Wayland.<br />Restricted Application added subscribers: kwin, plasma-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D5928" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><h3 class="remarkup-header">Introduction</h3>

<p>With Wayland KWin needs to provide certain services, which were provided before that by the Xserver. One of these is gamma correction, which includes the - by many people beloved - functionality to reduce the blue light at nighttime. This patch provides the KWin part of that. It is self contained, but in the end will work in tandem with a lib in Plasma Workspace and a KCM in Plasma Desktop, which can be used to configure Night Color. Diffs for these parts will be posted this weekend.</p>

<h3 class="remarkup-header">Features:</h3>

<ul class="remarkup-list">
<li class="remarkup-list-item">Three modi:<ul class="remarkup-list">
<li class="remarkup-list-item">Automatic: The location and sun timings are determined automatically (location data updates will be provided by the workspace)</li>
<li class="remarkup-list-item">Location: The sun timings are determined by fixed location data</li>
<li class="remarkup-list-item">Timings: The sun timings are set manually by the user</li>
</ul></li>
<li class="remarkup-list-item">Color temperature value changes are smoothly applied:<ul class="remarkup-list">
<li class="remarkup-list-item">Configuration changes, which lead to other current values are changed in a quick way over a few seconds</li>
<li class="remarkup-list-item">Changes on sunrise and sunset are applied slowly over the course of few minutes till several hours depending on the configuration</li>
</ul></li>
<li class="remarkup-list-item">The current color value is set immediately at startup or after suspend phases and VT switches. There is no flickering.</li>
<li class="remarkup-list-item">All configuration is done via a DBus interface, changed values are tested on correctness and applied atomically</li>
<li class="remarkup-list-item">Self contained mechanism, speaks directly to the hardware by setting the gamma ramps on the CRTC</li>
<li class="remarkup-list-item">Currently working on DRM backend, extensible to other platform backends in the future</li>
<li class="remarkup-list-item">The code is written in a way to make the classes later easily extendable to also provide normal color correction, as it's currently done by KGamma on X</li>
</ul>

<p>This patch solves the redshift part of <a href="https://phabricator.kde.org/T4465" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">T4465</a> and lays the foundations to solve the task in total in the near future.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Manually with the workspace parts and added integration tests in KWin using the virtual backend.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D5928" rel="noreferrer">https://phabricator.kde.org/D5928</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
autotests/integration/CMakeLists.txt<br />
autotests/integration/colorcorrect_nightcolor_test.cpp<br />
colorcorrection/colorcorrectdbusinterface.cpp<br />
colorcorrection/colorcorrectdbusinterface.h<br />
colorcorrection/constants.h<br />
colorcorrection/logging.cpp<br />
colorcorrection/logging.h<br />
colorcorrection/nightcolor.cpp<br />
colorcorrection/nightcolor.h<br />
colorcorrection/suncalc.cpp<br />
colorcorrection/suncalc.h<br />
org.kde.kwin.ColorCorrect.xml<br />
platform.cpp<br />
platform.h<br />
plugins/platforms/drm/drm_backend.cpp<br />
plugins/platforms/drm/drm_backend.h<br />
plugins/platforms/drm/drm_object_crtc.cpp<br />
plugins/platforms/drm/drm_object_crtc.h<br />
plugins/platforms/virtual/virtual_backend.cpp<br />
plugins/platforms/virtual/virtual_backend.h</div></div></div><br /><div><strong>To: </strong>subdiff, KWin<br /><strong>Cc: </strong>plasma-devel, kwin, ZrenBot, spstarr, progwolff, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, eliasp, sebas, apol, hein, lukas<br /></div>