Add support for GLX_EXT_buffer_age and EGL_EXT_buffer_age
Review Request #114162 - Created Nov. 27, 2013 and submitted
|graesslin, knechtges, luebking, ralfjung|
This review request differs from the previous ones in the following ways: * Both the EGL and the GLX extensions are supported. * The damage history is managed from begin/endRenderingFrame(). * The effects of occlusion culling is taken into account. * No assumptions are made about the buffer age value returned from the GL. * No attempt is made to combine this with other tearing prevention strategies; If the extension is supported it will be used unconditionally, and the tearing prevention settings are ignored. I have added many detailed comments in the code that I hope will make it easy to review. Since this represents a significant improvement for many users in terms of increased performance, no tearing, and reduced power consumption, I'd like to push this to the stable branch shortly after 4.11.4 is tagged. This is also available as a branch in my kde-workspace clone: http://quickgit.kde.org/?p=clones%2Fkde-workspace%2Ffredrik%2Fkde-workspace.git&a=shortlog&h=60398427 commit 603984278927ec8bef1a56e5c9efd7c6600042c5 Author: Fredrik Höglund <firstname.lastname@example.org> Date: Thu Nov 21 10:44:06 2013 +0100 kwin: Add support for EXT_buffer_age This patch adds support for GLX_EXT_buffer_age, and EGL_EXT_buffer_age on X11. commit 7f47327d9831886bf488135fa2a612e676799625 Author: Fredrik Höglund <email@example.com> Date: Sat Nov 23 15:08:17 2013 +0100 kwin: Return the modified damage in a separate paintScreen() parameter commit 68f4275777e5884fa6096f4458f1f156e79f01dd Author: Fredrik Höglund <firstname.lastname@example.org> Date: Thu Nov 21 10:39:29 2013 +0100 kwin: Prepare the backend interface for EXT_buffer_age Allow prepareRenderingFrame() to return a region that will be repainted in addition to the damaged region. Pass both the damaged region and the repainted region, which may be larger, as parameters to endRenderingFrame(). commit bf77ebeb3ce150da319c1eddca642086c0d850aa Author: Fredrik Höglund <email@example.com> Date: Thu Nov 21 10:38:16 2013 +0100 kwin: Don't call glFlush() unnecessarily in endRenderingFrame() We should only call glFlush() here if we're deferring the posting of the back buffer to the next prepareRenderingFrame() call.
I tried the patch today again without any problems. Though I cannot say that my usage pattern is representative given that it isn't a system that I use to work on. @Thomas: any chance to test this?
After having tested the patch and discussing it in the kwin channel with Fredrik, I just wanted to summarize some of my comments. We are hoping for some fresh input :)
Here I just wanted to have said: Good job :)
This was probably a typo, but the lines should be interchanged. Otherwise we end up with permanent full-screen repaints.
I did some quick and dirty testing whether one could copy the front buffer area which corresponds to updateRegion - validRegion to the backbuffer and my results were indicating that it is faster than repainting. Fredrik also mentioned https://bugs.kde.org/show_bug.cgi?id=328242 , so one should probably carefully investigate this option.
Review request changed
This updates the review request with the changes talked about in the comments. I intend to push this shortly.
Revision 2 (+287 -47)
thanks for pushing! I'm going to do the merge to master later today. Should we inform the release team to include a note in the next release announcment? I'm unsure about it - on the one hand I think a major optimization should be announced on the other hand I fear of it causing some buzz...