Mir

Merge lp:~hikiko/mir/mir.nested-gbm into lp:~mir-team/mir/trunk

Proposed by Eleni Maria Stea
Status: Work in progress
Proposed branch: lp:~hikiko/mir/mir.nested-gbm
Merge into: lp:~mir-team/mir/trunk
Diff against target: 1477 lines (+1138/-11) (has conflicts)
31 files modified
CMakeLists.txt (+14/-2)
examples/CMakeLists.txt (+1/-0)
examples/demo_client_accelerated.cpp (+4/-4)
examples/demo_server.cpp (+13/-0)
include/shared/mir/default_configuration.h (+4/-0)
include/shared/mir_toolkit/client_types.h (+2/-1)
src/client/CMakeLists.txt (+15/-0)
src/client/gbm/gbm_client_platform.cpp (+1/-1)
src/client/mir_client_library.cpp (+1/-1)
src/client/nested_gbm/nested_gbm_client_platform.cpp (+26/-0)
src/client/nested_gbm/nested_gbm_client_platform.h (+43/-0)
src/server/frontend/CMakeLists.txt (+3/-0)
src/server/graphics/CMakeLists.txt (+4/-0)
src/server/graphics/gbm/gbm_buffer_allocator.cpp (+13/-0)
src/server/graphics/gbm/gbm_buffer_allocator.h (+13/-0)
src/server/graphics/gbm/gbm_platform.h (+4/-1)
src/server/graphics/gbm/internal_client.cpp (+1/-1)
src/server/graphics/nested_gbm/CMakeLists.txt (+49/-0)
src/server/graphics/nested_gbm/nested_gbm_context_store.cpp (+40/-0)
src/server/graphics/nested_gbm/nested_gbm_context_store.h (+43/-0)
src/server/graphics/nested_gbm/nested_gbm_display.cpp (+228/-0)
src/server/graphics/nested_gbm/nested_gbm_display.h (+101/-0)
src/server/graphics/nested_gbm/nested_gbm_display_configuration.cpp (+31/-0)
src/server/graphics/nested_gbm/nested_gbm_display_configuration.h (+38/-0)
src/server/graphics/nested_gbm/nested_gbm_gl_context.cpp (+59/-0)
src/server/graphics/nested_gbm/nested_gbm_gl_context.h (+50/-0)
src/server/graphics/nested_gbm/nested_gbm_platform.cpp (+170/-0)
src/server/graphics/nested_gbm/nested_gbm_platform.h (+83/-0)
src/server/graphics/nested_gbm/nested_gbm_surface_store.cpp (+40/-0)
src/server/graphics/nested_gbm/nested_gbm_surface_store.h (+43/-0)
src/server/run_mir.cpp (+1/-0)
Text conflict in CMakeLists.txt
To merge this branch: bzr merge lp:~hikiko/mir/mir.nested-gbm
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Alan Griffiths Needs Fixing
Alexandros Frantzis (community) Needs Fixing
Kevin DuBois (community) Needs Fixing
Robert Ancell Pending
Review via email: mp+173284@code.launchpad.net

Description of the change

This branch implements a first version of a nested gbm display. It's not 100% ready yet, it might need fixes and it certainly needs some polishing. Nevertheless, I did the MP because I'd like to get some feedback while I write a first version of a nested android display. Any comments/suggestions are welcome! Thanks!

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:771
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~hikiko/mir/mir.nested-gbm/+merge/173284/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mir-ci/926/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-android-saucy-i386-build/1190/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-clang-saucy-amd64-build/1074/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-saucy-amd64-ci/164/console

Click here to trigger a rebuild:
http://s-jenkins:8080/job/mir-ci/926/rebuild

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

+#ifdef NESTED_GBM
we're pretty much ifdef-free, we should work on getting nested mir servers to work without ifdefs

there are a few c-style casts
l219 : (long unsigned int)

src/server/graphics/nested_gbm/nested_gbm_display.cpp
has a lot of classes in it, we try to keep it to 1 class per cpp/h as best as makes sense

lastly, a 'platform' should just be the class of drivers that mir is running on (mesa-based or android based at the moment). A non-native display shouldn't constitute a new platform, rather an option that we can turn on for either platform. Both android and gbm should be able to use the same code for the nested mir display classes

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

if i could suggest a landing strategy :)

Right now the structure of the project (in terms of file directories and build options) is not very well suited for sharing code between android and gbm platforms. We should resurrect lp:~raof/mir/separate-graphics-buffer-and-display and get the files and build system in shape for accomodating a mir driver platform using the same code to get a nested-mir-based display.

Revision history for this message
Eleni Maria Stea (hikiko) wrote :

@Kevin, thanks for the feedback! :)
The suggestion for the separation of display/buffers is something that we certainly have to do at some point.. but I am not sure if I have to do it now or when I finish the nested android display... So, I'll start with the cleanup the mested_gbm_display.cpp and the ifdef for the moment!

Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

