egl: Implement __DRI_BACKGROUND_CALLABLE
authorEric Anholt <eric@anholt.net>
Fri, 28 Dec 2012 01:39:37 +0000 (17:39 -0800)
committerTimothy Arceri <tarceri@itsqueeze.com>
Thu, 16 Mar 2017 03:14:18 +0000 (14:14 +1100)
v2: (Timothy Arceri) use C99 initializers.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Marek Olšák <maraeo@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/platform_x11.c
src/egl/main/eglcontext.c
src/egl/main/eglcontext.h

index 4bab6f1c5e20fc901e0b7028975a8ee922150eed..2cab7d00c1fe6d095ccbdbcce1d1d47533404b6d 100644 (file)
 #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 }
 };
index f981e3890b696f449b8f9e731c8ca5040213dda1..230c0663d3c06f79b7e512084b49d7d16286c26d 100644 (file)
@@ -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);
index c5bb9734b1f2d8c93dcc648526f508035e71173a..2f1086e28f0befb35edafa7d23f159b9347229e1 100644 (file)
@@ -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,
 };
 
index 5313e1dabccc884bd77a7549a865352336a5c3d5..05cc523c8d12d6f7ef408f7b606a7550a6171056 100644 (file)
@@ -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;
index 69bf77d8aff7702c6af787fa5ee6b350d21de929..f2fe80662650eddad09c861244daa5f4306e8870 100644 (file)
@@ -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.