Mir

Merge lp:~robertcarr/mir/emancipate-egl-native-display-from-surface into lp:~mir-team/mir/trunk

Proposed by Robert Carr
Status: Merged
Approved by: Robert Carr
Approved revision: no longer in the source branch.
Merged at revision: 687
Proposed branch: lp:~robertcarr/mir/emancipate-egl-native-display-from-surface
Merge into: lp:~mir-team/mir/trunk
Diff against target: 402 lines (+49/-46)
22 files modified
examples/demo-inprocess-surface-client/inprocess_egl_client.cpp (+2/-2)
include/server/mir/graphics/internal_client.h (+7/-1)
include/server/mir/graphics/platform.h (+1/-1)
include/test/mir_test_doubles/stub_platform.h (+1/-1)
src/server/graphics/android/android_platform.cpp (+2/-3)
src/server/graphics/android/android_platform.h (+1/-1)
src/server/graphics/android/internal_client.cpp (+10/-5)
src/server/graphics/android/internal_client.h (+2/-2)
src/server/graphics/gbm/gbm_platform.cpp (+2/-3)
src/server/graphics/gbm/gbm_platform.h (+1/-1)
src/server/graphics/gbm/internal_client.cpp (+3/-5)
src/server/graphics/gbm/internal_client.h (+2/-4)
tests/integration-tests/graphics/android/test_internal_client.cpp (+2/-2)
tests/integration-tests/graphics/gbm/test_buffer_integration.cpp (+1/-1)
tests/integration-tests/test_display_info.cpp (+1/-1)
tests/integration-tests/test_drm_auth_magic.cpp (+1/-1)
tests/integration-tests/test_surfaceloop.cpp (+2/-2)
tests/mir_test_framework/testing_server_options.cpp (+1/-1)
tests/unit-tests/frontend/test_session_mediator_gbm.cpp (+1/-1)
tests/unit-tests/graphics/android/test_internal_client.cpp (+3/-3)
tests/unit-tests/graphics/gbm/test_gbm_platform.cpp (+1/-3)
tests/unit-tests/graphics/gbm/test_internal_client.cpp (+2/-2)
To merge this branch: bzr merge lp:~robertcarr/mir/emancipate-egl-native-display-from-surface
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Kevin DuBois (community) Approve
Review via email: mp+163775@code.launchpad.net

Commit message

Allow access to the internal egl native display without usage of a surface.

Description of the change

Allow access to the internal egl native display without usage of a surface.

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 :

good, makes more sense

small needs fixing:

doesn't need to be a class member:
148 std::shared_ptr<MirNativeWindow> client_window;

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

> good, makes more sense
>
> small needs fixing:
>
> doesn't need to be a class member:
> 148 std::shared_ptr<MirNativeWindow> client_window;

apologies, it does need to be a class member so that a reference to it is maintained.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Kevin DuBois (kdub) wrote :

