Merge lp:~compiz-team/compiz/compiz.gles2.always-swapbuffers.1 into lp:~compiz-linaro-team/compiz/gles2
- compiz.gles2.always-swapbuffers.1
- Merge into gles2
Status: | Superseded |
---|---|
Proposed branch: | lp:~compiz-team/compiz/compiz.gles2.always-swapbuffers.1 |
Merge into: | lp:~compiz-linaro-team/compiz/gles2 |
Diff against target: |
1127 lines (+602/-148) 37 files modified
cmake/CMakeLists.txt (+9/-0) cmake/CompizCommon.cmake (+15/-0) cmake/src/CMakeLists.txt (+1/-0) cmake/src/compiz/CMakeLists.txt (+6/-0) cmake/src/compiz/compiz_discover_gtest_tests.cpp (+99/-0) compizconfig/libcompizconfig/tests/CMakeLists.txt (+4/-4) plugins/composite/src/pixmapbinding/tests/CMakeLists.txt (+1/-1) plugins/decor/src/clip-groups/tests/CMakeLists.txt (+1/-1) plugins/decor/src/pixmap-requests/tests/CMakeLists.txt (+1/-1) plugins/grid/src/grabhandler/tests/CMakeLists.txt (+1/-1) plugins/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) plugins/place/src/constrain-to-workarea/tests/CMakeLists.txt (+1/-1) plugins/place/src/screen-size-change/tests/CMakeLists.txt (+1/-1) plugins/place/src/smart/tests/CMakeLists.txt (+1/-1) plugins/wall/src/offset_movement/tests/CMakeLists.txt (+1/-1) src/option/tests/CMakeLists.txt (+1/-1) src/plugin/tests/CMakeLists.txt (+1/-1) src/pluginclasshandler/tests/CMakeLists.txt (+3/-3) src/point/tests/CMakeLists.txt (+1/-1) src/privatescreen/tests/CMakeLists.txt (+1/-1) src/rect/tests/CMakeLists.txt (+2/-2) src/region/tests/CMakeLists.txt (+1/-1) src/servergrab/tests/CMakeLists.txt (+1/-1) src/string/tests/CMakeLists.txt (+1/-1) src/timer/tests/CMakeLists.txt (+4/-4) src/window/constrainment/tests/CMakeLists.txt (+1/-1) src/window/extents/tests/CMakeLists.txt (+1/-1) src/window/geometry-saver/tests/CMakeLists.txt (+1/-1) src/window/geometry/tests/CMakeLists.txt (+1/-1) src/wrapsystem/tests/CMakeLists.txt (+1/-1) |
To merge this branch: | bzr merge lp:~compiz-team/compiz/compiz.gles2.always-swapbuffers.1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | Pending | ||
Review via email: mp+113516@code.launchpad.net |
This proposal supersedes a proposal from 2012-07-05.
This proposal has been superseded by a proposal from 2012-07-05.
Commit message
Description of the change
Always use *SwapBuffers instead of using glCopyPixels. Introduces a dependency on either having EGL_NV_
More of an RFC really.
Related to bug 1013514
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
> It seems to work very nicely on intel. I have a couple of concerns though:
>
> 1. The glCopyPixels fallback works and is reliable. I would like to keep it
> unless there is a good reason not to. That way we don't raise the minimum
> system requirements unnecessarily.
It is completely broken on NVIDIA (for reasons unknown, and for reasons that I don't think are worth looking into).
The only hardware that was going to be using this fallback path these days was hardware using the binary nvidia driver older than about 2003 (< GF FX 5xxx) and radeon hardware using the binary fglrx driver < Radeon 9xxx (2003 also). Every other driver supports supports either GLX_EXT_
>
> 2. We need a configuration option for people to be able to choose the old
> rendering method.
I would prefer not to do this.
Back in the Beryl days we had countless configuration options for controlling how rendering worked internally and we had countless bug reports because people used the wrong configuration for their particular hardware. Configuration should only be exposed for user-facing functionality and not for core functionality. I think we can all agree that the existing configuration options which change how rendering work, like providing an option to sync to vblank is already totally insane. Adding an option to say "do you want to handle vsync in software or hardware" also makes no sense to the user.
Assuming that we might be running in the case of glCopyPixels OR glXSwapBuffers presents a significant divergence in codepath internally. It means we need to keep around and maintain a bunch of old vsync code which we know is flaky at best because its not handled internally in the driver. I would prefer to drop support for GL_MESA_
We will also be heavily depending on shaders and vertex buffer objects in the future, and these codepaths have higher requirements than GLX_EXT_
Its time to move on from the past.
> There is a significant performance hit in (unthrottled)
> benchmark results with this change. So people need to have the option of going
> back to regional updates.
I'd like some information on this.
If it is that the performance hit comes from the fact that we're effectively always being vsync'd because we're using glXSwapBuffers / eglSwapBuffers, then I think the best course of action is to leave VSync on by default and use triple buffering so that you don't get the performance hit when you're really under load.
We're a compositor, not a benchmark. I don't think there's a good reason to maintain the old codepaths.
Achim (ach1m) wrote : Posted in a previous version of this proposal | # |
Just FYI the intel driver is using triple buffering by default.
$ cat /var/log/Xorg.0.log | grep "Triple"
[ 15.316] (**) intel(0): Triple buffering? enabled
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Okay, after some discussions on IRC, here is I think what the best course of action should be:
1) Always use glXSwapBuffers if GLX_EXT_
2) If GLX_EXT_
a) Use glXSwapBuffers if damage is fullscreen
b) Use GLX_MESA_
c) Use glCopyPixels
What this means is that if you hit 2(c) on NVIDIA, you're going to have a broken desktop. We should probably warn if we hit that case
I would much prefer to do this in future:
With VSync On:
1) Always use glXSwapBuffers if GLX_EXT_
2) If GLX_EXT_
a) Use glXSwapBuffers if damage is fullscreen
b) Use GLX_MESA_
c) Use glCopyPixels
With VSync Off:
1) Only render to framebuffer object if plugins needed to do fullscreen postprocessing
2) Use glXSwapBuffers where we are either rendering to an fbo, or doing a fullscreen render
3) Use glCopySubBufferMESA where supported
4) Use glCopyPixels if glCopySubBufferMESA is not supported
The reason being that always using swapbuffers in the no vsync case will effectively slow down unthrottled rendering because we have to do the pipeline stall on binding the fbo. Because the user doesn't care about image perfection with vsync off, we can just use the slightly more glitchy methods.
I will rework the code however to go with the first methods
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
As discussed on IRC, we will be dropping the glCopyPixels codepath as it is broken on all drivers not just nvidia
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal | # |
Hi, resubmitted with the following changes:
1. Got the fallback logic under test, created an abstraction that we could use for both EGL and GLX, which removed some ifdef soup
2. Called SwapBuffers if fullscreen damage or painting to FBO
3. Added startup requirement on GLX_MESA_
4. Removed EGL_BUFFER_
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Please use a more appropriate class name that doesn't contain a verb. So change:
XYZBufferBlit
to
XYZDoubleBuffer
(where Buffer is a noun in this case, not a verb ;)
Also missing file:
[ 26%] Building CXX object plugins/
/home/dan/
compilation terminated.
make[2]: *** [plugins/
make[1]: *** [plugins/
make[1]: *** Waiting for unfinished jobs....
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Please use a more appropriate class name that doesn't contain a verb. So change:
XYZBufferBlit
to
XYZDoubleBuffer
(where Buffer is a noun in this case, not a verb ;)
Sam Spilsbury (smspillaz) wrote : | # |
Rename complete
Unmerged revisions
Preview Diff
1 | === modified file 'cmake/CMakeLists.txt' |
2 | --- cmake/CMakeLists.txt 2012-05-26 10:52:26 +0000 |
3 | +++ cmake/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
4 | @@ -34,3 +34,12 @@ |
5 | FILES ${_PluginExtensionFiles} |
6 | DESTINATION ${CMAKE_INSTALL_PREFIX}/share/compiz/cmake/plugin_extensions |
7 | ) |
8 | + |
9 | +# Do not install src/compiz for a while until we've polished it up |
10 | + |
11 | +#install (DIRECTORY src/compiz |
12 | +# DESTINATION ${CMAKE_INSTALL_PREFIX}/src) |
13 | + |
14 | +if (COMPIZ_BUILD_TESTING) |
15 | + add_subdirectory (src) |
16 | +endif (COMPIZ_BUILD_TESTING) |
17 | |
18 | === modified file 'cmake/CompizCommon.cmake' |
19 | --- cmake/CompizCommon.cmake 2012-05-26 10:52:26 +0000 |
20 | +++ cmake/CompizCommon.cmake 2012-07-05 08:22:43 +0000 |
21 | @@ -82,6 +82,21 @@ |
22 | endif (NOT OPENGLES2_FOUND) |
23 | endif (USE_GLES) |
24 | |
25 | +# Create target to discover tests |
26 | +function (compiz_discover_tests EXECUTABLE) |
27 | + |
28 | + add_dependencies (${EXECUTABLE} |
29 | + compiz_discover_gtest_tests) |
30 | + |
31 | + add_custom_command (TARGET ${EXECUTABLE} |
32 | + POST_BUILD |
33 | + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE} --gtest_list_tests | ${CMAKE_BINARY_DIR}/compiz_gtest/compiz_discover_gtest_tests ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE} |
34 | + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} |
35 | + COMMENT "Discovering Tests in ${EXECUTABLE}" |
36 | + DEPENDS |
37 | + VERBATIM) |
38 | +endfunction () |
39 | + |
40 | function (compiz_ensure_linkage) |
41 | find_program (LDCONFIG_EXECUTABLE ldconfig) |
42 | mark_as_advanced (FORCE LDCONFIG_EXECUTABLE) |
43 | |
44 | === added directory 'cmake/src' |
45 | === added file 'cmake/src/CMakeLists.txt' |
46 | --- cmake/src/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
47 | +++ cmake/src/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
48 | @@ -0,0 +1,1 @@ |
49 | +add_subdirectory (compiz) |
50 | |
51 | === added directory 'cmake/src/compiz' |
52 | === added file 'cmake/src/compiz/CMakeLists.txt' |
53 | --- cmake/src/compiz/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
54 | +++ cmake/src/compiz/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
55 | @@ -0,0 +1,6 @@ |
56 | +add_executable (compiz_discover_gtest_tests |
57 | + EXCLUDE_FROM_ALL |
58 | + ${CMAKE_CURRENT_SOURCE_DIR}/compiz_discover_gtest_tests.cpp) |
59 | + |
60 | +set_target_properties (compiz_discover_gtest_tests PROPERTIES |
61 | + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/compiz_gtest) |
62 | |
63 | === added file 'cmake/src/compiz/compiz_discover_gtest_tests.cpp' |
64 | --- cmake/src/compiz/compiz_discover_gtest_tests.cpp 1970-01-01 00:00:00 +0000 |
65 | +++ cmake/src/compiz/compiz_discover_gtest_tests.cpp 2012-07-05 08:22:43 +0000 |
66 | @@ -0,0 +1,99 @@ |
67 | +#include <map> |
68 | +#include <vector> |
69 | +#include <string> |
70 | +#include <istream> |
71 | +#include <ostream> |
72 | +#include <fstream> |
73 | +#include <iterator> |
74 | +#include <iostream> |
75 | +#include <libgen.h> |
76 | + |
77 | +using namespace std; |
78 | + |
79 | +int main (int argc, char **argv) |
80 | +{ |
81 | + cin >> noskipws; |
82 | + |
83 | + if (argc < 2) |
84 | + { |
85 | + cout << "Usage: PATH_TO_TEST_BINARY --gtest_list_tests | ./build_test_cases PATH_TO_TEST_BINARY"; |
86 | + return 1; |
87 | + } |
88 | + |
89 | + map<string, vector<string> > testCases; |
90 | + string line; |
91 | + string currentTestCase; |
92 | + |
93 | + while (getline (cin, line)) |
94 | + { |
95 | + /* Is test case */ |
96 | + if (line.find (" ") == 0) |
97 | + testCases[currentTestCase].push_back (currentTestCase + line.substr (2)); |
98 | + else |
99 | + currentTestCase = line; |
100 | + |
101 | + } |
102 | + |
103 | + ofstream testfilecmake; |
104 | + char *base = basename (argv[1]); |
105 | + string gtestName (base); |
106 | + |
107 | + testfilecmake.open (string (gtestName + "_test.cmake").c_str (), ios::out | ios::trunc); |
108 | + |
109 | + if (testfilecmake.is_open ()) |
110 | + { |
111 | + for (map <string, vector<string> >::iterator it = testCases.begin (); |
112 | + it != testCases.end (); it++) |
113 | + { |
114 | + for (vector <string>::iterator jt = it->second.begin (); |
115 | + jt != it->second.end (); jt++) |
116 | + { |
117 | + if (testfilecmake.good ()) |
118 | + { |
119 | + string addTest ("ADD_TEST ("); |
120 | + string testExec (" \"" + string (argv[1]) + "\""); |
121 | + string gTestFilter ("\"--gtest_filter="); |
122 | + string endParen ("\")"); |
123 | + |
124 | + testfilecmake << addTest << *jt << testExec << gTestFilter << *jt << endParen << endl; |
125 | + } |
126 | + } |
127 | + } |
128 | + |
129 | + testfilecmake.close (); |
130 | + } |
131 | + |
132 | + ifstream CTestTestfile ("CTestTestfile.cmake", ifstream::in); |
133 | + bool needsInclude = true; |
134 | + line.clear (); |
135 | + |
136 | + string includeLine = string ("INCLUDE (") + |
137 | + gtestName + |
138 | + string ("_test.cmake)"); |
139 | + |
140 | + if (CTestTestfile.is_open ()) |
141 | + { |
142 | + while (CTestTestfile.good ()) |
143 | + { |
144 | + getline (CTestTestfile, line); |
145 | + |
146 | + if (line == includeLine) |
147 | + needsInclude = false; |
148 | + } |
149 | + |
150 | + CTestTestfile.close (); |
151 | + } |
152 | + |
153 | + if (needsInclude) |
154 | + { |
155 | + ofstream CTestTestfileW ("CTestTestfile.cmake", ofstream::app | ofstream::out); |
156 | + |
157 | + if (CTestTestfileW.is_open ()) |
158 | + { |
159 | + CTestTestfileW << includeLine << endl; |
160 | + CTestTestfileW.close (); |
161 | + } |
162 | + } |
163 | + |
164 | + return 0; |
165 | +} |
166 | |
167 | === modified file 'compizconfig/libcompizconfig/tests/CMakeLists.txt' |
168 | --- compizconfig/libcompizconfig/tests/CMakeLists.txt 2012-06-26 12:22:35 +0000 |
169 | +++ compizconfig/libcompizconfig/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
170 | @@ -94,7 +94,7 @@ |
171 | plugin-mock |
172 | setting-mock) |
173 | |
174 | -gtest_add_tests (test-ccs-object "" ${CMAKE_CURRENT_SOURCE_DIR}/test-ccs-object.cpp) |
175 | -gtest_add_tests (test-context "" ${CMAKE_CURRENT_SOURCE_DIR}/test-context.cpp) |
176 | -gtest_add_tests (test-plugin "" ${CMAKE_CURRENT_SOURCE_DIR}/test-plugin.cpp) |
177 | -gtest_add_tests (test-setting "" ${CMAKE_CURRENT_SOURCE_DIR}/test-setting.cpp) |
178 | +compiz_discover_tests (test-ccs-object) |
179 | +compiz_discover_tests (test-context) |
180 | +compiz_discover_tests (test-plugin) |
181 | +compiz_discover_tests (test-setting) |
182 | |
183 | === modified file 'plugins/composite/src/pixmapbinding/tests/CMakeLists.txt' |
184 | --- plugins/composite/src/pixmapbinding/tests/CMakeLists.txt 2012-05-31 07:15:37 +0000 |
185 | +++ plugins/composite/src/pixmapbinding/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
186 | @@ -21,4 +21,4 @@ |
187 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
188 | ) |
189 | |
190 | -gtest_add_tests (compiz_test_composite_pixmapbinding "" ${CMAKE_CURRENT_SOURCE_DIR}/test-composite-pixmapbinding.cpp) |
191 | +compiz_discover_tests (compiz_test_composite_pixmapbinding) |
192 | |
193 | === modified file 'plugins/decor/src/clip-groups/tests/CMakeLists.txt' |
194 | --- plugins/decor/src/clip-groups/tests/CMakeLists.txt 2012-03-30 16:06:07 +0000 |
195 | +++ plugins/decor/src/clip-groups/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
196 | @@ -11,4 +11,4 @@ |
197 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
198 | ) |
199 | |
200 | -gtest_add_tests (compiz_test_decor_clip_groups "" ${CMAKE_CURRENT_SOURCE_DIR}/clip-groups/src/test-decor-clip-groups.cpp) |
201 | +compiz_discover_tests (compiz_test_decor_clip_groups) |
202 | |
203 | === modified file 'plugins/decor/src/pixmap-requests/tests/CMakeLists.txt' |
204 | --- plugins/decor/src/pixmap-requests/tests/CMakeLists.txt 2012-05-10 15:40:25 +0000 |
205 | +++ plugins/decor/src/pixmap-requests/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
206 | @@ -12,4 +12,4 @@ |
207 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
208 | ) |
209 | |
210 | -gtest_add_tests (compiz_test_decor_pixmap_requests "" ${CMAKE_CURRENT_SOURCE_DIR}/pixmap-requests/src/test-decor-pixmap-requests.cpp) |
211 | +compiz_discover_tests (compiz_test_decor_pixmap_requests) |
212 | |
213 | === modified file 'plugins/grid/src/grabhandler/tests/CMakeLists.txt' |
214 | --- plugins/grid/src/grabhandler/tests/CMakeLists.txt 2012-05-28 06:48:42 +0000 |
215 | +++ plugins/grid/src/grabhandler/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
216 | @@ -21,4 +21,4 @@ |
217 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
218 | ) |
219 | |
220 | -gtest_add_tests (compiz_test_grid_grabhandler "" ${CMAKE_CURRENT_SOURCE_DIR}/test-grid-grab-handler.cpp) |
221 | +compiz_discover_tests (compiz_test_grid_grabhandler) |
222 | |
223 | === modified file 'plugins/opengl/CMakeLists.txt' |
224 | --- plugins/opengl/CMakeLists.txt 2012-05-17 10:41:21 +0000 |
225 | +++ plugins/opengl/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
226 | @@ -2,12 +2,17 @@ |
227 | |
228 | include (CompizPlugin) |
229 | |
230 | +set (INTERNAL_LIBRARIES |
231 | + compiz_opengl_double_buffer) |
232 | + |
233 | +add_subdirectory (src/doublebuffer) |
234 | + |
235 | if (USE_GLES) |
236 | - compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD "-DUSE_GLES -std=c++0x" LIBRARIES ${OPENGLES2_LIBRARIES} INCDIRS ${OPENGLES2_INCLUDE_DIR}) |
237 | + compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD "-DUSE_GLES -std=c++0x" LIBRARIES ${OPENGLES2_LIBRARIES} ${INTERNAL_LIBRARIES} INCDIRS ${OPENGLES2_INCLUDE_DIR}) |
238 | else (USE_GLES) |
239 | find_package (OpenGL) |
240 | if (OPENGL_FOUND) |
241 | - compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD -std=c++0x LIBRARIES ${OPENGL_gl_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR}) |
242 | + compiz_plugin(opengl PLUGINDEPS composite CFLAGSADD -std=c++0x LIBRARIES ${OPENGL_gl_LIBRARY} ${INTERNAL_LIBRARIES} INCDIRS ${OPENGL_INCLUDE_DIR}) |
243 | endif (OPENGL_FOUND) |
244 | endif (USE_GLES) |
245 | |
246 | |
247 | === added file 'plugins/opengl/include/opengl/doublebuffer.h' |
248 | --- plugins/opengl/include/opengl/doublebuffer.h 1970-01-01 00:00:00 +0000 |
249 | +++ plugins/opengl/include/opengl/doublebuffer.h 2012-07-05 08:22:43 +0000 |
250 | @@ -0,0 +1,31 @@ |
251 | +#ifndef _COMPIZ_OPENGL_BUFFERBLIT_H |
252 | +#define _COMPIZ_OPENGL_BUFFERBLIT_H |
253 | + |
254 | +#include <core/region.h> |
255 | + |
256 | +namespace compiz |
257 | +{ |
258 | +namespace opengl |
259 | +{ |
260 | + |
261 | +const unsigned int PaintedWithFramebufferObject = (1 << 0); |
262 | +const unsigned int PaintedFullscreen = (1 << 1); |
263 | + |
264 | +class GLDoubleBufferInterface |
265 | +{ |
266 | + public: |
267 | + |
268 | + virtual ~GLDoubleBufferInterface () {} |
269 | + |
270 | + virtual void swapBuffers () const = 0; |
271 | + virtual bool subBufferBlitAvailable () const = 0; |
272 | + virtual void subBufferBlit (const CompRegion ®ion) const = 0; |
273 | +}; |
274 | + |
275 | +void blitBuffers (unsigned int flags, |
276 | + const CompRegion &blitRegion, |
277 | + GLDoubleBufferInterface &); |
278 | + |
279 | +} |
280 | +} |
281 | +#endif |
282 | |
283 | === added directory 'plugins/opengl/src/doublebuffer' |
284 | === added file 'plugins/opengl/src/doublebuffer/CMakeLists.txt' |
285 | --- plugins/opengl/src/doublebuffer/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
286 | +++ plugins/opengl/src/doublebuffer/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
287 | @@ -0,0 +1,31 @@ |
288 | +INCLUDE_DIRECTORIES ( |
289 | + ${compiz_SOURCE_DIR}/src/logmessage/include |
290 | + ${CMAKE_CURRENT_SOURCE_DIR}/../../include |
291 | + ${CMAKE_CURRENT_SOURCE_DIR}/src |
292 | + |
293 | + ${Boost_INCLUDE_DIRS} |
294 | +) |
295 | + |
296 | +LINK_DIRECTORIES (${COMPIZ_LIBRARY_DIRS}) |
297 | + |
298 | +SET( |
299 | + SRCS |
300 | + ${CMAKE_CURRENT_SOURCE_DIR}/src/double-buffer.cpp |
301 | +) |
302 | + |
303 | +ADD_LIBRARY( |
304 | + compiz_opengl_double_buffer STATIC |
305 | + |
306 | + ${SRCS} |
307 | +) |
308 | + |
309 | +if (COMPIZ_BUILD_TESTING) |
310 | +ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) |
311 | +endif (COMPIZ_BUILD_TESTING) |
312 | + |
313 | +TARGET_LINK_LIBRARIES( |
314 | + compiz_opengl_double_buffer |
315 | + |
316 | + compiz_region |
317 | + compiz_logmessage |
318 | +) |
319 | |
320 | === added directory 'plugins/opengl/src/doublebuffer/src' |
321 | === added file 'plugins/opengl/src/doublebuffer/src/double-buffer.cpp' |
322 | --- plugins/opengl/src/doublebuffer/src/double-buffer.cpp 1970-01-01 00:00:00 +0000 |
323 | +++ plugins/opengl/src/doublebuffer/src/double-buffer.cpp 2012-07-05 08:22:43 +0000 |
324 | @@ -0,0 +1,34 @@ |
325 | +#include <iostream> |
326 | + |
327 | +#include <core/logmessage.h> |
328 | +#include <opengl/doublebuffer.h> |
329 | + |
330 | +#include <cstdlib> |
331 | + |
332 | +using namespace compiz::opengl; |
333 | + |
334 | +char programName[] = "compiz_test_opengl_double_buffer"; |
335 | +bool debugOutput = false; |
336 | + |
337 | +void |
338 | +compiz::opengl::blitBuffers (unsigned int flags, |
339 | + const CompRegion &tmpRegion, |
340 | + GLDoubleBufferInterface &blit) |
341 | +{ |
342 | + if (flags & (PaintedFullscreen | |
343 | + PaintedWithFramebufferObject)) |
344 | + { |
345 | + blit.swapBuffers (); |
346 | + } |
347 | + else if (blit.subBufferBlitAvailable ()) |
348 | + { |
349 | + blit.subBufferBlit (tmpRegion); |
350 | + } |
351 | + else |
352 | + { |
353 | + /* FIXME: We need to use compLogMessage here, but for some |
354 | + * reason it just crashes in the tests */ |
355 | + std::cerr << "(compiz) - fatal: no back to front flip methods supported" << std::endl; |
356 | + abort (); |
357 | + } |
358 | +} |
359 | |
360 | === added directory 'plugins/opengl/src/doublebuffer/tests' |
361 | === added file 'plugins/opengl/src/doublebuffer/tests/CMakeLists.txt' |
362 | --- plugins/opengl/src/doublebuffer/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
363 | +++ plugins/opengl/src/doublebuffer/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
364 | @@ -0,0 +1,24 @@ |
365 | +find_library (GMOCK_LIBRARY gmock) |
366 | +find_library (GMOCK_MAIN_LIBRARY gmock_main) |
367 | + |
368 | +if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) |
369 | + message ("Google Mock and Google Test not found - cannot build tests!") |
370 | + set (COMPIZ_BUILD_TESTING OFF) |
371 | +endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) |
372 | + |
373 | +include_directories (${GTEST_INCLUDE_DIRS}) |
374 | + |
375 | +link_directories (${COMPIZ_LIBRARY_DIRS}) |
376 | + |
377 | +add_executable (compiz_test_opengl_double_buffer |
378 | + ${CMAKE_CURRENT_SOURCE_DIR}/test-opengl-double-buffer.cpp) |
379 | + |
380 | +target_link_libraries (compiz_test_opengl_double_buffer |
381 | + compiz_opengl_double_buffer |
382 | + ${GTEST_BOTH_LIBRARIES} |
383 | + ${GMOCK_LIBRARY} |
384 | + ${GMOCK_MAIN_LIBRARY} |
385 | + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
386 | + ) |
387 | + |
388 | +compiz_discover_tests (compiz_test_opengl_double_buffer) |
389 | |
390 | === added file 'plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp' |
391 | --- plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp 1970-01-01 00:00:00 +0000 |
392 | +++ plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp 2012-07-05 08:22:43 +0000 |
393 | @@ -0,0 +1,91 @@ |
394 | +#include <gtest/gtest.h> |
395 | +#include <gmock/gmock.h> |
396 | + |
397 | +#include <opengl/doublebuffer.h> |
398 | + |
399 | +using namespace compiz::opengl; |
400 | +using testing::_; |
401 | +using testing::StrictMock; |
402 | +using testing::Return; |
403 | + |
404 | +class MockGLDoubleBuffer : |
405 | + public GLDoubleBufferInterface |
406 | +{ |
407 | + public: |
408 | + |
409 | + MOCK_CONST_METHOD0 (swapBuffers, void ()); |
410 | + MOCK_CONST_METHOD0 (subBufferBlitAvailable, bool ()); |
411 | + MOCK_CONST_METHOD1 (subBufferBlit, void (const CompRegion &)); |
412 | +}; |
413 | + |
414 | +class CompizOpenGLDoubleBufferTest : |
415 | + public ::testing::Test |
416 | +{ |
417 | + public: |
418 | + |
419 | + MockGLDoubleBuffer mglbb; |
420 | + CompRegion blitRegion; |
421 | + |
422 | +}; |
423 | + |
424 | +class CompizOpenGLDoubleBufferDeathTest : |
425 | + public CompizOpenGLDoubleBufferTest |
426 | +{ |
427 | +}; |
428 | + |
429 | +TEST_F(CompizOpenGLDoubleBufferTest, TestPaintedWithFBOAlwaysSwaps) |
430 | +{ |
431 | + EXPECT_CALL (mglbb, swapBuffers ()); |
432 | + |
433 | + blitBuffers (PaintedWithFramebufferObject, blitRegion, mglbb); |
434 | +} |
435 | + |
436 | +TEST_F(CompizOpenGLDoubleBufferTest, TestPaintedFullscreenAlwaysSwaps) |
437 | +{ |
438 | + EXPECT_CALL (mglbb, swapBuffers ()); |
439 | + |
440 | + blitBuffers (PaintedFullscreen, blitRegion, mglbb); |
441 | +} |
442 | + |
443 | +TEST_F(CompizOpenGLDoubleBufferTest, TestNoPaintedFullscreenOrFBOAlwaysBlitsSubBuffer) |
444 | +{ |
445 | + EXPECT_CALL (mglbb, subBufferBlitAvailable ()).WillOnce (Return (true)); |
446 | + EXPECT_CALL (mglbb, subBufferBlit (_)); |
447 | + |
448 | + blitBuffers (0, blitRegion, mglbb); |
449 | +} |
450 | + |
451 | +TEST_F(CompizOpenGLDoubleBufferTest, TestNoPaintedFullscreenOrFBODoesNotBlitIfNotSupported) |
452 | +{ |
453 | + |
454 | +} |
455 | + |
456 | +TEST_F(CompizOpenGLDoubleBufferTest, TestBlitExactlyWithRegionSpecified) |
457 | +{ |
458 | + CompRegion r1 (0, 0, 100, 100); |
459 | + CompRegion r2 (100, 100, 100, 100); |
460 | + CompRegion r3 (200, 200, 100, 100); |
461 | + |
462 | + EXPECT_CALL (mglbb, subBufferBlitAvailable ()).WillRepeatedly (Return (true)); |
463 | + |
464 | + EXPECT_CALL (mglbb, subBufferBlit (r1)); |
465 | + blitBuffers (0, r1, mglbb); |
466 | + |
467 | + EXPECT_CALL (mglbb, subBufferBlit (r2)); |
468 | + blitBuffers (0, r2, mglbb); |
469 | + |
470 | + EXPECT_CALL (mglbb, subBufferBlit (r3)); |
471 | + blitBuffers (0, r3, mglbb); |
472 | +} |
473 | + |
474 | +TEST_F(CompizOpenGLDoubleBufferDeathTest, TestNoPaintedFullscreenOrFBODoesNotBlitIfNotSupportedAndDies) |
475 | +{ |
476 | + StrictMock <MockGLDoubleBuffer> mglbbStrict; |
477 | + |
478 | + ON_CALL (mglbbStrict, subBufferBlitAvailable ()).WillByDefault (Return (false)); |
479 | + |
480 | + ASSERT_DEATH ({ |
481 | + blitBuffers (0, blitRegion, mglbbStrict); |
482 | + }, |
483 | + ".fatal."); |
484 | +} |
485 | |
486 | === modified file 'plugins/opengl/src/privates.h' |
487 | --- plugins/opengl/src/privates.h 2012-05-26 12:52:04 +0000 |
488 | +++ plugins/opengl/src/privates.h 2012-07-05 08:22:43 +0000 |
489 | @@ -36,12 +36,77 @@ |
490 | #include <opengl/framebufferobject.h> |
491 | #endif |
492 | |
493 | +#include <opengl/doublebuffer.h> |
494 | + |
495 | #include "privatetexture.h" |
496 | #include "privatevertexbuffer.h" |
497 | #include "opengl_options.h" |
498 | |
499 | extern CompOutput *targetOutput; |
500 | |
501 | +class BaseDoubleBuffer |
502 | +{ |
503 | + public: |
504 | + |
505 | + BaseDoubleBuffer (Display *, |
506 | + const CompSize &, |
507 | + const boost::function <bool ()> &); |
508 | + |
509 | + protected: |
510 | + |
511 | + Display *mDpy; |
512 | + const CompSize &mSize; |
513 | + boost::function <bool ()> getSyncVblank; |
514 | +}; |
515 | + |
516 | +#ifndef USE_GLES |
517 | + |
518 | +class GLXDoubleBuffer : |
519 | + public compiz::opengl::GLDoubleBufferInterface, |
520 | + public BaseDoubleBuffer |
521 | +{ |
522 | + public: |
523 | + |
524 | + GLXDoubleBuffer (Display *, |
525 | + const CompSize &, |
526 | + const boost::function <bool ()> &, |
527 | + Window, |
528 | + const boost::function <void ()> &); |
529 | + |
530 | + void swapBuffers () const; |
531 | + bool subBufferBlitAvailable () const; |
532 | + void subBufferBlit (const CompRegion ®ion) const; |
533 | + |
534 | + protected: |
535 | + |
536 | + Window mOutput; |
537 | + boost::function <void ()> waitVSync; |
538 | +}; |
539 | + |
540 | +#else |
541 | + |
542 | +class EGLDoubleBuffer : |
543 | + public compiz::opengl::GLDoubleBufferInterface, |
544 | + public BaseDoubleBuffer |
545 | +{ |
546 | + public: |
547 | + |
548 | + EGLDoubleBuffer (Display *, |
549 | + const CompSize &, |
550 | + const boost::function <bool ()> &, |
551 | + EGLSurface const &); |
552 | + |
553 | + void swapBuffers () const; |
554 | + bool subBufferBlitAvailable () const; |
555 | + void subBufferBlit (const CompRegion ®ion) const; |
556 | + |
557 | + private: |
558 | + |
559 | + EGLSurface const & mSurface; |
560 | +}; |
561 | + |
562 | +#endif |
563 | + |
564 | class GLIcon |
565 | { |
566 | public: |
567 | @@ -118,10 +183,12 @@ |
568 | #ifdef USE_GLES |
569 | EGLContext ctx; |
570 | EGLSurface surface; |
571 | + EGLDoubleBuffer bufferBlit; |
572 | #else |
573 | GLXContext ctx; |
574 | |
575 | GL::GLXGetProcAddressProc getProcAddress; |
576 | + GLXDoubleBuffer bufferBlit; |
577 | #endif |
578 | |
579 | GLFramebufferObject *scratchFbo; |
580 | |
581 | === modified file 'plugins/opengl/src/screen.cpp' |
582 | --- plugins/opengl/src/screen.cpp 2012-07-03 18:16:28 +0000 |
583 | +++ plugins/opengl/src/screen.cpp 2012-07-05 08:22:43 +0000 |
584 | @@ -341,8 +341,8 @@ |
585 | return false; |
586 | } |
587 | |
588 | - // Currently we rely unconditionally on preserving the buffer contents. |
589 | - eglSurfaceAttrib (dpy, priv->surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); |
590 | + // Do not preserve buffer contents on swap |
591 | + eglSurfaceAttrib (dpy, priv->surface, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); |
592 | |
593 | priv->ctx = eglCreateContext (dpy, config, EGL_NO_CONTEXT, context_attribs); |
594 | if (priv->ctx == EGL_NO_CONTEXT) |
595 | @@ -415,6 +415,15 @@ |
596 | GL::postSubBuffer = (GL::EGLPostSubBufferNVProc) |
597 | eglGetProcAddress ("eglPostSubBufferNV"); |
598 | |
599 | + if (!GL::fbo && |
600 | + !GL::postSubBuffer) |
601 | + { |
602 | + compLogMessage ("opengl", CompLogLevelFatal, |
603 | + "GL_EXT_framebuffer_object or EGL_NV_post_sub_buffer are required"); |
604 | + screen->handleCompizEvent ("opengl", "fatal_fallback", o); |
605 | + return false; |
606 | + } |
607 | + |
608 | GL::activeTexture = glActiveTexture; |
609 | GL::genFramebuffers = glGenFramebuffers; |
610 | GL::deleteFramebuffers = glDeleteFramebuffers; |
611 | @@ -631,6 +640,16 @@ |
612 | GL::fbo = true; |
613 | } |
614 | |
615 | + |
616 | + if (!GL::fbo && |
617 | + !GL::copySubBuffer) |
618 | + { |
619 | + compLogMessage ("opengl", CompLogLevelFatal, |
620 | + "GL_EXT_framebuffer_object or GLX_MESA_copy_sub_buffer are required"); |
621 | + screen->handleCompizEvent ("opengl", "fatal_fallback", o); |
622 | + return false; |
623 | + } |
624 | + |
625 | if (strstr (glExtensions, "GL_ARB_vertex_buffer_object")) |
626 | { |
627 | GL::bindBuffer = (GL::GLBindBufferProc) |
628 | @@ -1069,6 +1088,14 @@ |
629 | lighting (false), |
630 | #ifndef USE_GLES |
631 | getProcAddress (0), |
632 | + bufferBlit (screen->dpy (), *screen, |
633 | + boost::bind (&PrivateGLScreen::optionGetSyncToVblank, this), |
634 | + cScreen->output (), |
635 | + boost::bind (&PrivateGLScreen::waitForVideoSync, this)), |
636 | + #else |
637 | + bufferBlit (screen->dpy (), *screen, |
638 | + boost::bind (&PrivateGLScreen::optionGetSyncToVblank, this), |
639 | + surface), |
640 | #endif |
641 | scratchFbo (NULL), |
642 | scratchFboBindFailed (false), |
643 | @@ -1677,6 +1704,111 @@ |
644 | GL::waitForVideoSync (); |
645 | } |
646 | |
647 | +BaseDoubleBuffer::BaseDoubleBuffer (Display *d, const CompSize &s, |
648 | + const boost::function <bool ()> &getSyncVblankFunc) : |
649 | + mDpy (d), |
650 | + mSize (s), |
651 | + getSyncVblank (getSyncVblankFunc) |
652 | +{ |
653 | +} |
654 | + |
655 | +#ifndef USE_GLES |
656 | + |
657 | +GLXDoubleBuffer::GLXDoubleBuffer (Display *d, |
658 | + const CompSize &s, |
659 | + const boost::function <bool ()> &getSyncVblankFunc, |
660 | + Window output, |
661 | + const boost::function <void ()> &waitVSyncFunc) : |
662 | + BaseDoubleBuffer (d, s, getSyncVblankFunc), |
663 | + mOutput (output), |
664 | + waitVSync (waitVSyncFunc) |
665 | +{ |
666 | +} |
667 | + |
668 | +void |
669 | +GLXDoubleBuffer::swapBuffers () const |
670 | +{ |
671 | + GL::controlSwapVideoSync (getSyncVblank ()); |
672 | + glXSwapBuffers (mDpy, mOutput); |
673 | +} |
674 | + |
675 | +bool |
676 | +GLXDoubleBuffer::subBufferBlitAvailable () const |
677 | +{ |
678 | + return GL::copySubBuffer ? true : false; |
679 | +} |
680 | + |
681 | +void |
682 | +GLXDoubleBuffer::subBufferBlit (const CompRegion ®ion) const |
683 | +{ |
684 | + CompRect::vector blitRects (region.rects ()); |
685 | + int y = 0; |
686 | + |
687 | + waitVSync (); |
688 | + |
689 | + foreach (const CompRect &r, blitRects) |
690 | + { |
691 | + y = mSize.height () - r.y2 (); |
692 | + |
693 | + (*GL::copySubBuffer) (screen->dpy (), mOutput, |
694 | + r.x1 (), y, |
695 | + r.width (), |
696 | + r.height ()); |
697 | + } |
698 | +} |
699 | + |
700 | +#else |
701 | + |
702 | +EGLDoubleBuffer::EGLDoubleBuffer (Display *d, |
703 | + const CompSize &s, |
704 | + const boost::function <bool ()> &getSyncVblankFunc, |
705 | + EGLSurface const & surface) : |
706 | + BaseDoubleBuffer (d, s, getSyncVblankFunc), |
707 | + mSurface (surface) |
708 | +{ |
709 | +} |
710 | + |
711 | +void |
712 | +EGLDoubleBuffer::swapBuffers () const |
713 | +{ |
714 | + GL::controlSwapVideoSync (getSyncVblank ()); |
715 | + |
716 | + eglSwapBuffers (eglGetDisplay (mDpy), mSurface); |
717 | + eglWaitGL (); |
718 | + XFlush (mDpy); |
719 | +} |
720 | + |
721 | +bool |
722 | +EGLDoubleBuffer::subBufferBlitAvailable () const |
723 | +{ |
724 | + return GL::postSubBuffer ? true : false; |
725 | +} |
726 | + |
727 | +void |
728 | +EGLDoubleBuffer::subBufferBlit (const CompRegion ®ion) const |
729 | +{ |
730 | + CompRect::vector blitRects (region.rects ()); |
731 | + int y = 0; |
732 | + |
733 | + GL::controlSwapVideoSync (getSyncVblank ()); |
734 | + |
735 | + foreach (const CompRect &r, blitRects) |
736 | + { |
737 | + y = mSize.height () - r.y2 (); |
738 | + |
739 | + (*GL::postSubBuffer) (eglGetDisplay (screen->dpy ()), |
740 | + mSurface, |
741 | + r.x1 (), y, |
742 | + r.width (), |
743 | + r.height ()); |
744 | + } |
745 | + |
746 | + eglWaitGL (); |
747 | + XFlush (screen->dpy ()); |
748 | +} |
749 | + |
750 | +#endif |
751 | + |
752 | void |
753 | PrivateGLScreen::paintOutputs (CompOutput::ptrList &outputs, |
754 | unsigned int mask, |
755 | @@ -1691,11 +1823,21 @@ |
756 | GLFramebufferObject *oldFbo = NULL; |
757 | bool useFbo = false; |
758 | |
759 | - if (!scratchFboBindFailed) |
760 | + /* Clear the color buffer where appropriate */ |
761 | + if (!scratchFboBindFailed && GL::fbo) |
762 | { |
763 | + if (clearBuffers) |
764 | + glClear (GL_COLOR_BUFFER_BIT); |
765 | + |
766 | oldFbo = scratchFbo->bind (); |
767 | useFbo = scratchFbo->checkStatus () && scratchFbo->tex (); |
768 | } |
769 | + else |
770 | + { |
771 | + if (clearBuffers) |
772 | + if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) |
773 | + glClear (GL_COLOR_BUFFER_BIT); |
774 | + } |
775 | |
776 | if (!useFbo && !scratchFboBindFailed) |
777 | { |
778 | @@ -1721,12 +1863,6 @@ |
779 | } |
780 | #endif |
781 | |
782 | - if (clearBuffers) |
783 | - { |
784 | - if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) |
785 | - glClear (GL_COLOR_BUFFER_BIT); |
786 | - } |
787 | - |
788 | CompRegion tmpRegion (region); |
789 | |
790 | foreach (CompOutput *output, outputs) |
791 | @@ -1747,11 +1883,7 @@ |
792 | lastViewport = r; |
793 | } |
794 | |
795 | -#ifdef USE_GLES |
796 | - if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK || !GL::postSubBuffer) |
797 | -#else |
798 | if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) |
799 | -#endif |
800 | { |
801 | GLMatrix identity; |
802 | |
803 | @@ -1796,109 +1928,18 @@ |
804 | GLFramebufferObject::rebind (oldFbo); |
805 | |
806 | // FIXME: does not work if screen dimensions exceed max texture size |
807 | - gScreen->glPaintCompositedOutput (tmpRegion, scratchFbo, mask); |
808 | + gScreen->glPaintCompositedOutput (screen->region (), scratchFbo, mask); |
809 | } |
810 | |
811 | - glFlush (); |
812 | - |
813 | -#ifdef USE_GLES |
814 | - if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK || !GL::postSubBuffer) |
815 | -#else |
816 | + unsigned int blitMask = 0; |
817 | + |
818 | + if (useFbo) |
819 | + blitMask |= compiz::opengl::PaintedWithFramebufferObject; |
820 | + |
821 | if (mask & COMPOSITE_SCREEN_DAMAGE_ALL_MASK) |
822 | -#endif |
823 | - { |
824 | - /* |
825 | - * controlSwapVideoSync is much faster than waitForVideoSync because |
826 | - * it won't block the CPU. The waiting is offloaded to the GPU. |
827 | - * Unfortunately it only works with glXSwapBuffers in most drivers. |
828 | - */ |
829 | - #ifdef USE_GLES |
830 | - Display *xdpy = screen->dpy (); |
831 | - GL::controlSwapVideoSync (optionGetSyncToVblank ()); |
832 | - eglSwapBuffers (eglGetDisplay (xdpy), surface); |
833 | - eglWaitGL (); |
834 | - XFlush (xdpy); |
835 | - #else |
836 | - GL::controlSwapVideoSync (optionGetSyncToVblank ()); |
837 | - glXSwapBuffers (screen->dpy (), cScreen->output ()); |
838 | - #endif |
839 | - } |
840 | - else |
841 | - { |
842 | - BoxPtr pBox = const_cast <Region> (tmpRegion.handle ())->rects; |
843 | - int nBox = const_cast <Region> (tmpRegion.handle ())->numRects; |
844 | - int y; |
845 | - |
846 | - waitForVideoSync (); |
847 | - |
848 | - #ifdef USE_GLES |
849 | - Display *xdpy = screen->dpy (); |
850 | - |
851 | - GL::controlSwapVideoSync (optionGetSyncToVblank ()); |
852 | - |
853 | - while (nBox--) |
854 | - { |
855 | - y = screen->height () - pBox->y2; |
856 | - |
857 | - (*GL::postSubBuffer) (eglGetDisplay (xdpy), surface, |
858 | - pBox->x1, y, |
859 | - pBox->x2 - pBox->x1, |
860 | - pBox->y2 - pBox->y1); |
861 | - pBox++; |
862 | - } |
863 | - |
864 | - eglWaitGL (); |
865 | - XFlush (xdpy); |
866 | - |
867 | - #else |
868 | - if (GL::copySubBuffer) |
869 | - { |
870 | - while (nBox--) |
871 | - { |
872 | - y = screen->height () - pBox->y2; |
873 | - |
874 | - (*GL::copySubBuffer) (screen->dpy (), cScreen->output (), |
875 | - pBox->x1, y, |
876 | - pBox->x2 - pBox->x1, |
877 | - pBox->y2 - pBox->y1); |
878 | - |
879 | - pBox++; |
880 | - } |
881 | - } |
882 | - else |
883 | - { |
884 | - glEnable (GL_SCISSOR_TEST); |
885 | - glDrawBuffer (GL_FRONT); |
886 | - |
887 | - while (nBox--) |
888 | - { |
889 | - y = screen->height () - pBox->y2; |
890 | - |
891 | - glBitmap (0, 0, 0, 0, |
892 | - pBox->x1 - rasterPos.x (), |
893 | - y - rasterPos.y (), |
894 | - NULL); |
895 | - |
896 | - rasterPos = CompPoint (pBox->x1, y); |
897 | - |
898 | - glScissor (pBox->x1, y, |
899 | - pBox->x2 - pBox->x1, |
900 | - pBox->y2 - pBox->y1); |
901 | - |
902 | - glCopyPixels (pBox->x1, y, |
903 | - pBox->x2 - pBox->x1, |
904 | - pBox->y2 - pBox->y1, |
905 | - GL_COLOR); |
906 | - |
907 | - pBox++; |
908 | - } |
909 | - |
910 | - glDrawBuffer (GL_BACK); |
911 | - glDisable (GL_SCISSOR_TEST); |
912 | - glFlush (); |
913 | - } |
914 | - #endif |
915 | - } |
916 | + blitMask |= compiz::opengl::PaintedFullscreen; |
917 | + |
918 | + compiz::opengl::blitBuffers (blitMask, tmpRegion, bufferBlit); |
919 | |
920 | lastMask = mask; |
921 | } |
922 | |
923 | === modified file 'plugins/place/src/constrain-to-workarea/tests/CMakeLists.txt' |
924 | --- plugins/place/src/constrain-to-workarea/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
925 | +++ plugins/place/src/constrain-to-workarea/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
926 | @@ -15,4 +15,4 @@ |
927 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
928 | ) |
929 | |
930 | -gtest_add_tests (compiz_test_place_constrain_to_workarea "" ${CMAKE_CURRENT_SOURCE_DIR}/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp) |
931 | +compiz_discover_tests (compiz_test_place_constrain_to_workarea) |
932 | |
933 | === modified file 'plugins/place/src/screen-size-change/tests/CMakeLists.txt' |
934 | --- plugins/place/src/screen-size-change/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
935 | +++ plugins/place/src/screen-size-change/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
936 | @@ -15,4 +15,4 @@ |
937 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
938 | ) |
939 | |
940 | -gtest_add_tests (compiz_test_place_screen_size_change "" ${CMAKE_CURRENT_SOURCE_DIR}/screen-size-change/src/test-place-screen-size-change.cpp) |
941 | +compiz_discover_tests (compiz_test_place_screen_size_change) |
942 | |
943 | === modified file 'plugins/place/src/smart/tests/CMakeLists.txt' |
944 | --- plugins/place/src/smart/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
945 | +++ plugins/place/src/smart/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
946 | @@ -11,4 +11,4 @@ |
947 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
948 | ) |
949 | |
950 | -gtest_add_tests (compiz_test_place_smart_on_screen "" ${CMAKE_CURRENT_SOURCE_DIR}/offscreen/src/test-place-smart-on-screen.cpp) |
951 | +compiz_discover_tests (compiz_test_place_smart_on_screen) |
952 | |
953 | === modified file 'plugins/wall/src/offset_movement/tests/CMakeLists.txt' |
954 | --- plugins/wall/src/offset_movement/tests/CMakeLists.txt 2012-05-21 06:43:20 +0000 |
955 | +++ plugins/wall/src/offset_movement/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
956 | @@ -21,4 +21,4 @@ |
957 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
958 | ) |
959 | |
960 | -gtest_add_tests (compiz_test_wall_offset_movement "" ${CMAKE_CURRENT_SOURCE_DIR}/test-wall-offset-movement.cpp) |
961 | +compiz_discover_tests (compiz_test_wall_offset_movement) |
962 | |
963 | === modified file 'src/option/tests/CMakeLists.txt' |
964 | --- src/option/tests/CMakeLists.txt 2012-05-21 06:43:20 +0000 |
965 | +++ src/option/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
966 | @@ -28,4 +28,4 @@ |
967 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
968 | ) |
969 | |
970 | -gtest_add_tests( compiz_option_test "" ${CMAKE_CURRENT_SOURCE_DIR}/option.cpp ) |
971 | +compiz_discover_tests ( compiz_option_test ) |
972 | |
973 | === modified file 'src/plugin/tests/CMakeLists.txt' |
974 | --- src/plugin/tests/CMakeLists.txt 2012-06-24 09:00:27 +0000 |
975 | +++ src/plugin/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
976 | @@ -32,5 +32,5 @@ |
977 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
978 | ) |
979 | |
980 | -env_gtest_add_tests( compiz_plugin_test "" ${CMAKE_CURRENT_SOURCE_DIR}/test-plugin.cpp ) |
981 | +compiz_discover_tests ( compiz_plugin_test ) |
982 | |
983 | |
984 | === modified file 'src/pluginclasshandler/tests/CMakeLists.txt' |
985 | --- src/pluginclasshandler/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
986 | +++ src/pluginclasshandler/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
987 | @@ -74,8 +74,8 @@ |
988 | # gtest_main |
989 | #) |
990 | |
991 | -gtest_add_tests( compiz_pch_construct "" ${CMAKE_CURRENT_SOURCE_DIR}/construct/src/test-pch-construct.cpp ) |
992 | -gtest_add_tests( compiz_pch_get "" ${CMAKE_CURRENT_SOURCE_DIR}/get/src/test-pch-get.cpp ) |
993 | +compiz_discover_tests (compiz_pch_construct) |
994 | +compiz_discover_tests (compiz_pch_get) |
995 | #add_test( compiz_pch_indexes compiz_pch_indexes ) |
996 | -gtest_add_tests( compiz_pch_typenames "" ${CMAKE_CURRENT_SOURCE_DIR}/typenames/src/test-pch-typenames.cpp ) |
997 | +compiz_discover_tests (compiz_pch_typenames) |
998 | |
999 | |
1000 | === modified file 'src/point/tests/CMakeLists.txt' |
1001 | --- src/point/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
1002 | +++ src/point/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1003 | @@ -15,4 +15,4 @@ |
1004 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1005 | ) |
1006 | |
1007 | -gtest_add_tests (compiz_test_point "" ${CMAKE_CURRENT_SOURCE_DIR}/point/src/test-point.cpp) |
1008 | +compiz_discover_tests (compiz_test_point) |
1009 | |
1010 | === modified file 'src/privatescreen/tests/CMakeLists.txt' |
1011 | --- src/privatescreen/tests/CMakeLists.txt 2012-06-24 09:00:27 +0000 |
1012 | +++ src/privatescreen/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1013 | @@ -53,4 +53,4 @@ |
1014 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1015 | ) |
1016 | |
1017 | -env_gtest_add_tests( compiz_privatescreen_test "" ${CMAKE_CURRENT_SOURCE_DIR}/test-privatescreen.cpp ) |
1018 | +compiz_discover_tests (compiz_privatescreen_test) |
1019 | |
1020 | === modified file 'src/rect/tests/CMakeLists.txt' |
1021 | --- src/rect/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
1022 | +++ src/rect/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1023 | @@ -27,5 +27,5 @@ |
1024 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1025 | ) |
1026 | |
1027 | -gtest_add_tests (compiz_test_rect "" ${CMAKE_CURRENT_SOURCE_DIR}/rect/src/test-rect.cpp) |
1028 | -gtest_add_tests (compiz_test_rect_wraparound_point "" ${CMAKE_CURRENT_SOURCE_DIR}/wraparound_point/src/test-rect-wraparound-point.cpp) |
1029 | +compiz_discover_tests (compiz_test_rect) |
1030 | +compiz_discover_tests (compiz_test_rect_wraparound_point) |
1031 | |
1032 | === modified file 'src/region/tests/CMakeLists.txt' |
1033 | --- src/region/tests/CMakeLists.txt 2012-05-21 06:43:20 +0000 |
1034 | +++ src/region/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1035 | @@ -33,4 +33,4 @@ |
1036 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1037 | ) |
1038 | |
1039 | -gtest_add_tests( compiz_region_test "" ${CMAKE_CURRENT_SOURCE_DIR}/test-region.cpp ) |
1040 | +compiz_discover_tests (compiz_region_test) |
1041 | |
1042 | === modified file 'src/servergrab/tests/CMakeLists.txt' |
1043 | --- src/servergrab/tests/CMakeLists.txt 2012-05-28 07:53:38 +0000 |
1044 | +++ src/servergrab/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1045 | @@ -11,4 +11,4 @@ |
1046 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1047 | ) |
1048 | |
1049 | -gtest_add_tests (compiz_test_servergrab "" ${CMAKE_CURRENT_SOURCE_DIR}/test-servergrab.cpp) |
1050 | +compiz_discover_tests (compiz_test_servergrab) |
1051 | |
1052 | === modified file 'src/string/tests/CMakeLists.txt' |
1053 | --- src/string/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
1054 | +++ src/string/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1055 | @@ -17,4 +17,4 @@ |
1056 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1057 | ) |
1058 | |
1059 | -gtest_add_tests( compiz_string_test "" ${CMAKE_CURRENT_SOURCE_DIR}/printf/src/test-string-printf.cpp ) |
1060 | +compiz_discover_tests (compiz_string_test) |
1061 | |
1062 | === modified file 'src/timer/tests/CMakeLists.txt' |
1063 | --- src/timer/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
1064 | +++ src/timer/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1065 | @@ -51,7 +51,7 @@ |
1066 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1067 | ) |
1068 | |
1069 | -gtest_add_tests (compiz_timer_callbacks "" ${CMAKE_CURRENT_SOURCE_DIR}/callbacks/src/test-timer-callbacks.cpp) |
1070 | -gtest_add_tests (compiz_timer_diffs "" ${CMAKE_CURRENT_SOURCE_DIR}/diffs/src/test-timer-diffs.cpp) |
1071 | -gtest_add_tests (compiz_timer_set-values "" ${CMAKE_CURRENT_SOURCE_DIR}/set-values/src/test-timer-set-values.cpp) |
1072 | -gtest_add_tests (compiz_timer_while-calling "" ${CMAKE_CURRENT_SOURCE_DIR}/while-calling/src/test-timer-set-times-while-calling.cpp) |
1073 | +compiz_discover_tests (compiz_timer_callbacks) |
1074 | +compiz_discover_tests (compiz_timer_diffs) |
1075 | +compiz_discover_tests (compiz_timer_set-values) |
1076 | +compiz_discover_tests (compiz_timer_while-calling) |
1077 | |
1078 | === modified file 'src/window/constrainment/tests/CMakeLists.txt' |
1079 | --- src/window/constrainment/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
1080 | +++ src/window/constrainment/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1081 | @@ -16,4 +16,4 @@ |
1082 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1083 | ) |
1084 | |
1085 | -gtest_add_tests ( compiz_test_window_constrainment_to_hints "" ${CMAKE_CURRENT_SOURCE_DIR}/to-hints/src/test-window-constrainment-to-hints.cpp) |
1086 | +compiz_discover_tests (compiz_test_window_constrainment_to_hints) |
1087 | |
1088 | === modified file 'src/window/extents/tests/CMakeLists.txt' |
1089 | --- src/window/extents/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
1090 | +++ src/window/extents/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1091 | @@ -15,4 +15,4 @@ |
1092 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1093 | ) |
1094 | |
1095 | -gtest_add_tests (compiz_test_window_extents_shift "" ${CMAKE_CURRENT_SOURCE_DIR}/shift/src/test-window-extents-shift.cpp) |
1096 | +compiz_discover_tests (compiz_test_window_extents_shift) |
1097 | |
1098 | === modified file 'src/window/geometry-saver/tests/CMakeLists.txt' |
1099 | --- src/window/geometry-saver/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
1100 | +++ src/window/geometry-saver/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1101 | @@ -15,4 +15,4 @@ |
1102 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1103 | ) |
1104 | |
1105 | -gtest_add_tests (compiz_test_window_geometry_saver "" ${CMAKE_CURRENT_SOURCE_DIR}/window-geometry-saver/src/test-window-geometry-saver.cpp) |
1106 | +compiz_discover_tests (compiz_test_window_geometry_saver) |
1107 | |
1108 | === modified file 'src/window/geometry/tests/CMakeLists.txt' |
1109 | --- src/window/geometry/tests/CMakeLists.txt 2012-03-30 16:30:13 +0000 |
1110 | +++ src/window/geometry/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1111 | @@ -15,4 +15,4 @@ |
1112 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1113 | ) |
1114 | |
1115 | -gtest_add_tests (compiz_test_window_geometry "" ${CMAKE_CURRENT_SOURCE_DIR}/window-geometry/src/test-window-geometry.cpp) |
1116 | +compiz_discover_tests (compiz_test_window_geometry) |
1117 | |
1118 | === modified file 'src/wrapsystem/tests/CMakeLists.txt' |
1119 | --- src/wrapsystem/tests/CMakeLists.txt 2012-05-21 08:58:41 +0000 |
1120 | +++ src/wrapsystem/tests/CMakeLists.txt 2012-07-05 08:22:43 +0000 |
1121 | @@ -15,4 +15,4 @@ |
1122 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1123 | ) |
1124 | |
1125 | -gtest_add_tests (${CMAKE_CURRENT_BINARY_DIR}/compiz_wrapsystem_test "" "test-wrapsystem.cpp") |
1126 | +compiz_discover_tests (compiz_wrapsystem_test) |
1127 | \ No newline at end of file |
It seems to work very nicely on intel. I have a couple of concerns though:
1. The glCopyPixels fallback works and is reliable. I would like to keep it unless there is a good reason not to. That way we don't raise the minimum system requirements unnecessarily.
2. We need a configuration option for people to be able to choose the old rendering method. There is a significant performance hit in (unthrottled) benchmark results with this change. So people need to have the option of going back to regional updates.