Merge lp:~afrantzis/mir/texture-bindable-over-native-buffer-base into lp:mir
- texture-bindable-over-native-buffer-base
- Merge into development-branch
Status: | Merged |
---|---|
Approved by: | Cemil Azizoglu |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2911 |
Proposed branch: | lp:~afrantzis/mir/texture-bindable-over-native-buffer-base |
Merge into: | lp:mir |
Prerequisite: | lp:~afrantzis/mir/update-mirplatform-abi-standalone |
Diff against target: |
942 lines (+312/-56) 33 files modified
examples/CMakeLists.txt (+2/-0) examples/buffer_render_target.cpp (+7/-1) examples/server_example_adorning_compositor.cpp (+12/-1) include/platform/mir/graphics/buffer.h (+0/-1) src/platform/symbols.map (+0/-1) src/platforms/CMakeLists.txt (+1/-0) src/platforms/android/server/buffer.h (+3/-1) src/platforms/mesa/server/common/gbm_buffer.h (+3/-1) src/platforms/mesa/server/common/shm_buffer.h (+3/-1) src/renderers/gl/include/mir/renderer/gl/texture_source.h (+46/-0) src/server/compositor/CMakeLists.txt (+4/-0) src/server/compositor/recently_used_cache.cpp (+11/-1) src/server/compositor/screencast_display_buffer.cpp (+8/-2) src/server/compositor/screencast_display_buffer.h (+2/-0) src/server/compositor/temporary_buffers.cpp (+0/-5) src/server/compositor/temporary_buffers.h (+0/-1) src/server/scene/CMakeLists.txt (+4/-0) src/server/scene/gl_pixel_buffer.cpp (+7/-1) tests/CMakeLists.txt (+1/-0) tests/include/mir/test/doubles/mock_buffer.h (+0/-1) tests/include/mir/test/doubles/mock_gl_buffer.h (+45/-0) tests/include/mir/test/doubles/stub_buffer.h (+0/-1) tests/include/mir/test/doubles/stub_gl_buffer.h (+45/-0) tests/include/mir/test/doubles/stub_gl_buffer_allocator.h (+45/-0) tests/integration-tests/graphics/mesa/test_buffer_integration.cpp (+12/-3) tests/integration-tests/test_session.cpp (+21/-1) tests/unit-tests/compositor/test_compositing_screencast.cpp (+6/-6) tests/unit-tests/compositor/test_gl_renderer.cpp (+3/-3) tests/unit-tests/compositor/test_gl_texture_cache.cpp (+4/-3) tests/unit-tests/compositor/test_screencast_display_buffer.cpp (+8/-8) tests/unit-tests/compositor/test_temporary_buffers.cpp (+0/-9) tests/unit-tests/graphics/mesa/kms/test_gbm_buffer.cpp (+7/-2) tests/unit-tests/scene/test_gl_pixel_buffer.cpp (+2/-2) |
To merge this branch: | bzr merge lp:~afrantzis/mir/texture-bindable-over-native-buffer-base |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cemil Azizoglu (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Kevin DuBois (community) | Approve | ||
Alan Griffiths | Abstain | ||
Review via email: mp+269739@code.launchpad.net |
Commit message
platform: Move gl_bind_to_texture method from Buffer to mir::renderer:
Description of the change
platform: Move gl_bind_to_texture method from Buffer to mir::renderer:
This MP makes the Buffer class agnostic of rendering technology, by moving the gl_bind_to_buffer() method to a renderer specific interface (TextureBindable). This interface is implemented by the native buffer types and accessed by components that need it by dynamically casting Buffer:
The definition of TextureBindable will eventually be made public (e.g. shipped in a mir-renderer-gl-dev package), so I have made it accessible from most of the non-core codebase (tests and examples). The core (libmirserver), however, should not be aware of the rendering-specific technologies, so I've tried to limit exposure to TextureBindable only to parts that currently need it (e.g. scene, compositor). These components will be eventually cleaned to remove this dependency.
Next steps involve isolating the GL dependencies from our core, so they can be moved into a different shared object (i.e. plugin).
PS Jenkins bot (ps-jenkins) wrote : | # |
Alexandros Frantzis (afrantzis) wrote : | # |
Failure is caused problem in parent branch, which has now been fixed. Rebuilding.
Alexandros Frantzis (afrantzis) wrote : | # |
@Cemil
> 1) src/renderers/
> Do we need both 'gl's in the path?
Yes, so that files can '#include <mir/renderer/
> 2) Have you built and tested with mesa-x11 as the first platform on the list?
Yes, works fine.
@Alan
> I'd be happier with putting the header under include and making it public than
> having this "temporary" solution.
The header placement is not a temporary solution, only the dependency of core components on the gl renderer is temporary.
The reason I've kept the header inside src/renderers/gl is because I want to treat the renderers in src/renderers/* as independent/
You could argue that placing the header in, e.g., include/
[1] For example see src/platforms/
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2901
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alan Griffiths (alan-griffiths) wrote : | # |
> You could argue that placing the header in, e.g.,
> include/
> structure, and I agree, but that's also what I want to avoid in order to
> stress the independence of the renderers and their renderer-specific public
> headers from the rest of the project.
I so argue.
> [1] For example see src/platforms/
> specific client headers shipped in mir-client-
I don't like that either. Burying "public" header files under ./src is confusing.
Abstaining because there's a precedent for this approach.
Kevin DuBois (kdub) wrote : | # |
224 +class TextureBindable
seems like its just a Texture
LGTM otherwise, needs-info/
Alexandros Frantzis (afrantzis) wrote : | # |
> 224 +class TextureBindable
> seems like its just a Texture
I don't know... Texture:
Texture:
Another alternative TextureSource:
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2901
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
Test failures are (seemingly) unrelated:
https:/
https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2901
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kevin DuBois (kdub) wrote : | # |
> > 224 +class TextureBindable
> > seems like its just a Texture
>
> I don't know... Texture:
> a texture why do we need to bind to one?
>
> Texture:
> is a generic Texture entity (the object) and a separate but related entity "gl
> texture" that the Texture object can be bound to.
>
> Another alternative TextureSource:
I like TextureSource (or TextureContent) better than TextureBindable. (pre-approve)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:2902
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
> > Another alternative TextureSource:
>
> I like TextureSource (or TextureContent) better than TextureBindable. (pre-approve)
Renamed to TextureSource.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:2902
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'examples/CMakeLists.txt' |
2 | --- examples/CMakeLists.txt 2015-08-12 09:52:57 +0000 |
3 | +++ examples/CMakeLists.txt 2015-09-04 06:51:35 +0000 |
4 | @@ -3,6 +3,7 @@ |
5 | buffer_render_target.cpp |
6 | image_renderer.cpp |
7 | ) |
8 | + |
9 | target_link_libraries(mir_demo_standalone_render_surfaces |
10 | mirserver |
11 | exampleserverconfig |
12 | @@ -168,6 +169,7 @@ |
13 | ${PROJECT_SOURCE_DIR}/include/server |
14 | ${PROJECT_SOURCE_DIR}/include/client |
15 | ${PROJECT_SOURCE_DIR}/include/platform |
16 | + ${PROJECT_SOURCE_DIR}/src/renderers/gl/include |
17 | ${GLESv2_INCLUDE_DIRS} |
18 | ) |
19 | |
20 | |
21 | === modified file 'examples/buffer_render_target.cpp' |
22 | --- examples/buffer_render_target.cpp 2015-02-22 07:46:25 +0000 |
23 | +++ examples/buffer_render_target.cpp 2015-09-04 06:51:35 +0000 |
24 | @@ -18,6 +18,7 @@ |
25 | |
26 | #include "buffer_render_target.h" |
27 | #include "mir/graphics/buffer.h" |
28 | +#include "mir/renderer/gl/texture_source.h" |
29 | |
30 | #include <GLES2/gl2ext.h> |
31 | #include <stdexcept> |
32 | @@ -71,13 +72,18 @@ |
33 | |
34 | if (fbo == 0) |
35 | { |
36 | + auto const texture_source = |
37 | + dynamic_cast<mir::renderer::gl::TextureSource*>(buffer.native_buffer_base()); |
38 | + if (!texture_source) |
39 | + throw std::logic_error("Buffer does not support GL rendering"); |
40 | + |
41 | glGenFramebuffers(1, &fbo); |
42 | glBindFramebuffer(GL_FRAMEBUFFER, fbo); |
43 | |
44 | /* Set up color buffer... */ |
45 | glGenTextures(1, &color_tex); |
46 | glBindTexture(GL_TEXTURE_2D, color_tex); |
47 | - buffer.gl_bind_to_texture(); |
48 | + texture_source->gl_bind_to_texture(); |
49 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
50 | GL_TEXTURE_2D, color_tex, 0); |
51 | |
52 | |
53 | === modified file 'examples/server_example_adorning_compositor.cpp' |
54 | --- examples/server_example_adorning_compositor.cpp 2015-04-07 13:19:22 +0000 |
55 | +++ examples/server_example_adorning_compositor.cpp 2015-09-04 06:51:35 +0000 |
56 | @@ -20,6 +20,11 @@ |
57 | #include "mir/graphics/display_buffer.h" |
58 | #include "mir/graphics/buffer.h" |
59 | #include "mir/compositor/scene_element.h" |
60 | +#include "mir/renderer/gl/texture_source.h" |
61 | + |
62 | +#include <stdexcept> |
63 | +#include <boost/throw_exception.hpp> |
64 | + |
65 | #include <GLES2/gl2.h> |
66 | |
67 | namespace me = mir::examples; |
68 | @@ -150,7 +155,13 @@ |
69 | |
70 | glActiveTexture(GL_TEXTURE0); |
71 | glBindTexture(GL_TEXTURE_2D, texture); |
72 | - renderable->buffer()->gl_bind_to_texture(); |
73 | + |
74 | + auto const texture_source = |
75 | + dynamic_cast<mir::renderer::gl::TextureSource*>( |
76 | + renderable->buffer()->native_buffer_base()); |
77 | + if (!texture_source) |
78 | + BOOST_THROW_EXCEPTION(std::logic_error("Buffer does not support GL rendering")); |
79 | + texture_source->gl_bind_to_texture(); |
80 | |
81 | glEnableVertexAttribArray(vPositionAttr); |
82 | glEnableVertexAttribArray(uvCoord); |
83 | |
84 | === modified file 'include/platform/mir/graphics/buffer.h' |
85 | --- include/platform/mir/graphics/buffer.h 2015-08-27 13:41:02 +0000 |
86 | +++ include/platform/mir/graphics/buffer.h 2015-09-04 06:51:35 +0000 |
87 | @@ -51,7 +51,6 @@ |
88 | virtual geometry::Size size() const = 0; |
89 | virtual geometry::Stride stride() const = 0; |
90 | virtual MirPixelFormat pixel_format() const = 0; |
91 | - virtual void gl_bind_to_texture() = 0; |
92 | //FIXME: correct mg::Buffer::write, it requires that the user does too much to use it correctly, |
93 | // (ie, it forces them to figure out what size is proper, alloc a buffer, fill it, and then |
94 | // copy the data into the buffer) |
95 | |
96 | === modified file 'src/platform/symbols.map' |
97 | --- src/platform/symbols.map 2015-09-04 06:51:35 +0000 |
98 | +++ src/platform/symbols.map 2015-09-04 06:51:35 +0000 |
99 | @@ -5,7 +5,6 @@ |
100 | # ../tools/process_doxygen_xml.py doc/xml/*.xml | grep "^mirplatform public" | sed "s/mirplatform public: / /" | sort |
101 | mir::graphics::BufferBasic::BufferBasic*; |
102 | mir::graphics::Buffer::Buffer*; |
103 | - mir::graphics::Buffer::gl_bind_to_texture*; |
104 | mir::graphics::Buffer::id*; |
105 | mir::graphics::Buffer::native_buffer_base*; |
106 | mir::graphics::Buffer::native_buffer_handle*; |
107 | |
108 | === modified file 'src/platforms/CMakeLists.txt' |
109 | --- src/platforms/CMakeLists.txt 2015-09-04 06:51:35 +0000 |
110 | +++ src/platforms/CMakeLists.txt 2015-09-04 06:51:35 +0000 |
111 | @@ -27,6 +27,7 @@ |
112 | |
113 | set(server_common_include_dirs |
114 | ${PROJECT_SOURCE_DIR}/include/platform |
115 | + ${PROJECT_SOURCE_DIR}/src/renderers/gl/include |
116 | ) |
117 | |
118 | # TODO platform implementations shouldn't depend on private APIs |
119 | |
120 | === modified file 'src/platforms/android/server/buffer.h' |
121 | --- src/platforms/android/server/buffer.h 2015-08-27 13:41:02 +0000 |
122 | +++ src/platforms/android/server/buffer.h 2015-09-04 06:51:35 +0000 |
123 | @@ -21,6 +21,7 @@ |
124 | #define MIR_GRAPHICS_ANDROID_BUFFER_H_ |
125 | |
126 | #include "mir/graphics/buffer_basic.h" |
127 | +#include "mir/renderer/gl/texture_source.h" |
128 | #include "buffer_usage.h" |
129 | |
130 | #include <hardware/gralloc.h> |
131 | @@ -42,7 +43,8 @@ |
132 | namespace android |
133 | { |
134 | |
135 | -class Buffer: public BufferBasic, public NativeBufferBase |
136 | +class Buffer: public BufferBasic, public NativeBufferBase, |
137 | + public renderer::gl::TextureSource |
138 | { |
139 | public: |
140 | Buffer(gralloc_module_t const* hw_module, |
141 | |
142 | === modified file 'src/platforms/mesa/server/common/gbm_buffer.h' |
143 | --- src/platforms/mesa/server/common/gbm_buffer.h 2015-08-27 13:41:02 +0000 |
144 | +++ src/platforms/mesa/server/common/gbm_buffer.h 2015-09-04 06:51:35 +0000 |
145 | @@ -21,6 +21,7 @@ |
146 | #define MIR_GRAPHICS_MESA_GBM_BUFFER_H_ |
147 | |
148 | #include "mir/graphics/buffer_basic.h" |
149 | +#include "mir/renderer/gl/texture_source.h" |
150 | |
151 | #include <gbm.h> |
152 | |
153 | @@ -45,7 +46,8 @@ |
154 | |
155 | class BufferTextureBinder; |
156 | |
157 | -class GBMBuffer: public BufferBasic, public NativeBufferBase |
158 | +class GBMBuffer: public BufferBasic, public NativeBufferBase, |
159 | + public renderer::gl::TextureSource |
160 | { |
161 | public: |
162 | GBMBuffer(std::shared_ptr<gbm_bo> const& handle, |
163 | |
164 | === modified file 'src/platforms/mesa/server/common/shm_buffer.h' |
165 | --- src/platforms/mesa/server/common/shm_buffer.h 2015-08-27 13:41:02 +0000 |
166 | +++ src/platforms/mesa/server/common/shm_buffer.h 2015-09-04 06:51:35 +0000 |
167 | @@ -24,6 +24,7 @@ |
168 | #include "mir/geometry/dimensions.h" |
169 | #include "mir/geometry/size.h" |
170 | #include "mir_toolkit/common.h" |
171 | +#include "mir/renderer/gl/texture_source.h" |
172 | |
173 | namespace mir |
174 | { |
175 | @@ -34,7 +35,8 @@ |
176 | |
177 | class ShmFile; |
178 | |
179 | -class ShmBuffer : public BufferBasic, public NativeBufferBase |
180 | +class ShmBuffer : public BufferBasic, public NativeBufferBase, |
181 | + public renderer::gl::TextureSource |
182 | { |
183 | public: |
184 | static bool supports(MirPixelFormat); |
185 | |
186 | === added directory 'src/renderers' |
187 | === added directory 'src/renderers/gl' |
188 | === added directory 'src/renderers/gl/include' |
189 | === added directory 'src/renderers/gl/include/mir' |
190 | === added directory 'src/renderers/gl/include/mir/renderer' |
191 | === added directory 'src/renderers/gl/include/mir/renderer/gl' |
192 | === added file 'src/renderers/gl/include/mir/renderer/gl/texture_source.h' |
193 | --- src/renderers/gl/include/mir/renderer/gl/texture_source.h 1970-01-01 00:00:00 +0000 |
194 | +++ src/renderers/gl/include/mir/renderer/gl/texture_source.h 2015-09-04 06:51:35 +0000 |
195 | @@ -0,0 +1,46 @@ |
196 | +/* |
197 | + * Copyright © 2015 Canonical Ltd. |
198 | + * |
199 | + * This program is free software: you can redistribute it and/or modify it |
200 | + * under the terms of the GNU Lesser General Public License version 3, |
201 | + * as published by the Free Software Foundation. |
202 | + * |
203 | + * This program is distributed in the hope that it will be useful, |
204 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
205 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
206 | + * GNU Lesser General Public License for more details. |
207 | + * |
208 | + * You should have received a copy of the GNU Lesser General Public License |
209 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
210 | + * |
211 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
212 | + */ |
213 | + |
214 | +#ifndef MIR_RENDERER_GL_TEXTURE_SOURCE_H_ |
215 | +#define MIR_RENDERER_GL_TEXTURE_SOURCE_H_ |
216 | + |
217 | +namespace mir |
218 | +{ |
219 | +namespace renderer |
220 | +{ |
221 | +namespace gl |
222 | +{ |
223 | + |
224 | +class TextureSource |
225 | +{ |
226 | +public: |
227 | + virtual ~TextureSource() = default; |
228 | + |
229 | + virtual void gl_bind_to_texture() = 0; |
230 | + |
231 | +protected: |
232 | + TextureSource() = default; |
233 | + TextureSource(TextureSource const&) = delete; |
234 | + TextureSource& operator=(TextureSource const&) = delete; |
235 | +}; |
236 | + |
237 | +} |
238 | +} |
239 | +} |
240 | + |
241 | +#endif |
242 | |
243 | === modified file 'src/server/compositor/CMakeLists.txt' |
244 | --- src/server/compositor/CMakeLists.txt 2015-08-10 07:14:58 +0000 |
245 | +++ src/server/compositor/CMakeLists.txt 2015-09-04 06:51:35 +0000 |
246 | @@ -1,3 +1,7 @@ |
247 | +include_directories( |
248 | + ${PROJECT_SOURCE_DIR}/src/renderers/gl/include |
249 | +) |
250 | + |
251 | set( |
252 | MIR_COMPOSITOR_SRCS |
253 | |
254 | |
255 | === modified file 'src/server/compositor/recently_used_cache.cpp' |
256 | --- src/server/compositor/recently_used_cache.cpp 2015-06-17 05:20:42 +0000 |
257 | +++ src/server/compositor/recently_used_cache.cpp 2015-09-04 06:51:35 +0000 |
258 | @@ -19,6 +19,10 @@ |
259 | |
260 | #include "mir/compositor/recently_used_cache.h" |
261 | #include "mir/graphics/buffer.h" |
262 | +#include "mir/renderer/gl/texture_source.h" |
263 | + |
264 | +#include <stdexcept> |
265 | +#include <boost/throw_exception.hpp> |
266 | |
267 | namespace mg = mir::graphics; |
268 | namespace mc = mir::compositor; |
269 | @@ -33,7 +37,13 @@ |
270 | |
271 | if ((texture.last_bound_buffer != buffer_id) || (!texture.valid_binding)) |
272 | { |
273 | - buffer->gl_bind_to_texture(); |
274 | + auto const texture_source = |
275 | + dynamic_cast<mir::renderer::gl::TextureSource*>( |
276 | + buffer->native_buffer_base()); |
277 | + if (!texture_source) |
278 | + BOOST_THROW_EXCEPTION(std::logic_error("Buffer does not support GL rendering")); |
279 | + |
280 | + texture_source->gl_bind_to_texture(); |
281 | texture.resource = buffer; |
282 | texture.last_bound_buffer = buffer_id; |
283 | } |
284 | |
285 | === modified file 'src/server/compositor/screencast_display_buffer.cpp' |
286 | --- src/server/compositor/screencast_display_buffer.cpp 2015-06-24 08:17:02 +0000 |
287 | +++ src/server/compositor/screencast_display_buffer.cpp 2015-09-04 06:51:35 +0000 |
288 | @@ -28,8 +28,14 @@ |
289 | mc::ScreencastDisplayBuffer::ScreencastDisplayBuffer( |
290 | geom::Rectangle const& rect, |
291 | mg::Buffer& buffer) |
292 | - : rect(rect), buffer(buffer), old_fbo(), old_viewport() |
293 | + : rect(rect), buffer(buffer), |
294 | + texture_source( |
295 | + dynamic_cast<mir::renderer::gl::TextureSource*>( |
296 | + buffer.native_buffer_base())), |
297 | + old_fbo(), old_viewport() |
298 | { |
299 | + if (!texture_source) |
300 | + BOOST_THROW_EXCEPTION(std::logic_error("Buffer does not support GL rendering")); |
301 | glGetIntegerv(GL_VIEWPORT, old_viewport); |
302 | glGetIntegerv(GL_FRAMEBUFFER_BINDING, &old_fbo); |
303 | |
304 | @@ -68,7 +74,7 @@ |
305 | void mc::ScreencastDisplayBuffer::make_current() |
306 | { |
307 | glBindTexture(GL_TEXTURE_2D, color_tex); |
308 | - buffer.gl_bind_to_texture(); |
309 | + texture_source->gl_bind_to_texture(); |
310 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
311 | GL_TEXTURE_2D, color_tex, 0); |
312 | |
313 | |
314 | === modified file 'src/server/compositor/screencast_display_buffer.h' |
315 | --- src/server/compositor/screencast_display_buffer.h 2015-06-24 08:17:02 +0000 |
316 | +++ src/server/compositor/screencast_display_buffer.h 2015-09-04 06:51:35 +0000 |
317 | @@ -20,6 +20,7 @@ |
318 | #define MIR_COMPOSITOR_SCREENCAST_DISPLAY_BUFFER_H_ |
319 | |
320 | #include "mir/graphics/display_buffer.h" |
321 | +#include "mir/renderer/gl/texture_source.h" |
322 | |
323 | #include <GLES2/gl2.h> |
324 | |
325 | @@ -68,6 +69,7 @@ |
326 | private: |
327 | geometry::Rectangle const rect; |
328 | graphics::Buffer& buffer; |
329 | + renderer::gl::TextureSource* texture_source; |
330 | GLint old_fbo; |
331 | GLint old_viewport[4]; |
332 | detail::GLResource<glGenTextures,glDeleteTextures> const color_tex; |
333 | |
334 | === modified file 'src/server/compositor/temporary_buffers.cpp' |
335 | --- src/server/compositor/temporary_buffers.cpp 2015-08-27 13:41:02 +0000 |
336 | +++ src/server/compositor/temporary_buffers.cpp 2015-09-04 06:51:35 +0000 |
337 | @@ -75,11 +75,6 @@ |
338 | return buffer->id(); |
339 | } |
340 | |
341 | -void mc::TemporaryBuffer::gl_bind_to_texture() |
342 | -{ |
343 | - buffer->gl_bind_to_texture(); |
344 | -} |
345 | - |
346 | std::shared_ptr<mg::NativeBuffer> mc::TemporaryBuffer::native_buffer_handle() const |
347 | { |
348 | return buffer->native_buffer_handle(); |
349 | |
350 | === modified file 'src/server/compositor/temporary_buffers.h' |
351 | --- src/server/compositor/temporary_buffers.h 2015-08-27 13:41:02 +0000 |
352 | +++ src/server/compositor/temporary_buffers.h 2015-09-04 06:51:35 +0000 |
353 | @@ -39,7 +39,6 @@ |
354 | geometry::Stride stride() const override; |
355 | MirPixelFormat pixel_format() const override; |
356 | mg::BufferID id() const override; |
357 | - void gl_bind_to_texture() override; |
358 | std::shared_ptr<mg::NativeBuffer> native_buffer_handle() const override; |
359 | void write (unsigned char const* data, size_t size) override; |
360 | void read (std::function<void(unsigned char const*)> const& do_with_pixels) override; |
361 | |
362 | === modified file 'src/server/scene/CMakeLists.txt' |
363 | --- src/server/scene/CMakeLists.txt 2015-06-18 04:38:28 +0000 |
364 | +++ src/server/scene/CMakeLists.txt 2015-09-04 06:51:35 +0000 |
365 | @@ -1,3 +1,7 @@ |
366 | +include_directories( |
367 | + ${PROJECT_SOURCE_DIR}/src/renderers/gl/include |
368 | +) |
369 | + |
370 | ADD_LIBRARY( |
371 | mirscene OBJECT |
372 | |
373 | |
374 | === modified file 'src/server/scene/gl_pixel_buffer.cpp' |
375 | --- src/server/scene/gl_pixel_buffer.cpp 2015-02-22 07:46:25 +0000 |
376 | +++ src/server/scene/gl_pixel_buffer.cpp 2015-09-04 06:51:35 +0000 |
377 | @@ -19,6 +19,7 @@ |
378 | #include "gl_pixel_buffer.h" |
379 | #include "mir/graphics/gl_context.h" |
380 | #include "mir/graphics/buffer.h" |
381 | +#include "mir/renderer/gl/texture_source.h" |
382 | |
383 | #include <stdexcept> |
384 | #include <boost/throw_exception.hpp> |
385 | @@ -103,7 +104,12 @@ |
386 | |
387 | prepare(); |
388 | |
389 | - buffer.gl_bind_to_texture(); |
390 | + auto const texture_source = |
391 | + dynamic_cast<mir::renderer::gl::TextureSource*>( |
392 | + buffer.native_buffer_base()); |
393 | + if (!texture_source) |
394 | + BOOST_THROW_EXCEPTION(std::logic_error("Buffer does not support GL rendering")); |
395 | + texture_source->gl_bind_to_texture(); |
396 | |
397 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0); |
398 | |
399 | |
400 | === modified file 'tests/CMakeLists.txt' |
401 | --- tests/CMakeLists.txt 2015-07-27 07:24:50 +0000 |
402 | +++ tests/CMakeLists.txt 2015-09-04 06:51:35 +0000 |
403 | @@ -54,6 +54,7 @@ |
404 | ${PROJECT_SOURCE_DIR}/include/client |
405 | ${PROJECT_SOURCE_DIR}/include/common |
406 | ${PROJECT_SOURCE_DIR}/include/test |
407 | + ${PROJECT_SOURCE_DIR}/src/renderers/gl/include |
408 | ) |
409 | |
410 | option(MIR_BUILD_ACCEPTANCE_TESTS "Build acceptance tests" ON) |
411 | |
412 | === modified file 'tests/include/mir/test/doubles/mock_buffer.h' |
413 | --- tests/include/mir/test/doubles/mock_buffer.h 2015-08-27 13:41:02 +0000 |
414 | +++ tests/include/mir/test/doubles/mock_buffer.h 2015-09-04 06:51:35 +0000 |
415 | @@ -67,7 +67,6 @@ |
416 | MOCK_CONST_METHOD0(pixel_format, MirPixelFormat()); |
417 | MOCK_CONST_METHOD0(native_buffer_handle, std::shared_ptr<graphics::NativeBuffer>()); |
418 | |
419 | - MOCK_METHOD0(gl_bind_to_texture, void()); |
420 | MOCK_CONST_METHOD0(id, graphics::BufferID()); |
421 | |
422 | MOCK_METHOD2(write, void(unsigned char const*, size_t)); |
423 | |
424 | === added file 'tests/include/mir/test/doubles/mock_gl_buffer.h' |
425 | --- tests/include/mir/test/doubles/mock_gl_buffer.h 1970-01-01 00:00:00 +0000 |
426 | +++ tests/include/mir/test/doubles/mock_gl_buffer.h 2015-09-04 06:51:35 +0000 |
427 | @@ -0,0 +1,45 @@ |
428 | +/* |
429 | + * Copyright © 2015 Canonical Ltd. |
430 | + * |
431 | + * This program is free software: you can redistribute it and/or modify it |
432 | + * under the terms of the GNU General Public License version 3, |
433 | + * as published by the Free Software Foundation. |
434 | + * |
435 | + * This program is distributed in the hope that it will be useful, |
436 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
437 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
438 | + * GNU General Public License for more details. |
439 | + * |
440 | + * You should have received a copy of the GNU General Public License |
441 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
442 | + * |
443 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
444 | + */ |
445 | + |
446 | +#ifndef MIR_TEST_DOUBLES_MOCK_GL_BUFFER_H_ |
447 | +#define MIR_TEST_DOUBLES_MOCK_GL_BUFFER_H_ |
448 | + |
449 | +#include "mock_buffer.h" |
450 | +#include "mir/renderer/gl/texture_source.h" |
451 | + |
452 | +namespace mir |
453 | +{ |
454 | +namespace test |
455 | +{ |
456 | +namespace doubles |
457 | +{ |
458 | + |
459 | +struct MockGLBuffer : public MockBuffer, |
460 | + public renderer::gl::TextureSource |
461 | +{ |
462 | + public: |
463 | + using MockBuffer::MockBuffer; |
464 | + |
465 | + MOCK_METHOD0(gl_bind_to_texture, void()); |
466 | +}; |
467 | + |
468 | +} |
469 | +} |
470 | +} |
471 | + |
472 | +#endif |
473 | |
474 | === modified file 'tests/include/mir/test/doubles/stub_buffer.h' |
475 | --- tests/include/mir/test/doubles/stub_buffer.h 2015-08-27 13:41:02 +0000 |
476 | +++ tests/include/mir/test/doubles/stub_buffer.h 2015-09-04 06:51:35 +0000 |
477 | @@ -99,7 +99,6 @@ |
478 | virtual MirPixelFormat pixel_format() const override { return buf_pixel_format; } |
479 | |
480 | virtual std::shared_ptr<graphics::NativeBuffer> native_buffer_handle() const override { return native_buffer; } |
481 | - virtual void gl_bind_to_texture() override {} |
482 | |
483 | void write(unsigned char const* pixels, size_t len) override |
484 | { |
485 | |
486 | === added file 'tests/include/mir/test/doubles/stub_gl_buffer.h' |
487 | --- tests/include/mir/test/doubles/stub_gl_buffer.h 1970-01-01 00:00:00 +0000 |
488 | +++ tests/include/mir/test/doubles/stub_gl_buffer.h 2015-09-04 06:51:35 +0000 |
489 | @@ -0,0 +1,45 @@ |
490 | +/* |
491 | + * Copyright © 2015 Canonical Ltd. |
492 | + * |
493 | + * This program is free software: you can redistribute it and/or modify it |
494 | + * under the terms of the GNU General Public License version 3, |
495 | + * as published by the Free Software Foundation. |
496 | + * |
497 | + * This program is distributed in the hope that it will be useful, |
498 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
499 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
500 | + * GNU General Public License for more details. |
501 | + * |
502 | + * You should have received a copy of the GNU General Public License |
503 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
504 | + * |
505 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
506 | + */ |
507 | + |
508 | +#ifndef MIR_TEST_DOUBLES_STUB_GL_BUFFER_H_ |
509 | +#define MIR_TEST_DOUBLES_STUB_GL_BUFFER_H_ |
510 | + |
511 | +#include "stub_buffer.h" |
512 | +#include "mir/renderer/gl/texture_source.h" |
513 | + |
514 | +namespace mir |
515 | +{ |
516 | +namespace test |
517 | +{ |
518 | +namespace doubles |
519 | +{ |
520 | + |
521 | +class StubGLBuffer : public StubBuffer, |
522 | + public renderer::gl::TextureSource |
523 | +{ |
524 | +public: |
525 | + using StubBuffer::StubBuffer; |
526 | + |
527 | + void gl_bind_to_texture() {} |
528 | +}; |
529 | + |
530 | +} |
531 | +} |
532 | +} |
533 | + |
534 | +#endif |
535 | |
536 | === added file 'tests/include/mir/test/doubles/stub_gl_buffer_allocator.h' |
537 | --- tests/include/mir/test/doubles/stub_gl_buffer_allocator.h 1970-01-01 00:00:00 +0000 |
538 | +++ tests/include/mir/test/doubles/stub_gl_buffer_allocator.h 2015-09-04 06:51:35 +0000 |
539 | @@ -0,0 +1,45 @@ |
540 | +/* |
541 | + * Copyright © 2015 Canonical Ltd. |
542 | + * |
543 | + * This program is free software: you can redistribute it and/or modify it |
544 | + * under the terms of the GNU General Public License version 3, |
545 | + * as published by the Free Software Foundation. |
546 | + * |
547 | + * This program is distributed in the hope that it will be useful, |
548 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
549 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
550 | + * GNU General Public License for more details. |
551 | + * |
552 | + * You should have received a copy of the GNU General Public License |
553 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
554 | + * |
555 | + * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com> |
556 | + */ |
557 | + |
558 | +#ifndef MIR_TEST_DOUBLES_STUB_GL_BUFFER_ALLOCATOR_H_ |
559 | +#define MIR_TEST_DOUBLES_STUB_GL_BUFFER_ALLOCATOR_H_ |
560 | + |
561 | +#include "stub_buffer_allocator.h" |
562 | +#include "stub_gl_buffer.h" |
563 | + |
564 | +namespace mir |
565 | +{ |
566 | +namespace test |
567 | +{ |
568 | +namespace doubles |
569 | +{ |
570 | + |
571 | +struct StubGLBufferAllocator : public StubBufferAllocator |
572 | +{ |
573 | + std::shared_ptr<graphics::Buffer> alloc_buffer( |
574 | + graphics::BufferProperties const& properties) override |
575 | + { |
576 | + return std::make_shared<StubGLBuffer>(properties); |
577 | + } |
578 | +}; |
579 | + |
580 | +} |
581 | +} |
582 | +} |
583 | + |
584 | +#endif |
585 | |
586 | === modified file 'tests/integration-tests/graphics/mesa/test_buffer_integration.cpp' |
587 | --- tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2015-06-25 13:43:43 +0000 |
588 | +++ tests/integration-tests/graphics/mesa/test_buffer_integration.cpp 2015-09-04 06:51:35 +0000 |
589 | @@ -28,6 +28,7 @@ |
590 | #include "mir/test/doubles/stub_gl_program_factory.h" |
591 | #include "mir/test/doubles/null_emergency_cleanup.h" |
592 | #include "mir/graphics/default_display_configuration_policy.h" |
593 | +#include "mir/renderer/gl/texture_source.h" |
594 | #include "src/server/report/null_report_factory.h" |
595 | |
596 | #include "mir_test_framework/testing_server_configuration.h" |
597 | @@ -46,7 +47,15 @@ |
598 | namespace mir |
599 | { |
600 | |
601 | -class StubBufferThread : public mtd::StubBuffer |
602 | +mir::renderer::gl::TextureSource* as_texture_source( |
603 | + std::shared_ptr<mg::Buffer> const& buffer) |
604 | +{ |
605 | + return dynamic_cast<mir::renderer::gl::TextureSource*>( |
606 | + buffer->native_buffer_base()); |
607 | +} |
608 | + |
609 | +class StubBufferThread : public mtd::StubBuffer, |
610 | + public mir::renderer::gl::TextureSource |
611 | { |
612 | public: |
613 | StubBufferThread() : |
614 | @@ -179,7 +188,7 @@ |
615 | |
616 | try |
617 | { |
618 | - buffer->gl_bind_to_texture(); |
619 | + as_texture_source(buffer)->gl_bind_to_texture(); |
620 | } |
621 | catch(std::runtime_error const&) |
622 | { |
623 | @@ -211,7 +220,7 @@ |
624 | |
625 | EXPECT_NO_THROW({ |
626 | auto buffer = allocator->alloc_buffer(buffer_properties); |
627 | - buffer->gl_bind_to_texture(); |
628 | + as_texture_source(buffer)->gl_bind_to_texture(); |
629 | ASSERT_EQ(EGL_SUCCESS, eglGetError()); |
630 | |
631 | BufferDestructorThread destructor{std::move(buffer)}; |
632 | |
633 | === modified file 'tests/integration-tests/test_session.cpp' |
634 | --- tests/integration-tests/test_session.cpp 2015-06-26 08:00:59 +0000 |
635 | +++ tests/integration-tests/test_session.cpp 2015-09-04 06:51:35 +0000 |
636 | @@ -30,6 +30,7 @@ |
637 | #include "mir/frontend/connector.h" |
638 | |
639 | #include "mir/test/doubles/stub_buffer_allocator.h" |
640 | +#include "mir/test/doubles/stub_gl_buffer.h" |
641 | #include "mir/test/doubles/stub_buffer_stream_factory.h" |
642 | #include "mir/test/doubles/stub_display.h" |
643 | #include "mir/test/doubles/null_event_sink.h" |
644 | @@ -86,6 +87,25 @@ |
645 | cv.wait(lock, [&]{ return done; }); |
646 | } |
647 | |
648 | +struct StubGLBufferStream : public mtd::StubBufferStream |
649 | +{ |
650 | +public: |
651 | + StubGLBufferStream() |
652 | + { |
653 | + stub_compositor_buffer = std::make_shared<mtd::StubGLBuffer>(); |
654 | + } |
655 | +}; |
656 | + |
657 | +struct StubGLBufferStreamFactory : public mtd::StubBufferStreamFactory |
658 | +{ |
659 | + std::shared_ptr<mc::BufferStream> create_buffer_stream( |
660 | + mf::BufferStreamId, std::shared_ptr<mf::BufferSink> const&, |
661 | + mg::BufferProperties const&) override |
662 | + { |
663 | + return std::make_shared<StubGLBufferStream>(); |
664 | + } |
665 | +}; |
666 | + |
667 | } // anonymouse namespace |
668 | |
669 | TEST(ApplicationSession, stress_test_take_snapshot) |
670 | @@ -97,7 +117,7 @@ |
671 | ms::ApplicationSession session{ |
672 | conf.the_surface_coordinator(), |
673 | conf.the_surface_factory(), |
674 | - std::make_shared<mtd::StubBufferStreamFactory>(), |
675 | + std::make_shared<StubGLBufferStreamFactory>(), |
676 | __LINE__, |
677 | "stress", |
678 | conf.the_snapshot_strategy(), |
679 | |
680 | === modified file 'tests/unit-tests/compositor/test_compositing_screencast.cpp' |
681 | --- tests/unit-tests/compositor/test_compositing_screencast.cpp 2015-06-25 03:00:08 +0000 |
682 | +++ tests/unit-tests/compositor/test_compositing_screencast.cpp 2015-09-04 06:51:35 +0000 |
683 | @@ -27,7 +27,7 @@ |
684 | #include "mir/test/doubles/null_display.h" |
685 | #include "mir/test/doubles/null_display_buffer_compositor_factory.h" |
686 | #include "mir/test/doubles/stub_display_configuration.h" |
687 | -#include "mir/test/doubles/stub_buffer_allocator.h" |
688 | +#include "mir/test/doubles/stub_gl_buffer_allocator.h" |
689 | #include "mir/test/doubles/mock_buffer.h" |
690 | #include "mir/test/doubles/mock_gl.h" |
691 | #include "mir/test/doubles/stub_scene.h" |
692 | @@ -170,7 +170,7 @@ |
693 | testing::NiceMock<mtd::MockGL> mock_gl; |
694 | mtd::StubScene stub_scene; |
695 | StubDisplay stub_display; |
696 | - mtd::StubBufferAllocator stub_buffer_allocator; |
697 | + mtd::StubGLBufferAllocator stub_buffer_allocator; |
698 | mtd::NullDisplayBufferCompositorFactory stub_db_compositor_factory; |
699 | mc::CompositingScreencast screencast; |
700 | geom::Size const default_size; |
701 | @@ -250,7 +250,7 @@ |
702 | using namespace testing; |
703 | |
704 | MockBufferAllocator mock_buffer_allocator; |
705 | - mtd::StubBuffer stub_buffer; |
706 | + mtd::StubGLBuffer stub_buffer; |
707 | |
708 | InSequence s; |
709 | EXPECT_CALL(mock_buffer_allocator, |
710 | @@ -274,8 +274,8 @@ |
711 | using namespace testing; |
712 | |
713 | MockBufferAllocator mock_buffer_allocator; |
714 | - mtd::StubBuffer stub_buffer1; |
715 | - mtd::StubBuffer stub_buffer2; |
716 | + mtd::StubGLBuffer stub_buffer1; |
717 | + mtd::StubGLBuffer stub_buffer2; |
718 | |
719 | EXPECT_CALL(mock_buffer_allocator, alloc_buffer(_)) |
720 | .WillOnce(Return(mt::fake_shared(stub_buffer1))) |
721 | @@ -306,7 +306,7 @@ |
722 | NiceMock<mtd::MockScene> mock_scene; |
723 | NiceMock<MockBufferAllocator> mock_buffer_allocator; |
724 | ON_CALL(mock_buffer_allocator, alloc_buffer(_)) |
725 | - .WillByDefault(Return(std::make_shared<mtd::StubBuffer>())); |
726 | + .WillByDefault(Return(std::make_shared<mtd::StubGLBuffer>())); |
727 | |
728 | EXPECT_CALL(mock_scene, register_compositor(_)) |
729 | .Times(1); |
730 | |
731 | === modified file 'tests/unit-tests/compositor/test_gl_renderer.cpp' |
732 | --- tests/unit-tests/compositor/test_gl_renderer.cpp 2015-06-25 03:00:08 +0000 |
733 | +++ tests/unit-tests/compositor/test_gl_renderer.cpp 2015-09-04 06:51:35 +0000 |
734 | @@ -24,7 +24,7 @@ |
735 | #include <mir/graphics/gl_texture.h> |
736 | #include <mir/compositor/gl_renderer.h> |
737 | #include <mir/test/fake_shared.h> |
738 | -#include <mir/test/doubles/mock_buffer.h> |
739 | +#include <mir/test/doubles/mock_gl_buffer.h> |
740 | #include <mir/test/doubles/mock_renderable.h> |
741 | #include <mir/test/doubles/mock_buffer_stream.h> |
742 | #include <mir/compositor/buffer_stream.h> |
743 | @@ -114,7 +114,7 @@ |
744 | EXPECT_CALL(mock_gl, glDrawArrays(_, _, _)).Times(AnyNumber()); |
745 | EXPECT_CALL(mock_gl, glDisableVertexAttribArray(_)).Times(AnyNumber()); |
746 | |
747 | - mock_buffer = std::make_shared<mtd::MockBuffer>(); |
748 | + mock_buffer = std::make_shared<mtd::MockGLBuffer>(); |
749 | EXPECT_CALL(*mock_buffer, gl_bind_to_texture()).Times(AnyNumber()); |
750 | EXPECT_CALL(*mock_buffer, id()) |
751 | .WillRepeatedly(Return(mir::graphics::BufferID(789))); |
752 | @@ -144,7 +144,7 @@ |
753 | |
754 | testing::NiceMock<mtd::MockGL> mock_gl; |
755 | testing::NiceMock<mtd::MockEGL> mock_egl; |
756 | - std::shared_ptr<mtd::MockBuffer> mock_buffer; |
757 | + std::shared_ptr<mtd::MockGLBuffer> mock_buffer; |
758 | mir::geometry::Rectangle display_area; |
759 | std::shared_ptr<testing::NiceMock<mtd::MockRenderable>> renderable; |
760 | mg::RenderableList renderable_list; |
761 | |
762 | === modified file 'tests/unit-tests/compositor/test_gl_texture_cache.cpp' |
763 | --- tests/unit-tests/compositor/test_gl_texture_cache.cpp 2015-06-25 03:00:08 +0000 |
764 | +++ tests/unit-tests/compositor/test_gl_texture_cache.cpp 2015-09-04 06:51:35 +0000 |
765 | @@ -18,7 +18,7 @@ |
766 | */ |
767 | |
768 | #include "mir/compositor/recently_used_cache.h" |
769 | -#include "mir/test/doubles/mock_buffer.h" |
770 | +#include "mir/test/doubles/mock_gl_buffer.h" |
771 | #include "mir/test/doubles/mock_renderable.h" |
772 | #include "mir/test/doubles/mock_gl.h" |
773 | #include <gtest/gtest.h> |
774 | @@ -29,13 +29,14 @@ |
775 | |
776 | namespace |
777 | { |
778 | + |
779 | class RecentlyUsedCache : public testing::Test |
780 | { |
781 | public: |
782 | RecentlyUsedCache() |
783 | { |
784 | using namespace testing; |
785 | - mock_buffer = std::make_shared<NiceMock<mtd::MockBuffer>>(); |
786 | + mock_buffer = std::make_shared<NiceMock<mtd::MockGLBuffer>>(); |
787 | renderable = std::make_shared<NiceMock<mtd::MockRenderable>>(); |
788 | ON_CALL(*renderable, buffer()) |
789 | .WillByDefault(Return(mock_buffer)); |
790 | @@ -44,7 +45,7 @@ |
791 | } |
792 | |
793 | testing::NiceMock<mtd::MockGL> mock_gl; |
794 | - std::shared_ptr<mtd::MockBuffer> mock_buffer; |
795 | + std::shared_ptr<mtd::MockGLBuffer> mock_buffer; |
796 | std::shared_ptr<testing::NiceMock<mtd::MockRenderable>> renderable; |
797 | GLuint const stub_texture{1}; |
798 | }; |
799 | |
800 | === modified file 'tests/unit-tests/compositor/test_screencast_display_buffer.cpp' |
801 | --- tests/unit-tests/compositor/test_screencast_display_buffer.cpp 2015-06-25 03:00:08 +0000 |
802 | +++ tests/unit-tests/compositor/test_screencast_display_buffer.cpp 2015-09-04 06:51:35 +0000 |
803 | @@ -18,8 +18,8 @@ |
804 | |
805 | #include "src/server/compositor/screencast_display_buffer.h" |
806 | |
807 | -#include "mir/test/doubles/mock_buffer.h" |
808 | -#include "mir/test/doubles/stub_buffer.h" |
809 | +#include "mir/test/doubles/mock_gl_buffer.h" |
810 | +#include "mir/test/doubles/stub_gl_buffer.h" |
811 | #include "mir/test/doubles/mock_gl.h" |
812 | #include "mir/test/doubles/stub_renderable.h" |
813 | |
814 | @@ -60,7 +60,7 @@ |
815 | EXPECT_CALL(mock_gl, glDeleteFramebuffers(1,Pointee(framebuffer))); |
816 | |
817 | geom::Rectangle const rect{{100,100}, {800,600}}; |
818 | - mtd::StubBuffer stub_buffer; |
819 | + mtd::StubGLBuffer stub_buffer; |
820 | |
821 | mc::ScreencastDisplayBuffer db{rect, stub_buffer}; |
822 | } |
823 | @@ -87,7 +87,7 @@ |
824 | EXPECT_CALL(mock_gl, glDeleteFramebuffers(1,Pointee(framebuffer))); |
825 | |
826 | geom::Rectangle const rect{{100,100}, {800,600}}; |
827 | - mtd::StubBuffer stub_buffer; |
828 | + mtd::StubGLBuffer stub_buffer; |
829 | |
830 | EXPECT_THROW({ |
831 | mc::ScreencastDisplayBuffer db(rect, stub_buffer); |
832 | @@ -99,7 +99,7 @@ |
833 | using namespace testing; |
834 | |
835 | geom::Rectangle const rect{{100,100}, {800,600}}; |
836 | - testing::NiceMock<mtd::MockBuffer> mock_buffer{ |
837 | + testing::NiceMock<mtd::MockGLBuffer> mock_buffer{ |
838 | rect.size, geom::Stride{100}, mir_pixel_format_xbgr_8888}; |
839 | |
840 | /* Set the buffer as rendering target */ |
841 | @@ -116,7 +116,7 @@ |
842 | using namespace testing; |
843 | |
844 | geom::Rectangle const rect{{100,100}, {800,600}}; |
845 | - testing::NiceMock<mtd::MockBuffer> mock_buffer{ |
846 | + testing::NiceMock<mtd::MockGLBuffer> mock_buffer{ |
847 | rect.size, geom::Stride{100}, mir_pixel_format_xbgr_8888}; |
848 | |
849 | InSequence s; |
850 | @@ -138,7 +138,7 @@ |
851 | using namespace testing; |
852 | |
853 | geom::Rectangle const rect{{100,100}, {800,600}}; |
854 | - mtd::StubBuffer stub_buffer; |
855 | + mtd::StubGLBuffer stub_buffer; |
856 | |
857 | mc::ScreencastDisplayBuffer db{rect, stub_buffer}; |
858 | |
859 | @@ -151,7 +151,7 @@ |
860 | TEST_F(ScreencastDisplayBufferTest, rejects_attempt_to_optimize) |
861 | { |
862 | geom::Rectangle const rect{{100,100}, {800,600}}; |
863 | - mtd::StubBuffer stub_buffer; |
864 | + mtd::StubGLBuffer stub_buffer; |
865 | |
866 | mg::RenderableList renderables{ |
867 | std::make_shared<mtd::StubRenderable>(), |
868 | |
869 | === modified file 'tests/unit-tests/compositor/test_temporary_buffers.cpp' |
870 | --- tests/unit-tests/compositor/test_temporary_buffers.cpp 2015-08-27 13:41:02 +0000 |
871 | +++ tests/unit-tests/compositor/test_temporary_buffers.cpp 2015-09-04 06:51:35 +0000 |
872 | @@ -126,15 +126,6 @@ |
873 | EXPECT_EQ(buffer_pixel_format, pixel_format); |
874 | } |
875 | |
876 | -TEST_F(TemporaryBuffersTest, base_gl_bind_to_texture) |
877 | -{ |
878 | - TemporaryTestBuffer proxy_buffer(mock_buffer); |
879 | - EXPECT_CALL(*mock_buffer, gl_bind_to_texture()) |
880 | - .Times(1); |
881 | - |
882 | - proxy_buffer.gl_bind_to_texture(); |
883 | -} |
884 | - |
885 | TEST_F(TemporaryBuffersTest, base_test_id) |
886 | { |
887 | TemporaryTestBuffer proxy_buffer(mock_buffer); |
888 | |
889 | === modified file 'tests/unit-tests/graphics/mesa/kms/test_gbm_buffer.cpp' |
890 | --- tests/unit-tests/graphics/mesa/kms/test_gbm_buffer.cpp 2015-07-23 02:39:20 +0000 |
891 | +++ tests/unit-tests/graphics/mesa/kms/test_gbm_buffer.cpp 2015-09-04 06:51:35 +0000 |
892 | @@ -75,6 +75,11 @@ |
893 | allocator.reset(new mgm::BufferAllocator(platform->gbm.device, mgm::BypassOption::allowed, mgm::BufferImportMethod::gbm_native_pixmap)); |
894 | } |
895 | |
896 | + mir::renderer::gl::TextureSource* as_texture_source(std::shared_ptr<mg::Buffer> const& buffer) |
897 | + { |
898 | + return dynamic_cast<mir::renderer::gl::TextureSource*>(buffer->native_buffer_base()); |
899 | + } |
900 | + |
901 | ::testing::NiceMock<mtd::MockDRM> mock_drm; |
902 | ::testing::NiceMock<mtd::MockGBM> mock_gbm; |
903 | ::testing::NiceMock<mtd::MockEGL> mock_egl; |
904 | @@ -196,7 +201,7 @@ |
905 | |
906 | EXPECT_THROW({ |
907 | auto buffer = allocator->alloc_buffer(buffer_properties); |
908 | - buffer->gl_bind_to_texture(); |
909 | + as_texture_source(buffer)->gl_bind_to_texture(); |
910 | }, std::runtime_error); |
911 | } |
912 | |
913 | @@ -219,6 +224,6 @@ |
914 | |
915 | EXPECT_NO_THROW({ |
916 | auto buffer = allocator->alloc_buffer(buffer_properties); |
917 | - buffer->gl_bind_to_texture(); |
918 | + as_texture_source(buffer)->gl_bind_to_texture(); |
919 | }); |
920 | } |
921 | |
922 | === modified file 'tests/unit-tests/scene/test_gl_pixel_buffer.cpp' |
923 | --- tests/unit-tests/scene/test_gl_pixel_buffer.cpp 2015-06-25 03:00:08 +0000 |
924 | +++ tests/unit-tests/scene/test_gl_pixel_buffer.cpp 2015-09-04 06:51:35 +0000 |
925 | @@ -19,7 +19,7 @@ |
926 | #include "src/server/scene/gl_pixel_buffer.h" |
927 | #include "mir/graphics/gl_context.h" |
928 | |
929 | -#include "mir/test/doubles/mock_buffer.h" |
930 | +#include "mir/test/doubles/mock_gl_buffer.h" |
931 | #include "mir/test/doubles/mock_gl.h" |
932 | |
933 | #include <gmock/gmock.h> |
934 | @@ -68,7 +68,7 @@ |
935 | } |
936 | |
937 | testing::NiceMock<mtd::MockGL> mock_gl; |
938 | - testing::NiceMock<mtd::MockBuffer> mock_buffer; |
939 | + testing::NiceMock<mtd::MockGLBuffer> mock_buffer; |
940 | MockGLContext mock_context; |
941 | std::unique_ptr<WrappingGLContext> context; |
942 | }; |
FAILED: Continuous integration, rev:2900 jenkins. qa.ubuntu. com/job/ mir-ci/ 4761/ jenkins. qa.ubuntu. com/job/ mir-android- vivid-i386- build/3777/ console s-jenkins. ubuntu- ci:8080/ job/mir- clang-ts- vivid-amd64- build/198/ console jenkins. qa.ubuntu. com/job/ mir-clang- vivid-amd64- build/2688/ console jenkins. qa.ubuntu. com/job/ mir-mediumtests -vivid- touch/3727/ console jenkins. qa.ubuntu. com/job/ mir-wily- amd64-ci/ 910/console jenkins. qa.ubuntu. com/job/ mir-mediumtests -builder- vivid-armhf/ 3727/console
http://
Executed test runs:
FAILURE: http://
None: http://
None: http://
None: http://
None: http://
None: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/mir- ci/4761/ rebuild
http://