From c491e585e43d48a2aeec96ccc4008da6c443fb42 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 28 Jul 2010 15:33:09 -0400 Subject: glx: Move bind and unbind to context vtable --- src/glx/drisw_glx.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/glx/drisw_glx.c') diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c index 070c9d612b..46c56066e6 100644 --- a/src/glx/drisw_glx.c +++ b/src/glx/drisw_glx.c @@ -36,7 +36,6 @@ struct drisw_display struct drisw_context { struct glx_context base; - __GLXDRIcontext dri_vtable; __DRIcontext *driContext; }; @@ -258,21 +257,29 @@ drisw_destroy_context(struct glx_context *context) Xfree(pcp); } -static Bool -driBindContext(struct glx_context * context, - __GLXDRIdrawable * draw, __GLXDRIdrawable * read) +static int +drisw_bind_context(struct glx_context *context, struct glx_context *old, + GLXDrawable draw, GLXDrawable read) { struct drisw_context *pcp = (struct drisw_context *) context; struct drisw_screen *psc = (struct drisw_screen *) pcp->base.psc; - struct drisw_drawable *pdr = (struct drisw_drawable *) draw; - struct drisw_drawable *prd = (struct drisw_drawable *) read; + struct drisw_drawable *pdraw, *pread; + + pdraw = (struct drisw_drawable *) driFetchDrawable(context, draw); + pread = (struct drisw_drawable *) driFetchDrawable(context, read); + + if (pdraw == NULL || pread == NULL) + return GLXBadDrawable; + + if ((*psc->core->bindContext) (pcp->driContext, + pdraw->driDrawable, pread->driDrawable)) + return Success; - return (*psc->core->bindContext) (pcp->driContext, - pdr->driDrawable, prd->driDrawable); + return GLXBadContext; } static void -driUnbindContext(struct glx_context * context) +drisw_unbind_context(struct glx_context *context, struct glx_context *new) { struct drisw_context *pcp = (struct drisw_context *) context; struct drisw_screen *psc = (struct drisw_screen *) pcp->base.psc; @@ -282,6 +289,8 @@ driUnbindContext(struct glx_context * context) static const struct glx_context_vtable drisw_context_vtable = { drisw_destroy_context, + drisw_bind_context, + drisw_unbind_context, NULL, NULL, DRI_glXUseXFont, @@ -303,7 +312,7 @@ drisw_create_context(struct glx_screen *base, return NULL; if (shareList) { - pcp_shared = (struct drisw_context *) shareList->driContext; + pcp_shared = (struct drisw_context *) shareList; shared = pcp_shared->driContext; } @@ -326,9 +335,6 @@ drisw_create_context(struct glx_screen *base, } pcp->base.vtable = &drisw_context_vtable; - pcp->base.driContext = &pcp->dri_vtable; - pcp->dri_vtable.bindContext = driBindContext; - pcp->dri_vtable.unbindContext = driUnbindContext; return &pcp->base; } -- cgit v1.2.3