summaryrefslogtreecommitdiffstats
path: root/src/glx/dri_common.c
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2010-07-28 15:33:09 -0400
committerKristian Høgsberg <[email protected]>2010-07-28 16:45:25 -0400
commitc491e585e43d48a2aeec96ccc4008da6c443fb42 (patch)
tree0d7b0b349e9aa398c5f208d496370c45f46db4d0 /src/glx/dri_common.c
parentc356f5867f2c1fad7155df538b9affa8dbdcf869 (diff)
glx: Move bind and unbind to context vtable
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 812fb2eb080..a7fb4c64244 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 */