drmFreeVersion(version);
}
+ psp->loaderPrivate = data;
+
psp->extensions = emptyExtensionList;
psp->fd = fd;
psp->myNum = scrn;
psp->api_mask = (1 << __DRI_API_OPENGL);
+
*driver_configs = driDriverAPI.InitScreen(psp);
if (*driver_configs == NULL) {
free(psp);
return NULL;
}
- psp->loaderPrivate = data;
-
- driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
- __dri2NConfigOptions);
- driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum,
- "dri2");
+ driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions, __dri2NConfigOptions);
+ driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum, "dri2");
return psp;
}
_mesa_destroy_shader_compiler();
- if (driDriverAPI.DestroyScreen)
- driDriverAPI.DestroyScreen(psp);
+ driDriverAPI.DestroyScreen(psp);
driDestroyOptionCache(&psp->optionCache);
driDestroyOptionInfo(&psp->optionInfo);
if (!context)
return NULL;
+ context->loaderPrivate = data;
+
context->driScreenPriv = screen;
context->driDrawablePriv = NULL;
- context->loaderPrivate = data;
+ context->driReadablePriv = NULL;
- if (!driDriverAPI.CreateContext(mesa_api, modes,
- context, shareCtx) ) {
+ if (!driDriverAPI.CreateContext(mesa_api, modes, context, shareCtx) ) {
free(context);
return NULL;
}
dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
__DRIcontext *shared, void *data)
{
- return dri2CreateNewContextForAPI(screen, __DRI_API_OPENGL,
- config, shared, data);
+ return dri2CreateNewContextForAPI(screen, __DRI_API_OPENGL,
+ config, shared, data);
}
/**
dri_get_drawable(prp);
}
- /* Call device-specific MakeCurrent */
return driDriverAPI.MakeCurrent(pcp, pdp, prp);
}
*/
if (pcp == NULL)
- return GL_FALSE;
+ return GL_FALSE;
pdp = pcp->driDrawablePriv;
prp = pcp->driReadablePriv;
/* already unbound */
if (!pdp && !prp)
- return GL_TRUE;
- /* Let driver unbind drawable from context */
+ return GL_TRUE;
+
driDriverAPI.UnbindContext(pcp);
assert(pdp);
dri_put_drawable(pdp);
if (prp != pdp) {
- if (prp->refcount == 0) {
+ if (prp->refcount == 0) {
/* ERROR!!! */
return GL_FALSE;
}
- dri_put_drawable(prp);
+ dri_put_drawable(prp);
}
-
/* XXX this is disabled so that if we call SwapBuffers on an unbound
* window we can determine the last context bound to the window and
* use that context's lock. (BrianP, 2-Dec-2000)
*/
- pcp->driDrawablePriv = pcp->driReadablePriv = NULL;
+ pcp->driDrawablePriv = NULL;
+ pcp->driReadablePriv = NULL;
return GL_TRUE;
}
static void dri_put_drawable(__DRIdrawable *pdp)
{
- __DRIscreen *psp;
-
if (pdp) {
pdp->refcount--;
if (pdp->refcount)
return;
- psp = pdp->driScreenPriv;
- driDriverAPI.DestroyBuffer(pdp);
+ driDriverAPI.DestroyBuffer(pdp);
free(pdp);
}
}
static __DRIdrawable *
dri2CreateNewDrawable(__DRIscreen *screen,
const __DRIconfig *config,
- void *loaderPrivate)
+ void *data)
{
__DRIdrawable *pdraw;
if (!pdraw)
return NULL;
+ pdraw->loaderPrivate = data;
+
+ pdraw->driScreenPriv = screen;
pdraw->driContextPriv = NULL;
- pdraw->loaderPrivate = loaderPrivate;
- pdraw->refcount = 1;
+ pdraw->refcount = 0;
pdraw->lastStamp = 0;
pdraw->w = 0;
pdraw->h = 0;
- pdraw->driScreenPriv = screen;
- if (!driDriverAPI.CreateBuffer(screen, pdraw, &config->modes, 0)) {
+ dri_get_drawable(pdraw);
+
+ if (!driDriverAPI.CreateBuffer(screen, pdraw, &config->modes, GL_FALSE)) {
free(pdraw);
return NULL;
}
static void
dri2ReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
{
- driDriverAPI.ReleaseBuffer(screen, buffer);
+ driDriverAPI.ReleaseBuffer(screen, buffer);
}
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
- (void) data;
-
psp = CALLOC_STRUCT(__DRIscreenRec);
if (!psp)
return NULL;
setupLoaderExtensions(psp, extensions);
+ psp->loaderPrivate = data;
+
psp->extensions = emptyExtensionList;
psp->fd = -1;
psp->myNum = scrn;
*driver_configs = driDriverAPI.InitScreen(psp);
-
if (*driver_configs == NULL) {
FREE(psp);
return NULL;
{
if (psp) {
driDriverAPI.DestroyScreen(psp);
-
FREE(psp);
}
}
* Context functions
*/
-static __DRIcontext *
-driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
- __DRIcontext *shared, void *data)
-{
- __DRIcontext *pcp;
- void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
-
- pcp = CALLOC_STRUCT(__DRIcontextRec);
- if (!pcp)
- return NULL;
-
- pcp->loaderPrivate = data;
-
- pcp->driScreenPriv = psp;
- pcp->driDrawablePriv = NULL;
- pcp->driReadablePriv = NULL;
-
- if (!driDriverAPI.CreateContext(API_OPENGL,
- &config->modes, pcp, shareCtx)) {
- FREE(pcp);
- return NULL;
- }
-
- return pcp;
-}
-
static __DRIcontext *
driCreateNewContextForAPI(__DRIscreen *psp, int api,
const __DRIconfig *config,
__DRIcontext *shared, void *data)
{
__DRIcontext *pcp;
+ const struct gl_config *modes = (config != NULL) ? &config->modes : NULL;
void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
gl_api mesa_api;
pcp->driDrawablePriv = NULL;
pcp->driReadablePriv = NULL;
- if (!driDriverAPI.CreateContext(mesa_api,
- &config->modes, pcp, shareCtx)) {
+ if (!driDriverAPI.CreateContext(mesa_api, modes, pcp, shareCtx)) {
FREE(pcp);
return NULL;
}
return pcp;
}
+static __DRIcontext *
+driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
+ __DRIcontext *shared, void *data)
+{
+ return driCreateNewContextForAPI(psp, __DRI_API_OPENGL,
+ config, shared, data);
+}
+
static void
driDestroyContext(__DRIcontext *pcp)
{
pdp->driContextPriv = pcp;
dri_get_drawable(pdp);
}
- if ( prp && pdp != prp ) {
+ if (prp && pdp != prp) {
dri_get_drawable(prp);
}
}
return;
driDriverAPI.DestroyBuffer(pdp);
-
FREE(pdp);
}
}