diff options
author | Gregory Hainaut <[email protected]> | 2017-05-29 13:18:26 +0200 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-05-29 17:06:49 +0100 |
commit | 63b78c939bcca5a0ec29259e312b986604d617f3 (patch) | |
tree | b4e639d3a42f594a23aba8ac57eda507b459f5ea /src/glx/dri2_glx.c | |
parent | fa84f6225b1342dbe564962f639de50c5e9029d3 (diff) |
glx: implement __DRIbackgroundCallableExtension.isThreadSafe
v2:
bump version
v3:
Add code comment
s/IsGlThread/IsThread/ (and variation)
v4:
DRI3 doesn't hit X through GL call so it is always safe
Signed-off-by: Gregory Hainaut <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/glx/dri2_glx.c')
-rw-r--r-- | src/glx/dri2_glx.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index 145f44d6e8c..4f163688f2c 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -953,6 +953,18 @@ driSetBackgroundContext(void *loaderPrivate) __glXSetCurrentContext(&pcp->base); } +static GLboolean +driIsThreadSafe(void *loaderPrivate) +{ + struct dri2_context *pcp = (struct dri2_context *) loaderPrivate; + /* Check Xlib is running in thread safe mode + * + * 'lock_fns' is the XLockDisplay function pointer of the X11 display 'dpy'. + * It wll be NULL if XInitThreads wasn't called. + */ + return pcp->base.psc->dpy->lock_fns != NULL; +} + static const __DRIdri2LoaderExtension dri2LoaderExtension = { .base = { __DRI_DRI2_LOADER, 3 }, @@ -974,9 +986,10 @@ static const __DRIuseInvalidateExtension dri2UseInvalidate = { }; static const __DRIbackgroundCallableExtension driBackgroundCallable = { - .base = { __DRI_BACKGROUND_CALLABLE, 1 }, + .base = { __DRI_BACKGROUND_CALLABLE, 2 }, .setBackgroundContext = driSetBackgroundContext, + .isThreadSafe = driIsThreadSafe, }; _X_HIDDEN void |