summaryrefslogtreecommitdiffstats
path: root/src/glx/dri2_glx.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/dri2_glx.c
parentc356f5867f2c1fad7155df538b9affa8dbdcf869 (diff)
glx: Move bind and unbind to context vtable
Diffstat (limited to 'src/glx/dri2_glx.c')
-rw-r--r--src/glx/dri2_glx.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 8ad0e339edf..e57d10f0913 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -95,7 +95,6 @@ struct dri2_screen {
struct dri2_context
{
struct glx_context base;
- __GLXDRIcontext dri_vtable;
__DRIcontext *driContext;
};
@@ -133,20 +132,28 @@ dri2_destroy_context(struct glx_context *context)
}
static Bool
-dri2BindContext(struct glx_context *context,
- __GLXDRIdrawable *draw, __GLXDRIdrawable *read)
+dri2_bind_context(struct glx_context *context, struct glx_context *old,
+ GLXDrawable draw, GLXDrawable read)
{
struct dri2_context *pcp = (struct dri2_context *) context;
struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
- struct dri2_drawable *pdr = (struct dri2_drawable *) draw;
- struct dri2_drawable *prd = (struct dri2_drawable *) read;
+ struct dri2_drawable *pdraw, *pread;
- return (*psc->core->bindContext) (pcp->driContext,
- pdr->driDrawable, prd->driDrawable);
+ pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw);
+ pread = (struct dri2_drawable *) driFetchDrawable(context, read);
+
+ if (pdraw == NULL || pread == NULL)
+ return GLXBadDrawable;
+
+ if ((*psc->core->bindContext) (pcp->driContext,
+ pdraw->driDrawable, pread->driDrawable))
+ return Success;
+
+ return GLXBadContext;
}
static void
-dri2UnbindContext(struct glx_context *context)
+dri2_unbind_context(struct glx_context *context, struct glx_context *new)
{
struct dri2_context *pcp = (struct dri2_context *) context;
struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
@@ -189,9 +196,6 @@ dri2_create_context(struct glx_screen *base,
}
pcp->base.vtable = &dri2_context_vtable;
- pcp->base.driContext = &pcp->dri_vtable;
- pcp->dri_vtable.bindContext = dri2BindContext;
- pcp->dri_vtable.unbindContext = dri2UnbindContext;
return &pcp->base;
}
@@ -684,6 +688,8 @@ dri2_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
static const struct glx_context_vtable dri2_context_vtable = {
dri2_destroy_context,
+ dri2_bind_context,
+ dri2_unbind_context,
dri2_wait_gl,
dri2_wait_x,
DRI_glXUseXFont,