egl: Implement __DRI_BACKGROUND_CALLABLE

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>
This commit is contained in:
Eric Anholt 2012-12-27 17:39:37 -08:00 committed by Timothy Arceri
parent 6b70d9fce3
commit 3b7b6adf3a
5 changed files with 22 additions and 1 deletions

View File

@ -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 }
};

View 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);

View 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,
};

View 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;

View 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.