diff options
Diffstat (limited to 'debian/patches/95-gl-Take-advantage-of-GLX_MESA_multithread_makecurren.patch')
-rw-r--r-- | debian/patches/95-gl-Take-advantage-of-GLX_MESA_multithread_makecurren.patch | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/debian/patches/95-gl-Take-advantage-of-GLX_MESA_multithread_makecurren.patch b/debian/patches/95-gl-Take-advantage-of-GLX_MESA_multithread_makecurren.patch new file mode 100644 index 0000000..daabcb6 --- /dev/null +++ b/debian/patches/95-gl-Take-advantage-of-GLX_MESA_multithread_makecurren.patch @@ -0,0 +1,71 @@ +From 1085971717af280f6d12a5fbf3d11f8586a74357 Mon Sep 17 00:00:00 2001 +From: Eric Anholt <eric@anholt.net> +Date: Mon, 31 Jan 2011 20:47:15 -0800 +Subject: [PATCH 15/16] gl: Take advantage of GLX_MESA_multithread_makecurrent + to avoid unbinding. + +Because of GLX's unfortunate requirement that only one context have a +thread current at a time, we had to unbind the context, triggering a +flush, and eating of all the CPU. With a small tweak to the GLX spec +by GLX_MESA_multithread_makecurrent, and a small tweak to Mesa that +consisted mostly of deleting the "is this thread already bound +elsewhere?" check, we can bind our context to any thread and use it +safely as long as our usage of it is mutexed, which cairo-gl should +already be doing. + +[ 0] before firefox-talos-gfx 50.260 50.525 0.25% 3/3 +[ 0] after firefox-talos-gfx 32.091 32.422 0.65% 3/3 +(cherry picked from commit 2fae22a3f2914a6e79436bafe94d19100d7cf6bf) + +Signed-off-by: Cyril Brulebois <kibi@debian.org> +--- + src/cairo-glx-context.c | 12 +++++++++++- + 1 files changed, 11 insertions(+), 1 deletions(-) + +diff --git a/src/cairo-glx-context.c b/src/cairo-glx-context.c +index 83963fb..f89fa32 100644 +--- a/src/cairo-glx-context.c ++++ b/src/cairo-glx-context.c +@@ -52,6 +52,8 @@ typedef struct _cairo_glx_context { + Display *display; + Window dummy_window; + GLXContext context; ++ ++ cairo_bool_t has_multithread_makecurrent; + } cairo_glx_context_t; + + typedef struct _cairo_glx_surface { +@@ -92,7 +94,9 @@ _glx_release (void *abstract_ctx) + { + cairo_glx_context_t *ctx = abstract_ctx; + +- glXMakeCurrent (ctx->display, None, None); ++ if (!ctx->has_multithread_makecurrent) { ++ glXMakeCurrent (ctx->display, None, None); ++ } + } + + static void +@@ -174,6 +178,7 @@ cairo_glx_device_create (Display *dpy, GLXContext gl_ctx) + cairo_glx_context_t *ctx; + cairo_status_t status; + Window dummy = None; ++ const char *glx_extensions; + + status = _glx_dummy_ctx (dpy, gl_ctx, &dummy); + if (unlikely (status)) +@@ -206,6 +211,11 @@ cairo_glx_device_create (Display *dpy, GLXContext gl_ctx) + return _cairo_gl_context_create_in_error (status); + } + ++ glx_extensions = glXQueryExtensionsString (dpy, DefaultScreen (dpy)); ++ if (strstr(glx_extensions, "GLX_MESA_multithread_makecurrent")) { ++ ctx->has_multithread_makecurrent = TRUE; ++ } ++ + ctx->base.release (ctx); + + return &ctx->base.base; +-- +1.7.5.4 + |