[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Re: Review Request: Implement color correction (per output)
From:       "Casian Andrei" <skeletk13 () gmail ! com>
Date:       2012-09-23 12:53:28
Message-ID: 20120923125328.30303.49641 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/106141/
-----------------------------------------------------------

(Updated Sept. 23, 2012, 12:53 p.m.)


Review request for kwin, Thomas L=C3=BCbking and Martin Gr=C3=A4=C3=9Flin.


Changes
-------

Brought up to date after the SceneOpenGL refactorings.
The changes are a bit cleaner after the refactoring of SceneOpenGL. Yay :)

I don't remember all the changes from the initial version of the diff, but =
one thing is noticeable - the initialization of the color correction does n=
o longer require the compositor to be reinitialized. It just cleans up Shad=
erManager and reinitializes it.

I think the issues with transparency are fixed, but I did a slight modifica=
tion to scene-fragment.glsl, which I don't remember if it's really necessar=
y, but it looks like the right thing to do anyway.


Description
-------

These are the results of my GSoC project, for KWin.

This color correction needs KolorManager installed, 'kded' branch. That one=
 needs Oyranos.
git://anongit.kde.org/kolor-manager.git         http://www.oyranos.org/down=
loads
If it's not installed, the ColorCorrection class should fail without causin=
g any issues to the user (that's if it's enabled from the KCM). Probably a =
notification could be appropriate in that case? "Failed to initialize CC be=
cause cannot contact Kolor-Server KDED..." something like that?

Change summary:
--
Add an option to kcmcompositing in the 'Advanced' tab, to enable or disable=
 color correction. It is specified that it's experimental and it needs Kolo=
r Manager. This implies some small changes to options.h and cpp.

In composite.cpp, the ColorCorrection class instance is initialized or clea=
ned up (it's like being owned by the compositor). In workspace, there's a s=
ignal connected to reset compositing if the color correction setting is cha=
nged.

Scene::finalPaintWindow code is moved into SceneOpenGL::performPaint.
SceneOpenGL has the declarations of some methods changed to include the scr=
een number - those could be changed to pass around PaintData's probably. Sc=
eneOpenGL's newly implemented finalDrawWindow splits the rendering if color=
 correction is enabled and there are multiple screens. Before painting for =
a particular screen, ColorCorrection::setupForOutput should be called.

There was a problem with the blending function causing artifacts with color=
 correction enabled so it is set up to src_alpha, one_minus_src alpha in th=
at case.

Now, inside KWinEffects:
--
A screen property is added for WindowPaintData.
In kwinglutils, The fragment shaders are intercepted before being compiled =
and they get a couple of lines of code inserted in order to do the color st=
uff. This happens only when color correction is enabled, of course.

And there is the big ColorCorrection class. The public and private stuff ar=
e well separated. More additions to the public stuff shouldn't be necessary=
 in the future as far as I see it. Everything is there I think. The region =
stuff is not used at the moment, and the 2 reset methods aren't used either=
 (for now).

The private stuff consists of the private data and the D-Bus interface. Reg=
arding D-Bus, everything is async (I think).

The implementation basically manages a set of color lookup tables for diffe=
rent outputs and for different window regions. These are taken via D-Bus. E=
ach lookup table has around 700 KB. I hope I am not wrong in assuming it's =
not that big of an issue time-wise, since they are transferred only once or=
 twice for an entire session. I hope D-Bus doesn't do any time consuming bu=
siness to transfer those QVector's.

There is an issue with OpenGL ES, apparently it doesn't support 3D textures=
 (probably it needs an extension or something). Until we envision a clear s=
olution, I have disabled the color correction for OpenGL ES.

In case of problems, it should not affect the rest of KWin in any way.

Next priorities:
--
Implement per-window-region stuff. It should be a matter of extending Kolor=
Server's capabilities and doing some small modifications in SceneOpenGL::Wi=
ndow. The ColorCorrection class from KWinEffects has everything prepared.

Fix issues with transparency / some weird colors.

--
There's another thing... I don't know when I'm supposed to be able to do im=
provements and modifications, since the GSoC project ended. Probably if I k=
eep the new modifications well separated, there should be no issues.


Diffs (updated)
-----

  kwin/kcmkwin/kwincompositing/main.cpp 7a89db4 =

  kwin/kcmkwin/kwincompositing/main.ui cff0f63 =

  kwin/libkwineffects/CMakeLists.txt 14a2747 =

  kwin/libkwineffects/kwineffects.h 2c2f7bf =

  kwin/libkwineffects/kwineffects.cpp bae85e7 =

  kwin/libkwineffects/kwinglcolorcorrection.h PRE-CREATION =

  kwin/libkwineffects/kwinglcolorcorrection.cpp PRE-CREATION =

  kwin/libkwineffects/kwinglcolorcorrection_p.h PRE-CREATION =

  kwin/libkwineffects/kwinglplatform.h 14555a2 =

  kwin/libkwineffects/kwinglplatform.cpp 26341e4 =

  kwin/libkwineffects/kwinglutils.h 14fdd5b =

  kwin/libkwineffects/kwinglutils.cpp 5abae52 =

  kwin/options.h 3acc17d =

  kwin/options.cpp cd96e1b =

  kwin/scene-fragment.glsl 4b5424b =

  kwin/scene.h be3acc4 =

  kwin/scene.cpp 28136b6 =

  kwin/scene_opengl.h 8ff0006 =

  kwin/scene_opengl.cpp 3e4290a =


Diff: http://git.reviewboard.kde.org/r/106141/diff/


Testing
-------

Restarted KDED making sure Kolor-Manager is installed properly - this shoul=
d make the KDED module available.

Restarted KWin, enabled color correction in KCM compositing, advanced tab.

Played a bit with commands like:
oyranos-monitor -d 0 XYZ.icc
oyranos-monitor -d 1 Lab.icc
Those set up particular profiles for the monitors. However, it seems there =
is a problem with reverting to the normal ones. The code regarding that is =
taken directly from CompICC, so I don't know whether it's a bug or a featur=
e. Anyway, it's from Kolor-Server.

Apparently, everything works as planned. But I cannot distinguish visible d=
ifferences for the profiles used for the different monitors by default.

There is an issue with the transparent areas - they are darkened somehow. T=
his should be easy to fix, I have left the issue around because I hadn't ti=
me to finish before the GSoC deadline and it makes it possible to quickly f=
ind out whether color correction is enabled or not :). Perhaps, it's becaus=
e of the blending function and not because of the correction. Also, there's=
 something wrong with the highlights in gitk, I don't know exactly what. So=
, small issues are present.


Screenshots
-----------

Output 0 Lab.icc Output 1 XYZ.icc
  http://git.reviewboard.kde.org/r/106141/s/695/


Thanks,

Casian Andrei


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/106141/">http://git.reviewboard.kde.org/r/106141/</a>
  </td>
    </tr>
   </table>
   <br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for kwin, Thomas Lübking and Martin Gräßlin.</div>
<div>By Casian Andrei.</div>


<p style="color: grey;"><i>Updated Sept. 23, 2012, 12:53 p.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Brought up to date after the SceneOpenGL refactorings. The changes are a \
bit cleaner after the refactoring of SceneOpenGL. Yay :)

I don&#39;t remember all the changes from the initial version of the diff, but one \
thing is noticeable - the initialization of the color correction does no longer \
require the compositor to be reinitialized. It just cleans up ShaderManager and \
reinitializes it.

I think the issues with transparency are fixed, but I did a slight modification to \
scene-fragment.glsl, which I don&#39;t remember if it&#39;s really necessary, but it \
looks like the right thing to do anyway. </pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">These are the results of my GSoC project, for KWin.

This color correction needs KolorManager installed, &#39;kded&#39; branch. That one \
needs Oyranos. git://anongit.kde.org/kolor-manager.git         \
http://www.oyranos.org/downloads If it&#39;s not installed, the ColorCorrection class \
should fail without causing any issues to the user (that&#39;s if it&#39;s enabled \
from the KCM). Probably a notification could be appropriate in that case? \
&quot;Failed to initialize CC because cannot contact Kolor-Server KDED...&quot; \
something like that?

Change summary:
--
Add an option to kcmcompositing in the &#39;Advanced&#39; tab, to enable or disable \
color correction. It is specified that it&#39;s experimental and it needs Kolor \
Manager. This implies some small changes to options.h and cpp.

