summaryrefslogtreecommitdiffstats
path: root/common/recipes-graphics
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-graphics')
-rw-r--r--common/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch95
-rw-r--r--common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-build-fix.patch257
-rw-r--r--common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-query.patch35
-rw-r--r--common/recipes-graphics/mesa/mesa-demos_8.0.1.bbappend5
4 files changed, 392 insertions, 0 deletions
diff --git a/common/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch b/common/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch
new file mode 100644
index 00000000..43d4fb1d
--- /dev/null
+++ b/common/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch
@@ -0,0 +1,95 @@
1From 43c2122af1caa750531f29bf734c03d1f50801d1 Mon Sep 17 00:00:00 2001
2Message-Id: <43c2122af1caa750531f29bf734c03d1f50801d1.1365283761.git.tom.zanussi@linux.intel.com>
3From: Frank Binns <frank.binns@imgtec.com>
4Date: Fri, 29 Jun 2012 14:06:27 +0100
5Subject: [PATCH] xeglgears: Make EGL_KHR_image usage portable
6
7EGL extension functions don't have to be exported which means
8xeglgears was failing to link against implementations that
9support EGL_KHR_image but were not exporting its related functions.
10
11This has been fixed by using eglGetProcAddress to get a function
12pointer instead of using the functions prototype. This is portable.
13
14Signed-off-by: Frank Binns <frank.binns@imgtec.com>
15
16Integrated-by: Tom Zanussi <tom.zanussi@linux.intel.com>
17
18Upstream-Status: Backport
19---
20 src/egl/opengl/xeglgears.c | 37 +++++++++++++++++++++++++++++++------
21 1 file changed, 31 insertions(+), 6 deletions(-)
22
23diff --git a/src/egl/opengl/xeglgears.c b/src/egl/opengl/xeglgears.c
24index 513c587..866b89a 100644
25--- a/src/egl/opengl/xeglgears.c
26+++ b/src/egl/opengl/xeglgears.c
27@@ -51,6 +51,10 @@
28 static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES_func;
29 #endif
30
31+#ifdef EGL_KHR_image
32+static PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR_func;
33+#endif
34+
35
36 #define BENCHMARK
37
38@@ -405,6 +409,17 @@ egl_manager_new(EGLNativeDisplayType xdpy, const EGLint *attrib_list,
39 eglGetProcAddress("glEGLImageTargetTexture2DOES");
40 #endif
41
42+#ifdef EGL_KHR_image
43+ eglCreateImageKHR_func = (PFNEGLCREATEIMAGEKHRPROC)
44+ eglGetProcAddress("eglCreateImageKHR");
45+ if (eglCreateImageKHR_func == NULL) {
46+ printf("failed to get eglCreateImageKHR\n");
47+ eglTerminate(eman->dpy);
48+ free(eman);
49+ return NULL;
50+ }
51+#endif
52+
53 return eman;
54 }
55
56@@ -850,10 +865,16 @@ main(int argc, char *argv[])
57 case GEARS_PIXMAP:
58 case GEARS_PIXMAP_TEXTURE:
59 ret = egl_manager_create_pixmap(eman, eman->xwin, EGL_TRUE, NULL);
60+
61+#ifdef EGL_KHR_image
62 if (surface_type == GEARS_PIXMAP_TEXTURE)
63- eman->image = eglCreateImageKHR (eman->dpy, eman->ctx,
64- EGL_NATIVE_PIXMAP_KHR,
65- (EGLClientBuffer) eman->xpix, NULL);
66+ eman->image = eglCreateImageKHR_func(eman->dpy, eman->ctx,
67+ EGL_NATIVE_PIXMAP_KHR,
68+ (EGLClientBuffer) eman->xpix, NULL);
69+#else
70+ fprintf(stderr, "EGL_KHR_image not found at compile time.\n");
71+#endif
72+
73 if (ret)
74 ret = eglMakeCurrent(eman->dpy, eman->pix, eman->pix, eman->ctx);
75 break;
76@@ -892,9 +913,13 @@ main(int argc, char *argv[])
77 GL_RENDERBUFFER_EXT,
78 color_rb);
79
80- eman->image = eglCreateImageKHR(eman->dpy, eman->ctx,
81- EGL_GL_RENDERBUFFER_KHR,
82- (EGLClientBuffer) color_rb, NULL);
83+#ifdef EGL_KHR_image
84+ eman->image = eglCreateImageKHR_func(eman->dpy, eman->ctx,
85+ EGL_GL_RENDERBUFFER_KHR,
86+ (EGLClientBuffer) color_rb, NULL);
87+#else
88+ fprintf(stderr, "EGL_KHR_image not found at compile time.\n");
89+#endif
90
91 glGenRenderbuffers(1, &depth_rb);
92 glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_rb);
93--
941.7.11.4
95
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 00000000..46a3e98c
--- /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 }
diff --git a/common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-query.patch b/common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-query.patch
new file mode 100644
index 00000000..79537081
--- /dev/null
+++ b/common/recipes-graphics/mesa/mesa-demos/egl-mesa-screen-surface-query.patch
@@ -0,0 +1,35 @@
1From cf90a5c0c173d017a80cde057da57c365b3b1a40 Mon Sep 17 00:00:00 2001
2From: Frank Binns <frank.binns@imgtec.com>
3Date: Fri, 29 Jun 2012 12:00:26 +0100
4Subject: [PATCH 2/2] mesa-demos: Query display for EGL_MESA_screen_surface
5 extension before using it
6
7This code makes heavy use of the EGL_MESA_screen_surface extension so
8check the display to determine if it's supported by the underlying EGL
9implementation. If it doesn't then bail.
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/opengl/demo1.c
20===================================================================
21--- mesa-demos-8.0.1.orig/src/egl/opengl/demo1.c
22+++ mesa-demos-8.0.1/src/egl/opengl/demo1.c
23@@ -110,6 +110,12 @@ main(int argc, char *argv[])
24 printf("EGL version = %d.%d\n", maj, min);
25 printf("EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
26
27+ if (!strstr(eglQueryString(d, EGL_EXTENSIONS),
28+ "EGL_MESA_screen_surface")) {
29+ printf("EGL_MESA_screen_surface is not supported\n");
30+ exit(1);
31+ }
32+
33 eglGetConfigs(d, NULL, 0, &numConfigs);
34 configs = malloc(sizeof(*configs) *numConfigs);
35 eglGetConfigs(d, configs, numConfigs, &numConfigs);
diff --git a/common/recipes-graphics/mesa/mesa-demos_8.0.1.bbappend b/common/recipes-graphics/mesa/mesa-demos_8.0.1.bbappend
new file mode 100644
index 00000000..1894cb16
--- /dev/null
+++ b/common/recipes-graphics/mesa/mesa-demos_8.0.1.bbappend
@@ -0,0 +1,5 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3SRC_URI += "file://egl-mesa-screen-surface-build-fix.patch \
4 file://egl-mesa-screen-surface-query.patch \
5 file://0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch"