Add option to use glXSwapBuffers on every frame, not just full-screen redraws.
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| Compiz |
Fix Released
|
Wishlist
|
Compiz Linaro Team | ||
| Compiz Core |
Won't Fix
|
Wishlist
|
Daniel van Vugt | ||
| Ubutter |
Fix Released
|
Undecided
|
Unassigned | ||
| compiz (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bug Description
Adding the option to use glXSwapBuffers on every frame should eliminate all tearing once and for all. It also allows us to remove glFinish from each frame, providing much higher rendering performance without the trade-off of reintroducing tearing.
Related branches
- Daniel van Vugt: Approve
- Sam Spilsbury: Approve
- Tim Penhey: Pending requested
- Alan Griffiths: Pending requested
- jenkins: Pending (continuous-integration) requested
-
Diff: 16838 lines (+7498/-4718) 104 files modifiedapicmake/CMakeLists.txt (+2/-0)
cmake/CompizCommon.cmake (+12/-0)
cmake/CompizPlugin.cmake (+14/-10)
cmake/FindCompiz.cmake (+1/-1)
cmake/FindOpenGLES2.cmake (+51/-0)
cmake/base.cmake (+3/-0)
cmake/plugin_extensions/CompizOpenGLFixups.cmake (+22/-0)
include/core/wrapsystem.h (+8/-0)
plugins/CMakeLists.txt (+30/-0)
plugins/animation/CMakeLists.txt (+3/-5)
plugins/animation/include/animation/animation.h (+1/-1)
plugins/animation/include/animation/animeffect.h (+3/-3)
plugins/animation/include/animation/grid.h (+0/-2)
plugins/animation/src/animation.cpp (+85/-27)
plugins/animation/src/grid.cpp (+25/-258)
plugins/animation/src/private.h (+3/-3)
plugins/annotate/src/annotate.cpp (+149/-71)
plugins/blur/CMakeLists.txt (+12/-12)
plugins/clone/src/clone.cpp (+0/-5)
plugins/compiztoolbox/src/compiztoolbox.cpp (+5/-18)
plugins/copytex/src/copytex.cpp (+9/-0)
plugins/cube/include/cube/cube.h (+9/-6)
plugins/cube/src/cube.cpp (+85/-80)
plugins/decor/src/decor.cpp (+29/-27)
plugins/decor/src/decor.h (+2/-2)
plugins/expo/CMakeLists.txt (+4/-8)
plugins/expo/src/expo.cpp (+256/-111)
plugins/expo/src/expo.h (+3/-4)
plugins/ezoom/src/ezoom.cpp (+118/-52)
plugins/grid/src/grid.cpp (+108/-53)
plugins/imgsvg/src/imgsvg.cpp (+9/-6)
plugins/imgsvg/src/imgsvg.h (+2/-1)
plugins/kdecompat/src/kdecompat.cpp (+7/-22)
plugins/mag/src/mag.cpp (+102/-73)
plugins/mag/src/mag.h (+2/-0)
plugins/neg/src/neg.cpp (+33/-106)
plugins/neg/src/neg.h (+3/-6)
plugins/obs/src/obs.cpp (+8/-7)
plugins/obs/src/obs.h (+1/-1)
plugins/opengl/CMakeLists.txt (+14/-4)
plugins/opengl/compiz-opengl.pc.in (+1/-1)
plugins/opengl/include/opengl/doublebuffer.h (+39/-0)
plugins/opengl/include/opengl/fragment.h (+0/-125)
plugins/opengl/include/opengl/framebufferobject.h (+104/-0)
plugins/opengl/include/opengl/matrix.h (+2/-0)
plugins/opengl/include/opengl/opengl.h (+441/-73)
plugins/opengl/include/opengl/program.h (+75/-0)
plugins/opengl/include/opengl/programcache.h (+51/-0)
plugins/opengl/include/opengl/shadercache.h (+100/-0)
plugins/opengl/include/opengl/texture.h (+5/-0)
plugins/opengl/include/opengl/vector.h (+3/-3)
plugins/opengl/include/opengl/vertexbuffer.h (+130/-0)
plugins/opengl/opengl.xml.in (+15/-0)
plugins/opengl/src/doublebuffer/CMakeLists.txt (+31/-0)
plugins/opengl/src/doublebuffer/src/double-buffer.cpp (+76/-0)
plugins/opengl/src/doublebuffer/tests/CMakeLists.txt (+24/-0)
plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp (+98/-0)
plugins/opengl/src/fragment.cpp (+0/-1146)
plugins/opengl/src/framebufferobject.cpp (+221/-0)
plugins/opengl/src/matrix.cpp (+54/-0)
plugins/opengl/src/paint.cpp (+472/-443)
plugins/opengl/src/privatefragment.h (+0/-54)
plugins/opengl/src/privates.h (+101/-13)
plugins/opengl/src/privatetexture.h (+32/-0)
plugins/opengl/src/privatevertexbuffer.h (+149/-0)
plugins/opengl/src/program.cpp (+262/-0)
plugins/opengl/src/programcache.cpp (+175/-0)
plugins/opengl/src/screen.cpp (+938/-154)
plugins/opengl/src/shadercache.cpp (+246/-0)
plugins/opengl/src/texture.cpp (+152/-22)
plugins/opengl/src/vector.cpp (+2/-2)
plugins/opengl/src/vertexbuffer.cpp (+634/-0)
plugins/opengl/src/window.cpp (+65/-83)
plugins/resize/src/resize.cpp (+84/-31)
plugins/resizeinfo/src/resizeinfo.cpp (+45/-27)
plugins/resizeinfo/src/resizeinfo.h (+2/-1)
plugins/ring/src/ring.cpp (+19/-37)
plugins/ring/src/ring.h (+1/-1)
plugins/scale/src/scale.cpp (+10/-17)
plugins/scaleaddon/src/scaleaddon.cpp (+51/-21)
plugins/scaleaddon/src/scaleaddon.h (+2/-2)
plugins/scalefilter/src/scalefilter.cpp (+1/-6)
plugins/screenshot/src/screenshot.cpp (+47/-20)
plugins/shift/src/shift.cpp (+95/-98)
plugins/shift/src/shift.h (+1/-1)
plugins/staticswitcher/src/staticswitcher.cpp (+156/-64)
plugins/staticswitcher/src/staticswitcher.h (+5/-3)
plugins/switcher/src/switcher.cpp (+45/-42)
plugins/text/include/text/text.h (+2/-1)
plugins/text/src/text.cpp (+53/-24)
plugins/thumbnail/src/thumbnail.cpp (+301/-118)
plugins/thumbnail/src/thumbnail.h (+3/-1)
plugins/wall/src/wall.cpp (+60/-46)
plugins/wall/src/wall.h (+1/-1)
plugins/water/src/shaders.h (+200/-0)
plugins/water/src/water.cpp (+281/-801)
plugins/water/src/water.h (+33/-63)
plugins/water/water.xml.in (+26/-2)
plugins/wobbly/src/wobbly.cpp (+20/-176)
plugins/wobbly/src/wobbly.h (+0/-1)
plugins/workarounds/src/workarounds.cpp (+14/-0)
plugins/workarounds/src/workarounds.h (+4/-0)
plugins/workspacenames/src/workspacenames.cpp (+4/-8)
plugins/workspacenames/src/workspacenames.h (+1/-1)
- Daniel van Vugt: Approve
-
Diff: 699 lines (+439/-115) 8 files modifiedapiplugins/opengl/CMakeLists.txt (+7/-2)
plugins/opengl/include/opengl/doublebuffer.h (+31/-0)
plugins/opengl/src/doublebuffer/CMakeLists.txt (+31/-0)
plugins/opengl/src/doublebuffer/src/double-buffer.cpp (+34/-0)
plugins/opengl/src/doublebuffer/tests/CMakeLists.txt (+24/-0)
plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp (+91/-0)
plugins/opengl/src/privates.h (+67/-0)
plugins/opengl/src/screen.cpp (+154/-113)
- always_swap_buffers.patch Edit (2.1 KiB, text/plain)
Here's my initial prototype. You get the idea, but it breaks lots of plugins. smspillaz says a reasonable amount of other changes would be required to avoid breaking the plugins :P
Correction: It doesn't break "lots" of plugins. Only Unity and window resizing AFAIK.
Status changed to 'Confirmed' because the bug affects multiple users.
On 2012年2月26日, Daniel van Vugt wrote:
> ** Changed in: compiz-core
> Assignee: (unassigned) => Daniel van Vugt (vanvugt)
>
> ** Description changed:
>
> Adding the option to use glXSwapBuffers on every frame should eliminate
> - all tearing once and for all.
> + all tearing once and for all. It also allows us to remove glFinish from
> + each frame, providing much higher rendering performance without the
> + trade-off of reintroducing tearing.
>
Daniel, if you are working on this, could you have a look into backporting
the paint-to-fbo stuff here
http://
There's very little performance penalty here since there is only one
pipeline flush and it has the added benefit of reducing complexity in merging
the linaro branch in a few weeks.
> --
> You received this bug notification because you are a member of Compiz
> Maintainers, which is the registrant for Compiz Core.
> https:/
>
> Title:
> Add option to use glXSwapBuffers on every frame, not just full-screen
> redraws.
>
> Status in Compiz Core:
> Triaged
> Status in "compiz" package in Ubuntu:
> Confirmed
>
> Bug description:
> Adding the option to use glXSwapBuffers on every frame should
> eliminate all tearing once and for all. It also allows us to remove
> glFinish from each frame, providing much higher rendering performance
> without the trade-off of reintroducing tearing.
>
> To manage notifications about this bug go to:
> https:/
>
Sam, I reviewed the options again last Friday. What I found was:
1. The GLES branch looks promising and merges cleanly but:
(a) It's too late to consider a new core rendering algorithm for precise; and
(b) The diff is still over 11k lines. Yet another reason why it won't land in 0.9.7.
2. Forcing full screen redraws (not really a code change, just a config change) now performs better than regional redraws in most cases. Full screen redraws provide higher framerates and equal or _lower_ CPU usage than regional redraws. The only exception was on a very slow system which got its framerate doubled, so the CPU increased somewhat in a good way. The other problem with full screen redraws is that there seems to be high lag when used on multiple monitors. I think someone has logged a bug for that already...
I personally would not mind forcing full screen redraws right now as it will fix more peoples bugs than it would cause. But I won't do so because we are in freeze and it would still be risky to change core config so late.
3. Interestingly in the GLES code I saw some hints that they encountered the same kind of rendering bugs as I did with my prototype in comment #1. This suggests they are indeed plugin bugs.
I think at this late stage in the precise cycle, then only sane solution to bug 930192 is not to fix this bug yet, but use one of the quick solutions documented there --> bug 930192.
On 2012年3月20日, Daniel van Vugt wrote:
> Sam, I reviewed the options again last Friday. What I found was:
>
> 1. The GLES branch looks promising and merges cleanly but:
> (a) It's too late to consider a new core rendering algorithm for precise; and
> (b) The diff is still over 11k lines. Yet another reason why it won't land in 0.9.7.
>
I think what I was getting at is that we should look to backporting the
paint-fbo stuff that's in the current linaro branch. That is only about
400 lines, most of which is framebuffer management stuff.
> 2. Forcing full screen redraws (not really a code change, just a config change) now performs better than regional redraws in most cases. Full screen redraws provide higher framerates and equal or _lower_ CPU usage than regional redraws. The only exception was on a very slow system which got its framerate doubled, so the CPU increased somewhat in a good way. The other problem with full screen redraws is that there seems to be high lag when used on multiple monitors. I think someone has logged a bug for that already...
> I personally would not mind forcing full screen redraws right now as it will fix more peoples bugs than it would cause. But I won't do so because we are in freeze and it would still be risky to change core config so late.
>
Forcing fullscreen redraws means that the damage-intersection detection
code will be turned off and we also can't use plugins like showrepaint in debugging. We
can use full screen redraws by default this cycle but it is not a long
term solution.
> 3. Interestingly in the GLES code I saw some hints that they encountered
> the same kind of rendering bugs as I did with my prototype in comment
> #1. This suggests they are indeed plugin bugs.
>
> I think at this late stage in the precise cycle, then only sane solution
> to bug 930192 is not to fix this bug yet, but use one of the quick
> solutions documented there --> bug 930192.
>
> --
> You received this bug notification because you are a member of compiz
> packagers, which is subscribed to compiz in Ubuntu.
> https:/
>
> Title:
> Add option to use glXSwapBuffers on every frame, not just full-screen
> redraws.
>
> To manage notifications about this bug go to:
> https:/
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Even 400 lines is way too much change for precise. And I haven't done any performance testing on it yet.
At the moment forcing full screen redraws provides the highest framerates and lowest CPU (compiz+Xorg). It also means regional damage debugging with showrepaint is irrelevant. And it's even lower CPU than the prototype in comment #1.
Keep in mind that the opengl plugin goes through the motions of drawing ALL windows regardless of the rendering mode. So the more complex the regions (even if they're small), the more CPU it uses.
I would like to benchmark the GLES rendering when I have time. But it's irrelevant this close to release.
But don't panic too much. Before new rendering modes are added, I planned on adding a simple config option to the opengl plugin so we can switch between the existing (and future) rendering modes. So we don't need to settle on a single solution. Just decide which is default :)
Care must be taken with removing glFinish as doing so may cause additional latency. Ideally the drawing should occur as late as possible, right before the buffer swap (1-5 ms latency at compositing stage) but it may be difficult to guarantee that the deadline isn't missed (causing frameskips). Drawing right after the previous swap is much easier and still acceptable (one frame latency). If no glFinish is done, the display driver may buffer multiple completed frames, leading to high latency.
The fix has landed in lp:~compiz-linaro-team/compiz/gles2. So now we just have to wait till that branch lands in lp:compiz for 0.9.8.0.
I now think my original patch in comment #1 was correct. The bugs with Unity should be fixed by:
lp:~vanvugt/unity/regionalDamage
and the bugs with resizing should be fixed by:
http://
Fix committed into lp:compiz at revision 3320. And won't be backported to compiz-core (0.9.7) because this is a massive architectural change.
This bug was fixed in the package compiz - 1:0.9.8.0-0ubuntu1
---------------
compiz (1:0.9.
* debian/control, debian/rules:
- enable gles on armel and armhf
- use dh-translations rather than custom code
[ Sam Spilsbury ]
* Enable OpenGL ES building
- Refresh debian/
- Remove non-ported plugins from compiz-plugins
- Add FindOpenGLES2.cmake to compiz-dev
[ Timo Jyrinki ]
* New upstream release.
- Code to make compiz work on GLES. This includes several changes
to the compiz API. (LP: #201342) (LP: #901097) (LP: #1004251)
(LP: #1037710)
- Draft first 0.9.8.0 NEWS and bump VERSION
* debian/
- Remove, obsoleted by the upstream GLES work
* Disable plugins that don't work on pure GLES on armhf/armel:
- bench, firepaint, mblur, showmouse, splash, showrepaint, td, widget
-- Sebastien Bacher <email address hidden> 2012年8月31日 22:59:50 +0200