Mir

Merge lp:~vanvugt/mir/full-gl into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 3513
Proposed branch: lp:~vanvugt/mir/full-gl
Merge into: lp:mir
Diff against target: 954 lines (+153/-53)
46 files modified
CMakeLists.txt (+34/-0)
debian/control (+1/-0)
examples/CMakeLists.txt (+3/-2)
examples/graphics_utils.cpp (+2/-0)
examples/image_renderer.cpp (+2/-0)
examples/server_example_adorning_compositor.cpp (+4/-2)
include/test/mir/test/doubles/mock_egl.h (+2/-0)
playground/demo-shell/demo_renderer.cpp (+4/-0)
playground/demo-shell/typo/CMakeLists.txt (+1/-3)
playground/demo-shell/typo/typo_glcache.cpp (+1/-1)
src/gl/program.cpp (+2/-0)
src/include/gl/mir/gl/primitive.h (+1/-1)
src/include/gl/mir/gl/program.h (+1/-1)
src/include/gl/mir/gl/texture.h (+1/-1)
src/include/platform/mir/graphics/egl_extensions.h (+2/-3)
src/platform/CMakeLists.txt (+1/-1)
src/platform/graphics/CMakeLists.txt (+1/-1)
src/platform/graphics/egl_extensions.cpp (+7/-0)
src/platforms/android/include/egl_sync_extensions.h (+2/-0)
src/platforms/android/server/buffer.h (+2/-0)
src/platforms/android/server/hwc_fallback_gl_renderer.cpp (+2/-0)
src/platforms/common/server/CMakeLists.txt (+2/-2)
src/platforms/common/server/shm_buffer.cpp (+5/-3)
src/platforms/mesa/server/buffer_allocator.cpp (+4/-2)
src/platforms/mesa/server/display_helpers.cpp (+15/-3)
src/platforms/mesa/server/kms/CMakeLists.txt (+2/-2)
src/platforms/mesa/server/kms/display_buffer.cpp (+1/-1)
src/platforms/mesa/server/x11/CMakeLists.txt (+1/-1)
src/platforms/mesa/server/x11/graphics/CMakeLists.txt (+1/-1)
src/platforms/mesa/server/x11/graphics/display.cpp (+5/-1)
src/renderers/gl/program_family.cpp (+2/-1)
src/renderers/gl/program_family.h (+1/-1)
src/renderers/gl/renderer.cpp (+5/-0)
src/renderers/gl/renderer.h (+1/-1)
src/server/CMakeLists.txt (+2/-2)
src/server/compositor/screencast_display_buffer.h (+2/-1)
src/server/graphics/CMakeLists.txt (+1/-1)
src/server/graphics/nested/display.cpp (+9/-4)
src/server/graphics/nested/display.h (+1/-1)
src/server/graphics/nested/display_buffer.cpp (+1/-1)
src/server/graphics/offscreen/display.cpp (+2/-0)
src/server/graphics/offscreen/display_buffer.cpp (+4/-2)
src/server/graphics/surfaceless_egl_context.cpp (+5/-1)
src/server/scene/gl_pixel_buffer.cpp (+2/-2)
src/server/scene/gl_pixel_buffer.h (+1/-1)
tests/unit-tests/graphics/test_shm_buffer.cpp (+2/-2)
To merge this branch: bzr merge lp:~vanvugt/mir/full-gl
Reviewer Review Type Date Requested Status
Cemil Azizoglu (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+294609@code.launchpad.net

Commit message

Introducing full desktop GL support for Mir servers (LP: #1420581)

It works well with Mesa, but is disabled by default due to one
remaining "TODO" you will find.

Note the new eglBindAPI calls. Without those, EGL makes all new
threads default to ES. And then eglMakeContext/eglGetCurrent*
functions will randomly fail. So we need to be sure any thread
that touches EGL will call eglBindAPI with the correct value
first.

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Hmm that TODO may not be required. Seems GL_OES_EGL_image is a standard feature provided by Mesa even in non-ES full OpenGL. And with some Googling, AMD even seems to claim they support it in full OpenGL too. That only leaves a question mark over NVIDIA...

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:3528
https://mir-jenkins.ubuntu.com/job/mir-ci/983/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/1065
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/1112
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1103
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1103
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1075
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=vivid+overlay/1075/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1075
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial/1075/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/1075
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/1075/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/1075
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/1075/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1075
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial/1075/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

* Needs discussion *

I am not quite sure about this. The right way to achieve GL-based compositing should not be this invasive. In my mind, it should go more or less like the following :

1- Finish the work that alf started abstracting the renderer. There should not be any renderer specific code outside the renderer (e.g. no EGL/GL/GLES calls).

2- This should give us a proper (default) renderer with GLESv2. Going one step further, since GL/GLES would probably be desired by many shells potentially, we should have multiple flavors of a default set of renderers already implemented in Mir (e.g. A GL based renderer, a GLESv2 renderer, a GLESv3 renderer).

3- The shells should also be able to override that functionality with their own renderer (say vulkan based), or blitter based renderer). (I believe we already have some form of this but not sure how complete).

4- Also the renderer should be able to be chosen at run-time dynamically and replaced on the fly if needed, though this can be done at a later time (e.g. use blitter based rendering instead of GL for power reasons etc).

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

As discussed in the hangout today, I agree and I think we all agree that dynamic renderer selection is where we want to be in future.

However this work is a necessary stepping stone on that path. You can't make progress toward dynamic renderer selection without this work.

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Isolating renderers and dynamically selecting them is a long term goal. Given that Qtmir needs GL today, it is more correct to support GL rather than GLES.

So lgtm.

review: Approve

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 2016-05-03 04:36:33 +0000
3+++ CMakeLists.txt 2016-05-13 09:11:33 +0000
4@@ -199,6 +199,40 @@
5 include_directories (SYSTEM ${EGL_INCLUDE_DIRS})
6 include_directories (SYSTEM ${GLM_INCLUDE_DIRS})
7
8+#
9+# Full OpenGL support works with Mesa. Although it probably should not, and
10+# is expected to fail in proprietary drivers due to one remaining "TODO" in:
11+# src/platform/graphics/egl_extensions.cpp
12+#
13+#if (TARGET_ARCH STREQUAL "x86_64-linux-gnu" OR
14+# TARGET_ARCH STREQUAL "i386-linux-gnu")
15+# set(DEFAULT_LIBGL "libGL")
16+#else()
17+ set(DEFAULT_LIBGL "libGLESv2")
18+#endif()
19+set(MIR_SERVER_LIBGL ${DEFAULT_LIBGL} CACHE STRING "OpenGL library to use in Mir servers {libGL,libGLESv2}")
20+
21+if (MIR_SERVER_LIBGL STREQUAL "libGL")
22+ pkg_check_modules(GL REQUIRED gl)
23+ add_definitions(
24+ -DGL_GLEXT_PROTOTYPES
25+ -DMIR_SERVER_GL_H=<GL/gl.h>
26+ -DMIR_SERVER_GLEXT_H=<GL/glext.h>
27+ -DMIR_SERVER_EGL_OPENGL_BIT=EGL_OPENGL_BIT
28+ -DMIR_SERVER_EGL_OPENGL_API=EGL_OPENGL_API
29+ )
30+elseif (MIR_SERVER_LIBGL STREQUAL "libGLESv2")
31+ pkg_check_modules(GL REQUIRED glesv2)
32+ add_definitions(
33+ -DMIR_SERVER_GL_H=<GLES2/gl2.h>
34+ -DMIR_SERVER_GLEXT_H=<GLES2/gl2ext.h>
35+ -DMIR_SERVER_EGL_OPENGL_BIT=EGL_OPENGL_ES2_BIT
36+ -DMIR_SERVER_EGL_OPENGL_API=EGL_OPENGL_ES_API
37+ )
38+else()
39+ message(FATAL_ERROR "Invalid MIR_SERVER_LIBGL value ${MIR_SERVER_LIBGL}")
40+endif()
41+
42 if (MIR_BUILD_PLATFORM_ANDROID)
43 find_package(AndroidProperties REQUIRED)
44 find_package(LibHardware REQUIRED)
45
46=== modified file 'debian/control'
47--- debian/control 2016-05-03 04:36:33 +0000
48+++ debian/control 2016-05-13 09:11:33 +0000
49@@ -19,6 +19,7 @@
50 libdrm-dev,
51 libegl1-mesa-dev,
52 libgles2-mesa-dev,
53+ libgl1-mesa-dev [amd64 i386],
54 libgbm-dev,
55 libglm-dev,
56 libprotobuf-dev,
57
58=== modified file 'examples/CMakeLists.txt'
59--- examples/CMakeLists.txt 2016-05-09 14:27:58 +0000
60+++ examples/CMakeLists.txt 2016-05-13 09:11:33 +0000
61@@ -167,20 +167,20 @@
62 target_link_libraries(mir_demo_client_scroll
63 eglapp
64 mirdraw
65+ ${GLESv2_LIBRARIES}
66 )
67
68 mir_add_wrapped_executable(mir_demo_client_prompt_session prompt_session.c)
69 target_link_libraries(mir_demo_client_prompt_session mirclient)
70
71 add_library(mirdraw STATIC graphics_utils.cpp)
72-target_link_libraries(mirdraw ${GLESv2_LIBRARIES})
73
74 include_directories(
75 ${PROJECT_SOURCE_DIR}/include/server
76 ${PROJECT_SOURCE_DIR}/include/client
77 ${PROJECT_SOURCE_DIR}/include/platform
78 ${PROJECT_SOURCE_DIR}/include/renderers/gl
79- ${GLESv2_INCLUDE_DIRS}
80+ ${GL_INCLUDE_DIRS}
81 )
82
83 mir_add_wrapped_executable(mir_demo_standalone_render_to_fb
84@@ -190,6 +190,7 @@
85 target_link_libraries(mir_demo_standalone_render_to_fb
86 mirserver
87 mirdraw
88+ ${GL_LIBRARIES}
89 ${Boost_LIBRARIES}
90 )
91
92
93=== modified file 'examples/graphics_utils.cpp'
94--- examples/graphics_utils.cpp 2013-04-24 05:22:20 +0000
95+++ examples/graphics_utils.cpp 2016-05-13 09:11:33 +0000
96@@ -38,7 +38,9 @@
97
98 static const GLchar *frag_shader_src =
99 {
100+ "#ifdef GL_ES\n"
101 "precision mediump float;\n"
102+ "#endif\n"
103 "uniform sampler2D tex;\n"
104 "varying vec2 texcoord;\n"
105 "void main() {\n"
106
107=== modified file 'examples/image_renderer.cpp'
108--- examples/image_renderer.cpp 2015-07-16 07:03:19 +0000
109+++ examples/image_renderer.cpp 2016-05-13 09:11:33 +0000
110@@ -49,7 +49,9 @@
111
112 const GLchar* fragment_shader_src =
113 {
114+ "#ifdef GL_ES\n"
115 "precision mediump float;\n"
116+ "#endif\n"
117 "uniform sampler2D tex;\n"
118 "varying vec2 v_texcoord;\n"
119 "void main() {\n"
120
121=== modified file 'examples/server_example_adorning_compositor.cpp'
122--- examples/server_example_adorning_compositor.cpp 2016-03-29 07:30:50 +0000
123+++ examples/server_example_adorning_compositor.cpp 2016-05-13 09:11:33 +0000
124@@ -29,7 +29,7 @@
125 #include <stdexcept>
126 #include <boost/throw_exception.hpp>
127
128-#include <GLES2/gl2.h>
129+#include MIR_SERVER_GL_H
130
131 namespace me = mir::examples;
132 namespace mg = mir::graphics;
133@@ -85,7 +85,9 @@
134 "}"
135 },
136 frag_shader_src{
137- "precision mediump float;"
138+ "#ifdef GL_ES\n"
139+ "precision mediump float;\n"
140+ "#endif\n"
141 "varying vec2 texcoord;"
142 "uniform sampler2D tex;"
143 "uniform float alpha;"
144
145=== modified file 'include/test/mir/test/doubles/mock_egl.h'
146--- include/test/mir/test/doubles/mock_egl.h 2016-01-29 08:18:22 +0000
147+++ include/test/mir/test/doubles/mock_egl.h 2016-05-13 09:11:33 +0000
148@@ -25,7 +25,9 @@
149 #include <thread>
150 #include <unordered_map>
151
152+#ifndef GL_GLEXT_PROTOTYPES
153 #define GL_GLEXT_PROTOTYPES
154+#endif
155 #define EGL_EGLEXT_PROTOTYPES
156 #include <EGL/egl.h>
157 #include <EGL/eglext.h>
158
159=== modified file 'playground/demo-shell/demo_renderer.cpp'
160--- playground/demo-shell/demo_renderer.cpp 2016-01-29 08:18:22 +0000
161+++ playground/demo-shell/demo_renderer.cpp 2016-05-13 09:11:33 +0000
162@@ -152,7 +152,9 @@
163
164 static const GLchar inverse_fshader[] =
165 {
166+ "#ifdef GL_ES\n"
167 "precision mediump float;\n"
168+ "#endif\n"
169 "uniform sampler2D tex;\n"
170 "uniform float alpha;\n"
171 "varying vec2 v_texcoord;\n"
172@@ -164,7 +166,9 @@
173 };
174 static const GLchar contrast_fshader[] =
175 {
176+ "#ifdef GL_ES\n"
177 "precision mediump float;\n"
178+ "#endif\n"
179 "uniform sampler2D tex;\n"
180 "uniform float alpha;\n"
181 "varying vec2 v_texcoord;\n"
182
183=== modified file 'playground/demo-shell/typo/CMakeLists.txt'
184--- playground/demo-shell/typo/CMakeLists.txt 2015-02-19 09:30:02 +0000
185+++ playground/demo-shell/typo/CMakeLists.txt 2016-05-13 09:11:33 +0000
186@@ -1,4 +1,3 @@
187-find_package(GLESv2 REQUIRED)
188 find_package(PkgConfig)
189
190 pkg_search_module(FREETYPE freetype2)
191@@ -13,8 +12,7 @@
192 ${OPTIONAL_SRCS}
193 )
194
195-target_link_libraries(typo ${GLESv2_LIBRARIES})
196-include_directories(${GLESv2_INCLUDE_DIRS})
197+target_link_libraries(typo ${GL_LIBRARIES})
198 target_include_directories(typo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
199
200 if (FREETYPE_FOUND)
201
202=== modified file 'playground/demo-shell/typo/typo_glcache.cpp'
203--- playground/demo-shell/typo/typo_glcache.cpp 2015-07-16 07:03:19 +0000
204+++ playground/demo-shell/typo/typo_glcache.cpp 2016-05-13 09:11:33 +0000
205@@ -17,7 +17,7 @@
206 */
207
208 #include "typo_glcache.h"
209-#include <GLES2/gl2.h> // TODO: Support plain OpenGL too
210+#include MIR_SERVER_GL_H
211
212 using namespace mir::examples::typo;
213
214
215=== modified file 'src/gl/program.cpp'
216--- src/gl/program.cpp 2016-01-29 08:18:22 +0000
217+++ src/gl/program.cpp 2016-05-13 09:11:33 +0000
218@@ -19,6 +19,8 @@
219 #include "mir/gl/program.h"
220 #include <boost/throw_exception.hpp>
221 #include <stdexcept>
222+#include MIR_SERVER_GL_H
223+#include MIR_SERVER_GLEXT_H
224
225 namespace mgl = mir::gl;
226
227
228=== modified file 'src/include/gl/mir/gl/primitive.h'
229--- src/include/gl/mir/gl/primitive.h 2016-01-29 08:18:22 +0000
230+++ src/include/gl/mir/gl/primitive.h 2016-05-13 09:11:33 +0000
231@@ -20,7 +20,7 @@
232 #ifndef MIR_GL_PRIMITIVE_H_
233 #define MIR_GL_PRIMITIVE_H_
234
235-#include <GLES2/gl2.h>
236+#include MIR_SERVER_GL_H
237
238 namespace mir
239 {
240
241=== modified file 'src/include/gl/mir/gl/program.h'
242--- src/include/gl/mir/gl/program.h 2015-10-05 08:19:39 +0000
243+++ src/include/gl/mir/gl/program.h 2016-05-13 09:11:33 +0000
244@@ -19,7 +19,7 @@
245 #ifndef MIR_GL_PROGRAM_H_
246 #define MIR_GL_PROGRAM_H_
247
248-#include <GLES2/gl2.h>
249+#include MIR_SERVER_GL_H
250
251 namespace mir
252 {
253
254=== modified file 'src/include/gl/mir/gl/texture.h'
255--- src/include/gl/mir/gl/texture.h 2016-01-29 08:18:22 +0000
256+++ src/include/gl/mir/gl/texture.h 2016-05-13 09:11:33 +0000
257@@ -19,7 +19,7 @@
258 #ifndef MIR_GL_TEXTURE_H_
259 #define MIR_GL_TEXTURE_H_
260
261-#include <GLES2/gl2.h>
262+#include MIR_SERVER_GL_H
263
264 namespace mir
265 {
266
267=== modified file 'src/include/platform/mir/graphics/egl_extensions.h'
268--- src/include/platform/mir/graphics/egl_extensions.h 2016-03-29 07:30:50 +0000
269+++ src/include/platform/mir/graphics/egl_extensions.h 2016-05-13 09:11:33 +0000
270@@ -19,12 +19,11 @@
271 #ifndef MIR_GRAPHICS_EGL_EXTENSIONS_H_
272 #define MIR_GRAPHICS_EGL_EXTENSIONS_H_
273
274-#define GL_GLEXT_PROTOTYPES
275 #define EGL_EGLEXT_PROTOTYPES
276 #include <EGL/egl.h>
277 #include <EGL/eglext.h>
278-#include <GLES2/gl2.h>
279-#include <GLES2/gl2ext.h>
280+#include MIR_SERVER_GL_H
281+#include MIR_SERVER_GLEXT_H
282
283 namespace mir
284 {
285
286=== modified file 'src/platform/CMakeLists.txt'
287--- src/platform/CMakeLists.txt 2016-05-04 05:48:28 +0000
288+++ src/platform/CMakeLists.txt 2016-05-13 09:11:33 +0000
289@@ -18,7 +18,7 @@
290
291 set(MIR_PLATFORM_REFERENCES
292 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
293- ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
294+ ${GL_LDFLAGS} ${GL_LIBRARIES}
295 )
296
297 add_subdirectory(graphics/)
298
299=== modified file 'src/platform/graphics/CMakeLists.txt'
300--- src/platform/graphics/CMakeLists.txt 2016-03-29 07:30:50 +0000
301+++ src/platform/graphics/CMakeLists.txt 2016-05-13 09:11:33 +0000
302@@ -1,4 +1,4 @@
303-include_directories(${GLESv2_INCLUDE_DIRS})
304+include_directories(${GL_INCLUDE_DIRS})
305
306 set(
307 GRAPHICS_SOURCES
308
309=== modified file 'src/platform/graphics/egl_extensions.cpp'
310--- src/platform/graphics/egl_extensions.cpp 2016-03-29 07:30:50 +0000
311+++ src/platform/graphics/egl_extensions.cpp 2016-05-13 09:11:33 +0000
312@@ -28,6 +28,13 @@
313 reinterpret_cast<PFNEGLCREATEIMAGEKHRPROC>(eglGetProcAddress("eglCreateImageKHR"))},
314 eglDestroyImageKHR{
315 reinterpret_cast<PFNEGLDESTROYIMAGEKHRPROC>(eglGetProcAddress("eglDestroyImageKHR"))},
316+
317+ /*
318+ * TODO: Find a non-ES GL equivalent for glEGLImageTargetTexture2DOES
319+ * It's the LAST remaining ES-specific function. Although Mesa lets you use
320+ * it in full GL, it theoretically should not work. Mesa just lets you
321+ * mix ES and GL code. But other drivers won't be so lenient.
322+ */
323 glEGLImageTargetTexture2DOES{
324 reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES"))}
325 {
326
327=== modified file 'src/platforms/android/include/egl_sync_extensions.h'
328--- src/platforms/android/include/egl_sync_extensions.h 2016-01-29 13:10:01 +0000
329+++ src/platforms/android/include/egl_sync_extensions.h 2016-05-13 09:11:33 +0000
330@@ -19,7 +19,9 @@
331 #ifndef MIR_GRAPHICS_EGL_SYNC_EXTENSIONS_H_
332 #define MIR_GRAPHICS_EGL_SYNC_EXTENSIONS_H_
333
334+#ifndef GL_GLEXT_PROTOTYPES
335 #define GL_GLEXT_PROTOTYPES
336+#endif
337 #define EGL_EGLEXT_PROTOTYPES
338
339 //Xenial egl has started needing a header (android/native_window.h)
340
341=== modified file 'src/platforms/android/server/buffer.h'
342--- src/platforms/android/server/buffer.h 2016-03-29 07:30:50 +0000
343+++ src/platforms/android/server/buffer.h 2016-05-13 09:11:33 +0000
344@@ -29,7 +29,9 @@
345 #include <condition_variable>
346 #include <map>
347
348+#ifndef GL_GLEXT_PROTOTYPES
349 #define GL_GLEXT_PROTOTYPES
350+#endif
351 #define EGL_EGLEXT_PROTOTYPES
352 #include <EGL/egl.h>
353 #include <EGL/eglext.h>
354
355=== modified file 'src/platforms/android/server/hwc_fallback_gl_renderer.cpp'
356--- src/platforms/android/server/hwc_fallback_gl_renderer.cpp 2016-01-29 08:18:22 +0000
357+++ src/platforms/android/server/hwc_fallback_gl_renderer.cpp 2016-05-13 09:11:33 +0000
358@@ -30,6 +30,8 @@
359 #include <glm/gtc/matrix_transform.hpp>
360 #include <glm/gtc/type_ptr.hpp>
361
362+#include <GLES2/gl2.h>
363+
364 namespace mg = mir::graphics;
365 namespace mgl = mir::gl;
366 namespace mga = mir::graphics::android;
367
368=== modified file 'src/platforms/common/server/CMakeLists.txt'
369--- src/platforms/common/server/CMakeLists.txt 2016-04-21 07:01:58 +0000
370+++ src/platforms/common/server/CMakeLists.txt 2016-05-13 09:11:33 +0000
371@@ -1,6 +1,6 @@
372 include_directories(
373 ${server_common_include_dirs}
374- ${GLESv2_INCLUDE_DIRS}
375+ ${GL_INCLUDE_DIRS}
376 )
377
378 add_library(server_platform_common STATIC
379@@ -13,5 +13,5 @@
380 server_platform_common
381
382 ${Boost_SYSTEM_LIBRARY}
383- ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
384+ ${GL_LDFLAGS} ${GL_LIBRARIES}
385 )
386
387=== modified file 'src/platforms/common/server/shm_buffer.cpp'
388--- src/platforms/common/server/shm_buffer.cpp 2016-05-03 04:36:33 +0000
389+++ src/platforms/common/server/shm_buffer.cpp 2016-05-13 09:11:33 +0000
390@@ -20,8 +20,8 @@
391 #include "shm_file.h"
392 #include "shm_buffer.h"
393 #include "buffer_texture_binder.h"
394-#include <GLES2/gl2.h>
395-#include <GLES2/gl2ext.h>
396+#include MIR_SERVER_GL_H
397+#include MIR_SERVER_GLEXT_H
398
399 #include <boost/throw_exception.hpp>
400
401@@ -138,7 +138,9 @@
402 */
403 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
404
405- glTexImage2D(GL_TEXTURE_2D, 0, format,
406+ auto internal_format = (format == GL_BGRA_EXT) ? GL_RGBA : format;
407+
408+ glTexImage2D(GL_TEXTURE_2D, 0, internal_format,
409 size_.width.as_int(), size_.height.as_int(),
410 0, format, type, pixels);
411 }
412
413=== modified file 'src/platforms/mesa/server/buffer_allocator.cpp'
414--- src/platforms/mesa/server/buffer_allocator.cpp 2016-05-04 09:06:26 +0000
415+++ src/platforms/mesa/server/buffer_allocator.cpp 2016-05-13 09:11:33 +0000
416@@ -31,8 +31,8 @@
417
418 #include <EGL/egl.h>
419 #include <EGL/eglext.h>
420-#include <GLES2/gl2.h>
421-#include <GLES2/gl2ext.h>
422+#include MIR_SERVER_GL_H
423+#include MIR_SERVER_GLEXT_H
424
425 #include <algorithm>
426 #include <stdexcept>
427@@ -97,6 +97,7 @@
428 {
429 if (egl_image == EGL_NO_IMAGE_KHR)
430 {
431+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
432 egl_display = eglGetCurrentDisplay();
433 gbm_bo* bo_raw{bo.get()};
434
435@@ -131,6 +132,7 @@
436 {
437 if (egl_image == EGL_NO_IMAGE_KHR)
438 {
439+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
440 egl_display = eglGetCurrentDisplay();
441 gbm_bo* bo_raw{bo.get()};
442
443
444=== modified file 'src/platforms/mesa/server/display_helpers.cpp'
445--- src/platforms/mesa/server/display_helpers.cpp 2016-05-04 09:06:26 +0000
446+++ src/platforms/mesa/server/display_helpers.cpp 2016-05-13 09:11:33 +0000
447@@ -321,8 +321,12 @@
448
449 void mgmh::EGLHelper::setup(GBMHelper const& gbm)
450 {
451+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
452+
453 static const EGLint context_attr[] = {
454+#if MIR_SERVER_EGL_OPENGL_BIT == EGL_OPENGL_ES2_BIT
455 EGL_CONTEXT_CLIENT_VERSION, 2,
456+#endif
457 EGL_NONE
458 };
459
460@@ -335,8 +339,12 @@
461
462 void mgmh::EGLHelper::setup(GBMHelper const& gbm, EGLContext shared_context)
463 {
464+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
465+
466 static const EGLint context_attr[] = {
467+#if MIR_SERVER_EGL_OPENGL_BIT == EGL_OPENGL_ES2_BIT
468 EGL_CONTEXT_CLIENT_VERSION, 2,
469+#endif
470 EGL_NONE
471 };
472
473@@ -350,8 +358,12 @@
474 void mgmh::EGLHelper::setup(GBMHelper const& gbm, gbm_surface* surface_gbm,
475 EGLContext shared_context)
476 {
477+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
478+
479 static const EGLint context_attr[] = {
480+#if MIR_SERVER_EGL_OPENGL_BIT == EGL_OPENGL_ES2_BIT
481 EGL_CONTEXT_CLIENT_VERSION, 2,
482+#endif
483 EGL_NONE
484 };
485
486@@ -371,6 +383,7 @@
487 if (egl_display != EGL_NO_DISPLAY) {
488 if (egl_context != EGL_NO_CONTEXT)
489 {
490+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
491 if (eglGetCurrentContext() == egl_context)
492 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
493 eglDestroyContext(egl_display, egl_context);
494@@ -391,6 +404,7 @@
495 bool mgmh::EGLHelper::make_current() const
496 {
497 auto ret = eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context);
498+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
499 return (ret == EGL_TRUE);
500 }
501
502@@ -410,7 +424,7 @@
503 EGL_ALPHA_SIZE, 0,
504 EGL_DEPTH_SIZE, depth_buffer_bits,
505 EGL_STENCIL_SIZE, stencil_buffer_bits,
506- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
507+ EGL_RENDERABLE_TYPE, MIR_SERVER_EGL_OPENGL_BIT,
508 EGL_NONE
509 };
510
511@@ -440,8 +454,6 @@
512 should_terminate_egl = true;
513 }
514
515- eglBindAPI(EGL_OPENGL_ES_API);
516-
517 if (eglChooseConfig(egl_display, config_attr, &egl_config, 1, &num_egl_configs) == EGL_FALSE ||
518 num_egl_configs != 1)
519 {
520
521=== modified file 'src/platforms/mesa/server/kms/CMakeLists.txt'
522--- src/platforms/mesa/server/kms/CMakeLists.txt 2016-05-09 10:03:10 +0000
523+++ src/platforms/mesa/server/kms/CMakeLists.txt 2016-05-13 09:11:33 +0000
524@@ -7,7 +7,7 @@
525 ${DRM_INCLUDE_DIRS}
526 ${GBM_INCLUDE_DIRS}
527 ${EGL_INCLUDE_DIRS}
528- ${GLESv2_INCLUDE_DIRS}
529+ ${GL_INCLUDE_DIRS}
530 ${UDEV_INCLUDE_DIRS}
531 )
532
533@@ -59,7 +59,7 @@
534 ${DRM_LDFLAGS} ${DRM_LIBRARIES}
535 ${GBM_LDFLAGS} ${GBM_LIBRARIES}
536 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
537- ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
538+ ${GL_LDFLAGS} ${GL_LIBRARIES}
539 )
540
541 set_target_properties(
542
543=== modified file 'src/platforms/mesa/server/kms/display_buffer.cpp'
544--- src/platforms/mesa/server/kms/display_buffer.cpp 2016-05-03 04:36:33 +0000
545+++ src/platforms/mesa/server/kms/display_buffer.cpp 2016-05-13 09:11:33 +0000
546@@ -24,7 +24,7 @@
547 #include "mir/fatal.h"
548
549 #include <boost/throw_exception.hpp>
550-#include <GLES2/gl2.h>
551+#include MIR_SERVER_GL_H
552
553 #include <stdexcept>
554 #include <chrono>
555
556=== modified file 'src/platforms/mesa/server/x11/CMakeLists.txt'
557--- src/platforms/mesa/server/x11/CMakeLists.txt 2016-01-29 08:18:22 +0000
558+++ src/platforms/mesa/server/x11/CMakeLists.txt 2016-05-13 09:11:33 +0000
559@@ -26,7 +26,7 @@
560 PRIVATE
561 mirplatform
562 EGL
563- GLESv2
564+ ${GL_LDFLAGS} ${GL_LIBRARIES}
565 X11
566 mirsharedmesaservercommon-static
567 ${Boost_PROGRAM_OPTIONS_LIBRARY}
568
569=== modified file 'src/platforms/mesa/server/x11/graphics/CMakeLists.txt'
570--- src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2016-05-04 09:06:26 +0000
571+++ src/platforms/mesa/server/x11/graphics/CMakeLists.txt 2016-05-13 09:11:33 +0000
572@@ -9,7 +9,7 @@
573 ${DRM_INCLUDE_DIRS}
574 ${GBM_INCLUDE_DIRS}
575 ${EGL_INCLUDE_DIRS}
576- ${GLESv2_INCLUDE_DIRS}
577+ ${GL_INCLUDE_DIRS}
578 ${UDEV_INCLUDE_DIRS}
579 )
580
581
582=== modified file 'src/platforms/mesa/server/x11/graphics/display.cpp'
583--- src/platforms/mesa/server/x11/graphics/display.cpp 2016-04-28 13:23:32 +0000
584+++ src/platforms/mesa/server/x11/graphics/display.cpp 2016-05-13 09:11:33 +0000
585@@ -71,7 +71,7 @@
586 EGL_ALPHA_SIZE, 8,
587 EGL_DEPTH_SIZE, 0,
588 EGL_STENCIL_SIZE, 0,
589- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
590+ EGL_RENDERABLE_TYPE, MIR_SERVER_EGL_OPENGL_BIT,
591 EGL_NONE
592 };
593
594@@ -202,8 +202,12 @@
595 mgx::X11EGLContext::X11EGLContext(EGLDisplay egl_dpy, EGLConfig config)
596 : egl_dpy{egl_dpy}
597 {
598+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
599+
600 static const EGLint ctx_attribs[] = {
601+#if MIR_SERVER_EGL_OPENGL_BIT == EGL_OPENGL_ES2_BIT
602 EGL_CONTEXT_CLIENT_VERSION, 2,
603+#endif
604 EGL_NONE };
605
606 egl_ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs);
607
608=== modified file 'src/renderers/gl/program_family.cpp'
609--- src/renderers/gl/program_family.cpp 2016-01-29 08:18:22 +0000
610+++ src/renderers/gl/program_family.cpp 2016-05-13 09:11:33 +0000
611@@ -17,7 +17,8 @@
612 */
613
614 #include "program_family.h"
615-
616+#include MIR_SERVER_GL_H
617+#include MIR_SERVER_GLEXT_H
618 #include <mutex>
619
620 namespace mir
621
622=== modified file 'src/renderers/gl/program_family.h'
623--- src/renderers/gl/program_family.h 2016-01-29 08:18:22 +0000
624+++ src/renderers/gl/program_family.h 2016-05-13 09:11:33 +0000
625@@ -19,7 +19,7 @@
626 #ifndef MIR_RENDERER_GL_PROGRAM_FAMILY_H_
627 #define MIR_RENDERER_GL_PROGRAM_FAMILY_H_
628
629-#include <GLES2/gl2.h>
630+#include MIR_SERVER_GL_H
631 #include <utility>
632 #include <map>
633 #include <unordered_map>
634
635=== modified file 'src/renderers/gl/renderer.cpp'
636--- src/renderers/gl/renderer.cpp 2016-05-03 04:36:33 +0000
637+++ src/renderers/gl/renderer.cpp 2016-05-13 09:11:33 +0000
638@@ -127,7 +127,9 @@
639
640 const GLchar* const mrg::Renderer::alpha_fshader =
641 {
642+ "#ifdef GL_ES\n"
643 "precision mediump float;\n"
644+ "#endif\n"
645 "uniform sampler2D tex;\n"
646 "uniform float alpha;\n"
647 "varying vec2 v_texcoord;\n"
648@@ -139,7 +141,9 @@
649
650 const GLchar* const mrg::Renderer::default_fshader =
651 { // This is the fastest fragment shader. Use it when you can.
652+ "#ifdef GL_ES\n"
653 "precision mediump float;\n"
654+ "#endif\n"
655 "uniform sampler2D tex;\n"
656 "varying vec2 v_texcoord;\n"
657 "void main() {\n"
658@@ -169,6 +173,7 @@
659 orientation(mir_orientation_normal),
660 mirror_mode(mir_mirror_mode_none)
661 {
662+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
663 EGLDisplay disp = eglGetCurrentDisplay();
664 if (disp != EGL_NO_DISPLAY)
665 {
666
667=== modified file 'src/renderers/gl/renderer.h'
668--- src/renderers/gl/renderer.h 2016-05-03 04:36:33 +0000
669+++ src/renderers/gl/renderer.h 2016-05-13 09:11:33 +0000
670@@ -28,7 +28,7 @@
671 #include <mir/gl/primitive.h>
672 #include "mir/renderer/gl/render_target.h"
673
674-#include <GLES2/gl2.h>
675+#include MIR_SERVER_GL_H
676 #include <unordered_map>
677 #include <unordered_set>
678 #include <vector>
679
680=== modified file 'src/server/CMakeLists.txt'
681--- src/server/CMakeLists.txt 2016-05-03 04:36:33 +0000
682+++ src/server/CMakeLists.txt 2016-05-13 09:11:33 +0000
683@@ -84,7 +84,7 @@
684
685 set(MIR_SERVER_REFERENCES
686 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
687- ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
688+ ${GL_LDFLAGS} ${GL_LIBRARIES}
689 ${UDEV_LDFLAGS} ${UDEV_LIBRARIES}
690 ${GLIB_LDFLAGS} ${GLIB_LIBRARIES}
691 ${UUID_LDFLAGS} ${UUID_LIBRARIES}
692@@ -109,7 +109,7 @@
693 ${GLog_LIBRARY}
694 ${GFlags_LIBRARY}
695 ${EGL_LDFLAGS} ${EGL_LIBRARIES}
696- ${GLESv2_LDFLAGS} ${GLESv2_LIBRARIES}
697+ ${GL_LDFLAGS} ${GL_LIBRARIES}
698 ${UDEV_LDFLAGS} ${UDEV_LIBRARIES}
699 ${GLIB_LDFLAGS} ${GLIB_LIBRARIES}
700 ${UUID_LDFLAGS} ${UUID_LIBRARIES}
701
702=== modified file 'src/server/compositor/screencast_display_buffer.h'
703--- src/server/compositor/screencast_display_buffer.h 2016-05-03 04:36:33 +0000
704+++ src/server/compositor/screencast_display_buffer.h 2016-05-13 09:11:33 +0000
705@@ -22,7 +22,8 @@
706 #include "mir/graphics/display_buffer.h"
707 #include "mir/renderer/gl/render_target.h"
708
709-#include <GLES2/gl2.h>
710+#include MIR_SERVER_GL_H
711+#include MIR_SERVER_GLEXT_H
712
713 namespace mir
714 {
715
716=== modified file 'src/server/graphics/CMakeLists.txt'
717--- src/server/graphics/CMakeLists.txt 2016-01-29 08:18:22 +0000
718+++ src/server/graphics/CMakeLists.txt 2016-05-13 09:11:33 +0000
719@@ -1,4 +1,4 @@
720-include_directories(${GLESv2_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR})
721+include_directories(${GL_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR})
722
723 add_library(
724 mirgraphics OBJECT
725
726=== modified file 'src/server/graphics/nested/display.cpp'
727--- src/server/graphics/nested/display.cpp 2016-02-01 22:53:06 +0000
728+++ src/server/graphics/nested/display.cpp 2016-05-13 09:11:33 +0000
729@@ -44,7 +44,9 @@
730
731 EGLint const mgn::detail::nested_egl_context_attribs[] =
732 {
733+#if MIR_SERVER_EGL_OPENGL_BIT == EGL_OPENGL_ES2_BIT
734 EGL_CONTEXT_CLIENT_VERSION, 2,
735+#endif
736 EGL_NONE
737 };
738
739@@ -86,14 +88,15 @@
740 BOOST_THROW_EXCEPTION(mg::egl_error("Nested Mir Display Error: Failed to initialize EGL."));
741 }
742
743+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
744 pixel_format = format;
745- egl_context_ = eglCreateContext(egl_display, choose_windowed_es_config(format), EGL_NO_CONTEXT, detail::nested_egl_context_attribs);
746+ egl_context_ = eglCreateContext(egl_display, choose_windowed_config(format), EGL_NO_CONTEXT, detail::nested_egl_context_attribs);
747
748 if (egl_context_ == EGL_NO_CONTEXT)
749 BOOST_THROW_EXCEPTION(mg::egl_error("Failed to create shared EGL context"));
750 }
751
752-EGLConfig mgn::detail::EGLDisplayHandle::choose_windowed_es_config(MirPixelFormat format) const
753+EGLConfig mgn::detail::EGLDisplayHandle::choose_windowed_config(MirPixelFormat format) const
754 {
755 EGLint const nested_egl_config_attribs[] =
756 {
757@@ -104,7 +107,7 @@
758 EGL_ALPHA_SIZE, mg::alpha_channel_depth(format),
759 EGL_DEPTH_SIZE, gl_config->depth_buffer_bits(),
760 EGL_STENCIL_SIZE, gl_config->stencil_buffer_bits(),
761- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
762+ EGL_RENDERABLE_TYPE, MIR_SERVER_EGL_OPENGL_BIT,
763 EGL_NONE
764 };
765 EGLConfig result;
766@@ -133,7 +136,7 @@
767 EGL_ALPHA_SIZE, mg::alpha_channel_depth(pixel_format),
768 EGL_DEPTH_SIZE, gl_config->depth_buffer_bits(),
769 EGL_STENCIL_SIZE, gl_config->stencil_buffer_bits(),
770- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
771+ EGL_RENDERABLE_TYPE, MIR_SERVER_EGL_OPENGL_BIT,
772 EGL_NONE
773 };
774 return std::make_unique<SurfacelessEGLContext>(egl_display, attribs, EGL_NO_CONTEXT);
775@@ -205,6 +208,7 @@
776
777 mgn::Display::~Display() noexcept
778 {
779+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
780 if (eglGetCurrentContext() == egl_display.egl_context())
781 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
782 }
783@@ -311,6 +315,7 @@
784 mir_buffer_usage_hardware,
785 static_cast<uint32_t>(best_output.id.as_value()));
786
787+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
788 display_buffer = std::make_shared<mgn::detail::DisplaySyncGroup>(
789 std::make_shared<mgn::detail::DisplayBuffer>(
790 egl_display,
791
792=== modified file 'src/server/graphics/nested/display.h'
793--- src/server/graphics/nested/display.h 2016-02-01 22:53:06 +0000
794+++ src/server/graphics/nested/display.h 2016-05-13 09:11:33 +0000
795@@ -78,7 +78,7 @@
796 ~EGLDisplayHandle() noexcept;
797
798 void initialize(MirPixelFormat format);
799- EGLConfig choose_windowed_es_config(MirPixelFormat format) const;
800+ EGLConfig choose_windowed_config(MirPixelFormat format) const;
801 EGLContext egl_context() const;
802 std::unique_ptr<graphics::GLContext> create_gl_context();
803
804
805=== modified file 'src/server/graphics/nested/display_buffer.cpp'
806--- src/server/graphics/nested/display_buffer.cpp 2016-05-03 04:36:33 +0000
807+++ src/server/graphics/nested/display_buffer.cpp 2016-05-13 09:11:33 +0000
808@@ -42,7 +42,7 @@
809 MirPixelFormat preferred_format) :
810 egl_display(egl_display),
811 host_surface{host_surface},
812- egl_config{egl_display.choose_windowed_es_config(preferred_format)},
813+ egl_config{egl_display.choose_windowed_config(preferred_format)},
814 egl_context{egl_display, eglCreateContext(egl_display, egl_config, egl_display.egl_context(), nested_egl_context_attribs)},
815 area{area.top_left, area.size},
816 dispatcher{dispatcher},
817
818=== modified file 'src/server/graphics/offscreen/display.cpp'
819--- src/server/graphics/offscreen/display.cpp 2016-01-27 16:09:11 +0000
820+++ src/server/graphics/offscreen/display.cpp 2016-05-13 09:11:33 +0000
821@@ -150,6 +150,7 @@
822 {
823 if (output.connected && output.preferred_mode_index < output.modes.size())
824 {
825+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
826 auto raw_db = new mgo::DisplayBuffer{
827 SurfacelessEGLContext{egl_display, egl_context_shared},
828 output.extents()};
829@@ -188,6 +189,7 @@
830
831 std::unique_ptr<mg::GLContext> mgo::Display::create_gl_context()
832 {
833+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
834 return std::make_unique<SurfacelessEGLContext>(egl_display, egl_context_shared);
835 }
836
837
838=== modified file 'src/server/graphics/offscreen/display_buffer.cpp'
839--- src/server/graphics/offscreen/display_buffer.cpp 2016-05-03 04:36:33 +0000
840+++ src/server/graphics/offscreen/display_buffer.cpp 2016-05-13 09:11:33 +0000
841@@ -23,8 +23,8 @@
842 #include <boost/throw_exception.hpp>
843 #include <stdexcept>
844
845-#include <GLES2/gl2.h>
846-#include <GLES2/gl2ext.h>
847+#include MIR_SERVER_GL_H
848+#include MIR_SERVER_GLEXT_H
849
850 namespace mg = mir::graphics;
851 namespace mgo = mg::offscreen;
852@@ -57,11 +57,13 @@
853 GLenum gl_color_format{GL_RGBA4};
854 GLenum const gl_depth_format{GL_DEPTH_COMPONENT16};
855
856+#ifdef GL_RGBA8_OES
857 if (extensions.support("GL_ARM_rgba8") ||
858 extensions.support("GL_OES_rgb8_rgba8"))
859 {
860 gl_color_format = GL_RGBA8_OES;
861 }
862+#endif
863
864 /* Create a renderbuffer for the color attachment */
865 glGenRenderbuffers(1, &color_renderbuffer);
866
867=== modified file 'src/server/graphics/surfaceless_egl_context.cpp'
868--- src/server/graphics/surfaceless_egl_context.cpp 2015-06-17 05:20:42 +0000
869+++ src/server/graphics/surfaceless_egl_context.cpp 2016-05-13 09:11:33 +0000
870@@ -120,7 +120,9 @@
871
872 EGLint const default_egl_context_attr[] =
873 {
874+#if MIR_SERVER_EGL_OPENGL_BIT == EGL_OPENGL_ES2_BIT
875 EGL_CONTEXT_CLIENT_VERSION, 2,
876+#endif
877 EGL_NONE
878 };
879
880@@ -131,7 +133,7 @@
881 EGL_GREEN_SIZE, 8,
882 EGL_BLUE_SIZE, 8,
883 EGL_ALPHA_SIZE, 0,
884- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
885+ EGL_RENDERABLE_TYPE, MIR_SERVER_EGL_OPENGL_BIT,
886 EGL_NONE
887 };
888
889@@ -180,6 +182,7 @@
890
891 void mg::SurfacelessEGLContext::make_current() const
892 {
893+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
894 if (eglGetCurrentContext() == egl_context)
895 return;
896
897@@ -193,6 +196,7 @@
898
899 void mg::SurfacelessEGLContext::release_current() const
900 {
901+ eglBindAPI(MIR_SERVER_EGL_OPENGL_API);
902 if (egl_context != EGL_NO_CONTEXT && eglGetCurrentContext() == egl_context)
903 eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
904 }
905
906=== modified file 'src/server/scene/gl_pixel_buffer.cpp'
907--- src/server/scene/gl_pixel_buffer.cpp 2016-01-29 08:18:22 +0000
908+++ src/server/scene/gl_pixel_buffer.cpp 2016-05-13 09:11:33 +0000
909@@ -23,8 +23,8 @@
910
911 #include <stdexcept>
912 #include <boost/throw_exception.hpp>
913-
914-#include <GLES2/gl2ext.h>
915+#include MIR_SERVER_GL_H
916+#include MIR_SERVER_GLEXT_H
917
918 namespace mg = mir::graphics;
919 namespace ms = mir::scene;
920
921=== modified file 'src/server/scene/gl_pixel_buffer.h'
922--- src/server/scene/gl_pixel_buffer.h 2014-03-06 06:05:17 +0000
923+++ src/server/scene/gl_pixel_buffer.h 2016-05-13 09:11:33 +0000
924@@ -24,7 +24,7 @@
925 #include <memory>
926 #include <vector>
927
928-#include <GLES2/gl2.h>
929+#include MIR_SERVER_GL_H
930
931 namespace mir
932 {
933
934=== modified file 'tests/unit-tests/graphics/test_shm_buffer.cpp'
935--- tests/unit-tests/graphics/test_shm_buffer.cpp 2016-04-01 06:57:58 +0000
936+++ tests/unit-tests/graphics/test_shm_buffer.cpp 2016-05-13 09:11:33 +0000
937@@ -162,7 +162,7 @@
938 TEST_F(ShmBufferTest, uploads_xrgb_8888_correctly)
939 {
940 #if __BYTE_ORDER == __LITTLE_ENDIAN
941- EXPECT_CALL(mock_gl, glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
942+ EXPECT_CALL(mock_gl, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
943 size.width.as_int(), size.height.as_int(),
944 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
945 stub_shm_file->fake_mapping));
946@@ -174,7 +174,7 @@
947 TEST_F(ShmBufferTest, uploads_argb_8888_correctly)
948 {
949 #if __BYTE_ORDER == __LITTLE_ENDIAN
950- EXPECT_CALL(mock_gl, glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
951+ EXPECT_CALL(mock_gl, glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
952 size.width.as_int(), size.height.as_int(),
953 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE,
954 stub_shm_file->fake_mapping));

Subscribers

People subscribed via source and target branches