Mir

Merge lp:~vanvugt/mir/consistent-alpha-usage into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 2576
Proposed branch: lp:~vanvugt/mir/consistent-alpha-usage
Merge into: lp:mir
Diff against target: 892 lines (+44/-279)
42 files modified
include/platform/mir/graphics/display_buffer.h (+0/-6)
playground/demo-shell/demo_compositor.cpp (+0/-10)
playground/demo-shell/demo_renderer.cpp (+1/-3)
playground/demo-shell/demo_renderer.h (+0/-1)
playground/demo-shell/demo_shell.cpp (+0/-1)
src/include/server/mir/compositor/destination_alpha.h (+0/-36)
src/include/server/mir/compositor/gl_renderer.h (+1/-7)
src/include/server/mir/compositor/renderer_factory.h (+1/-3)
src/platform/symbols.map (+0/-1)
src/platforms/android/server/display_buffer.cpp (+0/-5)
src/platforms/android/server/display_buffer.h (+0/-1)
src/platforms/mesa/server/display_buffer.cpp (+0/-5)
src/platforms/mesa/server/display_buffer.h (+0/-1)
src/server/compositor/default_display_buffer_compositor_factory.cpp (+1/-4)
src/server/compositor/gl_renderer.cpp (+3/-17)
src/server/compositor/gl_renderer_factory.cpp (+2/-3)
src/server/compositor/gl_renderer_factory.h (+1/-2)
src/server/compositor/screencast_display_buffer.cpp (+0/-5)
src/server/compositor/screencast_display_buffer.h (+0/-2)
src/server/graphics/nested/display_buffer.cpp (+0/-6)
src/server/graphics/nested/display_buffer.h (+0/-2)
src/server/graphics/offscreen/display_buffer.cpp (+0/-5)
src/server/graphics/offscreen/display_buffer.h (+0/-1)
src/server/server.cpp (+1/-1)
src/server/symbols.map (+0/-1)
tests/include/mir_test_doubles/mock_display_buffer.h (+0/-1)
tests/include/mir_test_doubles/null_display_buffer.h (+0/-1)
tests/integration-tests/test_server_shutdown.cpp (+1/-1)
tests/integration-tests/test_stale_frames.cpp (+1/-1)
tests/integration-tests/test_surface_first_frame_sync.cpp (+1/-2)
tests/integration-tests/test_surface_stack_with_compositor.cpp (+2/-2)
tests/mir_test_framework/stubbed_server_configuration.cpp (+1/-1)
tests/unit-tests/compositor/test_gl_renderer.cpp (+6/-18)
tests/unit-tests/compositor/test_screencast_display_buffer.cpp (+0/-9)
tests/unit-tests/examples/test_demo_renderer.cpp (+1/-3)
tests/unit-tests/graphics/android/test_display_buffer.cpp (+0/-5)
tests/unit-tests/graphics/android/test_display_group.cpp (+0/-1)
tests/unit-tests/graphics/mesa/test_display_buffer.cpp (+0/-16)
tests/unit-tests/graphics/nested/CMakeLists.txt (+0/-1)
tests/unit-tests/graphics/nested/test_nested_display.cpp (+20/-0)
tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp (+0/-87)
tests/unit-tests/graphics/test_program_factory.cpp (+0/-1)
To merge this branch: bzr merge lp:~vanvugt/mir/consistent-alpha-usage
Reviewer Review Type Date Requested Status
Kevin DuBois (community) Approve
Alan Griffiths Approve
Alberto Aguirre (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+258970@code.launchpad.net

Commit message

Reduce coupling and simplify: Remove DisplayBuffer::uses_alpha() and
switch back to a trivial colour mask for all targets.

Description of the change

Yes there is a slight change in behaviour here and yes Alberto did disapprove my first attempt at this because of that. However after some consideration I've realised the change in behaviour is OK and even desirable...

The change is that screenshots now contain accurate alpha information. If your shell renders the screen with some translucency then that translucency will now be present in the screenshot instead of being converted to black. Some might even call that a useful feature if you wanted to see how a nested shell would blend with other screens in the system compositor.

For mir_demo_shell (and anything else?) that has translucent parts, you may make a screenshot opaque (black instead of translucent background) by simply adding the "-alpha off" parameter to the "convert" command. Our phablet-screenshot script (lp:phablet-tools) already does this so there is no visible change to users of phablet-screenshot.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

Yay, I like getting rid of the function, and the change in behavior in screenshots seems okay to me. Did we check for lp: #1317260 (which seemed to fixed by having glClearColor(0.0, 0.0, 0.0, 1.0)?

review: Needs Information
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

The core of the issue in bug 1317260 was that the alpha channel was uninitialized (hence unpredictable blackness/transparency), due to:
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
which explicitly says "don't touch the alpha channel".

That's no longer a problem as we now consistently use the standard GL default of:
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
so the framebuffer is always fully initialized to the default colour (0,0,0,0). This is ideal both for nested servers trying to do transitions in the system compositor, and for system compositors who on a physical framebuffer will get just plain black.

Revision history for this message
Kevin DuBois (kdub) wrote :

So +1 to the interface/code changes, but I guess would feel more confident if tested with usc+u8 (which have had problems in the past when we tinker with how alpha works)

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Unity8 doesn't use any "Renderer" classes at all now, only USC does. So risk is minimal but I can try to formulate a backport to a phone to prove it's OK. Might wait till 0.13.0 makes it into the distro.

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

Right, qtmir completely replaces the compositor so it will not have any effect due to this change.

So if we want to have screenshots with transparency, then LGTM.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM

review: Approve
Revision history for this message
Kevin DuBois (kdub) wrote :

Mk, questions answered, lgtm too. Porting to 0.13 for test sounds like too much effort, esp if qtmir isn't using the function anyways

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/platform/mir/graphics/display_buffer.h'
2--- include/platform/mir/graphics/display_buffer.h 2015-03-31 02:35:42 +0000
3+++ include/platform/mir/graphics/display_buffer.h 2015-05-13 07:58:58 +0000
4@@ -81,12 +81,6 @@
5 */
6 virtual MirOrientation orientation() const = 0;
7
8- /** Returns true if the display buffer has an alpha channel and the alpha
9- * channel will be read from at some point - in which case the renderer
10- * must produce valid alpha channel content
11- */
12- virtual bool uses_alpha() const = 0;
13-
14 protected:
15 DisplayBuffer() = default;
16 DisplayBuffer(DisplayBuffer const& c) = delete;
17
18=== modified file 'playground/demo-shell/demo_compositor.cpp'
19--- playground/demo-shell/demo_compositor.cpp 2015-04-09 06:20:31 +0000
20+++ playground/demo-shell/demo_compositor.cpp 2015-05-13 07:58:58 +0000
21@@ -19,7 +19,6 @@
22 #include "mir/graphics/display_buffer.h"
23 #include "mir/compositor/compositor_report.h"
24 #include "mir/compositor/scene_element.h"
25-#include "mir/compositor/destination_alpha.h"
26 #include "demo_compositor.h"
27
28 namespace me = mir::examples;
29@@ -27,14 +26,6 @@
30 namespace mc = mir::compositor;
31 namespace geom = mir::geometry;
32
33-namespace
34-{
35-mc::DestinationAlpha destination_alpha(mg::DisplayBuffer const& db)
36-{
37- return db.uses_alpha() ? mc::DestinationAlpha::generate_from_source : mc::DestinationAlpha::opaque;
38-}
39-}
40-
41 std::mutex me::DemoCompositor::instances_mutex;
42 std::unordered_set<me::DemoCompositor*> me::DemoCompositor::instances;
43
44@@ -47,7 +38,6 @@
45 zoom_mag{1.0f},
46 renderer(
47 display_buffer.view_area(),
48- destination_alpha(display_buffer),
49 30.0f, //titlebar_height
50 80.0f) //shadow_radius
51 {
52
53=== modified file 'playground/demo-shell/demo_renderer.cpp'
54--- playground/demo-shell/demo_renderer.cpp 2015-04-09 06:20:31 +0000
55+++ playground/demo-shell/demo_renderer.cpp 2015-05-13 07:58:58 +0000
56@@ -24,7 +24,6 @@
57 #endif
58 #include "demo_renderer.h"
59 #include <mir/graphics/renderable.h>
60-#include <mir/compositor/destination_alpha.h>
61 #include <mir/log.h>
62 #include <cmath>
63
64@@ -179,10 +178,9 @@
65
66 DemoRenderer::DemoRenderer(
67 Rectangle const& display_area,
68- compositor::DestinationAlpha dest_alpha,
69 float const titlebar_height,
70 float const shadow_radius) :
71- GLRenderer(display_area, dest_alpha),
72+ GLRenderer(display_area),
73 titlebar_height{titlebar_height},
74 shadow_radius{shadow_radius},
75 corner_radius{0.5f},
76
77=== modified file 'playground/demo-shell/demo_renderer.h'
78--- playground/demo-shell/demo_renderer.h 2015-04-09 06:20:31 +0000
79+++ playground/demo-shell/demo_renderer.h 2015-05-13 07:58:58 +0000
80@@ -46,7 +46,6 @@
81 public:
82 DemoRenderer(
83 geometry::Rectangle const& display_area,
84- compositor::DestinationAlpha dest_alpha,
85 float const titlebar_height,
86 float const shadow_radius);
87 ~DemoRenderer();
88
89=== modified file 'playground/demo-shell/demo_shell.cpp'
90--- playground/demo-shell/demo_shell.cpp 2015-05-07 13:49:54 +0000
91+++ playground/demo-shell/demo_shell.cpp 2015-05-13 07:58:58 +0000
92@@ -27,7 +27,6 @@
93 #include "mir/graphics/display.h"
94 #include "mir/input/composite_event_filter.h"
95 #include "mir/compositor/display_buffer_compositor_factory.h"
96-#include "mir/compositor/destination_alpha.h"
97 #include "mir/compositor/renderer_factory.h"
98 #include "mir/options/option.h"
99 #include "mir/shell/default_window_manager.h"
100
101=== removed file 'src/include/server/mir/compositor/destination_alpha.h'
102--- src/include/server/mir/compositor/destination_alpha.h 2015-01-21 07:34:50 +0000
103+++ src/include/server/mir/compositor/destination_alpha.h 1970-01-01 00:00:00 +0000
104@@ -1,36 +0,0 @@
105-/*
106- * Copyright © 2014 Canonical Ltd.
107- *
108- * This program is free software: you can redistribute it and/or modify it
109- * under the terms of the GNU General Public License version 3,
110- * as published by the Free Software Foundation.
111- *
112- * This program is distributed in the hope that it will be useful,
113- * but WITHOUT ANY WARRANTY; without even the implied warranty of
114- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115- * GNU General Public License for more details.
116- *
117- * You should have received a copy of the GNU General Public License
118- * along with this program. If not, see <http://www.gnu.org/licenses/>.
119- *
120- * Authored by: Alberto Aguirre <alberto.aguirre@canonical.com>
121- */
122-
123-#ifndef MIR_COMPOSITOR_DESTINATION_ALPHA_H_
124-#define MIR_COMPOSITOR_DESTINATION_ALPHA_H_
125-
126-namespace mir
127-{
128-namespace compositor
129-{
130-
131-enum class DestinationAlpha
132-{
133- generate_from_source,
134- opaque
135-};
136-
137-}
138-}
139-
140-#endif
141
142=== modified file 'src/include/server/mir/compositor/gl_renderer.h'
143--- src/include/server/mir/compositor/gl_renderer.h 2015-04-09 06:37:09 +0000
144+++ src/include/server/mir/compositor/gl_renderer.h 2015-05-13 07:58:58 +0000
145@@ -37,13 +37,10 @@
146 namespace compositor
147 {
148
149-enum class DestinationAlpha;
150-
151 class GLRenderer : public Renderer
152 {
153 public:
154- GLRenderer(geometry::Rectangle const& display_area,
155- DestinationAlpha dest_alpha);
156+ GLRenderer(geometry::Rectangle const& display_area);
157 virtual ~GLRenderer();
158
159 // These are called with a valid GL context:
160@@ -74,8 +71,6 @@
161 virtual void tessellate(std::vector<graphics::GLPrimitive>& primitives,
162 graphics::Renderable const& renderable) const;
163
164- DestinationAlpha destination_alpha() const;
165-
166 GLfloat clear_color[4];
167
168 mutable long long frameno = 0;
169@@ -108,7 +103,6 @@
170 private:
171 std::unique_ptr<graphics::GLTextureCache> const texture_cache;
172 float rotation;
173- DestinationAlpha const dest_alpha;
174 geometry::Rectangle viewport;
175 glm::mat4 screen_to_gl_coords, screen_rotation;
176
177
178=== modified file 'src/include/server/mir/compositor/renderer_factory.h'
179--- src/include/server/mir/compositor/renderer_factory.h 2015-01-21 07:34:50 +0000
180+++ src/include/server/mir/compositor/renderer_factory.h 2015-05-13 07:58:58 +0000
181@@ -31,15 +31,13 @@
182 {
183
184 class Renderer;
185-enum class DestinationAlpha;
186
187 class RendererFactory
188 {
189 public:
190 virtual ~RendererFactory() = default;
191
192- virtual std::unique_ptr<Renderer> create_renderer_for(geometry::Rectangle const& rect,
193- DestinationAlpha dest_alpha) = 0;
194+ virtual std::unique_ptr<Renderer> create_renderer_for(geometry::Rectangle const& rect) = 0;
195
196 protected:
197 RendererFactory() = default;
198
199=== modified file 'src/platform/symbols.map'
200--- src/platform/symbols.map 2015-04-16 15:59:18 +0000
201+++ src/platform/symbols.map 2015-05-13 07:58:58 +0000
202@@ -33,7 +33,6 @@
203 mir::graphics::DisplayBuffer::orientation*;
204 mir::graphics::DisplayBuffer::post_renderables_if_optimizable*;
205 mir::graphics::DisplayBuffer::release_current*;
206- mir::graphics::DisplayBuffer::uses_alpha*;
207 mir::graphics::DisplayBuffer::view_area*;
208 mir::graphics::Display::configuration*;
209 mir::graphics::DisplayConfiguration::DisplayConfiguration*;
210
211=== modified file 'src/platforms/android/server/display_buffer.cpp'
212--- src/platforms/android/server/display_buffer.cpp 2015-04-13 14:07:18 +0000
213+++ src/platforms/android/server/display_buffer.cpp 2015-05-13 07:58:58 +0000
214@@ -105,11 +105,6 @@
215 return orientation_;
216 }
217
218-bool mga::DisplayBuffer::uses_alpha() const
219-{
220- return false;
221-}
222-
223 void mga::DisplayBuffer::configure(MirPowerMode power_mode, MirOrientation orientation)
224 {
225 power_mode_ = power_mode;
226
227=== modified file 'src/platforms/android/server/display_buffer.h'
228--- src/platforms/android/server/display_buffer.h 2015-03-31 02:35:42 +0000
229+++ src/platforms/android/server/display_buffer.h 2015-05-13 07:58:58 +0000
230@@ -62,7 +62,6 @@
231 bool post_renderables_if_optimizable(RenderableList const& renderlist) override;
232
233 MirOrientation orientation() const override;
234- bool uses_alpha() const override;
235 void configure(MirPowerMode power_mode, MirOrientation orientation) override;
236 DisplayContents contents() override;
237 MirPowerMode power_mode() const override;
238
239=== modified file 'src/platforms/mesa/server/display_buffer.cpp'
240--- src/platforms/mesa/server/display_buffer.cpp 2015-05-08 08:04:17 +0000
241+++ src/platforms/mesa/server/display_buffer.cpp 2015-05-13 07:58:58 +0000
242@@ -186,11 +186,6 @@
243 area = a;
244 }
245
246-bool mgm::DisplayBuffer::uses_alpha() const
247-{
248- return false;
249-}
250-
251 bool mgm::DisplayBuffer::post_renderables_if_optimizable(RenderableList const& renderable_list)
252 {
253 if ((rotation == mir_orientation_normal) &&
254
255=== modified file 'src/platforms/mesa/server/display_buffer.h'
256--- src/platforms/mesa/server/display_buffer.h 2015-05-08 07:48:24 +0000
257+++ src/platforms/mesa/server/display_buffer.h 2015-05-13 07:58:58 +0000
258@@ -68,7 +68,6 @@
259
260 MirOrientation orientation() const override;
261 void set_orientation(MirOrientation const rot, geometry::Rectangle const& a);
262- bool uses_alpha() const override;
263 void schedule_set_crtc();
264 void wait_for_page_flip();
265
266
267=== modified file 'src/server/compositor/default_display_buffer_compositor_factory.cpp'
268--- src/server/compositor/default_display_buffer_compositor_factory.cpp 2015-03-31 02:35:42 +0000
269+++ src/server/compositor/default_display_buffer_compositor_factory.cpp 2015-05-13 07:58:58 +0000
270@@ -17,7 +17,6 @@
271 */
272
273 #include "default_display_buffer_compositor_factory.h"
274-#include "mir/compositor/destination_alpha.h"
275 #include "mir/compositor/renderer_factory.h"
276 #include "mir/compositor/renderer.h"
277 #include "mir/graphics/display_buffer.h"
278@@ -39,9 +38,7 @@
279 mc::DefaultDisplayBufferCompositorFactory::create_compositor_for(
280 graphics::DisplayBuffer& display_buffer)
281 {
282- auto dest_alpha = display_buffer.uses_alpha() ?
283- DestinationAlpha::generate_from_source : DestinationAlpha::opaque;
284- auto renderer = renderer_factory->create_renderer_for(display_buffer.view_area(), dest_alpha);
285+ auto renderer = renderer_factory->create_renderer_for(display_buffer.view_area());
286 return std::make_unique<DefaultDisplayBufferCompositor>(
287 display_buffer, std::move(renderer), report);
288 }
289
290=== modified file 'src/server/compositor/gl_renderer.cpp'
291--- src/server/compositor/gl_renderer.cpp 2015-05-07 08:31:41 +0000
292+++ src/server/compositor/gl_renderer.cpp 2015-05-13 07:58:58 +0000
293@@ -18,7 +18,6 @@
294
295 #include "mir/compositor/gl_renderer.h"
296 #include "mir/compositor/buffer_stream.h"
297-#include "mir/compositor/destination_alpha.h"
298 #include "mir/compositor/recently_used_cache.h"
299 #include "mir/graphics/renderable.h"
300 #include "mir/graphics/buffer.h"
301@@ -91,15 +90,12 @@
302 alpha_uniform = glGetUniformLocation(id, "alpha");
303 }
304
305-mc::GLRenderer::GLRenderer(
306- geom::Rectangle const& display_area,
307- DestinationAlpha dest_alpha)
308- : clear_color{0.0f, 0.0f, 0.0f, 1.0f},
309+mc::GLRenderer::GLRenderer(geom::Rectangle const& display_area)
310+ : clear_color{0.0f, 0.0f, 0.0f, 0.0f},
311 default_program(family.add_program(vshader, default_fshader)),
312 alpha_program(family.add_program(vshader, alpha_fshader)),
313 texture_cache(std::make_unique<RecentlyUsedCache>()),
314- rotation(NAN), // ensure the first set_rotation succeeds
315- dest_alpha(dest_alpha)
316+ rotation(NAN) // ensure the first set_rotation succeeds
317 {
318 struct {GLenum id; char const* label;} const glstrings[] =
319 {
320@@ -134,9 +130,6 @@
321
322 set_viewport(display_area);
323 set_rotation(0.0f);
324-
325- if (dest_alpha != DestinationAlpha::opaque)
326- clear_color[3] = 0.0f;
327 }
328
329 mc::GLRenderer::~GLRenderer() = default;
330@@ -154,9 +147,6 @@
331 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
332 glClear(GL_COLOR_BUFFER_BIT);
333
334- if (dest_alpha == DestinationAlpha::opaque)
335- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
336-
337 ++frameno;
338 for (auto const& r : renderables)
339 draw(*r, r->alpha() < 1.0f ? alpha_program : default_program);
340@@ -296,7 +286,3 @@
341 texture_cache->invalidate();
342 }
343
344-mc::DestinationAlpha mc::GLRenderer::destination_alpha() const
345-{
346- return dest_alpha;
347-}
348
349=== modified file 'src/server/compositor/gl_renderer_factory.cpp'
350--- src/server/compositor/gl_renderer_factory.cpp 2015-04-13 14:07:18 +0000
351+++ src/server/compositor/gl_renderer_factory.cpp 2015-05-13 07:58:58 +0000
352@@ -24,8 +24,7 @@
353 namespace geom = mir::geometry;
354
355 std::unique_ptr<mc::Renderer>
356-mc::GLRendererFactory::create_renderer_for(geom::Rectangle const& rect,
357- DestinationAlpha dest_alpha)
358+mc::GLRendererFactory::create_renderer_for(geom::Rectangle const& rect)
359 {
360- return std::make_unique<GLRenderer>(rect, dest_alpha);
361+ return std::make_unique<GLRenderer>(rect);
362 }
363
364=== modified file 'src/server/compositor/gl_renderer_factory.h'
365--- src/server/compositor/gl_renderer_factory.h 2015-01-21 07:34:50 +0000
366+++ src/server/compositor/gl_renderer_factory.h 2015-05-13 07:58:58 +0000
367@@ -29,8 +29,7 @@
368 class GLRendererFactory : public RendererFactory
369 {
370 public:
371- std::unique_ptr<Renderer> create_renderer_for(geometry::Rectangle const& rect,
372- DestinationAlpha dest_alpha);
373+ std::unique_ptr<Renderer> create_renderer_for(geometry::Rectangle const& rect);
374 };
375 }
376 }
377
378=== modified file 'src/server/compositor/screencast_display_buffer.cpp'
379--- src/server/compositor/screencast_display_buffer.cpp 2015-03-31 02:35:42 +0000
380+++ src/server/compositor/screencast_display_buffer.cpp 2015-05-13 07:58:58 +0000
381@@ -99,8 +99,3 @@
382 {
383 return mir_orientation_normal;
384 }
385-
386-bool mc::ScreencastDisplayBuffer::uses_alpha() const
387-{
388- return false;
389-}
390
391=== modified file 'src/server/compositor/screencast_display_buffer.h'
392--- src/server/compositor/screencast_display_buffer.h 2015-03-31 02:35:42 +0000
393+++ src/server/compositor/screencast_display_buffer.h 2015-05-13 07:58:58 +0000
394@@ -65,8 +65,6 @@
395
396 MirOrientation orientation() const override;
397
398- bool uses_alpha() const override;
399-
400 private:
401 geometry::Rectangle const rect;
402 graphics::Buffer& buffer;
403
404=== modified file 'src/server/graphics/nested/display_buffer.cpp'
405--- src/server/graphics/nested/display_buffer.cpp 2015-05-04 22:42:59 +0000
406+++ src/server/graphics/nested/display_buffer.cpp 2015-05-13 07:58:58 +0000
407@@ -40,7 +40,6 @@
408 std::shared_ptr<input::InputDispatcher> const& dispatcher,
409 std::shared_ptr<mi::CursorListener> const& cursor_listener,
410 MirPixelFormat preferred_format) :
411- uses_alpha_{mg::contains_alpha(preferred_format)},
412 egl_display(egl_display),
413 host_surface{host_surface},
414 egl_config{egl_display.choose_windowed_es_config(preferred_format)},
415@@ -88,11 +87,6 @@
416 return mir_orientation_normal;
417 }
418
419-bool mgn::detail::DisplayBuffer::uses_alpha() const
420-{
421- return uses_alpha_;
422-}
423-
424 mgn::detail::DisplayBuffer::~DisplayBuffer() noexcept
425 {
426 }
427
428=== modified file 'src/server/graphics/nested/display_buffer.h'
429--- src/server/graphics/nested/display_buffer.h 2015-04-23 20:17:52 +0000
430+++ src/server/graphics/nested/display_buffer.h 2015-05-13 07:58:58 +0000
431@@ -58,14 +58,12 @@
432 void release_current() override;
433 void gl_swap_buffers() override;
434 MirOrientation orientation() const override;
435- bool uses_alpha() const override;
436
437 bool post_renderables_if_optimizable(RenderableList const& renderlist) override;
438
439 DisplayBuffer(DisplayBuffer const&) = delete;
440 DisplayBuffer operator=(DisplayBuffer const&) = delete;
441 private:
442- bool const uses_alpha_;
443 EGLDisplayHandle const& egl_display;
444 std::shared_ptr<HostSurface> const host_surface;
445 EGLConfig const egl_config;
446
447=== modified file 'src/server/graphics/offscreen/display_buffer.cpp'
448--- src/server/graphics/offscreen/display_buffer.cpp 2015-03-31 02:35:42 +0000
449+++ src/server/graphics/offscreen/display_buffer.cpp 2015-05-13 07:58:58 +0000
450@@ -157,8 +157,3 @@
451 */
452 return mir_orientation_normal;
453 }
454-
455-bool mgo::DisplayBuffer::uses_alpha() const
456-{
457- return false;
458-}
459
460=== modified file 'src/server/graphics/offscreen/display_buffer.h'
461--- src/server/graphics/offscreen/display_buffer.h 2015-03-31 02:35:42 +0000
462+++ src/server/graphics/offscreen/display_buffer.h 2015-05-13 07:58:58 +0000
463@@ -68,7 +68,6 @@
464 void gl_swap_buffers() override;
465
466 MirOrientation orientation() const override;
467- bool uses_alpha() const override;
468
469 bool post_renderables_if_optimizable(RenderableList const& renderlist) override;
470
471
472=== modified file 'src/server/server.cpp'
473--- src/server/server.cpp 2015-05-08 18:23:47 +0000
474+++ src/server/server.cpp 2015-05-13 07:58:58 +0000
475@@ -172,7 +172,7 @@
476 class StubRendererFactory : public mir::compositor::RendererFactory
477 {
478 public:
479- auto create_renderer_for(mir::geometry::Rectangle const&, mir::compositor::DestinationAlpha)
480+ auto create_renderer_for(mir::geometry::Rectangle const&)
481 -> std::unique_ptr<mir::compositor::Renderer>
482 {
483 return std::make_unique<StubRenderer>();
484
485=== modified file 'src/server/symbols.map'
486--- src/server/symbols.map 2015-05-11 14:07:15 +0000
487+++ src/server/symbols.map 2015-05-13 07:58:58 +0000
488@@ -492,7 +492,6 @@
489 mir::compositor::GLRenderer::GLRenderer*;
490 mir::compositor::GLRenderer::?GLRenderer*;
491 mir::compositor::GLRenderer::Program::Program*;
492- mir::compositor::GLRenderer::destination_alpha*;
493 mir::compositor::GLRenderer::draw*;
494 mir::compositor::GLRenderer::render*;
495 mir::compositor::GLRenderer::set_rotation*;
496
497=== modified file 'tests/include/mir_test_doubles/mock_display_buffer.h'
498--- tests/include/mir_test_doubles/mock_display_buffer.h 2015-03-31 02:35:42 +0000
499+++ tests/include/mir_test_doubles/mock_display_buffer.h 2015-05-13 07:58:58 +0000
500@@ -45,7 +45,6 @@
501 MOCK_METHOD0(gl_swap_buffers, void());
502 MOCK_METHOD1(post_renderables_if_optimizable, bool(graphics::RenderableList const&));
503 MOCK_CONST_METHOD0(orientation, MirOrientation());
504- MOCK_CONST_METHOD0(uses_alpha, bool());
505 };
506
507 }
508
509=== modified file 'tests/include/mir_test_doubles/null_display_buffer.h'
510--- tests/include/mir_test_doubles/null_display_buffer.h 2015-03-31 02:35:42 +0000
511+++ tests/include/mir_test_doubles/null_display_buffer.h 2015-05-13 07:58:58 +0000
512@@ -37,7 +37,6 @@
513 void gl_swap_buffers() override {}
514 bool post_renderables_if_optimizable(graphics::RenderableList const&) override { return false; }
515 MirOrientation orientation() const override { return mir_orientation_normal; }
516- bool uses_alpha() const override { return false; }
517 };
518
519 }
520
521=== modified file 'tests/integration-tests/test_server_shutdown.cpp'
522--- tests/integration-tests/test_server_shutdown.cpp 2015-04-30 12:27:33 +0000
523+++ tests/integration-tests/test_server_shutdown.cpp 2015-05-13 07:58:58 +0000
524@@ -53,7 +53,7 @@
525 class StubRendererFactory : public mc::RendererFactory
526 {
527 public:
528- std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&, mc::DestinationAlpha)
529+ std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&)
530 {
531 return std::unique_ptr<mc::Renderer>(new mtd::StubRenderer());
532 }
533
534=== modified file 'tests/integration-tests/test_stale_frames.cpp'
535--- tests/integration-tests/test_stale_frames.cpp 2015-04-30 12:27:33 +0000
536+++ tests/integration-tests/test_stale_frames.cpp 2015-05-13 07:58:58 +0000
537@@ -84,7 +84,7 @@
538 {
539 public:
540 std::unique_ptr<mc::Renderer> create_renderer_for(
541- geom::Rectangle const&, mc::DestinationAlpha) override
542+ geom::Rectangle const&) override
543 {
544 std::lock_guard<std::mutex> lock{mutex};
545 renderer_ = new StubRenderer();
546
547=== modified file 'tests/integration-tests/test_surface_first_frame_sync.cpp'
548--- tests/integration-tests/test_surface_first_frame_sync.cpp 2015-04-30 12:27:33 +0000
549+++ tests/integration-tests/test_surface_first_frame_sync.cpp 2015-05-13 07:58:58 +0000
550@@ -210,8 +210,7 @@
551 struct StubRendererFactory : public mc::RendererFactory
552 {
553 StubRendererFactory(int ops_fd) : ops_fd{ops_fd} {}
554- std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&,
555- mc::DestinationAlpha)
556+ std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&)
557 {
558 auto raw = new StubRenderer{ops_fd};
559 return std::unique_ptr<StubRenderer>(raw);
560
561=== modified file 'tests/integration-tests/test_surface_stack_with_compositor.cpp'
562--- tests/integration-tests/test_surface_stack_with_compositor.cpp 2015-04-27 17:30:44 +0000
563+++ tests/integration-tests/test_surface_stack_with_compositor.cpp 2015-05-13 07:58:58 +0000
564@@ -53,8 +53,8 @@
565 class StubRendererFactory : public mc::RendererFactory
566 {
567 public:
568- std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&,
569- mc::DestinationAlpha) override
570+ std::unique_ptr<mc::Renderer>
571+ create_renderer_for(geom::Rectangle const&) override
572 {
573 return std::unique_ptr<mtd::StubRenderer>(new mtd::StubRenderer);
574 }
575
576=== modified file 'tests/mir_test_framework/stubbed_server_configuration.cpp'
577--- tests/mir_test_framework/stubbed_server_configuration.cpp 2015-04-23 20:17:52 +0000
578+++ tests/mir_test_framework/stubbed_server_configuration.cpp 2015-05-13 07:58:58 +0000
579@@ -50,7 +50,7 @@
580 class StubRendererFactory : public mc::RendererFactory
581 {
582 public:
583- std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&, mc::DestinationAlpha)
584+ std::unique_ptr<mc::Renderer> create_renderer_for(geom::Rectangle const&)
585 {
586 return std::unique_ptr<mc::Renderer>(new mtd::StubRenderer());
587 }
588
589=== modified file 'tests/unit-tests/compositor/test_gl_renderer.cpp'
590--- tests/unit-tests/compositor/test_gl_renderer.cpp 2015-04-08 07:22:41 +0000
591+++ tests/unit-tests/compositor/test_gl_renderer.cpp 2015-05-13 07:58:58 +0000
592@@ -23,7 +23,6 @@
593 #include <mir/geometry/rectangle.h>
594 #include <mir/graphics/gl_texture.h>
595 #include <mir/compositor/gl_renderer.h>
596-#include <mir/compositor/destination_alpha.h>
597 #include <mir_test/fake_shared.h>
598 #include <mir_test_doubles/mock_buffer.h>
599 #include <mir_test_doubles/mock_renderable.h>
600@@ -159,7 +158,7 @@
601 .WillOnce(Return(false));
602 EXPECT_CALL(mock_gl, glDisable(GL_BLEND));
603
604- mc::GLRenderer renderer(display_area, mc::DestinationAlpha::opaque);
605+ mc::GLRenderer renderer(display_area);
606 renderer.render(renderable_list);
607 }
608
609@@ -170,7 +169,7 @@
610 {
611 OverriddenTessellateRenderer(
612 mir::geometry::Rectangle const& display_area, unsigned int num_primitives) :
613- GLRenderer(display_area, mc::DestinationAlpha::opaque),
614+ GLRenderer(display_area),
615 num_primitives(num_primitives)
616 {
617 }
618@@ -198,25 +197,14 @@
619 renderer.render(renderable_list);
620 }
621
622-TEST_F(GLRenderer, opaque_alpha_channel)
623+TEST_F(GLRenderer, clears_all_channels_zero)
624 {
625 InSequence seq;
626- EXPECT_CALL(mock_gl, glClearColor(_, _, _, 1.0f));
627+ EXPECT_CALL(mock_gl, glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
628 EXPECT_CALL(mock_gl, glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE));
629 EXPECT_CALL(mock_gl, glClear(_));
630- EXPECT_CALL(mock_gl, glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE));
631-
632- mc::GLRenderer renderer(display_area, mc::DestinationAlpha::opaque);
633-
634- renderer.render(renderable_list);
635-}
636-
637-TEST_F(GLRenderer, generates_alpha_channel_content)
638-{
639- EXPECT_CALL(mock_gl, glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE));
640-
641- mc::GLRenderer renderer(display_area,
642- mc::DestinationAlpha::generate_from_source);
643+
644+ mc::GLRenderer renderer(display_area);
645
646 renderer.render(renderable_list);
647 }
648
649=== modified file 'tests/unit-tests/compositor/test_screencast_display_buffer.cpp'
650--- tests/unit-tests/compositor/test_screencast_display_buffer.cpp 2015-03-31 02:35:42 +0000
651+++ tests/unit-tests/compositor/test_screencast_display_buffer.cpp 2015-05-13 07:58:58 +0000
652@@ -163,12 +163,3 @@
653 EXPECT_FALSE(db.post_renderables_if_optimizable(renderables));
654 }
655
656-TEST_F(ScreencastDisplayBufferTest, does_not_use_alpha)
657-{
658- geom::Rectangle const rect{{100,100}, {800,600}};
659- mtd::StubBuffer stub_buffer;
660-
661- mc::ScreencastDisplayBuffer db{rect, stub_buffer};
662-
663- EXPECT_FALSE(db.uses_alpha());
664-}
665
666=== modified file 'tests/unit-tests/examples/test_demo_renderer.cpp'
667--- tests/unit-tests/examples/test_demo_renderer.cpp 2015-01-21 07:34:50 +0000
668+++ tests/unit-tests/examples/test_demo_renderer.cpp 2015-05-13 07:58:58 +0000
669@@ -17,7 +17,6 @@
670 */
671
672 #include "mir/graphics/renderable.h"
673-#include "mir/compositor/destination_alpha.h"
674 #include "mir_test_doubles/fake_renderable.h"
675 #include "mir_test_doubles/mock_gl.h"
676 #include "playground/demo-shell/demo_renderer.h"
677@@ -32,7 +31,6 @@
678 {
679 testing::NiceMock<mtd::MockGL> mock_gl;
680 geom::Rectangle region{{0, 0}, {100, 100}};
681- mc::DestinationAlpha dest_alpha{mc::DestinationAlpha::opaque};
682 int const shadow_radius{20};
683 int const titlebar_height{5};
684
685@@ -52,7 +50,7 @@
686
687 TEST_F(DemoRenderer, detects_embellishments_on_renderables)
688 {
689- me::DemoRenderer demo_renderer(region, dest_alpha, titlebar_height, shadow_radius);
690+ me::DemoRenderer demo_renderer(region, titlebar_height, shadow_radius);
691
692 mtd::FakeRenderable fullscreen_surface(region);
693 mtd::FakeRenderable oversized_surface(geom::Rectangle{{-10, -10}, {120, 120}});
694
695=== modified file 'tests/unit-tests/graphics/android/test_display_buffer.cpp'
696--- tests/unit-tests/graphics/android/test_display_buffer.cpp 2015-04-29 20:37:55 +0000
697+++ tests/unit-tests/graphics/android/test_display_buffer.cpp 2015-05-13 07:58:58 +0000
698@@ -240,11 +240,6 @@
699 db.configure(mir_power_mode_on, mir_orientation_normal);
700 }
701
702-TEST_F(DisplayBuffer, does_not_use_alpha)
703-{
704- EXPECT_FALSE(db.uses_alpha());
705-}
706-
707 TEST_F(DisplayBuffer, reject_list_if_option_disabled)
708 {
709 using namespace testing;
710
711=== modified file 'tests/unit-tests/graphics/android/test_display_group.cpp'
712--- tests/unit-tests/graphics/android/test_display_group.cpp 2015-03-02 14:22:45 +0000
713+++ tests/unit-tests/graphics/android/test_display_group.cpp 2015-05-13 07:58:58 +0000
714@@ -39,7 +39,6 @@
715 void gl_swap_buffers() override {}
716 bool post_renderables_if_optimizable(mg::RenderableList const&) override { return false; }
717 MirOrientation orientation() const override { return mir_orientation_normal; }
718- bool uses_alpha() const override { return false; }
719 void configure(MirPowerMode, MirOrientation) override {}
720 mga::DisplayContents contents() override
721 {
722
723=== modified file 'tests/unit-tests/graphics/mesa/test_display_buffer.cpp'
724--- tests/unit-tests/graphics/mesa/test_display_buffer.cpp 2015-05-08 08:26:40 +0000
725+++ tests/unit-tests/graphics/mesa/test_display_buffer.cpp 2015-05-13 07:58:58 +0000
726@@ -441,19 +441,3 @@
727 EXPECT_FALSE(db.post_renderables_if_optimizable(list));
728 }
729
730-TEST_F(MesaDisplayBufferTest, does_not_use_alpha)
731-{
732- geometry::Rectangle const area{{12,34}, {56,78}};
733-
734- graphics::mesa::DisplayBuffer db(
735- create_platform(),
736- null_display_report(),
737- {mock_kms_output},
738- nullptr,
739- area,
740- mir_orientation_normal,
741- gl_config,
742- mock_egl.fake_egl_context);
743-
744- EXPECT_FALSE(db.uses_alpha());
745-}
746
747=== modified file 'tests/unit-tests/graphics/nested/CMakeLists.txt'
748--- tests/unit-tests/graphics/nested/CMakeLists.txt 2015-04-23 20:17:52 +0000
749+++ tests/unit-tests/graphics/nested/CMakeLists.txt 2015-05-13 07:58:58 +0000
750@@ -1,7 +1,6 @@
751 list(APPEND UNIT_TEST_SOURCES
752 ${CMAKE_CURRENT_SOURCE_DIR}/test_nested_display_configuration.cpp
753 ${CMAKE_CURRENT_SOURCE_DIR}/test_nested_display.cpp
754- ${CMAKE_CURRENT_SOURCE_DIR}/test_nested_display_buffer.cpp
755 ${CMAKE_CURRENT_SOURCE_DIR}/mir_display_configuration_builder.cpp
756 ${CMAKE_CURRENT_SOURCE_DIR}/test_nested_cursor.cpp
757 )
758
759=== modified file 'tests/unit-tests/graphics/nested/test_nested_display.cpp'
760--- tests/unit-tests/graphics/nested/test_nested_display.cpp 2015-04-23 20:17:52 +0000
761+++ tests/unit-tests/graphics/nested/test_nested_display.cpp 2015-05-13 07:58:58 +0000
762@@ -118,6 +118,26 @@
763 mt::fake_shared(mock_gl_config));
764 }
765
766+TEST_F(NestedDisplay, has_alpha_channel)
767+{
768+ using namespace testing;
769+
770+ // mt::build_trivial_configuration sets mir_pixel_format_abgr_8888
771+ EXPECT_CALL(mock_egl,
772+ eglChooseConfig(
773+ _,
774+ mtd::EGLConfigContainsAttrib(EGL_ALPHA_SIZE, 8),
775+ _,_,_))
776+ .Times(AtLeast(1))
777+ .WillRepeatedly(DoAll(SetArgPointee<2>(mock_egl.fake_configs[0]),
778+ SetArgPointee<4>(1),
779+ Return(EGL_TRUE)));
780+
781+ auto const nested_display = create_nested_display(
782+ null_platform,
783+ mt::fake_shared(stub_gl_config));
784+}
785+
786 TEST_F(NestedDisplay, does_not_change_host_display_configuration_at_construction)
787 {
788 using namespace testing;
789
790=== removed file 'tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp'
791--- tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp 2015-04-23 20:17:52 +0000
792+++ tests/unit-tests/graphics/nested/test_nested_display_buffer.cpp 1970-01-01 00:00:00 +0000
793@@ -1,87 +0,0 @@
794-/*
795- * Copyright © 2014 Canonical Ltd.
796- *
797- * This program is free software: you can redistribute it and/or modify
798- * it under the terms of the GNU General Public License version 3 as
799- * published by the Free Software Foundation.
800- *
801- * This program is distributed in the hope that it will be useful,
802- * but WITHOUT ANY WARRANTY; without even the implied warranty of
803- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
804- * GNU General Public License for more details.
805- *
806- * You should have received a copy of the GNU General Public License
807- * along with this program. If not, see <http://www.gnu.org/licenses/>.
808- *
809- * Authored by: Alberto Aguirre <alberto.aguirre@canonical.com>
810- */
811-
812-#include "src/server/graphics/nested/display_buffer.h"
813-#include "src/server/graphics/nested/host_connection.h"
814-#include "src/server/input/null_input_dispatcher.h"
815-
816-#include "mir_test_doubles/mock_egl.h"
817-#include "mir_test_doubles/stub_gl_config.h"
818-#include "mir_test_doubles/stub_cursor_listener.h"
819-#include "mir_test/fake_shared.h"
820-
821-#include <gtest/gtest.h>
822-#include <gmock/gmock.h>
823-
824-namespace geom = mir::geometry;
825-namespace mg = mir::graphics;
826-namespace mgn = mg::nested;
827-namespace mgnd = mg::nested::detail;
828-namespace mi = mir::input;
829-namespace mt = mir::test;
830-namespace mtd = mir::test::doubles;
831-
832-class NullHostSurface : public mgn::HostSurface
833-{
834-public:
835- EGLNativeWindowType egl_native_window() override { return {}; }
836- void set_event_handler(mir_surface_event_callback, void*) override {}
837-};
838-
839-struct NestedDisplayBufferTest : testing::Test
840-{
841- NestedDisplayBufferTest()
842- : egl_disp_handle{mock_egl.fake_egl_display,
843- mt::fake_shared(stub_gl_config)},
844- default_rect{{100,100}, {800,600}}
845- {}
846- testing::NiceMock<mtd::MockEGL> mock_egl;
847- mtd::StubGLConfig stub_gl_config;
848- NullHostSurface null_host_surface;
849- mi::NullInputDispatcher null_input_dispatcher;
850- std::shared_ptr<mi::CursorListener> cursor =
851- std::make_shared<mtd::StubCursorListener>();
852- mgnd::EGLDisplayHandle egl_disp_handle;
853- geom::Rectangle const default_rect;
854-};
855-
856-TEST_F(NestedDisplayBufferTest, alpha_enabled_pixel_format_enables_destination_alpha)
857-{
858- mgnd::DisplayBuffer db{
859- egl_disp_handle,
860- mt::fake_shared(null_host_surface),
861- default_rect,
862- mt::fake_shared(null_input_dispatcher),
863- cursor,
864- mir_pixel_format_abgr_8888};
865-
866- EXPECT_TRUE(db.uses_alpha());
867-}
868-
869-TEST_F(NestedDisplayBufferTest, non_alpha_pixel_format_disables_destination_alpha)
870-{
871- mgnd::DisplayBuffer db{
872- egl_disp_handle,
873- mt::fake_shared(null_host_surface),
874- default_rect,
875- mt::fake_shared(null_input_dispatcher),
876- cursor,
877- mir_pixel_format_xbgr_8888};
878-
879- EXPECT_FALSE(db.uses_alpha());
880-}
881
882=== modified file 'tests/unit-tests/graphics/test_program_factory.cpp'
883--- tests/unit-tests/graphics/test_program_factory.cpp 2015-01-21 07:34:50 +0000
884+++ tests/unit-tests/graphics/test_program_factory.cpp 2015-05-13 07:58:58 +0000
885@@ -24,7 +24,6 @@
886 #include <gtest/gtest.h>
887 #include <gmock/gmock.h>
888 #include <mir/geometry/rectangle.h>
889-#include <mir/compositor/destination_alpha.h>
890 #include "src/server/graphics/program_factory.h"
891 #include <mir_test/fake_shared.h>
892 #include <mir_test_doubles/mock_buffer.h>

Subscribers

People subscribed via source and target branches