summaryrefslogtreecommitdiffstats
path: root/common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-build-fix.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-build-fix.patch')
-rw-r--r--common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-build-fix.patch257
1 files changed, 257 insertions, 0 deletions
diff --git a/common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-build-fix.patch b/common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-build-fix.patch
new file mode 100644
index 0000000..46a3e98
--- /dev/null
+++ b/common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-build-fix.patch
@@ -0,0 +1,257 @@
1From ab76f645e29b0a603ff95d88f976bc35ab6301ee Mon Sep 17 00:00:00 2001
2From: Frank Binns <frank.binns@imgtec.com>
3Date: Fri, 29 Jun 2012 11:26:04 +0100
4Subject: [PATCH 1/2] mesa-demos: Fix build when EGL_MESA_screen_surface
5 extension isn't present
6
7The EGL demos won't build against EGL implementations that don't support
8the EGL_MESA_screen_surface extension. Fix this, in most cases, by
9wrapping relevant bits of code in #ifdef EGL_MESA_screen_surface.
10
11Signed-off-by: Frank Binns <frank.binns@imgtec.com>
12
13Applied and fixed up in Yocto by...
14
15Integrated-by: Tom Zanussi <tom.zanussi@linux.intel.com>
16
17Upstream-Status: Pending
18
19Index: mesa-demos-8.0.1/src/egl/eglut/eglut.c
20===================================================================
21--- mesa-demos-8.0.1.orig/src/egl/eglut/eglut.c
22+++ mesa-demos-8.0.1/src/egl/eglut/eglut.c
23@@ -51,8 +51,9 @@ _eglutNow(void)
24 static void
25 _eglutDestroyWindow(struct eglut_window *win)
26 {
27- if (_eglut->surface_type != EGL_PBUFFER_BIT &&
28- _eglut->surface_type != EGL_SCREEN_BIT_MESA)
29+
30+ if (_eglut->surface_type == EGL_WINDOW_BIT ||
31+ _eglut->surface_type == EGL_PIXMAP_BIT)
32 eglDestroySurface(_eglut->dpy, win->surface);
33
34 _eglutNativeFiniWindow(win);
35@@ -150,7 +151,9 @@ _eglutCreateWindow(const char *title, in
36 win->config, win->native.u.pixmap, NULL);
37 break;
38 case EGL_PBUFFER_BIT:
39+#ifdef EGL_MESA_screen_surface
40 case EGL_SCREEN_BIT_MESA:
41+#endif
42 win->surface = win->native.u.surface;
43 break;
44 default:
45@@ -264,8 +267,10 @@ eglutDestroyWindow(int win)
46 if (window->index != win)
47 return;
48
49+#ifdef EGL_MESA_screen_surface
50 /* XXX it causes some bug in st/egl KMS backend */
51 if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
52+#endif
53 eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
54
55 _eglutDestroyWindow(_eglut->current);
56Index: mesa-demos-8.0.1/src/egl/eglut/eglut_screen.c
57===================================================================
58--- mesa-demos-8.0.1.orig/src/egl/eglut/eglut_screen.c
59+++ mesa-demos-8.0.1/src/egl/eglut/eglut_screen.c
60@@ -10,26 +10,33 @@
61
62 #define MAX_MODES 100
63
64+#ifdef EGL_MESA_screen_surface
65 static EGLScreenMESA kms_screen;
66 static EGLModeMESA kms_mode;
67 static EGLint kms_width, kms_height;
68+#endif
69
70 void
71 _eglutNativeInitDisplay(void)
72 {
73+#ifdef EGL_MESA_screen_surface
74 _eglut->native_dpy = EGL_DEFAULT_DISPLAY;
75 _eglut->surface_type = EGL_SCREEN_BIT_MESA;
76+#endif
77 }
78
79 void
80 _eglutNativeFiniDisplay(void)
81 {
82+#ifdef EGL_MESA_screen_surface
83 kms_screen = 0;
84 kms_mode = 0;
85 kms_width = 0;
86 kms_height = 0;
87+#endif
88 }
89
90+#ifdef EGL_MESA_screen_surface
91 static void
92 init_kms(void)
93 {
94@@ -69,19 +76,23 @@ init_kms(void)
95 kms_width = width;
96 kms_height = height;
97 }
98+#endif
99
100 void
101 _eglutNativeInitWindow(struct eglut_window *win, const char *title,
102 int x, int y, int w, int h)
103 {
104+#ifdef EGL_MESA_screen_surface
105 EGLint surf_attribs[16];
106 EGLint i;
107+#endif
108 const char *exts;
109
110 exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS);
111 if (!exts || !strstr(exts, "EGL_MESA_screen_surface"))
112 _eglutFatal("EGL_MESA_screen_surface is not supported\n");
113
114+#ifdef EGL_MESA_screen_surface
115 init_kms();
116
117 i = 0;
118@@ -103,14 +114,17 @@ _eglutNativeInitWindow(struct eglut_wind
119
120 win->native.width = kms_width;
121 win->native.height = kms_height;
122+#endif
123 }
124
125 void
126 _eglutNativeFiniWindow(struct eglut_window *win)
127 {
128+#ifdef EGL_MESA_screen_surface
129 eglShowScreenSurfaceMESA(_eglut->dpy,
130 kms_screen, EGL_NO_SURFACE, 0);
131 eglDestroySurface(_eglut->dpy, win->native.u.surface);
132+#endif
133 }
134
135 void
136Index: mesa-demos-8.0.1/src/egl/opengl/demo1.c
137===================================================================
138--- mesa-demos-8.0.1.orig/src/egl/opengl/demo1.c
139+++ mesa-demos-8.0.1/src/egl/opengl/demo1.c
140@@ -18,6 +18,7 @@
141 static void
142 TestScreens(EGLDisplay dpy)
143 {
144+#ifdef EGL_MESA_screen_surface
145 #define MAX 8
146 EGLScreenMESA screens[MAX];
147 EGLint numScreens;
148@@ -28,6 +29,7 @@ TestScreens(EGLDisplay dpy)
149 for (i = 0; i < numScreens; i++) {
150 printf(" Screen %d handle: %d\n", i, (int) screens[i]);
151 }
152+#endif
153 }
154
155 /**
156Index: mesa-demos-8.0.1/src/egl/opengl/demo2.c
157===================================================================
158--- mesa-demos-8.0.1.orig/src/egl/opengl/demo2.c
159+++ mesa-demos-8.0.1/src/egl/opengl/demo2.c
160@@ -16,6 +16,7 @@
161
162 /*#define FRONTBUFFER*/
163
164+#ifdef EGL_MESA_screen_surface
165 static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2,
166 GLfloat r, GLfloat g, GLfloat b)
167 {
168@@ -95,12 +96,13 @@ TestScreens(EGLDisplay dpy)
169 printf(" Screen %d handle: %d\n", i, (int) screens[i]);
170 }
171 }
172-
173+#endif
174
175 int
176 main(int argc, char *argv[])
177 {
178 int maj, min;
179+#ifdef EGL_MESA_screen_surface
180 EGLContext ctx;
181 EGLSurface pbuffer, screen_surf;
182 EGLConfig configs[10];
183@@ -115,6 +117,7 @@ main(int argc, char *argv[])
184 EGLModeMESA mode;
185 EGLScreenMESA screen;
186 EGLint count;
187+#endif
188
189 EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
190 assert(d);
191@@ -132,6 +135,7 @@ main(int argc, char *argv[])
192 exit(1);
193 }
194
195+#ifdef EGL_MESA_screen_surface
196 eglGetConfigs(d, configs, 10, &numConfigs);
197 printf("Got %d EGL configs:\n", numConfigs);
198 for (i = 0; i < numConfigs; i++) {
199@@ -211,6 +215,7 @@ main(int argc, char *argv[])
200 eglDestroySurface(d, pbuffer);
201 eglDestroyContext(d, ctx);
202 eglTerminate(d);
203+#endif
204
205 return 0;
206 }
207Index: mesa-demos-8.0.1/src/egl/opengl/demo3.c
208===================================================================
209--- mesa-demos-8.0.1.orig/src/egl/opengl/demo3.c
210+++ mesa-demos-8.0.1/src/egl/opengl/demo3.c
211@@ -46,7 +46,7 @@ GLubyte OpenGL_bits[] = {
212 0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00,
213 };
214
215-
216+#ifdef EGL_MESA_screen_surface
217 static void Init(void)
218 {
219
220@@ -551,11 +551,13 @@ write_ppm(const char *filename, const GL
221 fclose(f);
222 }
223 }
224+#endif
225
226 int
227 main(int argc, char *argv[])
228 {
229 int maj, min;
230+#ifdef EGL_MESA_screen_surface
231 EGLContext ctx;
232 EGLSurface screen_surf;
233 EGLConfig configs[10];
234@@ -566,6 +568,7 @@ main(int argc, char *argv[])
235 const GLubyte *bitmap;
236 EGLint screenAttribs[32];
237 EGLint i;
238+#endif
239
240 EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
241 assert(d);
242@@ -583,6 +586,7 @@ main(int argc, char *argv[])
243 exit(1);
244 }
245
246+#ifdef EGL_MESA_screen_surface
247 eglGetConfigs(d, configs, 10, &numConfigs);
248 eglGetScreensMESA(d, &screen, 1, &count);
249 eglGetModesMESA(d, screen, &mode, 1, &count);
250@@ -642,6 +646,7 @@ main(int argc, char *argv[])
251 eglDestroySurface(d, screen_surf);
252 eglDestroyContext(d, ctx);
253 eglTerminate(d);
254+#endif
255
256 return 0;
257 }