looks good

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'examples/demo-inprocess-surface-client/inprocess_egl_client.cpp'
2--- examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2013-05-13 23:21:30 +0000
3+++ examples/demo-inprocess-surface-client/inprocess_egl_client.cpp 2013-05-14 23:46:25 +0000
4@@ -91,8 +91,8 @@
5 std::bind(std::mem_fn(&me::InprocessEGLClient::handle_event), this, std::placeholders::_1));
6 input_thread->start();
7
8- auto internal_client = graphics_platform->create_internal_client(surface);
9- me::EGLHelper helper(internal_client->egl_native_display(), internal_client->egl_native_window());
10+ auto internal_client = graphics_platform->create_internal_client();
11+ me::EGLHelper helper(internal_client->egl_native_display(), internal_client->egl_native_window(surface));
12
13 auto rc = eglMakeCurrent(helper.the_display(), helper.the_surface(), helper.the_surface(), helper.the_context());
14 assert(rc == EGL_TRUE);
15
16=== modified file 'include/server/mir/graphics/internal_client.h'
17--- include/server/mir/graphics/internal_client.h 2013-05-07 19:45:01 +0000
18+++ include/server/mir/graphics/internal_client.h 2013-05-14 23:46:25 +0000
19@@ -22,15 +22,21 @@
20
21 #include <EGL/egl.h>
22
23+#include <memory>
24+
25 namespace mir
26 {
27+namespace frontend
28+{
29+class Surface;
30+}
31 namespace graphics
32 {
33 class InternalClient
34 {
35 public:
36 virtual EGLNativeDisplayType egl_native_display() = 0;
37- virtual EGLNativeWindowType egl_native_window() = 0;
38+ virtual EGLNativeWindowType egl_native_window(std::shared_ptr<frontend::Surface> const&) = 0;
39 protected:
40 InternalClient() = default;
41 virtual ~InternalClient() = default;
42
43=== modified file 'include/server/mir/graphics/platform.h'
44--- include/server/mir/graphics/platform.h 2013-05-07 19:45:01 +0000
45+++ include/server/mir/graphics/platform.h 2013-05-14 23:46:25 +0000
46@@ -56,7 +56,7 @@
47 std::shared_ptr<BufferInitializer> const& buffer_initializer) = 0;
48 virtual std::shared_ptr<Display> create_display() = 0;
49 virtual std::shared_ptr<PlatformIPCPackage> get_ipc_package() = 0;
50- virtual std::shared_ptr<InternalClient> create_internal_client(std::shared_ptr<frontend::Surface> const&) = 0;
51+ virtual std::shared_ptr<InternalClient> create_internal_client() = 0;
52 };
53
54 // Create and return a new graphics platform.
55
56=== modified file 'include/test/mir_test_doubles/stub_platform.h'
57--- include/test/mir_test_doubles/stub_platform.h 2013-05-07 22:33:03 +0000
58+++ include/test/mir_test_doubles/stub_platform.h 2013-05-14 23:46:25 +0000
59@@ -48,7 +48,7 @@
60 return std::make_shared<graphics::PlatformIPCPackage>();
61 }
62
63- std::shared_ptr<graphics::InternalClient> create_internal_client(std::shared_ptr<frontend::Surface> const&)
64+ std::shared_ptr<graphics::InternalClient> create_internal_client()
65 {
66 return std::shared_ptr<graphics::InternalClient>();
67 }
68
69=== modified file 'src/server/graphics/android/android_platform.cpp'
70--- src/server/graphics/android/android_platform.cpp 2013-05-07 20:24:11 +0000
71+++ src/server/graphics/android/android_platform.cpp 2013-05-14 23:46:25 +0000
72@@ -61,10 +61,9 @@
73 return std::make_shared<mg::PlatformIPCPackage>();
74 }
75
76-std::shared_ptr<mg::InternalClient> mga::AndroidPlatform::create_internal_client(
77- std::shared_ptr<mf::Surface> const& surface)
78+std::shared_ptr<mg::InternalClient> mga::AndroidPlatform::create_internal_client()
79 {
80- return std::make_shared<mga::InternalClient>(surface);
81+ return std::make_shared<mga::InternalClient>();
82 }
83
84 std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<DisplayReport> const& display_report)
85
86=== modified file 'src/server/graphics/android/android_platform.h'
87--- src/server/graphics/android/android_platform.h 2013-05-07 19:45:01 +0000
88+++ src/server/graphics/android/android_platform.h 2013-05-14 23:46:25 +0000
89@@ -39,7 +39,7 @@
90 const std::shared_ptr<BufferInitializer>& buffer_initializer);
91 std::shared_ptr<Display> create_display();
92 std::shared_ptr<PlatformIPCPackage> get_ipc_package();
93- std::shared_ptr<InternalClient> create_internal_client(std::shared_ptr<frontend::Surface> const&);
94+ std::shared_ptr<InternalClient> create_internal_client();
95
96 private:
97 std::shared_ptr<DisplayReport> const display_report;
98
99=== modified file 'src/server/graphics/android/internal_client.cpp'
100--- src/server/graphics/android/internal_client.cpp 2013-05-07 20:15:09 +0000
101+++ src/server/graphics/android/internal_client.cpp 2013-05-14 23:46:25 +0000
102@@ -24,11 +24,9 @@
103 namespace mf=mir::frontend;
104 namespace mga=mir::graphics::android;
105
106-mga::InternalClient::InternalClient(std::shared_ptr<frontend::Surface> const& surface)
107+mga::InternalClient::InternalClient()
108+ : client_window(0)
109 {
110- auto cache = std::make_shared<mga::InterpreterCache>();
111- auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache);
112- client_window = std::make_shared<mga::MirNativeWindow>(interpreter);
113 }
114
115 EGLNativeDisplayType mga::InternalClient::egl_native_display()
116@@ -36,7 +34,14 @@
117 return EGL_DEFAULT_DISPLAY;
118 }
119
120-EGLNativeWindowType mga::InternalClient::egl_native_window()
121+EGLNativeWindowType mga::InternalClient::egl_native_window(std::shared_ptr<mf::Surface> const& surface)
122 {
123+ if (!client_window)
124+ {
125+ auto cache = std::make_shared<mga::InterpreterCache>();
126+ auto interpreter = std::make_shared<mga::InternalClientWindow>(surface, cache);
127+ client_window = std::make_shared<mga::MirNativeWindow>(interpreter);
128+ }
129+
130 return client_window.get();
131 }
132
133=== modified file 'src/server/graphics/android/internal_client.h'
134--- src/server/graphics/android/internal_client.h 2013-05-07 20:15:09 +0000
135+++ src/server/graphics/android/internal_client.h 2013-05-14 23:46:25 +0000
136@@ -37,9 +37,9 @@
137 class InternalClient : public mir::graphics::InternalClient
138 {
139 public:
140- InternalClient(std::shared_ptr<frontend::Surface> const&);
141+ InternalClient();
142 EGLNativeDisplayType egl_native_display();
143- EGLNativeWindowType egl_native_window();
144+ EGLNativeWindowType egl_native_window(std::shared_ptr<frontend::Surface> const&);
145
146 private:
147 std::shared_ptr<MirNativeWindow> client_window;
148
149=== modified file 'src/server/graphics/gbm/gbm_platform.cpp'
150--- src/server/graphics/gbm/gbm_platform.cpp 2013-05-08 18:57:03 +0000
151+++ src/server/graphics/gbm/gbm_platform.cpp 2013-05-14 23:46:25 +0000
152@@ -118,13 +118,12 @@
153 drm.auth_magic(magic);
154 }
155
156-std::shared_ptr<mg::InternalClient> mgg::GBMPlatform::create_internal_client(
157- std::shared_ptr<frontend::Surface> const& surface)
158+std::shared_ptr<mg::InternalClient> mgg::GBMPlatform::create_internal_client()
159 {
160 if (!internal_native_display)
161 internal_native_display = std::make_shared<mgg::InternalNativeDisplay>(get_ipc_package());
162 internal_display_clients_present = true;
163- return std::make_shared<mgg::InternalClient>(internal_native_display, surface);
164+ return std::make_shared<mgg::InternalClient>(internal_native_display);
165 }
166
167 std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<DisplayReport> const& report)
168
169=== modified file 'src/server/graphics/gbm/gbm_platform.h'
170--- src/server/graphics/gbm/gbm_platform.h 2013-05-08 18:57:03 +0000
171+++ src/server/graphics/gbm/gbm_platform.h 2013-05-14 23:46:25 +0000
172@@ -48,7 +48,7 @@
173 const std::shared_ptr<BufferInitializer>& buffer_initializer);
174 std::shared_ptr<Display> create_display();
175 std::shared_ptr<PlatformIPCPackage> get_ipc_package();
176- std::shared_ptr<InternalClient> create_internal_client(std::shared_ptr<frontend::Surface> const&);
177+ std::shared_ptr<InternalClient> create_internal_client();
178
179 /* From DRMAuthenticator */
180 void drm_auth_magic(drm_magic_t magic);
181
182=== modified file 'src/server/graphics/gbm/internal_client.cpp'
183--- src/server/graphics/gbm/internal_client.cpp 2013-05-09 18:46:57 +0000
184+++ src/server/graphics/gbm/internal_client.cpp 2013-05-14 23:46:25 +0000
185@@ -22,10 +22,8 @@
186 namespace mgg=mir::graphics::gbm;
187 namespace mf=mir::frontend;
188
189-mgg::InternalClient::InternalClient(std::shared_ptr<MirMesaEGLNativeDisplay> const& native_display,
190- std::shared_ptr<mf::Surface> const& surface)
191- : native_display(native_display),
192- surface(surface)
193+mgg::InternalClient::InternalClient(std::shared_ptr<MirMesaEGLNativeDisplay> const& native_display)
194+ : native_display(native_display)
195 {
196 }
197
198@@ -34,7 +32,7 @@
199 return reinterpret_cast<EGLNativeDisplayType>(native_display.get());
200 }
201
202-EGLNativeWindowType mgg::InternalClient::egl_native_window()
203+EGLNativeWindowType mgg::InternalClient::egl_native_window(std::shared_ptr<mf::Surface> const& surface)
204 {
205 return reinterpret_cast<EGLNativeWindowType>(surface.get());
206 }
207
208=== modified file 'src/server/graphics/gbm/internal_client.h'
209--- src/server/graphics/gbm/internal_client.h 2013-05-08 18:57:03 +0000
210+++ src/server/graphics/gbm/internal_client.h 2013-05-14 23:46:25 +0000
211@@ -38,14 +38,12 @@
212 class InternalClient : public mir::graphics::InternalClient
213 {
214 public:
215- InternalClient(std::shared_ptr<MirMesaEGLNativeDisplay> const&,
216- std::shared_ptr<frontend::Surface> const&);
217+ InternalClient(std::shared_ptr<MirMesaEGLNativeDisplay> const&);
218 EGLNativeDisplayType egl_native_display();
219- EGLNativeWindowType egl_native_window();
220+ EGLNativeWindowType egl_native_window(std::shared_ptr<frontend::Surface> const&);
221
222 private:
223 std::shared_ptr<MirMesaEGLNativeDisplay> const native_display;
224- std::shared_ptr<frontend::Surface> const surface;
225 };
226
227 }
228
229=== modified file 'tests/integration-tests/graphics/android/test_internal_client.cpp'
230--- tests/integration-tests/graphics/android/test_internal_client.cpp 2013-05-07 19:45:01 +0000
231+++ tests/integration-tests/graphics/android/test_internal_client.cpp 2013-05-14 23:46:25 +0000
232@@ -93,7 +93,7 @@
233
234 auto report = std::shared_ptr<mg::NullDisplayReport>();
235 auto platform = mg::create_platform(report);
236- auto internal_client = platform->create_internal_client(mir_surface);
237+ auto internal_client = platform->create_internal_client();
238
239 int major, minor, n;
240 EGLContext egl_context;
241@@ -116,7 +116,7 @@
242 rc = eglChooseConfig(egl_display, attribs, &egl_config, 1, &n);
243 EXPECT_EQ(EGL_TRUE, rc);
244
245- egl_surface = eglCreateWindowSurface(egl_display, egl_config, internal_client->egl_native_window(), NULL);
246+ egl_surface = eglCreateWindowSurface(egl_display, egl_config, internal_client->egl_native_window(mir_surface), NULL);
247 EXPECT_NE(EGL_NO_SURFACE, egl_surface);
248
249 egl_context = eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, context_attribs);
250
251=== modified file 'tests/integration-tests/graphics/gbm/test_buffer_integration.cpp'
252--- tests/integration-tests/graphics/gbm/test_buffer_integration.cpp 2013-05-07 22:33:03 +0000
253+++ tests/integration-tests/graphics/gbm/test_buffer_integration.cpp 2013-05-14 23:46:25 +0000
254@@ -100,7 +100,7 @@
255 return std::shared_ptr<mg::PlatformIPCPackage>();
256 }
257
258- std::shared_ptr<mg::InternalClient> create_internal_client(std::shared_ptr<mir::frontend::Surface> const&)
259+ std::shared_ptr<mg::InternalClient> create_internal_client()
260 {
261 return std::shared_ptr<mg::InternalClient>();
262 }
263
264=== modified file 'tests/integration-tests/test_display_info.cpp'
265--- tests/integration-tests/test_display_info.cpp 2013-05-07 19:45:01 +0000
266+++ tests/integration-tests/test_display_info.cpp 2013-05-14 23:46:25 +0000
267@@ -105,7 +105,7 @@
268 return std::make_shared<mg::PlatformIPCPackage>();
269 }
270
271- std::shared_ptr<mg::InternalClient> create_internal_client(std::shared_ptr<mf::Surface> const&)
272+ std::shared_ptr<mg::InternalClient> create_internal_client()
273 {
274 return std::shared_ptr<mg::InternalClient>();
275 }
276
277=== modified file 'tests/integration-tests/test_drm_auth_magic.cpp'
278--- tests/integration-tests/test_drm_auth_magic.cpp 2013-05-07 22:33:03 +0000
279+++ tests/integration-tests/test_drm_auth_magic.cpp 2013-05-14 23:46:25 +0000
280@@ -80,7 +80,7 @@
281 return std::make_shared<mg::PlatformIPCPackage>();
282 }
283
284- std::shared_ptr<mg::InternalClient> create_internal_client(std::shared_ptr<mir::frontend::Surface> const&)
285+ std::shared_ptr<mg::InternalClient> create_internal_client()
286 {
287 return std::shared_ptr<mg::InternalClient>();
288 }
289
290=== modified file 'tests/integration-tests/test_surfaceloop.cpp'
291--- tests/integration-tests/test_surfaceloop.cpp 2013-05-07 19:45:01 +0000
292+++ tests/integration-tests/test_surfaceloop.cpp 2013-05-14 23:46:25 +0000
293@@ -356,7 +356,7 @@
294 return std::make_shared<mg::PlatformIPCPackage>();
295 }
296
297- std::shared_ptr<mg::InternalClient> create_internal_client(std::shared_ptr<mf::Surface> const&)
298+ std::shared_ptr<mg::InternalClient> create_internal_client()
299 {
300 return std::shared_ptr<mg::InternalClient>();
301 }
302@@ -488,7 +488,7 @@
303 return std::make_shared<mg::PlatformIPCPackage>();
304 }
305
306- std::shared_ptr<mg::InternalClient> create_internal_client(std::shared_ptr<mf::Surface> const&)
307+ std::shared_ptr<mg::InternalClient> create_internal_client()
308 {
309 return std::shared_ptr<mg::InternalClient>();
310 }
311
312=== modified file 'tests/mir_test_framework/testing_server_options.cpp'
313--- tests/mir_test_framework/testing_server_options.cpp 2013-05-07 19:45:01 +0000
314+++ tests/mir_test_framework/testing_server_options.cpp 2013-05-14 23:46:25 +0000
315@@ -119,7 +119,7 @@
316 return std::make_shared<mg::PlatformIPCPackage>();
317 }
318
319- std::shared_ptr<mg::InternalClient> create_internal_client(std::shared_ptr<mf::Surface> const&)
320+ std::shared_ptr<mg::InternalClient> create_internal_client()
321 {
322 return std::shared_ptr<mg::InternalClient>();
323 }
324
325=== modified file 'tests/unit-tests/frontend/test_session_mediator_gbm.cpp'
326--- tests/unit-tests/frontend/test_session_mediator_gbm.cpp 2013-05-07 22:33:03 +0000
327+++ tests/unit-tests/frontend/test_session_mediator_gbm.cpp 2013-05-14 23:46:25 +0000
328@@ -83,7 +83,7 @@
329 return std::make_shared<mg::PlatformIPCPackage>();
330 }
331
332- std::shared_ptr<mg::InternalClient> create_internal_client(std::shared_ptr<mf::Surface> const&)
333+ std::shared_ptr<mg::InternalClient> create_internal_client()
334 {
335 return std::shared_ptr<mg::InternalClient>();
336 }
337
338=== modified file 'tests/unit-tests/graphics/android/test_internal_client.cpp'
339--- tests/unit-tests/graphics/android/test_internal_client.cpp 2013-05-07 20:07:10 +0000
340+++ tests/unit-tests/graphics/android/test_internal_client.cpp 2013-05-14 23:46:25 +0000
341@@ -68,15 +68,15 @@
342 TEST(InternalClient, native_display)
343 {
344 auto surface = std::make_shared<StubSurface>();
345- mga::InternalClient client(surface);
346+ mga::InternalClient client;
347 EXPECT_EQ(EGL_DEFAULT_DISPLAY, client.egl_native_display());
348 }
349
350 TEST(InternalClient, native_window)
351 {
352 auto surface = std::make_shared<StubSurface>();
353- mga::InternalClient client(surface);
354- ANativeWindow* native_window = static_cast<ANativeWindow*>(client.egl_native_window());
355+ mga::InternalClient client;
356+ ANativeWindow* native_window = static_cast<ANativeWindow*>(client.egl_native_window(surface));
357
358 /* check for basic window sanity */
359 ASSERT_NE(nullptr, native_window);
360
361=== modified file 'tests/unit-tests/graphics/gbm/test_gbm_platform.cpp'
362--- tests/unit-tests/graphics/gbm/test_gbm_platform.cpp 2013-05-08 18:57:03 +0000
363+++ tests/unit-tests/graphics/gbm/test_gbm_platform.cpp 2013-05-14 23:46:25 +0000
364@@ -21,7 +21,6 @@
365 #include "src/server/graphics/gbm/gbm_platform.h"
366 #include "src/server/graphics/gbm/internal_client.h"
367 #include "mir_test_doubles/null_virtual_terminal.h"
368-#include "mir_test_doubles/stub_surface.h"
369
370 #include "mir/graphics/null_display_report.h"
371
372@@ -148,12 +147,11 @@
373 */
374 TEST_F(GBMGraphicsPlatform, platform_provides_validation_of_display_for_internal_clients)
375 {
376- auto stub_surface = std::make_shared<mtd::StubSurface>();
377 MirMesaEGLNativeDisplay* native_display = nullptr;
378 EXPECT_EQ(0, mir_server_internal_display_is_valid(native_display));
379 {
380 auto platform = create_platform();
381- auto client = platform->create_internal_client(stub_surface);
382+ auto client = platform->create_internal_client();
383 native_display = reinterpret_cast<MirMesaEGLNativeDisplay*>(client->egl_native_display());
384 EXPECT_EQ(1, mir_server_internal_display_is_valid(native_display));
385 }
386
387=== modified file 'tests/unit-tests/graphics/gbm/test_internal_client.cpp'
388--- tests/unit-tests/graphics/gbm/test_internal_client.cpp 2013-05-08 18:57:03 +0000
389+++ tests/unit-tests/graphics/gbm/test_internal_client.cpp 2013-05-14 23:46:25 +0000
390@@ -33,10 +33,10 @@
391 {
392 auto stub_window = std::make_shared<mtd::StubSurface>();
393 auto stub_display = std::make_shared<MirMesaEGLNativeDisplay>();
394- mgg::InternalClient client(stub_display, stub_window);
395+ mgg::InternalClient client(stub_display);
396
397 auto native_display = client.egl_native_display();
398- auto native_window = client.egl_native_window();
399+ auto native_window = client.egl_native_window(stub_window);
400
401 EXPECT_EQ(reinterpret_cast<EGLNativeDisplayType>(stub_display.get()), native_display);
402 EXPECT_EQ(reinterpret_cast<EGLNativeWindowType>(stub_window.get()), native_window);

Subscribers

People subscribed via source and target branches