Mir

Merge lp:~vanvugt/mir/fix-1301210 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: 1581
Proposed branch: lp:~vanvugt/mir/fix-1301210
Merge into: lp:mir
Diff against target: 70 lines (+16/-0)
5 files modified
examples/demo-shell/demo_renderer.cpp (+4/-0)
include/test/mir_test_doubles/mock_gl.h (+1/-0)
src/server/compositor/gl_renderer.cpp (+4/-0)
tests/mir_test_doubles/mock_gl.cpp (+6/-0)
tests/unit-tests/compositor/test_gl_renderer.cpp (+1/-0)
To merge this branch: bzr merge lp:~vanvugt/mir/fix-1301210
Reviewer Review Type Date Requested Status
Robert Carr (community) Approve
Kevin DuBois (community) Approve
Alan Griffiths Approve
Alberto Aguirre (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+217329@code.launchpad.net

Commit message

Ensure the alpha component (if any) of the frame buffer is never changed
during compositing. Otherwise you could end up with translucent pixels which
produce incorrect looking screenshots/screencasts (LP: #1301210)

Description of the change

If anyone can figure out how/why our simple blending functions are producing pixels with alpha less than one, please let me know.

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
Alberto Aguirre (albaguirre) wrote :

LGTM

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

Code looks harmless. But it is a mystery to me too.

I also think we have a desperate need for automated tests covering this sort of behavior to avoid undetected regressions.

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

> Code looks harmless. But it is a mystery to me too.
>
> I also think we have a desperate need for automated tests covering this sort
> of behavior to avoid undetected regressions.

The 'render some simple golden images' in test project?

code looks okay to me

review: Approve
Revision history for this message
Robert Carr (robertcarr) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/demo-shell/demo_renderer.cpp'
2--- examples/demo-shell/demo_renderer.cpp 2014-04-24 08:42:12 +0000
3+++ examples/demo-shell/demo_renderer.cpp 2014-04-26 08:06:09 +0000
4@@ -156,6 +156,10 @@
5 {
6 glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
7 glClear(GL_COLOR_BUFFER_BIT);
8+
9+ // Ensure we don't change the framebuffer's alpha components (if any)
10+ // as that would ruin the appearance of screengrabs. (LP: #1301210)
11+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
12 }
13
14 void DemoRenderer::tessellate(std::vector<Primitive>& primitives,
15
16=== modified file 'include/test/mir_test_doubles/mock_gl.h'
17--- include/test/mir_test_doubles/mock_gl.h 2014-03-06 09:08:31 +0000
18+++ include/test/mir_test_doubles/mock_gl.h 2014-04-26 08:06:09 +0000
19@@ -47,6 +47,7 @@
20 void(GLenum, GLsizeiptr, const GLvoid *, GLenum));
21 MOCK_METHOD1(glCheckFramebufferStatus, GLenum(GLenum));
22 MOCK_METHOD1(glClear, void(GLbitfield));
23+ MOCK_METHOD4(glColorMask, void(GLboolean, GLboolean, GLboolean, GLboolean));
24 MOCK_METHOD1(glCompileShader, void(GLuint));
25 MOCK_METHOD0(glCreateProgram, GLuint());
26 MOCK_METHOD1(glCreateShader, GLuint(GLenum));
27
28=== modified file 'src/server/compositor/gl_renderer.cpp'
29--- src/server/compositor/gl_renderer.cpp 2014-04-25 12:35:50 +0000
30+++ src/server/compositor/gl_renderer.cpp 2014-04-26 08:06:09 +0000
31@@ -284,6 +284,10 @@
32 void mc::GLRenderer::begin() const
33 {
34 glClear(GL_COLOR_BUFFER_BIT);
35+
36+ // Ensure we don't change the framebuffer's alpha components (if any)
37+ // as that would ruin the appearance of screengrabs. (LP: #1301210)
38+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
39 }
40
41 void mc::GLRenderer::end() const
42
43=== modified file 'tests/mir_test_doubles/mock_gl.cpp'
44--- tests/mir_test_doubles/mock_gl.cpp 2014-03-06 09:08:31 +0000
45+++ tests/mir_test_doubles/mock_gl.cpp 2014-04-26 08:06:09 +0000
46@@ -84,6 +84,12 @@
47 global_mock_gl->glClear(mask);
48 }
49
50+void glColorMask(GLboolean r, GLboolean g, GLboolean b, GLboolean a)
51+{
52+ CHECK_GLOBAL_VOID_MOCK();
53+ global_mock_gl->glColorMask(r, g, b, a);
54+}
55+
56 void glEnable(GLenum func)
57 {
58 CHECK_GLOBAL_VOID_MOCK();
59
60=== modified file 'tests/unit-tests/compositor/test_gl_renderer.cpp'
61--- tests/unit-tests/compositor/test_gl_renderer.cpp 2014-04-24 08:42:12 +0000
62+++ tests/unit-tests/compositor/test_gl_renderer.cpp 2014-04-26 08:06:09 +0000
63@@ -163,6 +163,7 @@
64 InSequence seq;
65
66 EXPECT_CALL(mock_gl, glClear(_));
67+ EXPECT_CALL(mock_gl, glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE));
68 EXPECT_CALL(mock_gl, glUseProgram(stub_program));
69 EXPECT_CALL(renderable, shaped())
70 .WillOnce(Return(true));

Subscribers

People subscribed via source and target branches