Mir

Merge lp:~cemil-azizoglu/mir/fix-lp1589632 into lp:mir

Proposed by Cemil Azizoglu on 2016-06-08
Status: Merged
Approved by: Cemil Azizoglu on 2016-06-10
Approved revision: 3533
Merged at revision: 3541
Proposed branch: lp:~cemil-azizoglu/mir/fix-lp1589632
Merge into: lp:mir
Diff against target: 171 lines (+56/-10)
4 files modified
src/platforms/mesa/server/x11/graphics/display.cpp (+12/-5)
src/platforms/mesa/server/x11/graphics/display.h (+11/-2)
src/platforms/mesa/server/x11/graphics/platform.cpp (+2/-2)
tests/unit-tests/graphics/mesa/x11/test_display.cpp (+31/-1)
To merge this branch: bzr merge lp:~cemil-azizoglu/mir/fix-lp1589632
Reviewer Review Type Date Requested Status
Mir CI Bot continuous-integration Approve on 2016-06-11
Kevin DuBois (community) 2016-06-08 Approve on 2016-06-10
Review via email: mp+296877@code.launchpad.net

Commit message

Read depth and Stencil values from the GLConfig as in other platforms

Fixes lp#1589632

Description of the change

Read depth and Stencil values from the GLConfig as in other platforms

Fixes lp#1589632

To post a comment you must log in.
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3532
https://mir-jenkins.ubuntu.com/job/mir-ci/1128/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1250
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1300
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1291
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1291
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1260
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1260/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1260
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1260/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1260
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1260/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1260
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1260/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1260
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1260/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1128/rebuild

review: Approve (continuous-integration)
Kevin DuBois (kdub) wrote :

Should we have a unit test?

+ std::shared_ptr<GLConfig> const& gl_config)
could just be a reference, we don't seem to take the shared_ptr.

94 +
unneeded addition?

review: Needs Fixing
Cemil Azizoglu (cemil-azizoglu) wrote :

> Should we have a unit test?
>
Fixed.

> + std::shared_ptr<GLConfig> const& gl_config)
> could just be a reference, we don't seem to take the shared_ptr.
Fixed.

>
> 94 +
> unneeded addition?

This is to match the blank line at the top of the class declaration.

Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3533
https://mir-jenkins.ubuntu.com/job/mir-ci/1134/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1258
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1308
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1299
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1299
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1268
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1268/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1268
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1268/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1268
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1268/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1268
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1268/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1268
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1268/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/1134/rebuild

review: Approve (continuous-integration)
Alan Griffiths (alan-griffiths) wrote :

> > 94 +
> > unneeded addition?
>
> This is to match the blank line at the top of the class declaration.

Is this explanation a thinko? The line is added at the end of the X namespace, not the end of any class. (I don't see a need for it in either case.)

Kevin DuBois (kdub) wrote :

Still don't think the line is necessary, but primary topics addressed, so lgtm

review: Approve
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://mir-jenkins.ubuntu.com/job/mir-autolanding/315/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/1287/console
    None: https://mir-jenkins.ubuntu.com/job/generic-land-mp/341/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1337
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1328
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1328
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1297/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1297/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1297/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1297/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1297
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1297/artifact/output/*zip*/output.zip

review: Needs Fixing (continuous-integration)
Cemil Azizoglu (cemil-azizoglu) wrote :

Failure appears unrelated. Filed lp:1591354

Mir CI Bot (mir-ci-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/platforms/mesa/server/x11/graphics/display.cpp'
2--- src/platforms/mesa/server/x11/graphics/display.cpp 2016-06-02 05:33:50 +0000
3+++ src/platforms/mesa/server/x11/graphics/display.cpp 2016-06-09 14:11:22 +0000
4@@ -21,6 +21,7 @@
5 #include "mir/graphics/egl_resources.h"
6 #include "mir/graphics/egl_error.h"
7 #include "mir/graphics/virtual_output.h"
8+#include "mir/graphics/gl_config.h"
9 #include "display_configuration.h"
10 #include "display.h"
11 #include "display_buffer.h"
12@@ -60,7 +61,10 @@
13 return egl_dpy;
14 }
15
16-mgx::X11Window::X11Window(::Display* x_dpy, EGLDisplay egl_dpy, geom::Size const size)
17+mgx::X11Window::X11Window(::Display* x_dpy,
18+ EGLDisplay egl_dpy,
19+ geom::Size const size,
20+ GLConfig const& gl_config)
21 : x_dpy{x_dpy}
22 {
23 EGLint const att[] = {
24@@ -69,8 +73,8 @@
25 EGL_GREEN_SIZE, 8,
26 EGL_BLUE_SIZE, 8,
27 EGL_ALPHA_SIZE, 8,
28- EGL_DEPTH_SIZE, 0,
29- EGL_STENCIL_SIZE, 0,
30+ EGL_DEPTH_SIZE, gl_config.depth_buffer_bits(),
31+ EGL_STENCIL_SIZE, gl_config.stencil_buffer_bits(),
32 EGL_RENDERABLE_TYPE, MIR_SERVER_EGL_OPENGL_BIT,
33 EGL_NONE
34 };
35@@ -242,12 +246,15 @@
36 return egl_surf;
37 }
38
39-mgx::Display::Display(::Display* x_dpy, geom::Size const size)
40+mgx::Display::Display(::Display* x_dpy,
41+ geom::Size const size,
42+ GLConfig const& gl_config)
43 : egl_display{X11EGLDisplay(x_dpy)},
44 size{size},
45 win{X11Window(x_dpy,
46 egl_display,
47- size)},
48+ size,
49+ gl_config)},
50 egl_context{X11EGLContext(egl_display,
51 win.egl_config())},
52 egl_surface{X11EGLSurface(egl_display,
53
54=== modified file 'src/platforms/mesa/server/x11/graphics/display.h'
55--- src/platforms/mesa/server/x11/graphics/display.h 2016-04-22 02:39:57 +0000
56+++ src/platforms/mesa/server/x11/graphics/display.h 2016-06-09 14:11:22 +0000
57@@ -32,6 +32,9 @@
58 {
59 namespace graphics
60 {
61+
62+class GLConfig;
63+
64 namespace X
65 {
66
67@@ -50,7 +53,10 @@
68 class X11Window
69 {
70 public:
71- X11Window(::Display* const x_dpy, EGLDisplay egl_dpy, mir::geometry::Size const size);
72+ X11Window(::Display* const x_dpy,
73+ EGLDisplay egl_dpy,
74+ geometry::Size const size,
75+ GLConfig const& gl_config);
76 ~X11Window();
77
78 operator Window() const;
79@@ -93,7 +99,9 @@
80 class Display : public graphics::Display
81 {
82 public:
83- explicit Display(::Display* x_dpy, mir::geometry::Size const size);
84+ explicit Display(::Display* x_dpy,
85+ geometry::Size const size,
86+ GLConfig const& gl_config);
87 ~Display() noexcept;
88
89 void for_each_display_sync_group(std::function<void(graphics::DisplaySyncGroup&)> const& f) override;
90@@ -129,6 +137,7 @@
91 };
92
93 }
94+
95 }
96 }
97 #endif /* MIR_GRAPHICS_X_DISPLAY_H_ */
98
99=== modified file 'src/platforms/mesa/server/x11/graphics/platform.cpp'
100--- src/platforms/mesa/server/x11/graphics/platform.cpp 2016-01-29 08:18:22 +0000
101+++ src/platforms/mesa/server/x11/graphics/platform.cpp 2016-06-09 14:11:22 +0000
102@@ -46,9 +46,9 @@
103
104 mir::UniqueModulePtr<mg::Display> mgx::Platform::create_display(
105 std::shared_ptr<DisplayConfigurationPolicy> const& /*initial_conf_policy*/,
106- std::shared_ptr<GLConfig> const& /*gl_config*/)
107+ std::shared_ptr<GLConfig> const& gl_config)
108 {
109- return make_module_ptr<mgx::Display>(x11_connection.get(), size);
110+ return make_module_ptr<mgx::Display>(x11_connection.get(), size, *gl_config);
111 }
112
113 mir::UniqueModulePtr<mg::PlatformIpcOperations> mgx::Platform::make_ipc_operations() const
114
115=== modified file 'tests/unit-tests/graphics/mesa/x11/test_display.cpp'
116--- tests/unit-tests/graphics/mesa/x11/test_display.cpp 2016-01-29 08:18:22 +0000
117+++ tests/unit-tests/graphics/mesa/x11/test_display.cpp 2016-06-09 14:11:22 +0000
118@@ -22,6 +22,7 @@
119 #include "src/platforms/mesa/server/x11/graphics/display.h"
120 #include "mir/test/doubles/mock_egl.h"
121 #include "mir/test/doubles/mock_x11.h"
122+#include "mir/test/doubles/mock_gl_config.h"
123
124 namespace mg=mir::graphics;
125 namespace mgx=mg::X;
126@@ -78,11 +79,15 @@
127
128 std::shared_ptr<mgx::Display> create_display()
129 {
130- return std::make_shared<mgx::Display>(mock_x11.fake_x11.display, size);
131+ return std::make_shared<mgx::Display>(
132+ mock_x11.fake_x11.display,
133+ size,
134+ mock_gl_config);
135 }
136
137 ::testing::NiceMock<mtd::MockEGL> mock_egl;
138 ::testing::NiceMock<mtd::MockX11> mock_x11;
139+ mtd::MockGLConfig mock_gl_config;
140 };
141
142 }
143@@ -111,3 +116,28 @@
144
145 auto display = create_display();
146 }
147+
148+TEST_F(X11DisplayTest, respects_gl_config)
149+{
150+ using namespace testing;
151+
152+ EGLint const depth_bits{24};
153+ EGLint const stencil_bits{8};
154+
155+ EXPECT_CALL(mock_gl_config, depth_buffer_bits())
156+ .Times(AtLeast(1))
157+ .WillRepeatedly(Return(depth_bits));
158+ EXPECT_CALL(mock_gl_config, stencil_buffer_bits())
159+ .Times(AtLeast(1))
160+ .WillRepeatedly(Return(stencil_bits));
161+
162+ EXPECT_CALL(mock_egl,
163+ eglChooseConfig(
164+ _,
165+ AllOf(mtd::EGLConfigContainsAttrib(EGL_DEPTH_SIZE, depth_bits),
166+ mtd::EGLConfigContainsAttrib(EGL_STENCIL_SIZE, stencil_bits)),
167+ _,_,_))
168+ .Times(AtLeast(1));
169+
170+ auto display = create_display();
171+}

Subscribers

People subscribed via source and target branches