mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-16 12:50:38 +02:00
dri: cosmetic
To smooth minor diff between dri_util & drisw_util
This commit is contained in:
parent
2fbba6bb90
commit
cd86a5d2f8
2 changed files with 43 additions and 66 deletions
|
|
@ -74,23 +74,22 @@ dri2CreateNewScreen(int scrn, int fd,
|
|||
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;
|
||||
}
|
||||
|
|
@ -112,8 +111,7 @@ static void driDestroyScreen(__DRIscreen *psp)
|
|||
|
||||
_mesa_destroy_shader_compiler();
|
||||
|
||||
if (driDriverAPI.DestroyScreen)
|
||||
driDriverAPI.DestroyScreen(psp);
|
||||
driDriverAPI.DestroyScreen(psp);
|
||||
|
||||
driDestroyOptionCache(&psp->optionCache);
|
||||
driDestroyOptionInfo(&psp->optionInfo);
|
||||
|
|
@ -166,12 +164,13 @@ dri2CreateNewContextForAPI(__DRIscreen *screen, int api,
|
|||
if (!context)
|
||||
return NULL;
|
||||
|
||||
context->driScreenPriv = screen;
|
||||
context->driDrawablePriv = NULL;
|
||||
context->loaderPrivate = data;
|
||||
|
||||
if (!driDriverAPI.CreateContext(mesa_api, modes,
|
||||
context, shareCtx) ) {
|
||||
context->driScreenPriv = screen;
|
||||
context->driDrawablePriv = NULL;
|
||||
context->driReadablePriv = NULL;
|
||||
|
||||
if (!driDriverAPI.CreateContext(mesa_api, modes, context, shareCtx) ) {
|
||||
free(context);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -184,8 +183,8 @@ static __DRIcontext *
|
|||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -252,7 +251,6 @@ static int driBindContext(__DRIcontext *pcp,
|
|||
dri_get_drawable(prp);
|
||||
}
|
||||
|
||||
/* Call device-specific MakeCurrent */
|
||||
return driDriverAPI.MakeCurrent(pcp, pdp, prp);
|
||||
}
|
||||
|
||||
|
|
@ -283,15 +281,15 @@ static int driUnbindContext(__DRIcontext *pcp)
|
|||
*/
|
||||
|
||||
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);
|
||||
|
|
@ -303,20 +301,20 @@ static int driUnbindContext(__DRIcontext *pcp)
|
|||
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;
|
||||
}
|
||||
|
|
@ -331,15 +329,12 @@ static void dri_get_drawable(__DRIdrawable *pdp)
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -347,7 +342,7 @@ static void dri_put_drawable(__DRIdrawable *pdp)
|
|||
static __DRIdrawable *
|
||||
dri2CreateNewDrawable(__DRIscreen *screen,
|
||||
const __DRIconfig *config,
|
||||
void *loaderPrivate)
|
||||
void *data)
|
||||
{
|
||||
__DRIdrawable *pdraw;
|
||||
|
||||
|
|
@ -355,15 +350,18 @@ dri2CreateNewDrawable(__DRIscreen *screen,
|
|||
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;
|
||||
}
|
||||
|
|
@ -391,7 +389,7 @@ dri2AllocateBuffer(__DRIscreen *screen,
|
|||
static void
|
||||
dri2ReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
|
||||
{
|
||||
driDriverAPI.ReleaseBuffer(screen, buffer);
|
||||
driDriverAPI.ReleaseBuffer(screen, buffer);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,20 +54,19 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
|
|||
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;
|
||||
|
|
@ -80,7 +79,6 @@ static void driDestroyScreen(__DRIscreen *psp)
|
|||
{
|
||||
if (psp) {
|
||||
driDriverAPI.DestroyScreen(psp);
|
||||
|
||||
FREE(psp);
|
||||
}
|
||||
}
|
||||
|
|
@ -95,38 +93,13 @@ static const __DRIextension **driGetExtensions(__DRIscreen *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;
|
||||
|
||||
|
|
@ -154,8 +127,7 @@ driCreateNewContextForAPI(__DRIscreen *psp, int 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;
|
||||
}
|
||||
|
|
@ -163,6 +135,14 @@ driCreateNewContextForAPI(__DRIscreen *psp, int api,
|
|||
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)
|
||||
{
|
||||
|
|
@ -193,7 +173,7 @@ static int driBindContext(__DRIcontext *pcp,
|
|||
pdp->driContextPriv = pcp;
|
||||
dri_get_drawable(pdp);
|
||||
}
|
||||
if ( prp && pdp != prp ) {
|
||||
if (prp && pdp != prp) {
|
||||
dri_get_drawable(prp);
|
||||
}
|
||||
}
|
||||
|
|
@ -248,7 +228,6 @@ static void dri_put_drawable(__DRIdrawable *pdp)
|
|||
return;
|
||||
|
||||
driDriverAPI.DestroyBuffer(pdp);
|
||||
|
||||
FREE(pdp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue