About skelet13

wannabe KDE developer wannabe VLC contributor <3 FOSS

GSoC Color Correction in KWin Final Report

The time has come for the final report regarding my Google Summer of Code project.

During the last two weeks I have intensified work on the project, and there were notable results. Although I cannot claim to completely fulfilling the initial objectives, I believe there is not much more to do to reach that point. Another couple of days of work sometime and those are done. Of course, in the future, there will be improvements to do and other maintenance things, but those should be fun and easy.

The KolorServer KDED module has been successfully implemented. It appears that it works fine after initial tests. It supports per-output color correction, and per-window color correction should be easy to do. It was heavily inspired from CompICC, and it resembles most of it’s functionality. The code for this color server is included inside KolorManager, which is responsible with settings regarding color management. In my opinion, they fit well together (they also have the same dependency on the Oyranos Color Management System). They even have almost the same names :-).

KWin gets some rendering modifications in the compositor (not too big ones, they should not destabilize stuff too much) and it also gets a new class. All the color correction code is isolated in that class, and most of the more internal things are kept well inside. I tried to keep things as simple as possible. This class is designed to interact with the compositor, without forcing the compositor to do any strange color work. In fact, it just has to make one or two calls before drawing each output or window.

At the moment, the average user does not get to notice much difference if he/she get’s this color management installed somehow. The only visible setting is inside KWin compositing preferences, in the advanced tab – only a check box. Anyway, we don’t want more than that. Probably in the future, KolorServer will use some settings from KolorManager, but I can’t say for sure at the moment, it remains to be seen.

Screenshot from when it was not working:

And from when it was working (even if it does not seem like it):

Source code links:
KWin clone, color2 branch
KolorManager, kded branch

Website links:
KolorManager website
Oyranos website

Wiki link (a bit out of date):
Project’s community page

It was a great summer!
Thank you everyone!

GSoC Color Correction in KWin week 10 report

After a little break I am continuing the work on the color correction project.

Now it is time to implement the color server module. This thing seems to be more complicated to implement than I first hoped, but the complexity should be only in thinking how to perform the implementation, not in the actual stuff that will be done in the end. We don’t want to end up with hackish disorganized code that noone will understand.

Lots of inspiration will be drawn from the Compiz ICC plugin (compicc). It is implemented in C and it uses Compiz structures with coupled private structures, and this is very different from how the color server module will be like.

I have started developing a test application that will see most of the classes that will eventually be present in the color server module. Speaking of classes, it should be KDE code with Qt stuff everywhere, C++, so that is different from the CompICC plugin.

In parallel, the changes to KWin regarding color stuff need to be adapted to the latest changes in master (a rebase). This should be almost trivial, but it still takes a bit of time.

I am hoping for more significant progress the following weeks. The current objective is to get a functional color server module communicating with the KWin color stuff, and implementing the baseline X Color Management spec.

GSoC Color Correction in KWin week 5 report

I have continued working on color correction support in KWin. Last week we had the first results that have visible effects on how things look, but of course, at the moment, this is rather about color incorrection than correction. Now, it is possible to accelerate development and move on to other areas.

To make CC possible, KWin’s shaders needed to be altered. More specifically, the fragment shaders. In order to do this, their source code is intercepted before sending to the graphics card for compilation, and a couple of lines are inserted in the appropriate places. There is a special algorithm for parsing the sources, and if it finds anything fishy, it abandons making any changes to the shader source. However, it should be robust enough to handle any valid GLSL 1.2 fragment shader thrown at it.

There are no big modifications to KWin’s rendering process. The only ones are the painting split for multiple screens inside SceneOpenGL::Window::performPaint(), mentioned in the previous posts.

The code related to CC will be organized in a separate class, and enabling or disabling it will be possible at compile time, and on runtime (from one of KWin’s KCM). Now I am working on refurbishing these latest modifications and making the enabling and disabling possible.

Soon work will start on the KDED module (color server) that should do most of the hard work involved with CC.

GSoC Color Correction in KWin week 4 report

Hello again,

Last week wasn’t the most productive of all, since time spent on the graduation project induced some delays, but here’s what I did:

Implemented the new approach with the painting split in performPaint() very quickly. It appears to be working, but for now I am not able to test it properly. I did try to disable one of the screens, and the results were as expected (no further paints on it).

Next stage is to modify the shaders so they will do the color correction. The most robust solution is to inject a couple of lines in the shader code, just before sending it to the graphics card for compilation. But one needs to know where exactly to put those lines so the shader doesn’t end up broken. I have envisioned an algorithm to do this for GLSL 1.2, and have started working on the implementation. It should be okay, and I’m confident all cases are covered. I will do careful testing when implementing this.

GSoC Color Correction in KWin week 3 report

Hello everyone,

I have continued working on my GSoC project with the goal of achieving color correction in KWin. Last week, I concentrated my efforts on splitting the painting process to get a painting pass for each screen. But, unfortunately, there were unforeseen complications. Although the modifications work fine in KWin core, they break a significant number of the effects (unlucky me, the most complicated ones).

I have spent most of the time debugging around the effects and trying to fix each one. The problem is that in most of them it is assumed that there is only one big screen (that is an aggregation of the actual screens). So, obviously, things start to break after modifying the rendering pipeline.

It has been decided that I will put that approach on hold for a while, and begin working on a simpler one, that has very little chances of breaking effects again. However, this simpler approach (based on doing the splitting very near to the actual rendering) will have a significant performance impact. But the primary objective is to have something working.

Now I am much more confident than before, since by hacking around the effects and the core painting parts, I have a much better understanding of the code.

And, of course:
Going to Akademy!

GSoC Color Correction in KWin week 2 report

Last week I focused on splitting the painting process into multiple painting passes, one for each screen. Implemented a first crude attempt which was working, but there were issues with some of the effects, as well as a performance decrease. It had coding style flaws too, but that’s because I wasn’t warmed up with the style yet.

Changed the KWin effects API to allow those multiple passes. But this is not definitive and needs to be discussed more and changed. Fixed the relative drop in performance, but with the cost of some regressions.

Some of the effects are broken with the changes, and all of them need to be fixed. Some of them are already handling multiple screens, and they need to be adjusted to the new behavior. So, there will be much to do until the split is completed, and that is what I will be concentrating on.

Color Correction in KWin (GSoC 2012) start

I have commenced working on this years Google Summer of Code project.

It’s about color correction in the KWin compositor. KWin is a complex piece of software, and the modifications that are to be made must be carefully thought of in advance. Because of this, I must analyze the source code properly before attempting to start modifying. You can’t do a good job if you don’t understand what you’re working on.

For a start, I have analyzed the code paths related to window rendering inside KWin. Here are the results (big ugly table):

The color correction modifications will fit in somewhere in there, but I don’t know where is the best place to put them. Next step is to continue the analysis by using my preffered method: learning by destroying – disable stuff and see what happens, remove other stuff and see what happens, put ugly modifications and see what happens, and so on. Of course, this destruction would be limited to a local branch. After I become confident enough regarding the inner workings of KWin (rendering), I can try to propose and implement the appropriate modifications.

Project page in the KDE Community Wiki