summaryrefslogtreecommitdiff
path: root/src/glx/dri_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glx/dri_common.c')
-rw-r--r--src/glx/dri_common.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 812fb2eb08..a7fb4c6424 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -353,4 +353,31 @@ driDestroyConfigs(const __DRIconfig **configs)
free(configs);
}
+_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;
+
+ if (priv == NULL)
+ return NULL;
+
+ psc = priv->screens[gc->screen];
+ if (priv->drawHash == NULL)
+ return NULL;
+
+ if (__glxHashLookup(priv->drawHash, glxDrawable, (void *) &pdraw) == 0)
+ return pdraw;
+
+ pdraw = psc->driScreen->createDrawable(psc, glxDrawable,
+ glxDrawable, gc->config);
+ if (__glxHashInsert(priv->drawHash, glxDrawable, pdraw)) {
+ (*pdraw->destroyDrawable) (pdraw);
+ return NULL;
+ }
+
+ return pdraw;
+}
+
#endif /* GLX_DIRECT_RENDERING */