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