In composite.cpp, the ColorCorrection class instance is initialized or cleaned up \
(it&#39;s like being owned by the compositor). In workspace, there&#39;s a signal \
connected to reset compositing if the color correction setting is changed.

Scene::finalPaintWindow code is moved into SceneOpenGL::performPaint.
SceneOpenGL has the declarations of some methods changed to include the screen number \
- those could be changed to pass around PaintData&#39;s probably. SceneOpenGL&#39;s \
newly implemented finalDrawWindow splits the rendering if color correction is enabled \
and there are multiple screens. Before painting for a particular screen, \
ColorCorrection::setupForOutput should be called.

There was a problem with the blending function causing artifacts with color \
correction enabled so it is set up to src_alpha, one_minus_src alpha in that case.

Now, inside KWinEffects:
--
A screen property is added for WindowPaintData.
In kwinglutils, The fragment shaders are intercepted before being compiled and they \
get a couple of lines of code inserted in order to do the color stuff. This happens \
only when color correction is enabled, of course.

And there is the big ColorCorrection class. The public and private stuff are well \
separated. More additions to the public stuff shouldn&#39;t be necessary in the \
future as far as I see it. Everything is there I think. The region stuff is not used \
at the moment, and the 2 reset methods aren&#39;t used either (for now).

The private stuff consists of the private data and the D-Bus interface. Regarding \
D-Bus, everything is async (I think).

The implementation basically manages a set of color lookup tables for different \
outputs and for different window regions. These are taken via D-Bus. Each lookup \
table has around 700 KB. I hope I am not wrong in assuming it&#39;s not that big of \
an issue time-wise, since they are transferred only once or twice for an entire \
session. I hope D-Bus doesn&#39;t do any time consuming business to transfer those \
QVector&#39;s.

There is an issue with OpenGL ES, apparently it doesn&#39;t support 3D textures \
(probably it needs an extension or something). Until we envision a clear solution, I \
have disabled the color correction for OpenGL ES.

In case of problems, it should not affect the rest of KWin in any way.

Next priorities:
--
Implement per-window-region stuff. It should be a matter of extending \
KolorServer&#39;s capabilities and doing some small modifications in \
SceneOpenGL::Window. The ColorCorrection class from KWinEffects has everything \
prepared.

Fix issues with transparency / some weird colors.

--
There&#39;s another thing... I don&#39;t know when I&#39;m supposed to be able to do \
improvements and modifications, since the GSoC project ended. Probably if I keep the \
new modifications well separated, there should be no issues.</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Restarted KDED making sure Kolor-Manager is installed properly - this \
should make the KDED module available.

Restarted KWin, enabled color correction in KCM compositing, advanced tab.

Played a bit with commands like:
oyranos-monitor -d 0 XYZ.icc
oyranos-monitor -d 1 Lab.icc
Those set up particular profiles for the monitors. However, it seems there is a \
problem with reverting to the normal ones. The code regarding that is taken directly \
from CompICC, so I don&#39;t know whether it&#39;s a bug or a feature. Anyway, \
it&#39;s from Kolor-Server.

Apparently, everything works as planned. But I cannot distinguish visible differences \
for the profiles used for the different monitors by default.

There is an issue with the transparent areas - they are darkened somehow. This should \
be easy to fix, I have left the issue around because I hadn&#39;t time to finish \
before the GSoC deadline and it makes it possible to quickly find out whether color \
correction is enabled or not :). Perhaps, it&#39;s because of the blending function \
and not because of the correction. Also, there&#39;s something wrong with the \
highlights in gitk, I don&#39;t know exactly what. So, small issues are present. \
</pre>  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> \
(updated)</h1> <ul style="margin-left: 3em; padding-left: 0;">

 <li>kwin/kcmkwin/kwincompositing/main.cpp <span style="color: \
grey">(7a89db4)</span></li>

 <li>kwin/kcmkwin/kwincompositing/main.ui <span style="color: \
grey">(cff0f63)</span></li>

 <li>kwin/libkwineffects/CMakeLists.txt <span style="color: \
grey">(14a2747)</span></li>

 <li>kwin/libkwineffects/kwineffects.h <span style="color: \
grey">(2c2f7bf)</span></li>

 <li>kwin/libkwineffects/kwineffects.cpp <span style="color: \
grey">(bae85e7)</span></li>

 <li>kwin/libkwineffects/kwinglcolorcorrection.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>kwin/libkwineffects/kwinglcolorcorrection.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>kwin/libkwineffects/kwinglcolorcorrection_p.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>kwin/libkwineffects/kwinglplatform.h <span style="color: \
grey">(14555a2)</span></li>

 <li>kwin/libkwineffects/kwinglplatform.cpp <span style="color: \
grey">(26341e4)</span></li>

 <li>kwin/libkwineffects/kwinglutils.h <span style="color: \
grey">(14fdd5b)</span></li>

 <li>kwin/libkwineffects/kwinglutils.cpp <span style="color: \
grey">(5abae52)</span></li>

 <li>kwin/options.h <span style="color: grey">(3acc17d)</span></li>

 <li>kwin/options.cpp <span style="color: grey">(cd96e1b)</span></li>

 <li>kwin/scene-fragment.glsl <span style="color: grey">(4b5424b)</span></li>

 <li>kwin/scene.h <span style="color: grey">(be3acc4)</span></li>

 <li>kwin/scene.cpp <span style="color: grey">(28136b6)</span></li>

 <li>kwin/scene_opengl.h <span style="color: grey">(8ff0006)</span></li>

 <li>kwin/scene_opengl.cpp <span style="color: grey">(3e4290a)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/106141/diff/" style="margin-left: \
3em;">View Diff</a></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Screenshots </h1>

<div>

 <a href="http://git.reviewboard.kde.org/r/106141/s/695/"><img \
src="http://git.reviewboard.kde.org/media/uploaded/images/2012/08/23/cc_alter_6_400x100.png" \
style="border: 1px black solid;" alt="Output 0 Lab.icc Output 1 XYZ.icc" /></a>

</div>


  </td>
 </tr>
</table>




  </div>
 </body>
</html>



_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic