diff options
author | Adam Jackson <[email protected]> | 2017-11-14 15:13:05 -0500 |
---|---|---|
committer | Adam Jackson <[email protected]> | 2017-12-01 15:53:52 -0500 |
commit | a48a6b8a400e6e92961cf7b7b4c287e8e9875f39 (patch) | |
tree | c5693e5f74022bc174d2e62b14f189cfb9f8ebe9 /src/glx/dri_common.c | |
parent | 75d5d22fb790d856809a9dd896ffc22a268d1d96 (diff) |
glx: Prepare driFetchDrawable for no-config contexts
When we look up the DRI drawable state we need to associate an fbconfig
with the drawable. With GLX_EXT_no_config_context we can no longer infer
that from the context and must instead query the server.
Signed-off-by: Adam Jackson <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glx/dri_common.c')
-rw-r--r-- | src/glx/dri_common.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 3b82309fa20..ab5d6c5bc03 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -396,12 +396,25 @@ driDestroyConfigs(const __DRIconfig **configs) free(configs); } +static struct glx_config * +driInferDrawableConfig(struct glx_screen *psc, GLXDrawable draw) +{ + unsigned int fbconfig = 0; + + if (__glXGetDrawableAttribute(psc->dpy, draw, GLX_FBCONFIG_ID, &fbconfig)) { + return glx_config_find_fbconfig(psc->configs, fbconfig); + } + + return NULL; +} + _X_HIDDEN __GLXDRIdrawable * driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable) { struct glx_display *const priv = __glXInitialize(gc->psc->dpy); __GLXDRIdrawable *pdraw; struct glx_screen *psc; + struct glx_config *config = gc->config; if (priv == NULL) return NULL; @@ -418,8 +431,13 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable) return pdraw; } - pdraw = psc->driScreen->createDrawable(psc, glxDrawable, - glxDrawable, gc->config); + if (config == NULL) + config = driInferDrawableConfig(gc->psc, glxDrawable); + if (config == NULL) + return NULL; + + pdraw = psc->driScreen->createDrawable(psc, glxDrawable, glxDrawable, + config); if (pdraw == NULL) { ErrorMessageF("failed to create drawable\n"); |