My understanding is that this is a spike for the nested mir effort, and not the final design (as described in https://lists.ubuntu.com/archives/mir-devel/2013-June/000166.html), so I will not focus on the general design in this review.

> src/server/graphics/nested_gbm/nested_gbm_display.cpp
> has a lot of classes in it, we try to keep it to 1 class per cpp/h as best as makes sense

These are internal utility classes, and should be placed in an anonymous namespace.

663 + if(!platform->nm_connection) {
664 + BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Connection to host-mir not found!\n"));
665 + }
...and at other places

The opening brace should be placed on its own line (or the braces can be omitted for single lines), see http://unity.ubuntu.com/mir/cppguide/index.html#Conditionals .

677 + mir_surface_get_graphics_region(nm_surface, &nm_graphics_region);

This is called before nm_surface is created, plus you probably don't want to get the "graphics_region" (which maps the buffer to system memory) anyway. This confusion indicates a naming problem with the API, mir_surface_map() would probably be clearer.

778 +void mgng::NestedGBMDisplay::clear()

The clear() method has been removed from the Display class.

review: Needs Fixing
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :
Download full text (3.6 KiB)

The #ifdef approach is fine for a "proof of concept" spike, but *not* something we want to land on trunk.

The difference between the host and nested Mir processes should be a matter of configuration, not a separate build. (The two "platforms" Mir supports are android and gbm - nested/mir-on-mir isn't a separately compiled platform.)

Having said that, having the "nested" configuration load a different graphicsplatform library is a possible approach (if we really need that much separate code).

~~~~

1 === added directory '3rd_party/cucumber-cpp'

Not needed.

~~~

46 - "graphics backend to build (options are 'gbm' or 'android')"
47 + "graphics backend to build (options are 'gbm' or 'android' or 'nested_gbm')"
...
192 +if( MIR_PLATFORM STREQUAL "nested_gbm")
...
324 +elseif (MIR_PLATFORM STREQUAL "nested_gbm")
325 + include_directories(${DRM_INCLUDE_DIRS})
326 + list(APPEND FRONTEND_SOURCES session_mediator_gbm.cpp)
...
338 +if (MIR_PLATFORM STREQUAL "nested_gbm")
339 + add_subdirectory(nested_gbm/)
340 +endif()

See above discussion. "nested_gbm" is not a target platform, nested is a runtime option (implicitly gbm or android depending on the build).

~~~~

79 +# add_subdirectory(tests/)

We don't want to disable tests.

~~~~

138 +/* MirConnection* nm_connection;
139 + if(!(nm_connection = mir_connect_sync("/tmp/mir_socket", "nested_mir"))) {
140 + BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Failed to connect!\n"));
141 + }
142 + if(!mir_connection_is_valid(nm_connection)) {
143 + BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Invalid connection!\n"));
144 + }
145 + if(!(strcmp(mir_connection_get_error_message(nm_connection),"") == 0))
146 + {
147 + BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Errors occured!\n"));
148 + }
149 + */

Comments should not be used to store old code - that's what version control is for.

~~~~

162 +#ifdef NESTED_GBM
163 +const char default_server_socket[] = "/tmp/mir_socket_nested";
164 +#else
165 const char default_server_socket[] = "/tmp/mir_socket";
166 +#endif
...
361 +#ifdef NESTED_GBM
362 +mgg::GBMBufferAllocator::GBMBufferAllocator(
363 + const std::shared_ptr<mgng::NestedGBMPlatform>& platform,
364 + const std::shared_ptr<BufferInitializer>& buffer_initializer)
365 + : platform(platform),
366 + buffer_initializer(buffer_initializer),
367 + egl_extensions(std::make_shared<mg::EGLExtensions>())
368 +{
369 + assert(buffer_initializer.get() != 0);
370 +}
371 +#else
...
404 +#ifdef NESTED_GBM
405 + GBMBufferAllocator(const std::shared_ptr<mgng::NestedGBMPlatform>& platform,
406 + const std::shared_ptr<BufferInitializer>& buffer_initializer);
407 +#else

See above discussion - these should be controlled by configuration parameters at runtime, not selected at compile time.

~~~~

418 +#ifdef NESTED_GBM
419 + std::shared_ptr<mgng::NestedGBMPlatform> platform;
420 +#else
421 std::shared_ptr<GBMPlatform> platform;
422 +#endif

Either a common interface is needed or there needs to be two versions.

~~~~

434 +#include "internal_client.h"

Not needed - only a declaration is used in the header, not an definition.

~~~~

498 + ../../frontend/session_mediator_gbm.cpp
...

Read more...

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:772
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~hikiko/mir/mir.nested-gbm/+merge/173284/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/mir-ci/950/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-android-saucy-i386-build/1226/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-clang-saucy-amd64-build/1110/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/mir-saucy-amd64-ci/188/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/mir-vm-ci-build/./distribution=quantal,flavor=amd64/591

Click here to trigger a rebuild:
http://s-jenkins:8080/job/mir-ci/950/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Eleni Maria Stea (hikiko) wrote :

Thank you all for your comments/suggestions! I changed the status to "work in progress" so that each push doesn't cause a Jenkins rebuild while I fix/polish/refactor the branch. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-07-08 03:12:22 +0000
3+++ CMakeLists.txt 2013-07-09 13:08:27 +0000
4@@ -92,7 +92,7 @@
5 gbm
6 CACHE
7 STRING
8- "graphics backend to build (options are 'gbm' or 'android')"
9+ "graphics backend to build (options are 'gbm' or 'android' or 'nested_gbm')"
10 )
11
12 find_package(EGL REQUIRED)
13@@ -130,8 +130,14 @@
14 pkg_check_modules( DRM REQUIRED libdrm )
15 pkg_check_modules( UDEV REQUIRED libudev )
16 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__GBM__")
17+elseif (MIR_PLATFORM STREQUAL "nested_gbm")
18+ find_package( PkgConfig )
19+ pkg_check_modules( GBM REQUIRED gbm>=9.0.0)
20+ pkg_check_modules( DRM REQUIRED libdrm )
21+ pkg_check_modules( MIRCLIENT REQUIRED mirclient )
22+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNESTED_GBM")
23 else ()
24- message (FATAL_ERROR "MIR_BACKEND must be either 'android' or 'gbm'")
25+ message (FATAL_ERROR "MIR_BACKEND must be either 'android' or 'gbm' or 'nested_gbm'")
26 endif()
27
28 set(MIR_ANDROID_INCLUDE_DIRECTORIES) # to be filled by android-input
29@@ -183,10 +189,16 @@
30 # Restore -Werror for non-3rd-party code
31 set (CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
32
33+<<<<<<< TREE
34 option(MIR_ENABLE_TESTS "Build tests" ON)
35
36 if (MIR_ENABLE_TESTS)
37 add_subdirectory(tests/)
38+=======
39+add_subdirectory(benchmarks/)
40+if (MIR_TESTS_AVAILABLE)
41+# add_subdirectory(tests/)
42+>>>>>>> MERGE-SOURCE
43 endif ()
44 add_subdirectory(benchmarks/)
45 add_subdirectory(tools/)
46
47=== modified file 'examples/CMakeLists.txt'
48--- examples/CMakeLists.txt 2013-07-08 22:22:00 +0000
49+++ examples/CMakeLists.txt 2013-07-09 13:08:27 +0000
50@@ -135,6 +135,7 @@
51
52 target_link_libraries(mir_demo_server
53 mirserver
54+ mirclient
55 ${Boost_LIBRARIES}
56 )
57
58
59=== modified file 'examples/demo_client_accelerated.cpp'
60--- examples/demo_client_accelerated.cpp 2013-07-08 22:22:00 +0000
61+++ examples/demo_client_accelerated.cpp 2013-07-09 13:08:27 +0000
62@@ -58,9 +58,9 @@
63 puts("Starting");
64
65 connection = mir_connect_sync(socket_file, __PRETTY_FUNCTION__);
66- assert(connection != NULL);
67+ assert(connection);
68 assert(mir_connection_is_valid(connection));
69- assert(strcmp(mir_connection_get_error_message(connection), "") == 0);
70+ // assert(strcmp(mir_connection_get_error_message(connection), "") == 0);
71 puts("Connected");
72
73 MirDisplayInfo display_info;
74@@ -73,7 +73,7 @@
75 {__PRETTY_FUNCTION__, 640, 480, pixel_format, mir_buffer_usage_hardware};
76
77 surface = mir_connection_create_surface_sync(connection, &request_params);
78- assert(surface != NULL);
79+ assert(surface);
80 assert(mir_surface_is_valid(surface));
81 assert(strcmp(mir_surface_get_error_message(surface), "") == 0);
82 puts("Surface created");
83@@ -96,7 +96,7 @@
84
85 EGLNativeDisplayType native_display = (EGLNativeDisplayType) mir_connection_get_egl_native_display(connection);
86 EGLNativeWindowType native_window = (EGLNativeWindowType) mir_surface_get_egl_native_window(surface);
87- assert(native_window != NULL);
88+ assert(native_window);
89
90 disp = eglGetDisplay(native_display);
91 assert(disp != EGL_NO_DISPLAY);
92
93=== modified file 'examples/demo_server.cpp'
94--- examples/demo_server.cpp 2013-05-01 00:58:45 +0000
95+++ examples/demo_server.cpp 2013-07-09 13:08:27 +0000
96@@ -25,6 +25,19 @@
97 int main(int argc, char const* argv[])
98 try
99 {
100+/* MirConnection* nm_connection;
101+ if(!(nm_connection = mir_connect_sync("/tmp/mir_socket", "nested_mir"))) {
102+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Failed to connect!\n"));
103+ }
104+ if(!mir_connection_is_valid(nm_connection)) {
105+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Invalid connection!\n"));
106+ }
107+ if(!(strcmp(mir_connection_get_error_message(nm_connection),"") == 0))
108+ {
109+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Errors occured!\n"));
110+ }
111+ */
112+
113 mir::DefaultServerConfiguration config(argc, argv);
114
115 run_mir(config, [](mir::DisplayServer&) {/* empty init */});
116
117=== modified file 'include/shared/mir/default_configuration.h'
118--- include/shared/mir/default_configuration.h 2013-04-22 08:20:31 +0000
119+++ include/shared/mir/default_configuration.h 2013-07-09 13:08:27 +0000
120@@ -23,7 +23,11 @@
121
122 namespace mir
123 {
124+#ifdef NESTED_GBM
125+const char default_server_socket[] = "/tmp/mir_socket_nested";
126+#else
127 const char default_server_socket[] = "/tmp/mir_socket";
128+#endif
129 }
130
131 #endif
132
133=== modified file 'include/shared/mir_toolkit/client_types.h'
134--- include/shared/mir_toolkit/client_types.h 2013-06-20 09:43:30 +0000
135+++ include/shared/mir_toolkit/client_types.h 2013-07-09 13:08:27 +0000
136@@ -126,7 +126,8 @@
137 typedef enum MirPlatformType
138 {
139 mir_platform_type_gbm,
140- mir_platform_type_android
141+ mir_platform_type_android,
142+ mir_platform_type_nested_gbm
143 } MirPlatformType;
144
145 typedef struct MirPlatformPackage
146
147=== modified file 'src/client/CMakeLists.txt'
148--- src/client/CMakeLists.txt 2013-07-02 19:38:24 +0000
149+++ src/client/CMakeLists.txt 2013-07-09 13:08:27 +0000
150@@ -59,6 +59,21 @@
151 )
152 endif()
153
154+if( MIR_PLATFORM STREQUAL "nested_gbm")
155+set(
156+ CLIENT_SOURCES
157+
158+ nested_gbm/nested_gbm_client_platform.cpp
159+
160+ gbm/gbm_client_platform.cpp
161+ gbm/gbm_client_buffer_factory.cpp
162+ gbm/gbm_client_buffer.cpp
163+ gbm/mesa_native_display_container.cpp
164+ gbm/gbm_native_surface.cpp
165+ ${CLIENT_SOURCES}
166+)
167+endif()
168+
169 add_library(
170 mirclient SHARED
171
172
173=== modified file 'src/client/gbm/gbm_client_platform.cpp'
174--- src/client/gbm/gbm_client_platform.cpp 2013-06-13 22:44:04 +0000
175+++ src/client/gbm/gbm_client_platform.cpp 2013-07-09 13:08:27 +0000
176@@ -153,7 +153,7 @@
177 //TODO: this is awkward on both android and gbm...
178 auto gbm_window = new GBMNativeSurface(*client_surface);
179 auto egl_native_window = new EGLNativeWindowType;
180- *egl_native_window = gbm_window;
181+ *egl_native_window = (long unsigned int)gbm_window;
182 NativeWindowDeleter deleter(gbm_window);
183 return std::shared_ptr<EGLNativeWindowType>(egl_native_window, deleter);
184 }
185
186=== modified file 'src/client/mir_client_library.cpp'
187--- src/client/mir_client_library.cpp 2013-06-28 10:55:30 +0000
188+++ src/client/mir_client_library.cpp 2013-07-09 13:08:27 +0000
189@@ -264,7 +264,7 @@
190
191 MirEGLNativeWindowType mir_surface_get_egl_native_window(MirSurface *surface)
192 {
193- return surface->generate_native_window();
194+ return (MirEGLNativeWindowType)surface->generate_native_window();
195 }
196
197 MirWaitHandle *mir_connection_drm_auth_magic(MirConnection* connection,
198
199=== added directory 'src/client/nested_gbm'
200=== added file 'src/client/nested_gbm/nested_gbm_client_platform.cpp'
201--- src/client/nested_gbm/nested_gbm_client_platform.cpp 1970-01-01 00:00:00 +0000
202+++ src/client/nested_gbm/nested_gbm_client_platform.cpp 2013-07-09 13:08:27 +0000
203@@ -0,0 +1,26 @@
204+/*
205+ * Copyright © 2012 Canonical Ltd.
206+ *
207+ * This program is free software: you can redistribute it and/or modify it
208+ * under the terms of the GNU Lesser General Public License version 3,
209+ * as published by the Free Software Foundation.
210+ *
211+ * This program is distributed in the hope that it will be useful,
212+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
213+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
214+ * GNU Lesser General Public License for more details.
215+ *
216+ * You should have received a copy of the GNU Lesser General Public License
217+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
218+ *
219+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
220+ */
221+
222+#include "nested_gbm_client_platform.h"
223+
224+namespace mclng = mir::client::nested_gbm;
225+
226+MirPlatformType mclng::NestedGBMClientPlatform::platform_type() const
227+{
228+ return mir_platform_type_nested_gbm;
229+}
230
231=== added file 'src/client/nested_gbm/nested_gbm_client_platform.h'
232--- src/client/nested_gbm/nested_gbm_client_platform.h 1970-01-01 00:00:00 +0000
233+++ src/client/nested_gbm/nested_gbm_client_platform.h 2013-07-09 13:08:27 +0000
234@@ -0,0 +1,43 @@
235+/*
236+ * Copyright © 2012 Canonical Ltd.
237+ *
238+ * This program is free software: you can redistribute it and/or modify it
239+ * under the terms of the GNU Lesser General Public License version 3,
240+ * as published by the Free Software Foundation.
241+ *
242+ * This program is distributed in the hope that it will be useful,
243+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
244+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
245+ * GNU Lesser General Public License for more details.
246+ *
247+ * You should have received a copy of the GNU Lesser General Public License
248+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
249+ *
250+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
251+ */
252+#ifndef MIR_CLIENT_NESTED_GBM_NESTED_GBM_CLIENT_PLATFORM_H_
253+#define MIR_CLIENT_NESTED_GBM_NESTED_GBM_CLIENT_PLATFORM_H_
254+
255+#include "../gbm/gbm_client_platform.h"
256+
257+namespace mclg = mir::client::gbm;
258+
259+namespace mir
260+{
261+namespace client
262+{
263+namespace nested_gbm
264+{
265+
266+class NestedGBMClientPlatform : public mclg::GBMClientPlatform
267+{
268+public:
269+ virtual ~NestedGBMClientPlatform() {}
270+ MirPlatformType platform_type() const;
271+};
272+
273+}
274+}
275+}
276+
277+#endif /* MIR_CLIENT_NESTED_GBM_NESTED_GBM_CLIENT_PLATFORM_H_ */
278
279=== modified file 'src/server/frontend/CMakeLists.txt'
280--- src/server/frontend/CMakeLists.txt 2013-05-30 19:24:29 +0000
281+++ src/server/frontend/CMakeLists.txt 2013-07-09 13:08:27 +0000
282@@ -25,6 +25,9 @@
283 elseif (MIR_PLATFORM STREQUAL "gbm")
284 include_directories(${DRM_INCLUDE_DIRS})
285 list(APPEND FRONTEND_SOURCES session_mediator_gbm.cpp)
286+elseif (MIR_PLATFORM STREQUAL "nested_gbm")
287+ include_directories(${DRM_INCLUDE_DIRS})
288+ list(APPEND FRONTEND_SOURCES session_mediator_gbm.cpp)
289 endif()
290
291 add_library(
292
293=== modified file 'src/server/graphics/CMakeLists.txt'
294--- src/server/graphics/CMakeLists.txt 2013-06-25 10:44:13 +0000
295+++ src/server/graphics/CMakeLists.txt 2013-07-09 13:08:27 +0000
296@@ -11,6 +11,10 @@
297 add_subdirectory(gbm/)
298 endif()
299
300+if (MIR_PLATFORM STREQUAL "nested_gbm")
301+ add_subdirectory(nested_gbm/)
302+endif()
303+
304 set(
305 GRAPHICS_SOURCES
306
307
308=== modified file 'src/server/graphics/gbm/gbm_buffer_allocator.cpp'
309--- src/server/graphics/gbm/gbm_buffer_allocator.cpp 2013-06-14 17:16:31 +0000
310+++ src/server/graphics/gbm/gbm_buffer_allocator.cpp 2013-07-09 13:08:27 +0000
311@@ -37,6 +37,7 @@
312
313 namespace mg = mir::graphics;
314 namespace mgg = mir::graphics::gbm;
315+namespace mgng = mir::graphics::nested_gbm;
316 namespace mc = mir::compositor;
317 namespace geom = mir::geometry;
318
319@@ -106,6 +107,17 @@
320
321 }
322
323+#ifdef NESTED_GBM
324+mgg::GBMBufferAllocator::GBMBufferAllocator(
325+ const std::shared_ptr<mgng::NestedGBMPlatform>& platform,
326+ const std::shared_ptr<BufferInitializer>& buffer_initializer)
327+ : platform(platform),
328+ buffer_initializer(buffer_initializer),
329+ egl_extensions(std::make_shared<mg::EGLExtensions>())
330+{
331+ assert(buffer_initializer.get() != 0);
332+}
333+#else
334 mgg::GBMBufferAllocator::GBMBufferAllocator(
335 const std::shared_ptr<GBMPlatform>& platform,
336 const std::shared_ptr<BufferInitializer>& buffer_initializer)
337@@ -115,6 +127,7 @@
338 {
339 assert(buffer_initializer.get() != 0);
340 }
341+#endif
342
343 std::shared_ptr<mc::Buffer> mgg::GBMBufferAllocator::alloc_buffer(
344 mc::BufferProperties const& buffer_properties)
345
346=== modified file 'src/server/graphics/gbm/gbm_buffer_allocator.h'
347--- src/server/graphics/gbm/gbm_buffer_allocator.h 2013-06-14 17:16:31 +0000
348+++ src/server/graphics/gbm/gbm_buffer_allocator.h 2013-07-09 13:08:27 +0000
349@@ -22,8 +22,12 @@
350 #include "mir/compositor/graphic_buffer_allocator.h"
351 #include "mir/compositor/buffer_id.h"
352
353+#include "../nested_gbm/nested_gbm_platform.h"
354+
355 #include <memory>
356
357+namespace mgng = mir::graphics::nested_gbm;
358+
359 namespace mir
360 {
361 namespace graphics
362@@ -38,8 +42,13 @@
363 class GBMBufferAllocator: public compositor::GraphicBufferAllocator
364 {
365 public:
366+#ifdef NESTED_GBM
367+ GBMBufferAllocator(const std::shared_ptr<mgng::NestedGBMPlatform>& platform,
368+ const std::shared_ptr<BufferInitializer>& buffer_initializer);
369+#else
370 GBMBufferAllocator(const std::shared_ptr<GBMPlatform>& platform,
371 const std::shared_ptr<BufferInitializer>& buffer_initializer);
372+#endif
373
374 virtual std::shared_ptr<compositor::Buffer> alloc_buffer(
375 compositor::BufferProperties const& buffer_properties);
376@@ -47,7 +56,11 @@
377 std::vector<geometry::PixelFormat> supported_pixel_formats();
378
379 private:
380+#ifdef NESTED_GBM
381+ std::shared_ptr<mgng::NestedGBMPlatform> platform;
382+#else
383 std::shared_ptr<GBMPlatform> platform;
384+#endif
385 std::shared_ptr<graphics::BufferInitializer> buffer_initializer;
386 std::shared_ptr<EGLExtensions> const egl_extensions;
387 };
388
389=== modified file 'src/server/graphics/gbm/gbm_platform.h'
390--- src/server/graphics/gbm/gbm_platform.h 2013-07-08 11:11:07 +0000
391+++ src/server/graphics/gbm/gbm_platform.h 2013-07-09 13:08:27 +0000
392@@ -22,9 +22,12 @@
393 #include "mir/graphics/platform.h"
394 #include "mir/graphics/drm_authenticator.h"
395 #include "gbm_display_helpers.h"
396+#include "internal_client.h"
397
398 #include "mir_toolkit/mesa/native_display.h"
399
400+namespace mg = mir::graphics;
401+
402 namespace mir
403 {
404 namespace graphics
405@@ -48,7 +51,7 @@
406 const std::shared_ptr<BufferInitializer>& buffer_initializer);
407 std::shared_ptr<Display> create_display();
408 std::shared_ptr<PlatformIPCPackage> get_ipc_package();
409- std::shared_ptr<InternalClient> create_internal_client();
410+ std::shared_ptr<mg::InternalClient> create_internal_client();
411
412 void fill_ipc_package(std::shared_ptr<compositor::BufferIPCPacker> const& packer,
413 std::shared_ptr<compositor::Buffer> const& buffer) const;
414
415=== modified file 'src/server/graphics/gbm/internal_client.cpp'
416--- src/server/graphics/gbm/internal_client.cpp 2013-06-05 21:17:25 +0000
417+++ src/server/graphics/gbm/internal_client.cpp 2013-07-09 13:08:27 +0000
418@@ -39,5 +39,5 @@
419 client_window = std::make_shared<mgg::InternalNativeSurface>(surface);
420 }
421
422- return client_window.get();
423+ return (EGLNativeWindowType)client_window.get();
424 }
425
426=== added directory 'src/server/graphics/nested_gbm'
427=== added file 'src/server/graphics/nested_gbm/CMakeLists.txt'
428--- src/server/graphics/nested_gbm/CMakeLists.txt 1970-01-01 00:00:00 +0000
429+++ src/server/graphics/nested_gbm/CMakeLists.txt 2013-07-09 13:08:27 +0000
430@@ -0,0 +1,49 @@
431+include_directories(
432+ ${MIRCLIENT_INCLUDE_DIRS}
433+ ${DRM_INCLUDE_DIRS}
434+ ${GBM_INCLUDE_DIRS}
435+ ${EGL_INCLUDE_DIRS}
436+ ${GLESv2_INCLUDE_DIRS}
437+ ${UDEV_INCLUDE_DIRS}
438+)
439+
440+# gbm.h and drm.h have trailing commas at the end of enum definitions
441+# This is valid C99, but g++ 4.4 flags it as an error with -pedantic
442+#string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
443+
444+
445+add_library(
446+ mirplatformgraphics STATIC
447+
448+ nested_gbm_platform.cpp
449+ nested_gbm_display.cpp
450+ nested_gbm_display_configuration.cpp
451+ nested_gbm_context_store.cpp
452+ nested_gbm_surface_store.cpp
453+ nested_gbm_gl_context.cpp
454+
455+ ../gbm/gbm_buffer.cpp
456+ ../gbm/gbm_buffer_allocator.cpp
457+ ../gbm/gbm_display_helpers.cpp
458+ ../gbm/internal_native_display.cpp
459+ ../gbm/internal_client.cpp
460+ ../gbm/drm_close_threadsafe.cpp
461+ ../gbm/drm_mode_resources.cpp
462+
463+ # from frontend
464+ ../../frontend/session_mediator_gbm.cpp
465+)
466+
467+target_link_libraries(
468+ mirplatformgraphics
469+ mircompositor
470+ mirlogging
471+ mirserver
472+
473+ ${MIRCLIENT_LDFLAGS} ${MIRCLIENT_LIBRARIES}
474+ ${DRM_LDFLAGS} ${DRM_LIBRARIES}
475+ ${GBM_LDFLAGS} ${GBM_LIBRARIES}
476+ ${EGL_LDFLAGS} ${EGL_LIBRARIES}
477+ ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
478+ ${UDEV_LDFLAGS} ${UDEV_LIBRARIES}
479+)
480
481=== added file 'src/server/graphics/nested_gbm/nested_gbm_context_store.cpp'
482--- src/server/graphics/nested_gbm/nested_gbm_context_store.cpp 1970-01-01 00:00:00 +0000
483+++ src/server/graphics/nested_gbm/nested_gbm_context_store.cpp 2013-07-09 13:08:27 +0000
484@@ -0,0 +1,40 @@
485+/*
486+ * Copyright © 2012 Canonical Ltd.
487+ *
488+ * This program is free software: you can redistribute it and/or modify it
489+ * under the terms of the GNU General Public License version 3,
490+ * as published by the Free Software Foundation.
491+ *
492+ * This program is distributed in the hope that it will be useful,
493+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
494+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
495+ * GNU General Public License for more details.
496+ *
497+ * You should have received a copy of the GNU General Public License
498+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
499+ *
500+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
501+ */
502+
503+#include "nested_gbm_context_store.h"
504+
505+#include <boost/throw_exception.hpp>
506+#include <stdexcept>
507+
508+EGLContextStore::EGLContextStore(EGLDisplay egl_display, EGLContext egl_context) :
509+ egl_display_{egl_display},
510+ egl_context_{egl_context}
511+{
512+ if (egl_context_ == EGL_NO_CONTEXT)
513+ BOOST_THROW_EXCEPTION(std::runtime_error("Could not create egl context\n"));
514+}
515+
516+EGLContextStore::~EGLContextStore()
517+{
518+ eglDestroyContext(egl_display_, egl_context_);
519+}
520+
521+EGLContextStore::operator EGLContext() const
522+{
523+ return egl_context_;
524+}
525
526=== added file 'src/server/graphics/nested_gbm/nested_gbm_context_store.h'
527--- src/server/graphics/nested_gbm/nested_gbm_context_store.h 1970-01-01 00:00:00 +0000
528+++ src/server/graphics/nested_gbm/nested_gbm_context_store.h 2013-07-09 13:08:27 +0000
529@@ -0,0 +1,43 @@
530+/*
531+ * Copyright © 2012 Canonical Ltd.
532+ *
533+ * This program is free software: you can redistribute it and/or modify it
534+ * under the terms of the GNU General Public License version 3,
535+ * as published by the Free Software Foundation.
536+ *
537+ * This program is distributed in the hope that it will be useful,
538+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
539+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
540+ * GNU General Public License for more details.
541+ *
542+ * You should have received a copy of the GNU General Public License
543+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
544+ *
545+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
546+ */
547+
548+#ifndef NESTED_GBM_EGL_CONTEXT_STORE_H_
549+#define NESTED_GBM_EGL_CONTEXT_STORE_H_
550+
551+#include "EGL/egl.h"
552+
553+namespace
554+{
555+
556+class EGLContextStore
557+{
558+public:
559+ EGLContextStore(EGLDisplay egl_display, EGLContext egl_context);
560+ virtual ~EGLContextStore() noexcept;
561+
562+ operator EGLContext() const;
563+private:
564+ EGLContextStore(EGLContextStore const&) = delete;
565+ EGLContextStore& operator=(EGLContextStore const&) = delete;
566+ EGLDisplay const egl_display_;
567+ EGLContext const egl_context_;
568+};
569+
570+}
571+
572+#endif /* NESTED_GBM_EGL_CONTEXT_STORE_H_ */
573
574=== added file 'src/server/graphics/nested_gbm/nested_gbm_display.cpp'
575--- src/server/graphics/nested_gbm/nested_gbm_display.cpp 1970-01-01 00:00:00 +0000
576+++ src/server/graphics/nested_gbm/nested_gbm_display.cpp 2013-07-09 13:08:27 +0000
577@@ -0,0 +1,228 @@
578+/*
579+ * Copyright © 2012 Canonical Ltd.
580+ *
581+ * This program is free software: you can redistribute it and/or modify it
582+ * under the terms of the GNU General Public License version 3,
583+ * as published by the Free Software Foundation.
584+ *
585+ * This program is distributed in the hope that it will be useful,
586+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
587+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
588+ * GNU General Public License for more details.
589+ *
590+ * You should have received a copy of the GNU General Public License
591+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
592+ *
593+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
594+ */
595+
596+#include "nested_gbm_platform.h"
597+#include "nested_gbm_display.h"
598+#include "nested_gbm_display_configuration.h"
599+#include "nested_gbm_gl_context.h"
600+
601+#include <boost/throw_exception.hpp>
602+#include <stdexcept>
603+
604+#include <EGL/egl.h>
605+#include <GLES2/gl2.h>
606+#include <string.h>
607+
608+namespace mg = mir::graphics;
609+namespace mgg = mir::graphics::gbm;
610+namespace mgng = mir::graphics::nested_gbm;
611+namespace geom = mir::geometry;
612+
613+mgng::NestedGBMDisplay::NestedGBMDisplay(std::shared_ptr<NestedGBMPlatform> const& platform,
614+ std::shared_ptr<mg::DisplayReport> const& display_report) :
615+ platform{platform},
616+ display_report{display_report},
617+ nm_surface{0},
618+ egl_display{EGL_NO_DISPLAY},
619+ egl_context{EGL_NO_CONTEXT},
620+ egl_pbuf{EGL_NO_SURFACE}
621+{
622+ /////////////////////////////////////////////
623+ // Mir initialization - Mir Surface (Window)
624+ /////////////////////////////////////////////
625+
626+ if(!platform->nm_connection)
627+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Connection to host-mir not found!\n"));
628+
629+ mir_connection_get_display_info(platform->nm_connection, &egl_display_info);
630+ if(!egl_display_info.supported_pixel_format_items)
631+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to get the supported pixel format items.\n"));
632+
633+ MirPixelFormat pixel_format = egl_display_info.supported_pixel_format[0];
634+ if(!pixel_format || pixel_format == mir_pixel_format_invalid)
635+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Invalid pixel format.\n"));
636+
637+ mir_surface_get_graphics_region(nm_surface, &nm_graphics_region);
638+ MirSurfaceParameters const request_params = {__PRETTY_FUNCTION__, nm_graphics_region.width, nm_graphics_region.height, pixel_format, mir_buffer_usage_hardware};
639+
640+ nm_surface = mir_connection_create_surface_sync(platform->nm_connection, &request_params);
641+ if(!nm_surface || !mir_surface_is_valid(nm_surface) || (strcmp(mir_surface_get_error_message(nm_surface), "") !=0))
642+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to create a mir surface.\n"));
643+
644+ ////////////////////////////////
645+ // EGL display
646+ ////////////////////////////////
647+
648+ EGLNativeDisplayType native_display;
649+ if(!(native_display = (EGLNativeDisplayType) mir_connection_get_egl_native_display(platform->nm_connection)))
650+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to fetch EGL native display.\n"));
651+
652+ egl_display = eglGetDisplay(native_display);
653+ if(egl_display == EGL_NO_DISPLAY)
654+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to fetch EGL display.\n"));
655+
656+ EGLNativeWindowType native_window;
657+ if(!(native_window = (EGLNativeWindowType) mir_surface_get_egl_native_window(nm_surface)))
658+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to fetch EGL native window.\n"));
659+
660+ ///////////////////////////////////
661+ // EGL initialization
662+ ///////////////////////////////////
663+
664+ EGLint attribs[] = {
665+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
666+ EGL_RED_SIZE, 8,
667+ EGL_GREEN_SIZE, 8,
668+ EGL_BLUE_SIZE, 8,
669+ EGL_ALPHA_SIZE, 8,
670+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
671+ EGL_NONE
672+ };
673+
674+ EGLint context_attribs[] = {
675+ EGL_CONTEXT_CLIENT_VERSION, 2,
676+ EGL_NONE
677+ };
678+
679+ int res, major, minor, n;
680+
681+ res = eglInitialize(egl_display, &major, &minor);
682+ if((res != EGL_TRUE) || (major != 1) || (minor != 4))
683+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to initialize EGL.\n"));
684+
685+ res = eglChooseConfig(egl_display, attribs, &egl_config, 1, &n);
686+ if((res != EGL_TRUE) || (n != 1))
687+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to choose EGL configuration.\n"));
688+
689+ //////////////
690+ //EGL surface
691+ //////////////
692+
693+ egl_surface = eglCreateWindowSurface(egl_display, egl_config, native_window, NULL);
694+ if(egl_surface == EGL_NO_SURFACE)
695+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to create window surface.\n"));
696+
697+ egl_context = eglCreateContext(egl_display, egl_config, EGL_NO_CONTEXT, context_attribs);
698+ if(egl_context == EGL_NO_CONTEXT)
699+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to create context.\n"));
700+
701+ if(eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context) != EGL_TRUE)
702+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to MakeCurrent.\n"));
703+
704+ egl_surface = eglGetCurrentSurface(EGL_DRAW);
705+ if(egl_surface == EGL_NO_SURFACE)
706+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to get current egl surface: "));
707+}
708+
709+mgng::NestedGBMDisplay::~NestedGBMDisplay()
710+{
711+ eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
712+ eglDestroyContext(egl_display, egl_context);
713+ eglDestroySurface(egl_display, egl_surface);
714+ eglDestroyContext(egl_display, egl_context);
715+ eglTerminate(egl_display);
716+ mir_surface_release_sync(nm_surface);
717+}
718+
719+geom::Rectangle mgng::NestedGBMDisplay::view_area() const
720+{
721+ int display_width, display_height;
722+ eglQuerySurface(egl_display, egl_surface, EGL_WIDTH, &display_width);
723+ eglQuerySurface(egl_display, egl_surface, EGL_HEIGHT, &display_height);
724+ geom::Width w(display_width);
725+ geom::Height h(display_height);
726+
727+ geom::Point pt {
728+ geom::X{0},
729+ geom::Y{0}
730+ };
731+
732+ geom::Size sz{w,h};
733+ geom::Rectangle rect{pt, sz};
734+ return rect;
735+}
736+
737+void mgng::NestedGBMDisplay::clear()
738+{
739+ glClear(GL_COLOR_BUFFER_BIT);
740+}
741+
742+void mgng::NestedGBMDisplay::post_update()
743+{
744+ mir_surface_swap_buffers_sync(nm_surface);
745+ // eglSwapBuffers(egl_display, egl_surface);
746+}
747+
748+void mgng::NestedGBMDisplay::for_each_display_buffer(std::function<void(mg::DisplayBuffer&)> const& f)
749+{
750+ f(*this);
751+}
752+
753+std::shared_ptr<mg::DisplayConfiguration> mgng::NestedGBMDisplay::configuration()
754+{
755+ return std::make_shared<NullDisplayConfiguration>();
756+}
757+
758+void mgng::NestedGBMDisplay::configure(mg::DisplayConfiguration const& /*config*/)
759+{
760+}
761+
762+void mgng::NestedGBMDisplay::register_pause_resume_handlers(
763+ MainLoop& /*main_loop*/,
764+ DisplayPauseHandler const& /*pause_handler*/,
765+ DisplayResumeHandler const& /*resume_handler*/)
766+{
767+}
768+
769+void mgng::NestedGBMDisplay::register_configuration_change_handler(
770+ MainLoop&,
771+ DisplayConfigurationChangeHandler const&)
772+{
773+}
774+
775+void mgng::NestedGBMDisplay::pause()
776+{
777+}
778+
779+void mgng::NestedGBMDisplay::resume()
780+{
781+}
782+
783+void mgng::NestedGBMDisplay::make_current()
784+{
785+ fprintf(stderr, "refresh\n");
786+ if(eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context) != EGL_TRUE)
787+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Display Error: Failed to MakeCurrent.\n"));
788+
789+ fprintf(stderr, "refresh\n");
790+}
791+
792+void mgng::NestedGBMDisplay::release_current()
793+{
794+}
795+
796+auto mgng::NestedGBMDisplay::the_cursor() -> std::weak_ptr<Cursor>
797+{
798+ return std::weak_ptr<Cursor>();
799+}
800+
801+std::unique_ptr<mg::GLContext> mgng::NestedGBMDisplay::create_gl_context()
802+{
803+ return std::unique_ptr<NestedGBMGLContext>{
804+ new NestedGBMGLContext{egl_display, egl_config, egl_context}};
805+}
806
807=== added file 'src/server/graphics/nested_gbm/nested_gbm_display.h'
808--- src/server/graphics/nested_gbm/nested_gbm_display.h 1970-01-01 00:00:00 +0000
809+++ src/server/graphics/nested_gbm/nested_gbm_display.h 2013-07-09 13:08:27 +0000
810@@ -0,0 +1,101 @@
811+/*
812+ * Copyright © 2012 Canonical Ltd.
813+ *
814+ * This program is free software: you can redistribute it and/or modify it
815+ * under the terms of the GNU General Public License version 3,
816+ * as published by the Free Software Foundation.
817+ *
818+ * This program is distributed in the hope that it will be useful,
819+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
820+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
821+ * GNU General Public License for more details.
822+ *
823+ * You should have received a copy of the GNU General Public License
824+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
825+ *
826+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
827+ */
828+
829+#ifndef MIR_GRAPHICS_NESTED_GBM_NESTED_GBM_DISPLAY_H_
830+#define MIR_GRAPHICS_NESTED_GBM_NESTED_GBM_DISPLAY_H_
831+
832+#include "nested_gbm_platform.h"
833+
834+#include "mir_toolkit/mir_client_library.h"
835+
836+#include "mir/graphics/display.h"
837+#include "mir/graphics/display_buffer.h"
838+
839+#include "../gbm/gbm_display_helpers.h"
840+
841+namespace mir
842+{
843+
844+namespace geometry
845+{
846+struct Rectangle;
847+}
848+
849+namespace graphics
850+{
851+
852+class DisplayReport;
853+class DisplayBuffer;
854+
855+namespace nested_gbm
856+{
857+
858+class NestedGBMDisplay : public Display, public DisplayBuffer
859+{
860+public:
861+ NestedGBMDisplay(std::shared_ptr<NestedGBMPlatform> const& platform,
862+ std::shared_ptr<DisplayReport> const& display_report);
863+ virtual ~NestedGBMDisplay();
864+
865+ geometry::Rectangle view_area() const;
866+ void clear();
867+ void post_update();
868+ void for_each_display_buffer(std::function<void(DisplayBuffer&)> const& f);
869+
870+ std::shared_ptr<DisplayConfiguration> configuration();
871+ void configure(DisplayConfiguration const&);
872+
873+ void register_pause_resume_handlers(
874+ MainLoop& main_loop,
875+ DisplayPauseHandler const& pause_handler,
876+ DisplayResumeHandler const& resume_handler);
877+
878+ void register_configuration_change_handler(
879+ MainLoop& main_loop,
880+ DisplayConfigurationChangeHandler const& conf_change_handler);
881+
882+ void pause();
883+ void resume();
884+
885+ void make_current();
886+ void release_current();
887+
888+ std::weak_ptr<Cursor> the_cursor();
889+ std::unique_ptr<graphics::GLContext> create_gl_context();
890+
891+private:
892+ std::shared_ptr<NestedGBMPlatform> const platform;
893+ std::shared_ptr<DisplayReport> const display_report;
894+
895+ //Mir Window, Mir Context etc
896+ MirSurface* nm_surface;
897+ MirDisplayInfo egl_display_info;
898+ MirGraphicsRegion nm_graphics_region;
899+
900+ EGLDisplay egl_display;
901+ EGLContext egl_context;
902+ EGLSurface egl_surface;
903+ EGLSurface egl_pbuf;
904+ EGLConfig egl_config;
905+};
906+
907+}
908+}
909+}
910+
911+#endif /* MIR_GRAPHICS_NESTED_GBM_NESTED_GBM_DISPLAY_H_ */
912
913=== added file 'src/server/graphics/nested_gbm/nested_gbm_display_configuration.cpp'
914--- src/server/graphics/nested_gbm/nested_gbm_display_configuration.cpp 1970-01-01 00:00:00 +0000
915+++ src/server/graphics/nested_gbm/nested_gbm_display_configuration.cpp 2013-07-09 13:08:27 +0000
916@@ -0,0 +1,31 @@
917+/*
918+ * Copyright © 2012 Canonical Ltd.
919+ *
920+ * This program is free software: you can redistribute it and/or modify it
921+ * under the terms of the GNU General Public License version 3,
922+ * as published by the Free Software Foundation.
923+ *
924+ * This program is distributed in the hope that it will be useful,
925+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
926+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
927+ * GNU General Public License for more details.
928+ *
929+ * You should have received a copy of the GNU General Public License
930+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
931+ *
932+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
933+ */
934+
935+#include "nested_gbm_display_configuration.h"
936+
937+NullDisplayConfiguration::~NullDisplayConfiguration()
938+{
939+}
940+
941+void NullDisplayConfiguration::for_each_card(std::function<void(mg::DisplayConfigurationCard const&)>) const
942+{
943+}
944+
945+void NullDisplayConfiguration::for_each_output(std::function<void(mg::DisplayConfigurationOutput const&)>) const
946+{
947+}
948
949=== added file 'src/server/graphics/nested_gbm/nested_gbm_display_configuration.h'
950--- src/server/graphics/nested_gbm/nested_gbm_display_configuration.h 1970-01-01 00:00:00 +0000
951+++ src/server/graphics/nested_gbm/nested_gbm_display_configuration.h 2013-07-09 13:08:27 +0000
952@@ -0,0 +1,38 @@
953+/*
954+ * Copyright © 2012 Canonical Ltd.
955+ *
956+ * This program is free software: you can redistribute it and/or modify it
957+ * under the terms of the GNU General Public License version 3,
958+ * as published by the Free Software Foundation.
959+ *
960+ * This program is distributed in the hope that it will be useful,
961+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
962+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
963+ * GNU General Public License for more details.
964+ *
965+ * You should have received a copy of the GNU General Public License
966+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
967+ *
968+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
969+ */
970+
971+#ifndef NESTED_GBM_DISPLAY_CONFIGURATION_H_
972+#define NESTED_GBM_DISPLAY_CONFIGURATION_H_
973+
974+#include "mir/graphics/display_configuration.h"
975+
976+namespace mg = mir::graphics;
977+
978+namespace
979+{
980+
981+class NullDisplayConfiguration : public mg::DisplayConfiguration
982+{
983+public:
984+ virtual ~NullDisplayConfiguration();
985+ void for_each_card(std::function<void(mg::DisplayConfigurationCard const&)>) const;
986+ void for_each_output(std::function<void(mg::DisplayConfigurationOutput const&)>) const;
987+};
988+
989+}
990+#endif /* NESTED_GBM_DISPLAY_CONFIGURATION_H_ */
991
992=== added file 'src/server/graphics/nested_gbm/nested_gbm_gl_context.cpp'
993--- src/server/graphics/nested_gbm/nested_gbm_gl_context.cpp 1970-01-01 00:00:00 +0000
994+++ src/server/graphics/nested_gbm/nested_gbm_gl_context.cpp 2013-07-09 13:08:27 +0000
995@@ -0,0 +1,59 @@
996+/*
997+ * Copyright © 2012 Canonical Ltd.
998+ *
999+ * This program is free software: you can redistribute it and/or modify it
1000+ * under the terms of the GNU General Public License version 3,
1001+ * as published by the Free Software Foundation.
1002+ *
1003+ * This program is distributed in the hope that it will be useful,
1004+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1005+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1006+ * GNU General Public License for more details.
1007+ *
1008+ * You should have received a copy of the GNU General Public License
1009+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1010+ *
1011+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
1012+ */
1013+
1014+#include "nested_gbm_gl_context.h"
1015+
1016+#include <boost/throw_exception.hpp>
1017+#include <stdexcept>
1018+
1019+static EGLint const dummy_pbuffer_attribs[] =
1020+{
1021+ EGL_WIDTH, 1,
1022+ EGL_HEIGHT, 1,
1023+ EGL_NONE
1024+};
1025+
1026+static const EGLint default_egl_context_attr [] =
1027+{
1028+ EGL_CONTEXT_CLIENT_VERSION, 2,
1029+ EGL_NONE
1030+};
1031+
1032+NestedGBMGLContext::NestedGBMGLContext(EGLDisplay egl_display, EGLConfig egl_config, EGLContext egl_context) :
1033+ egl_display{egl_display},
1034+ egl_context{egl_display, eglCreateContext(egl_display, egl_config, egl_context, default_egl_context_attr)},
1035+ egl_surface{egl_display, eglCreatePbufferSurface(egl_display, egl_config, dummy_pbuffer_attribs)}
1036+{
1037+}
1038+
1039+NestedGBMGLContext::~NestedGBMGLContext()
1040+{
1041+ if (eglGetCurrentContext() != EGL_NO_CONTEXT)
1042+ release_current();
1043+}
1044+
1045+void NestedGBMGLContext::make_current()
1046+{
1047+ if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context) == EGL_FALSE)
1048+ BOOST_THROW_EXCEPTION(std::runtime_error("could not activate dummy surface with eglMakeCurrent\n"));
1049+}
1050+
1051+void NestedGBMGLContext::release_current()
1052+{
1053+ eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
1054+}
1055
1056=== added file 'src/server/graphics/nested_gbm/nested_gbm_gl_context.h'
1057--- src/server/graphics/nested_gbm/nested_gbm_gl_context.h 1970-01-01 00:00:00 +0000
1058+++ src/server/graphics/nested_gbm/nested_gbm_gl_context.h 2013-07-09 13:08:27 +0000
1059@@ -0,0 +1,50 @@
1060+/*
1061+ * Copyright © 2012 Canonical Ltd.
1062+ *
1063+ * This program is free software: you can redistribute it and/or modify it
1064+ * under the terms of the GNU General Public License version 3,
1065+ * as published by the Free Software Foundation.
1066+ *
1067+ * This program is distributed in the hope that it will be useful,
1068+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1069+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1070+ * GNU General Public License for more details.
1071+ *
1072+ * You should have received a copy of the GNU General Public License
1073+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1074+ *
1075+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
1076+ */
1077+
1078+#ifndef NESTED_GBM_GL_CONTEXT_H_
1079+#define NESTED_GBM_GL_CONTEXT_H_
1080+
1081+#include "mir/graphics/gl_context.h"
1082+#include "nested_gbm_context_store.h"
1083+#include "nested_gbm_surface_store.h"
1084+
1085+#include <EGL/egl.h>
1086+
1087+namespace mg = mir::graphics;
1088+
1089+namespace
1090+{
1091+
1092+class NestedGBMGLContext : public mg::GLContext
1093+{
1094+ public:
1095+ NestedGBMGLContext(EGLDisplay egl_display, EGLConfig egl_config, EGLContext egl_context);
1096+ virtual ~NestedGBMGLContext() noexcept;
1097+
1098+ void make_current();
1099+ void release_current();
1100+
1101+private:
1102+ EGLDisplay const egl_display;
1103+ EGLContextStore const egl_context;
1104+ EGLSurfaceStore const egl_surface;
1105+};
1106+
1107+}
1108+
1109+#endif /* NESTED_GBM_GL_CONTEXT_H_ */
1110
1111=== added file 'src/server/graphics/nested_gbm/nested_gbm_platform.cpp'
1112--- src/server/graphics/nested_gbm/nested_gbm_platform.cpp 1970-01-01 00:00:00 +0000
1113+++ src/server/graphics/nested_gbm/nested_gbm_platform.cpp 2013-07-09 13:08:27 +0000
1114@@ -0,0 +1,170 @@
1115+/*
1116+ * Copyright © 2012 Canonical Ltd.
1117+ *
1118+ * This program is free software: you can redistribute it and/or modify it
1119+ * under the terms of the GNU General Public License version 3,
1120+ * as published by the Free Software Foundation.
1121+ *
1122+ * This program is distributed in the hope that it will be useful,
1123+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1124+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1125+ * GNU General Public License for more details.
1126+ *
1127+ * You should have received a copy of the GNU General Public License
1128+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1129+ *
1130+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
1131+ */
1132+
1133+#include "nested_gbm_platform.h"
1134+#include "nested_gbm_display.h"
1135+
1136+#include "../gbm/gbm_platform.h"
1137+#include "../gbm/gbm_buffer_allocator.h"
1138+
1139+#include "../gbm/internal_client.h"
1140+#include "../gbm/internal_native_display.h"
1141+
1142+#include "mir_toolkit/mir_client_library.h"
1143+
1144+#include "mir/compositor/buffer_ipc_packer.h"
1145+#include "mir/graphics/platform_ipc_package.h"
1146+#include "../../frontend/protobuf_buffer_packer.h"
1147+
1148+#include <string.h>
1149+
1150+#include <boost/throw_exception.hpp>
1151+#include <stdexcept>
1152+
1153+//TODO: remove
1154+#include <assert.h>
1155+
1156+#include <memory>
1157+#include <fcntl.h>
1158+#include <sys/ioctl.h>
1159+#include <xf86drm.h>
1160+
1161+namespace mg = mir::graphics;
1162+namespace mgng = mir::graphics::nested_gbm;
1163+namespace mgg = mir::graphics::gbm;
1164+namespace mc = mir::compositor;
1165+
1166+//static std::string socket_file = "/tmp/mir_socket_nested";
1167+
1168+struct NestedGBMPlatformIPCPackage : public mg::PlatformIPCPackage
1169+{
1170+ NestedGBMPlatformIPCPackage(int drm_auth_fd)
1171+ {
1172+ ipc_fds.push_back(drm_auth_fd);
1173+ }
1174+
1175+ virtual ~NestedGBMPlatformIPCPackage()
1176+ {
1177+ if((int)ipc_fds.size() > 0 && (int)ipc_fds[0] >= 0)
1178+ drmClose(ipc_fds[0]);
1179+ }
1180+};
1181+
1182+std::shared_ptr<mgg::InternalNativeDisplay> mgng::NestedGBMPlatform::internal_native_display;
1183+bool mgng::NestedGBMPlatform::internal_display_clients_present;
1184+
1185+mgng::NestedGBMPlatform::NestedGBMPlatform(std::shared_ptr<mg::DisplayReport> const& display_report)
1186+ : display_report{display_report}
1187+{
1188+ nm_connection = 0;
1189+ if(!(nm_connection = mir_connect_sync("/tmp/mir_socket", "nested_mir"))) {
1190+ printf("no conn\n");
1191+ assert(1);
1192+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Failed to connect!\n"));
1193+ }
1194+ if(!mir_connection_is_valid(nm_connection))
1195+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Invalid connection!\n"));
1196+
1197+ if(!(strcmp(mir_connection_get_error_message(nm_connection),"") == 0))
1198+ BOOST_THROW_EXCEPTION(std::runtime_error("Nested Mir Platform: Errors occured!\n"));
1199+
1200+ drm.setup(udev);
1201+ gbm.setup(drm);
1202+ internal_display_clients_present = true;
1203+}
1204+
1205+mgng::NestedGBMPlatform::~NestedGBMPlatform()
1206+{
1207+ internal_native_display.reset();
1208+ internal_display_clients_present = false;
1209+
1210+ mir_connection_release(nm_connection);
1211+}
1212+
1213+////////////////////////////////////////
1214+////////////////////////////////////////
1215+
1216+std::shared_ptr<mc::GraphicBufferAllocator> mgng::NestedGBMPlatform::create_buffer_allocator(
1217+ const std::shared_ptr<mg::BufferInitializer>& buffer_initializer)
1218+{
1219+ return std::make_shared<mgg::GBMBufferAllocator>(this->shared_from_this(), buffer_initializer);
1220+}
1221+
1222+std::shared_ptr<mg::Display> mgng::NestedGBMPlatform::create_display()
1223+{
1224+ return std::make_shared<mgng::NestedGBMDisplay>(
1225+ this->shared_from_this(),
1226+ display_report);
1227+}
1228+
1229+////////////////////////////////////////
1230+////////////////////////////////////////
1231+
1232+std::shared_ptr<mg::InternalClient> mgng::NestedGBMPlatform::create_internal_client()
1233+{
1234+ if(!internal_native_display)
1235+ internal_native_display = std::make_shared<mgg::InternalNativeDisplay>(get_ipc_package());
1236+
1237+ internal_display_clients_present = false;
1238+ return std::make_shared<mgg::InternalClient>(mgng::NestedGBMPlatform::internal_native_display);
1239+}
1240+
1241+std::shared_ptr<mg::PlatformIPCPackage> mgng::NestedGBMPlatform::get_ipc_package()
1242+{
1243+ return std::make_shared<NestedGBMPlatformIPCPackage>(drm.get_authenticated_fd());
1244+}
1245+
1246+void mgng::NestedGBMPlatform::fill_ipc_package(std::shared_ptr<compositor::BufferIPCPacker> const& packer,
1247+ std::shared_ptr<compositor::Buffer> const& buffer) const
1248+{
1249+ auto native_handle = buffer->native_buffer_handle();
1250+ for(auto i=0; i<native_handle->data_items; i++)
1251+ {
1252+ packer->pack_data(native_handle->data[i]);
1253+ }
1254+ for(auto i=0; i<native_handle->fd_items; i++)
1255+ {
1256+ packer->pack_fd(native_handle->fd[i]);
1257+ }
1258+
1259+ packer->pack_stride(buffer->stride());
1260+}
1261+
1262+void mgng::NestedGBMPlatform::drm_auth_magic(drm_magic_t magic)
1263+{
1264+ drm.auth_magic(magic);
1265+}
1266+
1267+std::shared_ptr<mg::Platform> mg::create_platform(std::shared_ptr<DisplayReport> const& display_report)
1268+{
1269+ return std::make_shared<mgng::NestedGBMPlatform>(display_report);
1270+}
1271+
1272+extern "C"
1273+{
1274+int mir_server_internal_display_is_valid(MirMesaEGLNativeDisplay* display)
1275+{
1276+ return ((mgng::NestedGBMPlatform::internal_display_clients_present) &&
1277+ (display == (MirMesaEGLNativeDisplay*)mgng::NestedGBMPlatform::internal_native_display.get()));
1278+}
1279+
1280+int mir_egl_mesa_display_is_valid(MirMesaEGLNativeDisplay* display)
1281+{
1282+ return mir_server_internal_display_is_valid(display);
1283+}
1284+}
1285
1286=== added file 'src/server/graphics/nested_gbm/nested_gbm_platform.h'
1287--- src/server/graphics/nested_gbm/nested_gbm_platform.h 1970-01-01 00:00:00 +0000
1288+++ src/server/graphics/nested_gbm/nested_gbm_platform.h 2013-07-09 13:08:27 +0000
1289@@ -0,0 +1,83 @@
1290+/*
1291+ * Copyright © 2012 Canonical Ltd.
1292+ *
1293+ * This program is free software: you can redistribute it and/or modify it
1294+ * under the terms of the GNU General Public License version 3,
1295+ * as published by the Free Software Foundation.
1296+ *
1297+ * This program is distributed in the hope that it will be useful,
1298+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1299+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1300+ * GNU General Public License for more details.
1301+ *
1302+ * You should have received a copy of the GNU General Public License
1303+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1304+ *
1305+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
1306+ */
1307+
1308+#ifndef MIR_GRAPHICS_NESTED_GBM_NESTED_GBM_PLATFORM_H_
1309+#define MIR_GRAPHICS_NESTED_GBM_NESTED_GBM_PLATFORM_H_
1310+
1311+#include "../gbm/gbm_display_helpers.h"
1312+#include "../gbm/internal_native_display.h"
1313+#include "../gbm/internal_client.h"
1314+
1315+#include "mir/graphics/platform.h"
1316+#include "mir/graphics/drm_authenticator.h"
1317+#include "mir_toolkit/mesa/native_display.h"
1318+
1319+namespace mggh = mir::graphics::gbm::helpers;
1320+namespace mgg = mir::graphics::gbm;
1321+namespace mg = mir::graphics;
1322+
1323+namespace mir
1324+{
1325+namespace graphics
1326+{
1327+std::shared_ptr<Platform> create_platform(std::shared_ptr<DisplayReport> const& display_report);
1328+
1329+namespace nested_gbm
1330+{
1331+
1332+class NestedGBMPlatform : public Platform,
1333+ public DRMAuthenticator,
1334+ public std::enable_shared_from_this<NestedGBMPlatform>
1335+{
1336+public:
1337+ explicit NestedGBMPlatform(std::shared_ptr<DisplayReport>const& report);
1338+ virtual ~NestedGBMPlatform();
1339+
1340+ /* from Platform */
1341+ std::shared_ptr<compositor::GraphicBufferAllocator> create_buffer_allocator(
1342+ const std::shared_ptr<BufferInitializer>& buffer_initializer);
1343+
1344+ std::shared_ptr<Display> create_display();
1345+ std::shared_ptr<PlatformIPCPackage> get_ipc_package();
1346+ std::shared_ptr<mg::InternalClient> create_internal_client();
1347+
1348+ void fill_ipc_package(std::shared_ptr<compositor::BufferIPCPacker> const& packer,
1349+ std::shared_ptr<compositor::Buffer> const& buffer) const;
1350+
1351+ /* from DrmAuthenticator */
1352+ void drm_auth_magic(drm_magic_t magic);
1353+
1354+ mggh::UdevHelper udev;
1355+ mggh::DRMHelper drm;
1356+ mggh::GBMHelper gbm;
1357+
1358+ std::shared_ptr<DisplayReport> const display_report;
1359+
1360+ //connection shared by all internal clients
1361+ static bool internal_display_clients_present;
1362+ static std::shared_ptr<mgg::InternalNativeDisplay> internal_native_display;
1363+
1364+ //TODO
1365+ MirConnection* nm_connection;
1366+};
1367+
1368+}
1369+}
1370+}
1371+
1372+#endif /* MIR_GRAPHICS_NESTED_GBM_NESTED_GBM_PLATFORM_H_ */
1373
1374=== added file 'src/server/graphics/nested_gbm/nested_gbm_surface_store.cpp'
1375--- src/server/graphics/nested_gbm/nested_gbm_surface_store.cpp 1970-01-01 00:00:00 +0000
1376+++ src/server/graphics/nested_gbm/nested_gbm_surface_store.cpp 2013-07-09 13:08:27 +0000
1377@@ -0,0 +1,40 @@
1378+/*
1379+ * Copyright © 2012 Canonical Ltd.
1380+ *
1381+ * This program is free software: you can redistribute it and/or modify it
1382+ * under the terms of the GNU General Public License version 3,
1383+ * as published by the Free Software Foundation.
1384+ *
1385+ * This program is distributed in the hope that it will be useful,
1386+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1387+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1388+ * GNU General Public License for more details.
1389+ *
1390+ * You should have received a copy of the GNU General Public License
1391+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1392+ *
1393+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
1394+ */
1395+
1396+#include "nested_gbm_surface_store.h"
1397+
1398+#include <boost/throw_exception.hpp>
1399+#include <stdexcept>
1400+
1401+EGLSurfaceStore::EGLSurfaceStore(EGLDisplay egl_display, EGLSurface egl_surface) :
1402+ egl_display_{egl_display},
1403+ egl_surface_{egl_surface}
1404+{
1405+ if (egl_surface_ == EGL_NO_SURFACE)
1406+ BOOST_THROW_EXCEPTION(std::runtime_error("Could not create egl surface\n"));
1407+}
1408+
1409+EGLSurfaceStore::~EGLSurfaceStore()
1410+{
1411+ eglDestroySurface(egl_display_, egl_surface_);
1412+}
1413+
1414+EGLSurfaceStore::operator EGLSurface() const
1415+{
1416+ return egl_surface_;
1417+}
1418
1419=== added file 'src/server/graphics/nested_gbm/nested_gbm_surface_store.h'
1420--- src/server/graphics/nested_gbm/nested_gbm_surface_store.h 1970-01-01 00:00:00 +0000
1421+++ src/server/graphics/nested_gbm/nested_gbm_surface_store.h 2013-07-09 13:08:27 +0000
1422@@ -0,0 +1,43 @@
1423+/*
1424+ * Copyright © 2012 Canonical Ltd.
1425+ *
1426+ * This program is free software: you can redistribute it and/or modify it
1427+ * under the terms of the GNU General Public License version 3,
1428+ * as published by the Free Software Foundation.
1429+ *
1430+ * This program is distributed in the hope that it will be useful,
1431+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1432+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1433+ * GNU General Public License for more details.
1434+ *
1435+ * You should have received a copy of the GNU General Public License
1436+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1437+ *
1438+ * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
1439+ */
1440+
1441+#ifndef NESTED_GBM_SURFACE_STORE_H_
1442+#define NESTED_GBM_SURFACE_STORE_H_
1443+
1444+#include <EGL/egl.h>
1445+
1446+namespace
1447+{
1448+
1449+class EGLSurfaceStore
1450+{
1451+public:
1452+ EGLSurfaceStore(EGLDisplay egl_display, EGLSurface egl_surface);
1453+ virtual ~EGLSurfaceStore() noexcept;
1454+
1455+ operator EGLSurface() const;
1456+private:
1457+ EGLSurfaceStore(EGLSurfaceStore const&) = delete;
1458+ EGLSurfaceStore& operator=(EGLSurfaceStore const&) = delete;
1459+ EGLDisplay const egl_display_;
1460+ EGLSurface const egl_surface_;
1461+};
1462+
1463+}
1464+
1465+#endif /* NESTED_GBM_SURFACE_STORE_H_ */
1466
1467=== modified file 'src/server/run_mir.cpp'
1468--- src/server/run_mir.cpp 2013-04-24 05:22:20 +0000
1469+++ src/server/run_mir.cpp 2013-07-09 13:08:27 +0000
1470@@ -38,6 +38,7 @@
1471 });
1472
1473 DisplayServer server(config);
1474+
1475 server_ptr = &server;
1476
1477 init(server);

Subscribers

People subscribed via source and target branches