summaryrefslogtreecommitdiff
path: root/debian/patches/92-egl-Ensure-that-the-dummy-pbuffer-surface-is-compati.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/92-egl-Ensure-that-the-dummy-pbuffer-surface-is-compati.patch')
-rw-r--r--debian/patches/92-egl-Ensure-that-the-dummy-pbuffer-surface-is-compati.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/debian/patches/92-egl-Ensure-that-the-dummy-pbuffer-surface-is-compati.patch b/debian/patches/92-egl-Ensure-that-the-dummy-pbuffer-surface-is-compati.patch
new file mode 100644
index 0000000..c0d597e
--- /dev/null
+++ b/debian/patches/92-egl-Ensure-that-the-dummy-pbuffer-surface-is-compati.patch
@@ -0,0 +1,64 @@
+From 9e38b1e7ebf9d206a4de0e94a035c84cc59a9130 Mon Sep 17 00:00:00 2001
+From: Alexandros Frantzis <alexandros.frantzis@linaro.org>
+Date: Fri, 11 Feb 2011 16:11:43 +0200
+Subject: [PATCH 12/16] egl: Ensure that the dummy pbuffer surface is
+ compatible with the supplied context
+
+In order to be able to make an egl context current when using a
+pbuffer surface, that surface must have been created with a config
+that is compatible with the context config. For Mesa, this means that
+the configs must be the same.
+(cherry picked from commit 2181a53f61c08c3461c74932add4bac7bfa0cf27)
+
+Signed-off-by: Cyril Brulebois <kibi@debian.org>
+---
+ src/cairo-egl-context.c | 26 ++++++++++++++++----------
+ 1 files changed, 16 insertions(+), 10 deletions(-)
+
+diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
+index 9f14633..ec23852 100644
+--- a/src/cairo-egl-context.c
++++ b/src/cairo-egl-context.c
+@@ -140,7 +140,7 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
+ EGL_HEIGHT, 1,
+ EGL_NONE,
+ };
+- EGLConfig *configs;
++ EGLConfig config;
+ EGLint numConfigs;
+
+ ctx = calloc (1, sizeof (cairo_egl_context_t));
+@@ -158,15 +158,21 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
+
+ if (!_egl_make_current_surfaceless (ctx)) {
+ /* Fall back to dummy surface, meh. */
+- eglGetConfigs (dpy, NULL, 0, &numConfigs);
+- configs = malloc (sizeof(*configs) *numConfigs);
+- if (configs == NULL) {
+- free (ctx);
+- return _cairo_gl_context_create_in_error (CAIRO_STATUS_NO_MEMORY);
+- }
+- eglGetConfigs (dpy, configs, numConfigs, &numConfigs);
+- ctx->dummy_surface = eglCreatePbufferSurface (dpy, configs[0], attribs);
+- free (configs);
++ EGLint config_attribs[] = {
++ EGL_CONFIG_ID, 0,
++ EGL_NONE
++ };
++
++ /*
++ * In order to be able to make an egl context current when using a
++ * pbuffer surface, that surface must have been created with a config
++ * that is compatible with the context config. For Mesa, this means
++ * that the configs must be the same.
++ */
++ eglQueryContext (dpy, egl, EGL_CONFIG_ID, &config_attribs[1]);
++ eglChooseConfig (dpy, config_attribs, &config, 1, &numConfigs);
++
++ ctx->dummy_surface = eglCreatePbufferSurface (dpy, config, attribs);
+
+ if (ctx->dummy_surface == NULL) {
+ free (ctx);
+--
+1.7.5.4
+