diff options
Diffstat (limited to 'meta/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch')
-rw-r--r-- | meta/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/meta/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch b/meta/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch new file mode 100644 index 0000000000..43d4fb1d60 --- /dev/null +++ b/meta/recipes-graphics/mesa/mesa-demos/0001-xeglgears-Make-EGL_KHR_image-usage-portable.patch | |||
@@ -0,0 +1,95 @@ | |||
1 | From 43c2122af1caa750531f29bf734c03d1f50801d1 Mon Sep 17 00:00:00 2001 | ||
2 | Message-Id: <43c2122af1caa750531f29bf734c03d1f50801d1.1365283761.git.tom.zanussi@linux.intel.com> | ||
3 | From: Frank Binns <frank.binns@imgtec.com> | ||
4 | Date: Fri, 29 Jun 2012 14:06:27 +0100 | ||
5 | Subject: [PATCH] xeglgears: Make EGL_KHR_image usage portable | ||
6 | |||
7 | EGL extension functions don't have to be exported which means | ||
8 | xeglgears was failing to link against implementations that | ||
9 | support EGL_KHR_image but were not exporting its related functions. | ||
10 | |||
11 | This has been fixed by using eglGetProcAddress to get a function | ||
12 | pointer instead of using the functions prototype. This is portable. | ||
13 | |||
14 | Signed-off-by: Frank Binns <frank.binns@imgtec.com> | ||
15 | |||
16 | Integrated-by: Tom Zanussi <tom.zanussi@linux.intel.com> | ||
17 | |||
18 | Upstream-Status: Backport | ||
19 | --- | ||
20 | src/egl/opengl/xeglgears.c | 37 +++++++++++++++++++++++++++++++------ | ||
21 | 1 file changed, 31 insertions(+), 6 deletions(-) | ||
22 | |||
23 | diff --git a/src/egl/opengl/xeglgears.c b/src/egl/opengl/xeglgears.c | ||
24 | index 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 | -- | ||
94 | 1.7.11.4 | ||
95 | |||