diff options
author | Kristian Høgsberg <krh@hinata.boston.redhat.com> | 2007-05-10 18:38:49 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2007-10-10 17:09:16 -0400 |
commit | 8ed5c7ca0572a09375bdfd411c3804456dac78d6 (patch) | |
tree | 79a5fc7225b5d1be313bc99599ea7a51a4e8f7c3 /src/glx/x11 | |
parent | 4ff95e78e19e5902352ea3759d32d9f013255f42 (diff) |
Drop createContext and destroyContext from DRIinterfaceMethods.
As for createDrawable and destroyDrawable, these functions immediately
upon entry to driCreateNewContext and immediately before exit from
driDestroyContext. Instead of passing function pointers back and forth
just obtain the drm_context_t prior to calling DRIscreen::createNewContext
and pass it as a parameter.
This change also lets us keep the DRI context XID in the libGL loader only.
Diffstat (limited to 'src/glx/x11')
-rw-r--r-- | src/glx/x11/glxclient.h | 5 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 14 | ||||
-rw-r--r-- | src/glx/x11/glxext.c | 28 |
3 files changed, 22 insertions, 25 deletions
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 7ed4549658..5697325175 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -361,6 +361,11 @@ struct __GLXcontextRec { * Pointer to the mode used to create this context. */ const __GLcontextModes * mode; + + /** + * XID for the server side drm_context_t + */ + XID hwContextID; #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 229da5a584..b6c0c763e3 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -382,6 +382,7 @@ CreateContext(Display *dpy, XVisualInfo *vis, int screen = (fbconfig == NULL) ? vis->screen : fbconfig->screen; __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen); const __GLcontextModes * mode; + drm_context_t hwContext; /* The value of fbconfig cannot change because it is tested * later in the function. @@ -402,10 +403,19 @@ CreateContext(Display *dpy, XVisualInfo *vis, if (psc && psc->driScreen.private) { void * const shared = (shareList != NULL) ? shareList->driContext.private : NULL; + + + if (!XF86DRICreateContextWithConfig(dpy, psc->scr, + mode->fbconfigID, + &gc->hwContextID, &hwContext)) + /* gah, handle this better */ + return NULL; + gc->driContext.private = (*psc->driScreen.createNewContext)( &psc->driScreen, mode, renderType, shared, + hwContext, &gc->driContext ); if (gc->driContext.private) { gc->isDirect = GL_TRUE; @@ -415,6 +425,9 @@ CreateContext(Display *dpy, XVisualInfo *vis, gc->fbconfigID = mode->fbconfigID; gc->mode = mode; } + else { + XF86DRIDestroyContext(dpy, psc->scr, gc->hwContextID); + } } } #endif @@ -524,6 +537,7 @@ DestroyContext(Display *dpy, GLXContext gc) if (gc->isDirect) { if (gc->driContext.private) { (*gc->driContext.destroyContext)(gc->driContext.private); + XF86DRIDestroyContext(dpy, gc->psc->scr, gc->hwContextID); gc->driContext.private = NULL; } GarbageCollectDRIDrawables(dpy, gc->screen); diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index dce01d5528..85c990d4fc 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -774,28 +774,6 @@ static void __glXReportDamage(__DRIdrawable *driDraw, } static GLboolean -__glXDRICreateContext(__DRIscreen *screen, int configID, - void *pid, drm_context_t *hHWContext) -{ - __GLXscreenConfigs *psc = - containerOf(screen, __GLXscreenConfigs, driScreen); - Display *dpy = psc->dpy; - - return XF86DRICreateContextWithConfig(dpy, psc->scr, - configID, pid, hHWContext); -} - -static GLboolean -__glXDRIDestroyContext(__DRIscreen *screen, __DRIid context_id) -{ - __GLXscreenConfigs *psc = - containerOf(screen, __GLXscreenConfigs, driScreen); - Display *dpy = psc->dpy; - - return XF86DRIDestroyContext(dpy, psc->scr, context_id); -} - -static GLboolean __glXDRIGetDrawableInfo(__DRIdrawable *drawable, unsigned int *index, unsigned int *stamp, int *X, int *Y, int *W, int *H, @@ -824,9 +802,6 @@ static const __DRIinterfaceMethods interface_methods = { _gl_context_modes_create, _gl_context_modes_destroy, - - __glXDRICreateContext, - __glXDRIDestroyContext, __glXDRIGetDrawableInfo, @@ -1816,6 +1791,9 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, if (oldGC->driContext.private) { (*oldGC->driContext.destroyContext) (oldGC->driContext.private); + XF86DRIDestroyContext(oldGC->createDpy, + oldGC->psc->scr, + gc->hwContextID); oldGC->driContext.private = NULL; } } |