*/
/*@{*/
- /**
- * Create the server-side portion of the GL context.
- */
- GLboolean (* createContext)( __DRIscreen *screen,
- int configID, void * contextID, drm_context_t * hw_context );
-
- /**
- * Destroy the server-side portion of the GL context.
- */
- GLboolean (* destroyContext)( __DRIscreen *screen, __DRIid context );
-
/**
* This function is used to get information about the position, size, and
* clip rects of a drawable.
void * (*createNewContext)(__DRIscreen *screen,
const __GLcontextModes *modes,
int render_type,
- void *sharedPrivate, __DRIcontext *pctx);
+ void *sharedPrivate,
+ drm_context_t hwContext, __DRIcontext *pctx);
/**
* Method to override base texture image with a driver specific 'offset'.
* Pointer to the mode used to create this context.
*/
const __GLcontextModes * mode;
+
+ /**
+ * XID for the server side drm_context_t
+ */
+ XID hwContextID;
#endif
/**
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.
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;
gc->fbconfigID = mode->fbconfigID;
gc->mode = mode;
}
+ else {
+ XF86DRIDestroyContext(dpy, psc->scr, gc->hwContextID);
+ }
}
}
#endif
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);
#endif
}
-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,
_gl_context_modes_create,
_gl_context_modes_destroy,
-
- __glXDRICreateContext,
- __glXDRIDestroyContext,
__glXDRIGetDrawableInfo,
if (oldGC->driContext.private) {
(*oldGC->driContext.destroyContext)
(oldGC->driContext.private);
+ XF86DRIDestroyContext(oldGC->createDpy,
+ oldGC->psc->scr,
+ gc->hwContextID);
oldGC->driContext.private = NULL;
}
}
if (pcp) {
(*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
- (void) (*dri_interface->destroyContext)(pcp->driScreenPriv->psc,
- pcp->contextID);
_mesa_free(pcp);
}
}
*/
static void *
driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes,
- int render_type, void *sharedPrivate, __DRIcontext *pctx)
+ int render_type, void *sharedPrivate,
+ drm_context_t hwContext, __DRIcontext *pctx)
{
__DRIcontextPrivate *pcp;
__DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate;
return NULL;
}
- if (! (*dri_interface->createContext)(screen, modes->fbconfigID,
- &pcp->contextID, &pcp->hHWContext)) {
- _mesa_free(pcp);
- return NULL;
- }
-
+ pcp->hHWContext = hwContext;
pcp->driScreenPriv = psp;
pcp->driDrawablePriv = NULL;
*/
if (!psp->dummyContextPriv.driScreenPriv) {
- psp->dummyContextPriv.contextID = 0;
psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context;
psp->dummyContextPriv.driScreenPriv = psp;
psp->dummyContextPriv.driDrawablePriv = NULL;
pctx->unbindContext = driUnbindContext;
if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) {
- (void) (*dri_interface->destroyContext)(screen, pcp->contextID);
_mesa_free(pcp);
return NULL;
}
* Per-context private driver information.
*/
struct __DRIcontextPrivateRec {
- /**
- * Kernel context handle used to access the device lock.
- */
- __DRIid contextID;
-
/**
* Kernel context handle used to access the device lock.
*/