summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c15
-rw-r--r--src/egl/drivers/dri2/egl_dri2.h1
-rw-r--r--src/egl/drivers/dri2/platform_x11.c2
-rw-r--r--src/egl/main/eglcontext.c2
-rw-r--r--src/egl/main/eglcontext.h3
5 files changed, 22 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 4bab6f1c5e2..2cab7d00c1f 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -83,6 +83,21 @@
#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] R:G 16:16 little endian */
#endif
+static void
+dri_set_background_context(void *loaderPrivate)
+{
+ _EGLContext *ctx = _eglGetCurrentContext();
+ _EGLThreadInfo *t = _eglGetCurrentThread();
+
+ _eglBindContextToThread(ctx, t);
+}
+
+const __DRIbackgroundCallableExtension background_callable_extension = {
+ .base = { __DRI_BACKGROUND_CALLABLE, 1 },
+
+ .setBackgroundContext = dri_set_background_context,
+};
+
const __DRIuseInvalidateExtension use_invalidate = {
.base = { __DRI_USE_INVALIDATE, 1 }
};
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index f981e3890b6..230c0663d3c 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -351,6 +351,7 @@ _EGL_DRIVER_TYPECAST(dri2_egl_sync, _EGLSync, obj)
extern const __DRIimageLookupExtension image_lookup_extension;
extern const __DRIuseInvalidateExtension use_invalidate;
+extern const __DRIbackgroundCallableExtension background_callable_extension;
EGLBoolean
dri2_load_driver(_EGLDisplay *disp);
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index c5bb9734b1f..2f1086e28f0 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -1423,12 +1423,14 @@ static const __DRIdri2LoaderExtension dri2_loader_extension = {
static const __DRIextension *dri2_loader_extensions_old[] = {
&dri2_loader_extension_old.base,
&image_lookup_extension.base,
+ &background_callable_extension.base,
NULL,
};
static const __DRIextension *dri2_loader_extensions[] = {
&dri2_loader_extension.base,
&image_lookup_extension.base,
+ &background_callable_extension.base,
NULL,
};
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index 5313e1dabcc..05cc523c8d1 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -583,7 +583,7 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c,
*
* Note that the context may be NULL.
*/
-static _EGLContext *
+_EGLContext *
_eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t)
{
_EGLContext *oldCtx;
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index 69bf77d8aff..f2fe8066265 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -82,6 +82,9 @@ _eglBindContext(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read,
_EGLContext **old_ctx,
_EGLSurface **old_draw, _EGLSurface **old_read);
+extern _EGLContext *
+_eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t);
+
/**
* Increment reference count for the context.