From 4a22ae8d446855d839cc199df8eb1b057045cb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Sun, 7 Jan 2007 08:12:01 -0500 Subject: Remove XIDs from DRI interface (see #5714). --- src/mesa/drivers/dri/common/dri_util.c | 198 +++------------------------------ src/mesa/drivers/dri/common/dri_util.h | 5 - src/mesa/drivers/dri/i810/i810screen.c | 2 +- 3 files changed, 17 insertions(+), 188 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index c30e66f172..1f916a82ca 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -88,63 +88,6 @@ __driUtilMessage(const char *f, ...) } -/*****************************************************************/ -/** \name Drawable list management */ -/*****************************************************************/ -/*@{*/ - -static GLboolean __driAddDrawable(void *drawHash, __DRIdrawable *pdraw) -{ - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; - - if (drmHashInsert(drawHash, pdp->draw, pdraw)) - return GL_FALSE; - - return GL_TRUE; -} - -static __DRIdrawable *__driFindDrawable(void *drawHash, __DRIid draw) -{ - int retcode; - __DRIdrawable *pdraw; - - retcode = drmHashLookup(drawHash, draw, (void *)&pdraw); - if (retcode) - return NULL; - - return pdraw; -} - - -/** - * Find drawables in the local hash that have been destroyed on the - * server. - * - * \param drawHash Hash-table containing all know drawables. - */ -static void __driGarbageCollectDrawables(void *drawHash) -{ - __DRIid draw; - __DRInativeDisplay *dpy; - __DRIdrawable *pdraw; - - if (drmHashFirst(drawHash, &draw, (void *)&pdraw) == 1) { - do { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; - dpy = pdp->driScreenPriv->display; - if (! (*dri_interface->windowExists)(dpy, draw)) { - /* Destroy the local drawable data, if the drawable no - longer exists in the Xserver */ - (*pdraw->destroyDrawable)(dpy, pdraw->private); - _mesa_free(pdraw); - } - } while (drmHashNext(drawHash, &draw, (void *)&pdraw) == 1); - } -} - -/*@}*/ - - /*****************************************************************/ /** \name Context (un)binding functions */ /*****************************************************************/ @@ -155,8 +98,6 @@ static void __driGarbageCollectDrawables(void *drawHash) * * \param dpy the display handle. * \param scrn the screen number. - * \param draw drawable. - * \param read Current reading drawable. * \param gc context. * * \return \c GL_TRUE on success, or \c GL_FALSE on failure. @@ -170,12 +111,9 @@ static void __driGarbageCollectDrawables(void *drawHash) * into their respective real types it also assures they are not \c NULL. */ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, - __DRIid draw, __DRIid read, - __DRIcontext *ctx) + __DRIcontext *ctx) { __DRIscreen *pDRIScreen; - __DRIdrawable *pdraw; - __DRIdrawable *pread; __DRIcontextPrivate *pcp; __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -186,7 +124,7 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, ** calling driUnbindContext. */ - if (ctx == NULL || draw == None || read == None) { + if (ctx == NULL) { /* ERROR!!! */ return GL_FALSE; } @@ -199,26 +137,12 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, psp = (__DRIscreenPrivate *)pDRIScreen->private; pcp = (__DRIcontextPrivate *)ctx->private; - - pdraw = __driFindDrawable(psp->drawHash, draw); - if (!pdraw) { - /* ERROR!!! */ - return GL_FALSE; - } - pdp = (__DRIdrawablePrivate *)pdraw->private; - - pread = __driFindDrawable(psp->drawHash, read); - if (!pread) { - /* ERROR!!! */ - return GL_FALSE; - } - prp = (__DRIdrawablePrivate *)pread->private; - + pdp = (__DRIdrawablePrivate *)pcp->driDrawablePriv; + prp = (__DRIdrawablePrivate *)pcp->driReadablePriv; /* Let driver unbind drawable from context */ (*psp->DriverAPI.UnbindContext)(pcp); - if (pdp->refcount == 0) { /* ERROR!!! */ return GL_FALSE; @@ -254,72 +178,20 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, * This function takes both a read buffer and a draw buffer. This is needed * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. - * - * \bug This function calls \c driCreateNewDrawable in two places with the - * \c renderType hard-coded to \c GLX_WINDOW_BIT. Some checking might - * be needed in those places when support for pbuffers and / or pixmaps - * is added. Is it safe to assume that the drawable is a window? */ static GLboolean DoBindContext(__DRInativeDisplay *dpy, - __DRIid draw, __DRIid read, - __DRIcontext *ctx, const __GLcontextModes * modes, - __DRIscreenPrivate *psp) + __DRIdrawable *pdraw, + __DRIdrawable *pread, + __DRIcontext *ctx, + __DRIscreenPrivate *psp) { - __DRIdrawable *pdraw; __DRIdrawablePrivate *pdp; - __DRIdrawable *pread; __DRIdrawablePrivate *prp; __DRIcontextPrivate * const pcp = ctx->private; - /* Find the _DRIdrawable which corresponds to the writing drawable. */ - pdraw = __driFindDrawable(psp->drawHash, draw); - if (!pdraw) { - /* Allocate a new drawable */ - pdraw = (__DRIdrawable *)_mesa_malloc(sizeof(__DRIdrawable)); - if (!pdraw) { - /* ERROR!!! */ - return GL_FALSE; - } - - /* Create a new drawable */ - driCreateNewDrawable(dpy, modes, draw, pdraw, GLX_WINDOW_BIT, - empty_attribute_list); - if (!pdraw->private) { - /* ERROR!!! */ - _mesa_free(pdraw); - return GL_FALSE; - } - - } pdp = (__DRIdrawablePrivate *) pdraw->private; - - /* Find the _DRIdrawable which corresponds to the reading drawable. */ - if (read == draw) { - /* read buffer == draw buffer */ - prp = pdp; - } - else { - pread = __driFindDrawable(psp->drawHash, read); - if (!pread) { - /* Allocate a new drawable */ - pread = (__DRIdrawable *)_mesa_malloc(sizeof(__DRIdrawable)); - if (!pread) { - /* ERROR!!! */ - return GL_FALSE; - } - - /* Create a new drawable */ - driCreateNewDrawable(dpy, modes, read, pread, GLX_WINDOW_BIT, - empty_attribute_list); - if (!pread->private) { - /* ERROR!!! */ - _mesa_free(pread); - return GL_FALSE; - } - } - prp = (__DRIdrawablePrivate *) pread->private; - } + prp = (__DRIdrawablePrivate *) pread->private; /* Bind the drawable to the context */ pcp->driDrawablePriv = pdp; @@ -359,8 +231,9 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy, * function. */ static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, - __DRIid draw, __DRIid read, - __DRIcontext * ctx) + __DRIdrawable *pdraw, + __DRIdrawable *pread, + __DRIcontext * ctx) { __DRIscreen *pDRIScreen; @@ -369,7 +242,7 @@ static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, ** calling driBindContext. */ - if (ctx == NULL || draw == None || read == None) { + if (ctx == NULL || pdraw == None || pread == None) { /* ERROR!!! */ return GL_FALSE; } @@ -380,7 +253,7 @@ static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, return GL_FALSE; } - return DoBindContext( dpy, draw, read, ctx, ctx->mode, + return DoBindContext( dpy, pdraw, pread, ctx, (__DRIscreenPrivate *)pDRIScreen->private ); } /*@}*/ @@ -438,8 +311,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - if (!__driFindDrawable(psp->drawHash, pdp->draw) || - ! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw, + if (! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, @@ -675,30 +547,9 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, pdp->swapBuffers = psp->DriverAPI.SwapBuffers; - /* Add pdraw to drawable list */ - if (!__driAddDrawable(psp->drawHash, pdraw)) { - /* ERROR!!! */ - (*pdraw->destroyDrawable)(dpy, pdp); - _mesa_free(pdp); - pdp = NULL; - pdraw->private = NULL; - } - return (void *) pdp; } -static __DRIdrawable * -driGetDrawable(__DRInativeDisplay *dpy, __DRIid draw, void *screenPrivate) -{ - __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; - - /* - ** Make sure this routine returns NULL if the drawable is not bound - ** to a direct rendering context! - */ - return __driFindDrawable(psp->drawHash, draw); -} - static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) { @@ -710,9 +561,7 @@ driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) psp = pdp->driScreenPriv; scrn = psp->myNum; (*psp->DriverAPI.DestroyBuffer)(pdp); - if ((*dri_interface->windowExists)(dpy, pdp->draw)) - (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); - drmHashDelete(psp->drawHash, pdp->draw); + (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; @@ -751,7 +600,6 @@ driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate) if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); - __driGarbageCollectDrawables(pcp->driScreenPriv->drawHash); (void) (*dri_interface->destroyContext)(dpy, scrn, pcp->contextID); _mesa_free(pcp); } @@ -836,8 +684,6 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, return NULL; } - __driGarbageCollectDrawables(pcp->driScreenPriv->drawHash); - return pcp; } /*@}*/ @@ -874,15 +720,11 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); - _mesa_free(psp->pDevPriv); (void)drmCloseOnce(psp->fd); if ( psp->modes != NULL ) { (*dri_interface->destroyContextModes)( psp->modes ); } - assert(psp->drawHash); - drmHashDestroy(psp->drawHash); - _mesa_free(psp); } } @@ -939,13 +781,6 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, return NULL; } - /* Create the hash table */ - psp->drawHash = drmHashCreate(); - if ( psp->drawHash == NULL ) { - _mesa_free( psp ); - return NULL; - } - psp->display = dpy; psp->myNum = scrn; psp->psc = psc; @@ -993,7 +828,6 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, psc->destroyScreen = driDestroyScreen; psc->createNewDrawable = driCreateNewDrawable; - psc->getDrawable = driGetDrawable; psc->getMSC = driGetMSC; psc->createNewContext = driCreateNewContext; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 539d28d114..a08eab1616 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -489,11 +489,6 @@ struct __DRIscreenPrivateRec { */ __DRIcontextPrivate dummyContextPriv; - /** - * Hash table to hold the drawable information for this screen. - */ - void *drawHash; - /** * Device-dependent private information (not stored in the SAREA). * diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index f8cf050d7e..c0a7cdb90a 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -431,7 +431,7 @@ static const struct __DriverAPIRec i810API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20070105( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, -- cgit v1.2.3 From aceccda56b08338e217991e54607f1c9f18fc3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 10 May 2007 15:52:22 -0400 Subject: Drop __DRInativeDisplay and pass in __DRIscreen pointers instead. Many DRI entry points took a __DRInativeDisplay pointer and a screen index as arguments. The only use for the native display pointer was to pass it back to the loader when looking up the __DRIscreen for the given screen index. Instead, let's just pass in the __DRIscreen pointer directly, which let's drop the __DRInativeDisplay type and the getScreen function. The assumption is now that the loader will be able to retrieve context from the __DRIscreen pointer when necessary. --- src/mesa/drivers/dri/common/dri_util.c | 139 ++++++++----------------- src/mesa/drivers/dri/common/dri_util.h | 24 +---- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 22 ++-- src/mesa/drivers/dri/i810/i810screen.c | 23 ++-- src/mesa/drivers/dri/i915/intel_screen.c | 33 +++--- src/mesa/drivers/dri/i965/intel_screen.c | 22 ++-- src/mesa/drivers/dri/mach64/mach64_screen.c | 22 ++-- src/mesa/drivers/dri/mga/mga_xmesa.c | 22 ++-- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 22 ++-- src/mesa/drivers/dri/r128/r128_screen.c | 22 ++-- src/mesa/drivers/dri/r200/r200_ioctl.c | 6 +- src/mesa/drivers/dri/r200/r200_ioctl.h | 6 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 25 +++-- src/mesa/drivers/dri/savage/savage_xmesa.c | 22 ++-- src/mesa/drivers/dri/sis/sis_screen.c | 23 ++-- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 22 ++-- src/mesa/drivers/dri/trident/trident_context.c | 24 ++--- src/mesa/drivers/dri/unichrome/via_context.c | 3 - src/mesa/drivers/dri/unichrome/via_context.h | 1 - src/mesa/drivers/dri/unichrome/via_screen.c | 23 ++-- 20 files changed, 216 insertions(+), 290 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 1f916a82ca..2b5d6f0a59 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -33,7 +33,7 @@ #include "drm_sarea.h" #ifndef GLX_OML_sync_control -typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRInativeDisplay *dpy, __DRIid drawable, int32_t *numerator, int32_t *denominator); +typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); #endif /* This pointer *must* be set by the driver's __driCreateNewScreen funciton! @@ -53,16 +53,16 @@ static const int empty_attribute_list[1] = { None }; static int api_ver = 0; /* forward declarations */ -static int driQueryFrameTracking( __DRInativeDisplay *dpy, void *priv, +static int driQueryFrameTracking( void *priv, int64_t *sbc, int64_t *missedFrames, float *lastMissedUsage, float *usage ); -static void *driCreateNewDrawable(__DRInativeDisplay *dpy, - const __GLcontextModes *modes, +static void *driCreateNewDrawable(__DRIscreen *screen, + const __GLcontextModes *modes, __DRIid draw, __DRIdrawable *pdraw, int renderType, const int *attrs); -static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate); +static void driDestroyDrawable(void *drawablePrivate); /** @@ -96,8 +96,7 @@ __driUtilMessage(const char *f, ...) /** * Unbind context. * - * \param dpy the display handle. - * \param scrn the screen number. + * \param scrn the screen. * \param gc context. * * \return \c GL_TRUE on success, or \c GL_FALSE on failure. @@ -110,10 +109,8 @@ __driUtilMessage(const char *f, ...) * While casting the opaque private pointers associated with the parameters * into their respective real types it also assures they are not \c NULL. */ -static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, - __DRIcontext *ctx) +static GLboolean driUnbindContext(__DRIcontext *ctx) { - __DRIscreen *pDRIScreen; __DRIcontextPrivate *pcp; __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -124,19 +121,11 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, ** calling driUnbindContext. */ - if (ctx == NULL) { - /* ERROR!!! */ - return GL_FALSE; - } + if (ctx == NULL) + return GL_FALSE; - pDRIScreen = (*dri_interface->getScreen)(dpy, scrn); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - /* ERROR!!! */ - return GL_FALSE; - } - - psp = (__DRIscreenPrivate *)pDRIScreen->private; pcp = (__DRIcontextPrivate *)ctx->private; + psp = (__DRIscreenPrivate *)pcp->driScreenPriv; pdp = (__DRIdrawablePrivate *)pcp->driDrawablePriv; prp = (__DRIdrawablePrivate *)pcp->driReadablePriv; @@ -179,16 +168,14 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean DoBindContext(__DRInativeDisplay *dpy, - __DRIdrawable *pdraw, +static GLboolean DoBindContext(__DRIdrawable *pdraw, __DRIdrawable *pread, - __DRIcontext *ctx, - __DRIscreenPrivate *psp) + __DRIcontext *ctx) { __DRIdrawablePrivate *pdp; __DRIdrawablePrivate *prp; __DRIcontextPrivate * const pcp = ctx->private; - + __DRIscreenPrivate *psp = pcp->driScreenPriv; pdp = (__DRIdrawablePrivate *) pdraw->private; prp = (__DRIdrawablePrivate *) pread->private; @@ -230,31 +217,19 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy, * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, - __DRIdrawable *pdraw, +static GLboolean driBindContext(__DRIdrawable *pdraw, __DRIdrawable *pread, __DRIcontext * ctx) { - __DRIscreen *pDRIScreen; - /* ** Assume error checking is done properly in glXMakeCurrent before ** calling driBindContext. */ - if (ctx == NULL || pdraw == None || pread == None) { - /* ERROR!!! */ - return GL_FALSE; - } - - pDRIScreen = (*dri_interface->getScreen)(dpy, scrn); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - /* ERROR!!! */ + if (ctx == NULL || pdraw == None || pread == None) return GL_FALSE; - } - return DoBindContext( dpy, pdraw, pread, ctx, - (__DRIscreenPrivate *)pDRIScreen->private ); + return DoBindContext( pdraw, pread, ctx ); } /*@}*/ @@ -311,7 +286,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - if (! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw, + if (! (*dri_interface->getDrawableInfo)(pdp->driScreenPriv->psc, pdp->draw, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, @@ -345,7 +320,6 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) /** * Swap buffers. * - * \param dpy the display handle. * \param drawablePrivate opaque pointer to the per-drawable private info. * * \internal @@ -353,7 +327,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) * * Is called directly from glXSwapBuffers(). */ -static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate ) +static void driSwapBuffers(void *drawablePrivate) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; drm_clip_rect_t rect; @@ -374,8 +348,7 @@ static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate ) * front buffer, so we report the damage there rather than to the backing * store (if any). */ - (*dri_interface->reportDamage)(dpy, dPriv->screen, dPriv->draw, - dPriv->x, dPriv->y, + (*dri_interface->reportDamage)(dPriv->pdraw, dPriv->x, dPriv->y, &rect, 1, GL_TRUE); } @@ -392,7 +365,7 @@ static int driGetMSC( void *screenPrivate, int64_t *msc ) /** * Called directly from a number of higher-level GLX functions. */ -static int driGetSBC( __DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc ) +static int driGetSBC( void *drawablePrivate, int64_t *sbc ) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; __DRIswapInfo sInfo; @@ -405,8 +378,7 @@ static int driGetSBC( __DRInativeDisplay *dpy, void *drawablePrivate, int64_t *s return status; } -static int driWaitForSBC( __DRInativeDisplay * dpy, void *drawablePriv, - int64_t target_sbc, +static int driWaitForSBC( void *drawablePriv, int64_t target_sbc, int64_t * msc, int64_t * sbc ) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; @@ -415,8 +387,7 @@ static int driWaitForSBC( __DRInativeDisplay * dpy, void *drawablePriv, msc, sbc ); } -static int driWaitForMSC( __DRInativeDisplay * dpy, void *drawablePriv, - int64_t target_msc, +static int driWaitForMSC( void *drawablePriv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc, int64_t * sbc ) { @@ -442,8 +413,7 @@ static int driWaitForMSC( __DRInativeDisplay * dpy, void *drawablePriv, return status; } -static int64_t driSwapBuffersMSC( __DRInativeDisplay * dpy, void *drawablePriv, - int64_t target_msc, +static int64_t driSwapBuffersMSC( void *drawablePriv, int64_t target_msc, int64_t divisor, int64_t remainder ) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; @@ -453,25 +423,23 @@ static int64_t driSwapBuffersMSC( __DRInativeDisplay * dpy, void *drawablePriv, remainder ); } -static void driCopySubBuffer( __DRInativeDisplay *dpy, void *drawablePrivate, +static void driCopySubBuffer( void *drawablePrivate, int x, int y, int w, int h) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); - (void) dpy; } /** * This is called via __DRIscreenRec's createNewDrawable pointer. */ -static void *driCreateNewDrawable(__DRInativeDisplay *dpy, +static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, __DRIid draw, __DRIdrawable *pdraw, int renderType, const int *attrs) { - __DRIscreen * const pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen); __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -483,16 +451,14 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, */ (void) attrs; - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return NULL; - } - pdp = (__DRIdrawablePrivate *)_mesa_malloc(sizeof(__DRIdrawablePrivate)); if (!pdp) { return NULL; } - if (!(*dri_interface->createDrawable)(dpy, modes->screen, draw, &pdp->hHWDrawable)) { + /* Ensure that modes->screen and screen are the same screen? */ + + if (!(*dri_interface->createDrawable)(screen, draw, &pdp->hHWDrawable)) { _mesa_free(pdp); return NULL; } @@ -511,16 +477,14 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, pdp->numBackClipRects = 0; pdp->pClipRects = NULL; pdp->pBackClipRects = NULL; - pdp->display = dpy; - pdp->screen = modes->screen; - psp = (__DRIscreenPrivate *)pDRIScreen->private; + psp = (__DRIscreenPrivate *)screen->private; pdp->driScreenPriv = psp; pdp->driContextPriv = &psp->dummyContextPriv; if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes, renderType == GLX_PIXMAP_BIT)) { - (void)(*dri_interface->destroyDrawable)(dpy, modes->screen, pdp->draw); + (void)(*dri_interface->destroyDrawable)(screen, pdp->draw); _mesa_free(pdp); return NULL; } @@ -551,17 +515,15 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, } static void -driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) +driDestroyDrawable(void *drawablePrivate) { __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawablePrivate; __DRIscreenPrivate *psp; - int scrn; if (pdp) { psp = pdp->driScreenPriv; - scrn = psp->myNum; (*psp->DriverAPI.DestroyBuffer)(pdp); - (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); + (void)(*dri_interface->destroyDrawable)(psp->psc, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; @@ -585,8 +547,6 @@ driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) /** * Destroy the per-context private information. * - * \param dpy the display handle. - * \param scrn the screen number. * \param contextPrivate opaque pointer to the per-drawable private info. * * \internal @@ -594,13 +554,14 @@ driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) * drmDestroyContext(), and finally frees \p contextPrivate. */ static void -driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate) +driDestroyContext(void *contextPrivate) { __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); - (void) (*dri_interface->destroyContext)(dpy, scrn, pcp->contextID); + (void) (*dri_interface->destroyContext)(pcp->driScreenPriv->psc, + pcp->contextID); _mesa_free(pcp); } } @@ -628,35 +589,27 @@ driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate) * */ static void * -driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, +driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, int render_type, void *sharedPrivate, __DRIcontext *pctx) { - __DRIscreen *pDRIScreen; __DRIcontextPrivate *pcp; __DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate; __DRIscreenPrivate *psp; void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL; - pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - /* ERROR!!! */ - return NULL; - } - - psp = (__DRIscreenPrivate *)pDRIScreen->private; + psp = (__DRIscreenPrivate *)screen->private; pcp = (__DRIcontextPrivate *)_mesa_malloc(sizeof(__DRIcontextPrivate)); if (!pcp) { return NULL; } - if (! (*dri_interface->createContext)(dpy, modes->screen, modes->fbconfigID, - &pcp->contextID, &pcp->hHWContext)) { + if (! (*dri_interface->createContext)(screen, modes->fbconfigID, + &pcp->contextID, &pcp->hHWContext)) { _mesa_free(pcp); return NULL; } - pcp->display = dpy; pcp->driScreenPriv = psp; pcp->driDrawablePriv = NULL; @@ -678,8 +631,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, pctx->unbindContext = driUnbindContext; if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) { - (void) (*dri_interface->destroyContext)(dpy, modes->screen, - pcp->contextID); + (void) (*dri_interface->destroyContext)(screen, pcp->contextID); _mesa_free(pcp); return NULL; } @@ -705,7 +657,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls * drmClose(), and finally frees \p screenPrivate. */ -static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPrivate) +static void driDestroyScreen(void *screenPrivate) { __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; @@ -760,7 +712,7 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv * loader that is too old to even load this driver. */ __DRIscreenPrivate * -__driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +__driUtilCreateNewScreen(int scr, __DRIscreen *psc, __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -781,8 +733,6 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, return NULL; } - psp->display = dpy; - psp->myNum = scrn; psp->psc = psc; psp->modes = modes; @@ -818,6 +768,7 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; psp->fd = fd; + psp->myNum = scr; /* ** Do not init dummy context here; actual initialization will be @@ -873,7 +824,7 @@ int driCompareGLXAPIVersion( GLint required_version ) static int -driQueryFrameTracking( __DRInativeDisplay * dpy, void * priv, +driQueryFrameTracking( void * priv, int64_t * sbc, int64_t * missedFrames, float * lastMissedUsage, float * usage ) { @@ -935,7 +886,7 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, float usage = 1.0; - if ( (*dri_interface->getMSCRate)( dPriv->display, dPriv->draw, &n, &d ) ) { + if ( (*dri_interface->getMSCRate)(dPriv->pdraw, &n, &d) ) { interval = (dPriv->pdraw->swap_interval != 0) ? dPriv->pdraw->swap_interval : 1; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index a08eab1616..cae170c5f8 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -317,17 +317,6 @@ struct __DRIdrawablePrivateRec { */ __DRIscreenPrivate *driScreenPriv; - /** - * \name Display and screen information. - * - * Basically just need these for when the locking code needs to call - * \c __driUtilUpdateDrawableInfo. - */ - /*@{*/ - __DRInativeDisplay *display; - int screen; - /*@}*/ - /** * Called via glXSwapBuffers(). */ @@ -354,9 +343,9 @@ struct __DRIcontextPrivateRec { void *driverPrivate; /** - * This context's display pointer. + * Pointer back to the \c __DRIcontext that contains this structure. */ - __DRInativeDisplay *display; + __DRIcontext *pctx; /** * Pointer to drawable currently bound to this context for drawing. @@ -378,11 +367,6 @@ struct __DRIcontextPrivateRec { * Per-screen private driver information. */ struct __DRIscreenPrivateRec { - /** - * Display for this screen - */ - __DRInativeDisplay *display; - /** * Current screen's number */ @@ -535,8 +519,8 @@ extern void __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp); -extern __DRIscreenPrivate * __driUtilCreateNewScreen( __DRInativeDisplay *dpy, - int scrn, __DRIscreen *psc, __GLcontextModes * modes, +extern __DRIscreenPrivate * __driUtilCreateNewScreen( int scr, __DRIscreen *psc, + __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, drm_sarea_t *pSAREA, int fd, int internal_api_version, diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 4c5323d230..4cd5b9a208 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -714,16 +714,16 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -740,7 +740,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &ffbAPI); diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index c0a7cdb90a..b04bc38327 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -431,17 +431,16 @@ static const struct __DriverAPIRec i810API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20070105( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) - +void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 0, 0 }; @@ -457,7 +456,7 @@ void * __driCreateNewScreen_20070105( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &i810API); diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 2721a90094..7a11672a8f 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -886,18 +886,18 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits, * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * failure. */ -PUBLIC void * -__driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, - __DRIscreen * psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +PUBLIC +void * __DRI_CREATE_NEW_SCREEN(int scrn, + __DRIscreen * psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 5, 0 }; @@ -913,11 +913,10 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &intelAPI); - + psp = __driUtilCreateNewScreen(scrn, psc, NULL, + ddx_version, dri_version, drm_version, + frame_buffer, pSAREA, fd, + internal_api_version, &intelAPI); if (psp != NULL) { I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; *driver_modes = intelFillInModes(dri_priv->cpp * 8, diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 5dac50df32..29ea07d78e 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -650,16 +650,16 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; @@ -676,7 +676,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &intelAPI); diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 4e9e216e7d..52b96bf0bc 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -505,16 +505,16 @@ static struct __DriverAPIRec mach64API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -531,7 +531,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &mach64API); diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index f4e651afa0..372d2ce433 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -963,16 +963,16 @@ static const struct __DriverAPIRec mgaAPI = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -989,7 +989,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &mgaAPI); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 065aa81746..cab53f41ad 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -295,16 +295,16 @@ nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -331,7 +331,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &nouveauAPI); diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 880dee85c2..a84b54924a 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -514,16 +514,16 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -541,7 +541,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &r128API); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 2366bde525..c9c5a86172 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -857,7 +857,7 @@ void r200Finish( GLcontext *ctx ) * the kernel data structures, and the current context to get the * device fd. */ -void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size, +void *r200AllocateMemoryMESA(__DRIscreen *screen, GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority) { @@ -899,7 +899,7 @@ void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size, /* Called via glXFreeMemoryMESA() */ -void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer) +void r200FreeMemoryMESA(__DRIscreen *screen, GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; @@ -936,7 +936,7 @@ void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer) } /* Called via glXGetMemoryOffsetMESA() */ -GLuint r200GetMemoryOffsetMESA(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer) +GLuint r200GetMemoryOffsetMESA(__DRIscreen *screen, const GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index 5ed1555f6a..bf12679947 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -98,10 +98,10 @@ extern void r200WaitForIdleLocked( r200ContextPtr rmesa ); extern void r200WaitForVBlank( r200ContextPtr rmesa ); extern void r200InitIoctlFuncs( struct dd_function_table *functions ); -extern void *r200AllocateMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLsizei size, GLfloat readfreq, +extern void *r200AllocateMemoryMESA( __DRIscreen *screen, GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority ); -extern void r200FreeMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLvoid *pointer ); -extern GLuint r200GetMemoryOffsetMESA( __DRInativeDisplay *dpy, int scrn, const GLvoid *pointer ); +extern void r200FreeMemoryMESA( __DRIscreen *screen, GLvoid *pointer ); +extern GLuint r200GetMemoryOffsetMESA( __DRIscreen *screen, const GLvoid *pointer ); extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer, GLint size ); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 682cf3a5ee..2d44532a84 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -990,17 +990,16 @@ static const struct __DriverAPIRec r200API = { * failure. */ PUBLIC void * -__driCreateNewScreen_20050727( __DRInativeDisplay *dpy, - int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; #if !RADEON_COMMON @@ -1029,12 +1028,12 @@ __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, return NULL; } #if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &radeonAPI); #elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &r200API); diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 43422db9a8..e8a63ae51b 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -1027,16 +1027,16 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; @@ -1053,7 +1053,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &savageAPI); diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 89d734ba78..a1275f0026 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -333,17 +333,16 @@ static struct __DriverAPIRec sisAPI = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, - const __GLcontextModes *modes, - const __DRIversion *ddx_version, - const __DRIversion *dri_version, - const __DRIversion *drm_version, - const __DRIframebuffer *frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes **driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes *modes, + const __DRIversion *ddx_version, + const __DRIversion *dri_version, + const __DRIversion *drm_version, + const __DRIframebuffer *frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes **driver_modes) { __DRIscreenPrivate *psp; @@ -359,7 +358,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &sisAPI); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 1f9ff4e30c..899963d06d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -442,16 +442,16 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 1, 0 }; @@ -467,7 +467,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &tdfxAPI); diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index 8dc7f0dc78..1d2a49e6f4 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -430,17 +430,17 @@ static struct __DriverAPIRec tridentAPI = { }; -PUBLIC void *__driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +PUBLIC void * +__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 4, 0, 0 }; @@ -456,7 +456,7 @@ PUBLIC void *__driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &tridentAPI); diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 7c73877720..66e92cc602 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -601,9 +601,6 @@ viaCreateContext(const __GLcontextModes *visual, _tnl_allow_pixel_fog(ctx, GL_FALSE); _tnl_allow_vertex_fog(ctx, GL_TRUE); -/* vmesa->display = dpy; */ - vmesa->display = sPriv->display; - vmesa->hHWContext = driContextPriv->hHWContext; vmesa->driFd = sPriv->fd; vmesa->driHwLock = &sPriv->pSAREA->lock; diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index fecd2782fb..6321713688 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -289,7 +289,6 @@ struct via_context { drm_context_t hHWContext; drm_hw_lock_t *driHwLock; int driFd; - __DRInativeDisplay *display; /** * DRI drawable bound to this context for drawing. diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 90f76be44d..c10b7d1a9b 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -418,17 +418,16 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -448,7 +447,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &viaAPI); -- cgit v1.2.3 From b068af2f3b890bec26a186e9d0bdd3d44c17cd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 10 Oct 2007 17:07:01 -0400 Subject: Key drm_i915_flip_t typedef off of the ioctl #define instead. --- src/mesa/drivers/dri/i915/intel_buffers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c index 938bed6da7..bd2e67fbed 100644 --- a/src/mesa/drivers/dri/i915/intel_buffers.c +++ b/src/mesa/drivers/dri/i915/intel_buffers.c @@ -45,7 +45,7 @@ /* This block can be removed when libdrm >= 2.3.1 is required */ -#ifndef DRM_VBLANK_FLIP +#ifndef DRM_IOCTL_I915_FLIP #define DRM_VBLANK_FLIP 0x8000000 -- cgit v1.2.3 From 4ff95e78e19e5902352ea3759d32d9f013255f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 10 May 2007 17:14:38 -0400 Subject: Drop createDrawable and destroyDrawable fron DRIinterfaceMethods. All the DRI driver did was call the createDrawable callback immediately upon entry to DRIscreen::createNewDrawable to get the drm_drawable_t. We can just call that before calling into the DRI driver and pass the returned drm_drawable_t as an argument to the DRI entry point. Likewise for destroyDrawable. Also, DRIdrawablePrivate::draw isn't used anywhere, and since the driver no longer needs the XID of the drawable we can now drop that. --- src/mesa/drivers/dri/common/dri_util.c | 18 +++++------------- src/mesa/drivers/dri/common/dri_util.h | 1 - src/mesa/drivers/dri/mga/mgastate.c | 5 ----- 3 files changed, 5 insertions(+), 19 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 2b5d6f0a59..dd7068ad10 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -59,7 +59,8 @@ static int driQueryFrameTracking( void *priv, static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, - __DRIid draw, __DRIdrawable *pdraw, + __DRIdrawable *pdraw, + drm_drawable_t hwDrawable, int renderType, const int *attrs); static void driDestroyDrawable(void *drawablePrivate); @@ -286,7 +287,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - if (! (*dri_interface->getDrawableInfo)(pdp->driScreenPriv->psc, pdp->draw, + if (! (*dri_interface->getDrawableInfo)(pdp->pdraw, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, @@ -435,8 +436,8 @@ static void driCopySubBuffer( void *drawablePrivate, */ static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, - __DRIid draw, __DRIdrawable *pdraw, + drm_drawable_t hwDrawable, int renderType, const int *attrs) { @@ -456,14 +457,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen, return NULL; } - /* Ensure that modes->screen and screen are the same screen? */ - - if (!(*dri_interface->createDrawable)(screen, draw, &pdp->hHWDrawable)) { - _mesa_free(pdp); - return NULL; - } - - pdp->draw = draw; + pdp->hHWDrawable = hwDrawable; pdp->pdraw = pdraw; pdp->refcount = 0; pdp->pStamp = NULL; @@ -484,7 +478,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes, renderType == GLX_PIXMAP_BIT)) { - (void)(*dri_interface->destroyDrawable)(screen, pdp->draw); _mesa_free(pdp); return NULL; } @@ -523,7 +516,6 @@ driDestroyDrawable(void *drawablePrivate) if (pdp) { psp = pdp->driScreenPriv; (*psp->DriverAPI.DestroyBuffer)(pdp); - (void)(*dri_interface->destroyDrawable)(psp->psc, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index cae170c5f8..cb9bb26051 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -248,7 +248,6 @@ struct __DRIdrawablePrivateRec { /** * X's drawable ID associated with this private drawable. */ - __DRIid draw; __DRIdrawable *pdraw; /** diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index c20a76f29e..88f2175cc3 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -778,8 +778,6 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) { __DRIdrawablePrivate *const driDrawable = mmesa->driDrawable; __DRIdrawablePrivate *const driReadable = mmesa->driReadable; - drm_mga_sarea_t *sarea = mmesa->sarea; - mmesa->dirty_cliprects = 0; @@ -790,9 +788,6 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) mga_set_cliprects(mmesa); - sarea->req_drawable = driDrawable->draw; - sarea->req_draw_buffer = mmesa->draw_buffer; - mgaUpdateClipping( mmesa->glCtx ); mgaCalcViewport( mmesa->glCtx ); } -- cgit v1.2.3 From 8ed5c7ca0572a09375bdfd411c3804456dac78d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 10 May 2007 18:38:49 -0400 Subject: 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. --- src/mesa/drivers/dri/common/dri_util.c | 14 +++----------- src/mesa/drivers/dri/common/dri_util.h | 5 ----- 2 files changed, 3 insertions(+), 16 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index dd7068ad10..31438b8271 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -552,8 +552,6 @@ driDestroyContext(void *contextPrivate) if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); - (void) (*dri_interface->destroyContext)(pcp->driScreenPriv->psc, - pcp->contextID); _mesa_free(pcp); } } @@ -582,7 +580,8 @@ driDestroyContext(void *contextPrivate) */ 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; @@ -596,12 +595,7 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, 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; @@ -610,7 +604,6 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, */ if (!psp->dummyContextPriv.driScreenPriv) { - psp->dummyContextPriv.contextID = 0; psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context; psp->dummyContextPriv.driScreenPriv = psp; psp->dummyContextPriv.driDrawablePriv = NULL; @@ -623,7 +616,6 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, pctx->unbindContext = driUnbindContext; if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) { - (void) (*dri_interface->destroyContext)(screen, pcp->contextID); _mesa_free(pcp); return NULL; } diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index cb9bb26051..612e24acb2 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -326,11 +326,6 @@ struct __DRIdrawablePrivateRec { * 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. */ -- cgit v1.2.3 From aac367f48afc62176faf67aa6f329fbeae2004b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 11 May 2007 16:11:23 -0400 Subject: Remove screenConfigs from __DRIscreen. The screenConfigs field of __DRIscreen points back to the containing __GLXscreenConfigs struct. This is a serious abstraction violation; it assumes that the loader is libGL and that there *is* a __GLXscreenConfigs type in the loader. Using the containerOf macro, we can get from the __DRIscreen pointer to the containing __GLXscreenConfigs struct, at a place in the stack where the above is a valid assumption. Besides, the __DRI* structs shouldn't hold state other than the private pointer. --- src/mesa/drivers/dri/i915/intel_screen.c | 11 +++++------ src/mesa/drivers/dri/i965/intel_screen.c | 13 ++++++------- src/mesa/drivers/dri/mach64/mach64_screen.c | 9 ++++----- src/mesa/drivers/dri/mga/mga_xmesa.c | 11 +++++------ src/mesa/drivers/dri/r128/r128_screen.c | 9 ++++----- src/mesa/drivers/dri/radeon/radeon_screen.c | 15 +++++++-------- src/mesa/drivers/dri/savage/savage_xmesa.c | 3 +-- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 3 +-- src/mesa/drivers/dri/unichrome/via_screen.c | 11 +++++------ 9 files changed, 38 insertions(+), 47 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 7a11672a8f..6ecde574b4 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -430,7 +430,6 @@ intelInitDriver(__DRIscreenPrivate * sPriv) PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface-> getProcAddress("glxEnableExtension")); - void *const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(I830DRIRec)) { fprintf(stderr, @@ -524,11 +523,11 @@ intelInitDriver(__DRIscreenPrivate * sPriv) } if (glx_enable_extension != NULL) { - (*glx_enable_extension) (psc, "GLX_SGI_swap_control"); - (*glx_enable_extension) (psc, "GLX_SGI_video_sync"); - (*glx_enable_extension) (psc, "GLX_MESA_swap_control"); - (*glx_enable_extension) (psc, "GLX_MESA_swap_frame_usage"); - (*glx_enable_extension) (psc, "GLX_SGI_make_current_read"); + (*glx_enable_extension) (sPriv->psc, "GLX_SGI_swap_control"); + (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); + (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_control"); + (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage"); + (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } /* If we've got a new enough DDX that's initializing TTM and giving us diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 29ea07d78e..97ccba09d8 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -271,7 +271,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; volatile drmI830Sarea *sarea; if (sPriv->devPrivSize != sizeof(I830DRIRec)) { @@ -352,12 +351,12 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) } if (glx_enable_extension != NULL) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" ); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 52b96bf0bc..733a16b6ae 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -210,7 +210,6 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(ATIDRIRec)) { fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n"); @@ -321,12 +320,12 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) if ( glx_enable_extension != NULL ) { if ( mach64Screen->irq != 0 ) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } return mach64Screen; diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 372d2ce433..5b9d09d0bf 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -200,7 +200,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(MGADRIRec)) { fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n"); @@ -236,11 +235,11 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) } if ( glx_enable_extension != NULL ) { - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } if (serverInfo->chipset != MGA_CARD_TYPE_G200 && diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index a84b54924a..9df9c65fae 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -100,7 +100,6 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(R128DRIRec)) { fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n"); @@ -228,12 +227,12 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) if ( glx_enable_extension != NULL ) { if ( r128Screen->irq != 0 ) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } return r128Screen; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 2d44532a84..8f9509de5b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -343,7 +343,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) unsigned char *RADEONMMIO; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n"); @@ -734,17 +733,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); if (IS_R200_CLASS(screen)) - (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_allocate_memory" ); - (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" ); - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index e8a63ae51b..9678c526aa 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -266,8 +266,7 @@ savageInitDriver(__DRIscreenPrivate *sPriv) __driConfigOptions, __driNConfigOptions); if (glx_enable_extension != NULL) { - (*glx_enable_extension)(sPriv->psc->screenConfigs, - "GLX_SGI_make_current_read"); + (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read"); } #if 0 diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 899963d06d..e9033c5ef3 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -75,7 +75,6 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void *const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) { fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n"); @@ -117,7 +116,7 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) } if (glx_enable_extension != NULL) { - (*glx_enable_extension)(psc, "GLX_SGI_make_current_read"); + (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read"); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index c10b7d1a9b..22e4bcebc9 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -100,7 +100,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(VIADRIRec)) { fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n"); @@ -177,13 +176,13 @@ viaInitDriver(__DRIscreenPrivate *sPriv) if ( glx_enable_extension != NULL ) { if ( viaScreen->irqEnabled ) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } return GL_TRUE; -- cgit v1.2.3 From 5987a03f994af2bb413d1cf984ab01aa095c0943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 11 May 2007 16:43:20 -0400 Subject: Convert all DRI entrypoints to take pointers to __DRI* types. The entrypoints take a mix of __DRIscreen * and void * (screen private) arguments (similarly for contexts and drawables). This patch does away with passing the private void pointer and always only passes the fully typed __DRIscreen pointer and always as the first argument. This makes the interface more consistent and increases type safety, and catches a bug where we would pass a screen private to DRIdrawable::getSBC. --- src/mesa/drivers/dri/common/dri_util.c | 74 +++++++++++++++++----------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 31438b8271..48cde4c4e3 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -53,7 +53,7 @@ static const int empty_attribute_list[1] = { None }; static int api_ver = 0; /* forward declarations */ -static int driQueryFrameTracking( void *priv, +static int driQueryFrameTracking( __DRIdrawable *drawable, int64_t *sbc, int64_t *missedFrames, float *lastMissedUsage, float *usage ); @@ -63,7 +63,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen, drm_drawable_t hwDrawable, int renderType, const int *attrs); -static void driDestroyDrawable(void *drawablePrivate); +static void driDestroyDrawable(__DRIdrawable *drawable); /** @@ -169,9 +169,9 @@ static GLboolean driUnbindContext(__DRIcontext *ctx) * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean DoBindContext(__DRIdrawable *pdraw, - __DRIdrawable *pread, - __DRIcontext *ctx) +static GLboolean DoBindContext(__DRIcontext *ctx, + __DRIdrawable *pdraw, + __DRIdrawable *pread) { __DRIdrawablePrivate *pdp; __DRIdrawablePrivate *prp; @@ -218,9 +218,9 @@ static GLboolean DoBindContext(__DRIdrawable *pdraw, * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean driBindContext(__DRIdrawable *pdraw, - __DRIdrawable *pread, - __DRIcontext * ctx) +static GLboolean driBindContext(__DRIcontext * ctx, + __DRIdrawable *pdraw, + __DRIdrawable *pread) { /* ** Assume error checking is done properly in glXMakeCurrent before @@ -230,7 +230,7 @@ static GLboolean driBindContext(__DRIdrawable *pdraw, if (ctx == NULL || pdraw == None || pread == None) return GL_FALSE; - return DoBindContext( pdraw, pread, ctx ); + return DoBindContext( ctx, pdraw, pread ); } /*@}*/ @@ -328,9 +328,9 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) * * Is called directly from glXSwapBuffers(). */ -static void driSwapBuffers(void *drawablePrivate) +static void driSwapBuffers(__DRIdrawable *drawable) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; + __DRIdrawablePrivate *dPriv = drawable->private; drm_clip_rect_t rect; dPriv->swapBuffers(dPriv); @@ -356,9 +356,9 @@ static void driSwapBuffers(void *drawablePrivate) /** * Called directly from a number of higher-level GLX functions. */ -static int driGetMSC( void *screenPrivate, int64_t *msc ) +static int driGetMSC( __DRIscreen *screen, int64_t *msc ) { - __DRIscreenPrivate *sPriv = (__DRIscreenPrivate *) screenPrivate; + __DRIscreenPrivate *sPriv = screen->private; return sPriv->DriverAPI.GetMSC( sPriv, msc ); } @@ -366,9 +366,9 @@ static int driGetMSC( void *screenPrivate, int64_t *msc ) /** * Called directly from a number of higher-level GLX functions. */ -static int driGetSBC( void *drawablePrivate, int64_t *sbc ) +static int driGetSBC(__DRIdrawable *drawable, int64_t *sbc) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; + __DRIdrawablePrivate *dPriv = drawable->private; __DRIswapInfo sInfo; int status; @@ -379,20 +379,20 @@ static int driGetSBC( void *drawablePrivate, int64_t *sbc ) return status; } -static int driWaitForSBC( void *drawablePriv, int64_t target_sbc, - int64_t * msc, int64_t * sbc ) +static int driWaitForSBC(__DRIdrawable *drawable, int64_t target_sbc, + int64_t * msc, int64_t * sbc) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; + __DRIdrawablePrivate *dPriv = drawable->private; return dPriv->driScreenPriv->DriverAPI.WaitForSBC( dPriv, target_sbc, msc, sbc ); } -static int driWaitForMSC( void *drawablePriv, int64_t target_msc, - int64_t divisor, int64_t remainder, - int64_t * msc, int64_t * sbc ) +static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, + int64_t divisor, int64_t remainder, + int64_t * msc, int64_t * sbc) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; + __DRIdrawablePrivate *dPriv = drawable->private; __DRIswapInfo sInfo; int status; @@ -414,20 +414,20 @@ static int driWaitForMSC( void *drawablePriv, int64_t target_msc, return status; } -static int64_t driSwapBuffersMSC( void *drawablePriv, int64_t target_msc, - int64_t divisor, int64_t remainder ) +static int64_t driSwapBuffersMSC(__DRIdrawable *drawable, int64_t target_msc, + int64_t divisor, int64_t remainder) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; + __DRIdrawablePrivate *dPriv = drawable->private; return dPriv->driScreenPriv->DriverAPI.SwapBuffersMSC( dPriv, target_msc, divisor, remainder ); } -static void driCopySubBuffer( void *drawablePrivate, +static void driCopySubBuffer(__DRIdrawable *drawable, int x, int y, int w, int h) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; + __DRIdrawablePrivate *dPriv = drawable->private; dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); } @@ -508,9 +508,9 @@ static void *driCreateNewDrawable(__DRIscreen *screen, } static void -driDestroyDrawable(void *drawablePrivate) +driDestroyDrawable(__DRIdrawable *drawable) { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawablePrivate; + __DRIdrawablePrivate *pdp = drawable->private; __DRIscreenPrivate *psp; if (pdp) { @@ -546,9 +546,9 @@ driDestroyDrawable(void *drawablePrivate) * drmDestroyContext(), and finally frees \p contextPrivate. */ static void -driDestroyContext(void *contextPrivate) +driDestroyContext(__DRIcontext *context) { - __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; + __DRIcontextPrivate *pcp = context->private; if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); @@ -641,9 +641,9 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls * drmClose(), and finally frees \p screenPrivate. */ -static void driDestroyScreen(void *screenPrivate) +static void driDestroyScreen(__DRIscreen *screen) { - __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; + __DRIscreenPrivate *psp = screen->private; if (psp) { /* No interaction with the X-server is possible at this point. This @@ -808,14 +808,14 @@ int driCompareGLXAPIVersion( GLint required_version ) static int -driQueryFrameTracking( void * priv, - int64_t * sbc, int64_t * missedFrames, - float * lastMissedUsage, float * usage ) +driQueryFrameTracking(__DRIdrawable *drawable, + int64_t * sbc, int64_t * missedFrames, + float * lastMissedUsage, float * usage) { __DRIswapInfo sInfo; int status; int64_t ust; - __DRIdrawablePrivate * dpriv = (__DRIdrawablePrivate *) priv; + __DRIdrawablePrivate * dpriv = drawable->private; status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo ); -- cgit v1.2.3 From efd03a278ae55b454509e9659c42899133983ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 14 May 2007 16:37:19 -0400 Subject: Replace open-coded major, minor, and patch version fields with __DRIversionRec. --- src/mesa/drivers/dri/common/dri_util.c | 12 +++--------- src/mesa/drivers/dri/common/dri_util.h | 24 +++--------------------- src/mesa/drivers/dri/i915/intel_buffers.c | 2 +- src/mesa/drivers/dri/i915/intel_screen.c | 10 +++++----- src/mesa/drivers/dri/i965/intel_screen.c | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 4 ++-- src/mesa/drivers/dri/mga/mgaioctl.c | 4 ++-- src/mesa/drivers/dri/r128/r128_context.c | 2 +- src/mesa/drivers/dri/r128/r128_screen.c | 2 +- src/mesa/drivers/dri/r200/r200_context.c | 8 ++++---- src/mesa/drivers/dri/r300/radeon_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_context.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_screen.c | 20 ++++++++++---------- src/mesa/drivers/dri/savage/savage_xmesa.c | 2 +- src/mesa/drivers/dri/savage/savagetex.c | 4 ++-- 15 files changed, 41 insertions(+), 65 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 48cde4c4e3..09fc2230fd 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -727,15 +727,9 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc, */ psp->drawLockID = 1; - psp->drmMajor = drm_version->major; - psp->drmMinor = drm_version->minor; - psp->drmPatch = drm_version->patch; - psp->ddxMajor = ddx_version->major; - psp->ddxMinor = ddx_version->minor; - psp->ddxPatch = ddx_version->patch; - psp->driMajor = dri_version->major; - psp->driMinor = dri_version->minor; - psp->driPatch = dri_version->patch; + psp->drm_version = *drm_version; + psp->ddx_version = *ddx_version; + psp->dri_version = *dri_version; /* install driver's callback functions */ memcpy( &psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec) ); diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 612e24acb2..7a70bc7aa6 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -372,37 +372,19 @@ struct __DRIscreenPrivateRec { struct __DriverAPIRec DriverAPI; /** - * \name DDX version * DDX / 2D driver version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int ddxMajor; - int ddxMinor; - int ddxPatch; - /*@}*/ + __DRIversion ddx_version; /** - * \name DRI version * DRI X extension version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int driMajor; - int driMinor; - int driPatch; - /*@}*/ + __DRIversion dri_version; /** - * \name DRM version * DRM (kernel module) version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int drmMajor; - int drmMinor; - int drmPatch; - /*@}*/ + __DRIversion drm_version; /** * ID used when the client sets the drawable lock. diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c index bd2e67fbed..46a67b141e 100644 --- a/src/mesa/drivers/dri/i915/intel_buffers.c +++ b/src/mesa/drivers/dri/i915/intel_buffers.c @@ -231,7 +231,7 @@ intelWindowMoved(struct intel_context *intel) } } - if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) { + if (intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) { drmI830Sarea *sarea = intel->sarea; drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w, .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h }; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 6ecde574b4..58dc02e24e 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -217,7 +217,7 @@ intel_recreate_static_regions(intelScreenPrivate *intelScreen) /* The rotated region is only used for old DDXes that didn't handle rotation \ * on their own. */ - if (intelScreen->driScrnPriv->ddxMinor < 8) { + if (intelScreen->driScrnPriv->ddx_version.minor < 8) { intelScreen->rotated_region = intel_recreate_static(intelScreen, intelScreen->rotated_region, @@ -377,7 +377,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelScreen->back.handle = sarea->back_handle; intelScreen->back.size = sarea->back_size; - if (intelScreen->driScrnPriv->ddxMinor >= 8) { + if (intelScreen->driScrnPriv->ddx_version.minor >= 8) { intelScreen->third.offset = sarea->third_offset; intelScreen->third.pitch = sarea->pitch * intelScreen->cpp; intelScreen->third.handle = sarea->third_handle; @@ -389,7 +389,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelScreen->depth.handle = sarea->depth_handle; intelScreen->depth.size = sarea->depth_size; - if (intelScreen->driScrnPriv->ddxMinor >= 9) { + if (intelScreen->driScrnPriv->ddx_version.minor >= 9) { intelScreen->front.bo_handle = sarea->front_bo_handle; intelScreen->back.bo_handle = sarea->back_bo_handle; intelScreen->third.bo_handle = sarea->third_bo_handle; @@ -488,7 +488,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv) if (0) intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv); - intelScreen->drmMinor = sPriv->drmMinor; + intelScreen->drmMinor = sPriv->drm_version.minor; /* Determine if IRQs are active? */ { @@ -535,7 +535,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv) */ intelScreen->ttm = GL_FALSE; if (getenv("INTEL_NO_TTM") == NULL && - intelScreen->driScrnPriv->ddxMinor >= 9 && + intelScreen->driScrnPriv->ddx_version.minor >= 9 && intelScreen->front.bo_handle != -1) { intelScreen->bufmgr = dri_bufmgr_ttm_init(sPriv->fd, DRM_FENCE_TYPE_EXE, diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 97ccba09d8..cb6824b7ee 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -316,7 +316,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) return GL_FALSE; } - intelScreen->drmMinor = sPriv->drmMinor; + intelScreen->drmMinor = sPriv->drm_version.minor; /* Determine if IRQs are active? */ { diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 5b9d09d0bf..b001f8696a 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -216,7 +216,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->sPriv = sPriv; sPriv->private = (void *)mgaScreen; - if (sPriv->drmMinor >= 1) { + if (sPriv->drm_version.minor >= 1) { int ret; drm_mga_getparam_t gp; @@ -273,7 +273,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) * there is a new, in-kernel mechanism for handling the wait. */ - if (mgaScreen->sPriv->drmMinor < 2) { + if (mgaScreen->sPriv->drm_version.minor < 2) { mgaScreen->mmio.handle = serverInfo->registers.handle; mgaScreen->mmio.size = serverInfo->registers.size; if ( drmMap( sPriv->fd, diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index f8587fc541..679d688925 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -55,7 +55,7 @@ mgaSetFence( mgaContextPtr mmesa, uint32_t * fence ) { int ret = ENOSYS; - if ( mmesa->driScreen->drmMinor >= 2 ) { + if ( mmesa->driScreen->drm_version.minor >= 2 ) { ret = drmCommandWriteRead( mmesa->driScreen->fd, DRM_MGA_SET_FENCE, fence, sizeof( uint32_t )); if (ret) { @@ -73,7 +73,7 @@ mgaWaitFence( mgaContextPtr mmesa, uint32_t fence, uint32_t * curr_fence ) { int ret = ENOSYS; - if ( mmesa->driScreen->drmMinor >= 2 ) { + if ( mmesa->driScreen->drm_version.minor >= 2 ) { uint32_t temp = fence; ret = drmCommandWriteRead( mmesa->driScreen->fd, diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index 95e54a6af5..c9fe11f38b 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -254,7 +254,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, _tnl_allow_vertex_fog( ctx, GL_TRUE ); driInitExtensions( ctx, card_extensions, GL_TRUE ); - if (sPriv->drmMinor >= 4) + if (sPriv->drm_version.minor >= 4) _mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" ); r128InitTriFuncs( ctx ); diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 9df9c65fae..01b33d6493 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -120,7 +120,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen->IsPCI = r128DRIPriv->IsPCI; r128Screen->sarea_priv_offset = r128DRIPriv->sarea_priv_offset; - if (sPriv->drmMinor >= 3) { + if (sPriv->drm_version.minor >= 3) { drm_r128_getparam_t gp; int ret; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 5a178442bd..8f43a2f312 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -277,14 +277,14 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, "def_max_anisotropy"); if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) { - if ( sPriv->drmMinor < 13 ) + if ( sPriv->drm_version.minor < 13 ) fprintf( stderr, "DRM version 1.%d too old to support HyperZ, " - "disabling.\n",sPriv->drmMinor ); + "disabling.\n", sPriv->drm_version.minor ); else rmesa->using_hyperz = GL_TRUE; } - if ( sPriv->drmMinor >= 15 ) + if ( sPriv->drm_version.minor >= 15 ) rmesa->texmicrotile = GL_TRUE; /* Init default driver functions then plug in our R200-specific functions @@ -317,7 +317,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, rmesa->dri.hwContext = driContextPriv->hHWContext; rmesa->dri.hwLock = &sPriv->pSAREA->lock; rmesa->dri.fd = sPriv->fd; - rmesa->dri.drmMinor = sPriv->drmMinor; + rmesa->dri.drmMinor = sPriv->drm_version.minor; rmesa->r200Screen = screen; rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA + diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index e9634b427a..6dfaf3c647 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -156,7 +156,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->dri.hwContext = driContextPriv->hHWContext; radeon->dri.hwLock = &sPriv->pSAREA->lock; radeon->dri.fd = sPriv->fd; - radeon->dri.drmMinor = sPriv->drmMinor; + radeon->dri.drmMinor = sPriv->drm_version.minor; radeon->radeonScreen = screen; radeon->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA + diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index b302275c71..defc82fa26 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -233,14 +233,14 @@ radeonCreateContext( const __GLcontextModes *glVisual, "def_max_anisotropy"); if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) { - if ( sPriv->drmMinor < 13 ) + if ( sPriv->drm_version.minor < 13 ) fprintf( stderr, "DRM version 1.%d too old to support HyperZ, " - "disabling.\n",sPriv->drmMinor ); + "disabling.\n", sPriv->drm_version.minor ); else rmesa->using_hyperz = GL_TRUE; } - if ( sPriv->drmMinor >= 15 ) + if ( sPriv->drm_version.minor >= 15 ) rmesa->texmicrotile = GL_TRUE; /* Init default driver functions then plug in our Radeon-specific functions @@ -271,7 +271,7 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->dri.hwContext = driContextPriv->hHWContext; rmesa->dri.hwLock = &sPriv->pSAREA->lock; rmesa->dri.fd = sPriv->fd; - rmesa->dri.drmMinor = sPriv->drmMinor; + rmesa->dri.drmMinor = sPriv->drm_version.minor; rmesa->radeonScreen = screen; rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA + diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 8f9509de5b..9801322cd8 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -395,13 +395,13 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_IRQ_NR): %d\n", ret); return NULL; } - screen->drmSupportsCubeMapsR200 = (sPriv->drmMinor >= 7); - screen->drmSupportsBlendColor = (sPriv->drmMinor >= 11); - screen->drmSupportsTriPerf = (sPriv->drmMinor >= 16); - screen->drmSupportsFragShader = (sPriv->drmMinor >= 18); - screen->drmSupportsPointSprites = (sPriv->drmMinor >= 13); - screen->drmSupportsCubeMapsR100 = (sPriv->drmMinor >= 15); - screen->drmSupportsVertexProgram = (sPriv->drmMinor >= 25); + screen->drmSupportsCubeMapsR200 = (sPriv->drm_version.minor >= 7); + screen->drmSupportsBlendColor = (sPriv->drm_version.minor >= 11); + screen->drmSupportsTriPerf = (sPriv->drm_version.minor >= 16); + screen->drmSupportsFragShader = (sPriv->drm_version.minor >= 18); + screen->drmSupportsPointSprites = (sPriv->drm_version.minor >= 13); + screen->drmSupportsCubeMapsR100 = (sPriv->drm_version.minor >= 15); + screen->drmSupportsVertexProgram = (sPriv->drm_version.minor >= 25); } screen->mmio.handle = dri_priv->registerHandle; @@ -666,7 +666,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } if ((screen->chip_family == CHIP_FAMILY_R350 || screen->chip_family == CHIP_FAMILY_R300) && - sPriv->ddxMinor < 2) { + sPriv->ddx_version.minor < 2) { fprintf(stderr, "xf86-video-ati-6.6.2 or newer needed for Radeon 9500/9700/9800 cards.\n"); return NULL; } @@ -683,7 +683,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16; - if ( sPriv->drmMinor >= 10 ) { + if ( sPriv->drm_version.minor >= 10 ) { drm_radeon_setparam_t sp; sp.param = RADEON_SETPARAM_FB_LOCATION; @@ -701,7 +701,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->depthPitch = dri_priv->depthPitch; /* Check if ddx has set up a surface reg to cover depth buffer */ - screen->depthHasSurface = ((sPriv->ddxMajor > 4) && + screen->depthHasSurface = ((sPriv->ddx_version.major > 4) && (screen->chip_flags & RADEON_CHIPSET_TCL)); if ( dri_priv->textureSize == 0 ) { diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 9678c526aa..b2764f36f6 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -524,7 +524,7 @@ savageCreateContext( const __GLcontextModes *mesaVis, "enable_fastpath"); /* DRM versions before 2.1.3 would only render triangle lists. ELTS * support was added in 2.2.0. */ - if (imesa->enable_fastpath && sPriv->drmMinor < 2) { + if (imesa->enable_fastpath && sPriv->drm_version.minor < 2) { fprintf (stderr, "*** Disabling fast path because your DRM version is buggy " "or doesn't\n*** support ELTS. You need at least Savage DRM " diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 719e50f964..1dcfee291f 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -1016,7 +1016,7 @@ static void savageUploadTexImages( savageContextPtr imesa, savageTexObjPtr t ) /* Heap timestamps are only reliable with Savage DRM 2.3.x or * later. Earlier versions had only 16 bit time stamps which * would wrap too frequently. */ - if (imesa->savageScreen->driScrnPriv->drmMinor >= 3) { + if (imesa->savageScreen->driScrnPriv->drm_version.minor >= 3) { unsigned int heap = t->base.heap->heapId; LOCK_HARDWARE(imesa); savageWaitEvent (imesa, imesa->textureHeaps[heap]->timestamp); @@ -1713,7 +1713,7 @@ static void savageTimestampTextures( savageContextPtr imesa ) * Only useful with long-lived 32-bit event tags available * with Savage DRM 2.3.x or later. */ if ((imesa->CurrentTexObj[0] || imesa->CurrentTexObj[1]) && - imesa->savageScreen->driScrnPriv->drmMinor >= 3) { + imesa->savageScreen->driScrnPriv->drm_version.minor >= 3) { unsigned int e; FLUSH_BATCH(imesa); e = savageEmitEvent(imesa, SAVAGE_WAIT_3D); -- cgit v1.2.3 From 64106d0d9aeefa6974317042b6bc3e5eaabac5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 14 May 2007 16:58:37 -0400 Subject: Pull createNewScreen entry point into dri_util.c. This pulls the top level createNewScreen entry point out of the drivers and rewrites __driUtilCreateNewScreen in dri_util.c to be the new entry point. The change moves more logic into the common/ layer and changes the createNewScreen entry point to only be defined in one place. --- src/mesa/drivers/dri/common/dri_util.c | 59 ++++++++-------- src/mesa/drivers/dri/common/dri_util.h | 12 ++-- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 48 ++++--------- src/mesa/drivers/dri/i810/i810screen.c | 50 ++++---------- src/mesa/drivers/dri/i915/intel_screen.c | 73 ++++++++------------ src/mesa/drivers/dri/i965/intel_screen.c | 77 ++++++++------------- src/mesa/drivers/dri/mach64/mach64_screen.c | 75 +++++++------------- src/mesa/drivers/dri/mga/mga_xmesa.c | 84 +++++++++------------- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 96 ++++++++++---------------- src/mesa/drivers/dri/r128/r128_screen.c | 80 ++++++++------------- src/mesa/drivers/dri/radeon/radeon_screen.c | 96 ++++++++++---------------- src/mesa/drivers/dri/s3v/s3v_xmesa.c | 4 +- src/mesa/drivers/dri/savage/savage_xmesa.c | 80 ++++++++------------- src/mesa/drivers/dri/sis/sis_screen.c | 72 ++++++++----------- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 86 +++++++++-------------- src/mesa/drivers/dri/trident/trident_context.c | 52 ++++++-------- src/mesa/drivers/dri/unichrome/via_screen.c | 76 ++++++++------------ 17 files changed, 421 insertions(+), 699 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 09fc2230fd..9c96392654 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -667,9 +667,12 @@ static void driDestroyScreen(__DRIscreen *screen) /** - * Utility function used to create a new driver-private screen structure. + * This is the bootstrap function for the driver. libGL supplies all of the + * requisite information about the system, and the driver initializes itself. + * This routine also fills in the linked list pointed to by \c driver_modes + * with the \c __GLcontextModes that the driver can support for windows or + * pbuffers. * - * \param dpy Display pointer * \param scrn Index of the screen * \param psc DRI screen data (not driver private) * \param modes Linked list of known display modes. This list is, at a @@ -690,35 +693,34 @@ static void driDestroyScreen(__DRIscreen *screen) * driver and libGL. * \param driverAPI Driver API functions used by other routines in dri_util.c. * - * \note - * There is no need to check the minimum API version in this function. Since - * the \c __driCreateNewScreen function is versioned, it is impossible for a - * loader that is too old to even load this driver. + * \note There is no need to check the minimum API version in this + * function. Since the name of this function is versioned, it is + * impossible for a loader that is too old to even load this driver. */ -__DRIscreenPrivate * -__driUtilCreateNewScreen(int scr, __DRIscreen *psc, - __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drm_sarea_t *pSAREA, - int fd, - int internal_api_version, - const struct __DriverAPIRec *driverAPI) +PUBLIC +void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes ) + { __DRIscreenPrivate *psp; - + dri_interface = interface; api_ver = internal_api_version; - psp = (__DRIscreenPrivate *)_mesa_malloc(sizeof(__DRIscreenPrivate)); - if (!psp) { + psp = _mesa_malloc(sizeof(*psp)); + if (!psp) return NULL; - } psp->psc = psc; - psp->modes = modes; + psp->modes = NULL; /* ** NOT_DONE: This is used by the X server to detect when the client @@ -731,9 +733,6 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc, psp->ddx_version = *ddx_version; psp->dri_version = *dri_version; - /* install driver's callback functions */ - memcpy( &psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec) ); - psp->pSAREA = pSAREA; psp->pFB = frame_buffer->base; @@ -746,7 +745,7 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc, psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; psp->fd = fd; - psp->myNum = scr; + psp->myNum = scrn; /* ** Do not init dummy context here; actual initialization will be @@ -763,17 +762,15 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc, if (internal_api_version >= 20070121) psc->setTexOffset = psp->DriverAPI.setTexOffset; - if ( (psp->DriverAPI.InitDriver != NULL) - && !(*psp->DriverAPI.InitDriver)(psp) ) { - _mesa_free( psp ); + *driver_modes = __driDriverInitScreen(psp); + if (*driver_modes == NULL) { + _mesa_free(psp); return NULL; } - return psp; } - /** * Compare the current GLX API version with a driver supplied required version. * diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 7a70bc7aa6..f56f1fa96a 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -66,6 +66,13 @@ typedef struct __DRIswapInfoRec __DRIswapInfo; typedef struct __DRIutilversionRec2 __DRIutilversion2; +/** + * Driver specific entry point. Implemented by the driver. Called + * from the top level createNewScreen entry point to initialize the + * __DRIscreenPrivate struct. + */ +extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); + /** * Used by DRI_VALIDATE_DRAWABLE_INFO */ @@ -109,11 +116,6 @@ do { \ * this structure. */ struct __DriverAPIRec { - /** - * Driver initialization callback - */ - GLboolean (*InitDriver)(__DRIscreenPrivate *driScrnPriv); - /** * Screen destruction callback */ diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 4cd5b9a208..3a5551eeb3 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -605,7 +605,6 @@ void ffbXMesaUpdateState(ffbContextPtr fmesa) } static const struct __DriverAPIRec ffbAPI = { - .InitDriver = ffbInitDriver, .DestroyScreen = ffbDestroyScreen, .CreateContext = ffbCreateContext, .DestroyContext = ffbDestroyContext, @@ -704,49 +703,28 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 0, 1, 1 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 0, 0, 1 }; - dri_interface = interface; - if ( ! driCheckDriDdxDrmVersions2( "ffb", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &ffbAPI); - if ( psp != NULL ) { - *driver_modes = ffbFillInModes( 32, 16, 0, GL_TRUE ); - } + psp->DriverAPI = ffbAPI; + + if (!ffbInitDriver(psp)) + return NULL; - return (void *) psp; + return ffbFillInModes( 32, 16, 0, GL_TRUE ); } diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index b04bc38327..3c7ec96ff3 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -403,7 +403,6 @@ i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) static const struct __DriverAPIRec i810API = { - .InitDriver = i810InitDriver, .DestroyScreen = i810DestroyScreen, .CreateContext = i810CreateContext, .DestroyContext = i810DestroyContext, @@ -421,51 +420,30 @@ static const struct __DriverAPIRec i810API = { /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 2, 0 }; - dri_interface = interface; - if ( ! driCheckDriDdxDrmVersions2( "i810", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) { return NULL; } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &i810API); - if ( psp != NULL ) { - *driver_modes = i810FillInModes( 16, - 16, 0, - 1); - driInitExtensions( NULL, card_extensions, GL_TRUE ); - } + psp->DriverAPI = i810API; + driInitExtensions( NULL, card_extensions, GL_TRUE ); + + if (!i810InitDriver(psp)) + return NULL; - return (void *) psp; + return i810FillInModes(16, 16, 0, 1); } diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 58dc02e24e..a75133ec73 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -771,7 +771,6 @@ intelCreateContext(const __GLcontextModes * mesaVis, static const struct __DriverAPIRec intelAPI = { - .InitDriver = intelInitDriver, .DestroyScreen = intelDestroyScreen, .CreateContext = intelCreateContext, .DestroyContext = intelDestroyContext, @@ -876,64 +875,46 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, - __DRIscreen * psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 5, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 5, 0 }; + I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - dri_interface = interface; + psp->DriverAPI = intelAPI; if (!driCheckDriDdxDrmVersions2("i915", - dri_version, &dri_expected, - ddx_version, &ddx_expected, - drm_version, &drm_expected)) { + &psp->dri_version, &dri_expected, + &psp->ddx_version, &ddx_expected, + &psp->drm_version, &drm_expected)) { return NULL; } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &intelAPI); - if (psp != NULL) { - I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - *driver_modes = intelFillInModes(dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, 1); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions(NULL, card_extensions, GL_FALSE); - } + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions(NULL, card_extensions, GL_FALSE); + + if (!intelInitDriver(psp)) + return NULL; - return (void *) psp; + return intelFillInModes(dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, 1); } struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen) diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index cb6824b7ee..f0bce146b0 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -540,7 +540,6 @@ static GLboolean intelCreateContext( const __GLcontextModes *mesaVis, static const struct __DriverAPIRec intelAPI = { - .InitDriver = intelInitDriver, .DestroyScreen = intelDestroyScreen, .CreateContext = intelCreateContext, .DestroyContext = intelDestroyContext, @@ -639,62 +638,44 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 6, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 3, 0 }; + I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - dri_interface = interface; - + psp->DriverAPI = intelAPI; if ( ! driCheckDriDdxDrmVersions2( "i915", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { - return NULL; + &psp->dri_version, &dri_expected, + &psp->ddx_version, &ddx_expected, + &psp->drm_version, &drm_expected ) ) { + return NULL; } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &intelAPI); - if ( psp != NULL ) { - I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - *driver_modes = intelFillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - GL_TRUE ); - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - intelInitExtensions(NULL, GL_FALSE); - } + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + intelInitExtensions(NULL, GL_FALSE); + + if (!intelInitDriver(psp)) + return NULL; - return (void *) psp; + return intelFillInModes( dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + GL_TRUE ); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 733a16b6ae..ff261c841d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -476,7 +476,6 @@ mach64InitDriver( __DRIscreenPrivate *driScreen ) static struct __DriverAPIRec mach64API = { - .InitDriver = mach64InitDriver, .DestroyScreen = mach64DestroyScreen, .CreateContext = mach64CreateContext, .DestroyContext = mach64DestroyContext, @@ -494,63 +493,41 @@ static struct __DriverAPIRec mach64API = { /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 6, 4, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 0, 0 }; + ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv; - dri_interface = interface; - + psp->DriverAPI = mach64API; if ( ! driCheckDriDdxDrmVersions2( "Mach64", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) { return NULL; } + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!mach64InitDriver(psp)) + return NULL; - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &mach64API); - if ( psp != NULL ) { - ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv; - *driver_modes = mach64FillInModes( dri_priv->cpp * 8, - 16, - 0, - 1); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - - return (void *) psp; + return mach64FillInModes( dri_priv->cpp * 8, 16, 0, 1); } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index b001f8696a..5b4693983a 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -934,7 +934,6 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) static const struct __DriverAPIRec mgaAPI = { - .InitDriver = mgaInitDriver, .DestroyScreen = mgaDestroyScreen, .CreateContext = mgaCreateContext, .DestroyContext = mgaDestroyContext, @@ -952,69 +951,50 @@ static const struct __DriverAPIRec mgaAPI = { /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 3, 0, 0 }; + MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv; - dri_interface = interface; - + psp->DriverAPI = mgaAPI; if ( ! driCheckDriDdxDrmVersions2( "MGA", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &mgaAPI); - if ( psp != NULL ) { - MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv; - *driver_modes = mgaFillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - driInitExtensions( NULL, g400_extensions, GL_FALSE ); - driInitSingleExtension( NULL, ARB_vp_extension ); - driInitExtensions( NULL, NV_vp_extensions, GL_FALSE ); - } + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + + driInitExtensions( NULL, card_extensions, GL_FALSE ); + driInitExtensions( NULL, g400_extensions, GL_FALSE ); + driInitSingleExtension( NULL, ARB_vp_extension ); + driInitExtensions( NULL, NV_vp_extensions, GL_FALSE ); + + if (!mgaInitDriver(psp)) + return NULL; - return (void *) psp; + return mgaFillInModes( dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index cab53f41ad..3e7bab63f3 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -195,7 +195,6 @@ nouveauGetSwapInfo(__DRIdrawablePrivate *dpriv, __DRIswapInfo *sInfo) } static const struct __DriverAPIRec nouveauAPI = { - .InitDriver = nouveauInitDriver, .DestroyScreen = nouveauDestroyScreen, .CreateContext = nouveauCreateContext, .DestroyContext = nouveauDestroyContext, @@ -285,81 +284,62 @@ nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; + NOUVEAUDRIPtr dri_priv = (NOUVEAUDRIPtr)psp->pDevPriv; + #if NOUVEAU_DRM_HEADER_PATCHLEVEL != 10 #error nouveau_drm.h version doesn't match expected version #endif - dri_interface = interface; if (!driCheckDriDdxDrmVersions2("nouveau", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected)) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected)) return NULL; - } // temporary lock step versioning - if (drm_expected.patch!=drm_version->patch) { + if (drm_expected.patch != psp->drm_version.patch) { __driUtilMessage("%s: wrong DRM version, expected %d, got %d\n", - __func__, - drm_expected.patch, drm_version->patch); + __func__, + drm_expected.patch, psp->drm_version.patch); return NULL; } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &nouveauAPI); - if ( psp != NULL ) { - NOUVEAUDRIPtr dri_priv = (NOUVEAUDRIPtr)psp->pDevPriv; - - *driver_modes = nouveauFillInModes(dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - 1 - ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, common_extensions, GL_FALSE ); - driInitExtensions( NULL, nv10_extensions, GL_FALSE ); - driInitExtensions( NULL, nv10_extensions, GL_FALSE ); - driInitExtensions( NULL, nv30_extensions, GL_FALSE ); - driInitExtensions( NULL, nv40_extensions, GL_FALSE ); - driInitExtensions( NULL, nv50_extensions, GL_FALSE ); - } + psp->DriverAPI = nouveauAPI; + + /* Calling driInitExtensions here, with a NULL context + * pointer, does not actually enable the extensions. It just + * makes sure that all the dispatch offsets for all the + * extensions that *might* be enables are known. This is + * needed because the dispatch offsets need to be known when + * _mesa_context_create is called, but we can't enable the + * extensions until we have a context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, common_extensions, GL_FALSE ); + driInitExtensions( NULL, nv10_extensions, GL_FALSE ); + driInitExtensions( NULL, nv10_extensions, GL_FALSE ); + driInitExtensions( NULL, nv30_extensions, GL_FALSE ); + driInitExtensions( NULL, nv40_extensions, GL_FALSE ); + driInitExtensions( NULL, nv50_extensions, GL_FALSE ); + + if (!nouveauInitDriver(psp)) + return NULL; - return (void *) psp; + return nouveauFillInModes(dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + 1); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 01b33d6493..446280c399 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -403,7 +403,6 @@ r128InitDriver( __DRIscreenPrivate *sPriv ) static struct __DriverAPIRec r128API = { - .InitDriver = r128InitDriver, .DestroyScreen = r128DestroyScreen, .CreateContext = r128CreateContext, .DestroyContext = r128DestroyContext, @@ -503,64 +502,43 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 2, 0 }; + R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv; - - dri_interface = interface; - + psp->DriverAPI = r128API; if ( ! driCheckDriDdxDrmVersions2( "Rage128", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &r128API); - if ( psp != NULL ) { - R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv; - *driver_modes = r128FillInModes( dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - return (void *) psp; + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!r128InitDriver(psp)) + return NULL; + + return r128FillInModes( dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 9801322cd8..b7e0b5a0fa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -938,7 +938,6 @@ static void radeonDestroyContext(__DRIcontextPrivate * driContextPriv) #if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) static struct __DriverAPIRec radeonAPI = { - .InitDriver = radeonInitDriver, .DestroyScreen = radeonDestroyScreen, .CreateContext = radeonCreateContext, .DestroyContext = radeonDestroyContext, @@ -959,7 +958,6 @@ static struct __DriverAPIRec radeonAPI = { }; #else static const struct __DriverAPIRec r200API = { - .InitDriver = radeonInitDriver, .DestroyScreen = radeonDestroyScreen, .CreateContext = r200CreateContext, .DestroyContext = r200DestroyContext, @@ -978,29 +976,16 @@ static const struct __DriverAPIRec r200API = { }; #endif + /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \return the __GLcontextModes supported by this driver */ -PUBLIC void * -__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; #if !RADEON_COMMON static const char *driver_name = "Radeon"; static const __DRIutilversion2 ddx_expected = { 4, 5, 0, 0 }; @@ -1017,57 +1002,46 @@ __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 24, 0 }; #endif - - dri_interface = interface; + RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv; if ( ! driCheckDriDdxDrmVersions3( driver_name, - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) { return NULL; } #if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &radeonAPI); + psp->DriverAPI = radeonAPI; #elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &r200API); + psp->DriverAPI = r200API; #endif - if ( psp != NULL ) { - RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv; - if (driver_modes) { - *driver_modes = radeonFillInModes( dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - } - - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create - * is called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create + * is called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - driInitExtensions( NULL, blend_extensions, GL_FALSE ); - driInitSingleExtension( NULL, ARB_vp_extension ); - driInitSingleExtension( NULL, NV_vp_extension ); - driInitSingleExtension( NULL, ATI_fs_extension ); - driInitExtensions( NULL, point_extensions, GL_FALSE ); + driInitExtensions( NULL, blend_extensions, GL_FALSE ); + driInitSingleExtension( NULL, ARB_vp_extension ); + driInitSingleExtension( NULL, NV_vp_extension ); + driInitSingleExtension( NULL, ATI_fs_extension ); + driInitExtensions( NULL, point_extensions, GL_FALSE ); #endif - } - return (void *) psp; + if (!radeonInitDriver(psp)) + return NULL; + + return radeonFillInModes( dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c index c66fd6dac3..7b0b006b69 100644 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c @@ -329,7 +329,6 @@ s3vUnbindContext( __DRIcontextPrivate *driContextPriv ) static struct __DriverAPIRec s3vAPI = { - s3vInitDriver, s3vDestroyScreen, s3vCreateContext, s3vDestroyContext, @@ -355,6 +354,9 @@ void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, DEBUG(("__driCreateScreen: psp = %p\n", psp)); psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &s3vAPI); DEBUG(("__driCreateScreen: psp = %p\n", psp)); + if (!s3vInitDriver(psp)) + return NULLL + return (void *) psp; } #endif diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index b2764f36f6..3750c8948a 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -919,7 +919,6 @@ void savageGetLock( savageContextPtr imesa, GLuint flags ) static const struct __DriverAPIRec savageAPI = { - savageInitDriver, savageDestroyScreen, savageCreateContext, savageDestroyContext, @@ -1016,63 +1015,44 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 2, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 1, 0 }; - - dri_interface = interface; + SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv; if ( ! driCheckDriDdxDrmVersions2( "Savage", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &savageAPI); - if ( psp != NULL ) { - SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv; - *driver_modes = savageFillInModes( dri_priv->cpp*8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - return (void *) psp; + psp->DriverAPI = savageAPI; + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!savageInitDriver(psp)) + return NULL; + + return savageFillInModes( dri_priv->cpp*8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index a1275f0026..79682a7253 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -304,7 +304,6 @@ sisInitDriver( __DRIscreenPrivate *sPriv ) } static struct __DriverAPIRec sisAPI = { - .InitDriver = sisInitDriver, .DestroyScreen = sisDestroyScreen, .CreateContext = sisCreateContext, .DestroyContext = sisDestroyContext, @@ -323,59 +322,42 @@ static struct __DriverAPIRec sisAPI = { /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes *modes, - const __DRIversion *ddx_version, - const __DRIversion *dri_version, - const __DRIversion *drm_version, - const __DRIframebuffer *frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes **driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = {0, 8, 0}; static const __DRIversion dri_expected = {4, 0, 0}; static const __DRIversion drm_expected = {1, 0, 0}; static const char *driver_name = "SiS"; - dri_interface = interface; + SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv; - if (!driCheckDriDdxDrmVersions2(driver_name, dri_version, &dri_expected, - ddx_version, &ddx_expected, - drm_version, &drm_expected)) { + if (!driCheckDriDdxDrmVersions2(driver_name, + &psp->dri_version, &dri_expected, + &psp->ddx_version, &ddx_expected, + &psp->drm_version, &drm_expected)) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &sisAPI); - if (psp != NULL) { - SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv; - *driver_modes = sisFillInModes(dri_priv->bytesPerPixel * 8); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } + psp->DriverAPI = sisAPI; + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!sisInitDriver(psp)) + return NULL; - return (void *)psp; + return sisFillInModes(dri_priv->bytesPerPixel * 8); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index e9033c5ef3..081a534035 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -345,7 +345,6 @@ tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv ) static const struct __DriverAPIRec tdfxAPI = { - .InitDriver = tdfxInitDriver, .DestroyScreen = tdfxDestroyScreen, .CreateContext = tdfxCreateContext, .DestroyContext = tdfxDestroyContext, @@ -431,69 +430,50 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, } /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 1, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 }; - dri_interface = interface; + /* divined from tdfx_dri.c, sketchy */ + TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv; + + /* XXX i wish it was like this */ + /* bpp = dri_priv->bpp */ + int bpp = (dri_priv->cpp > 2) ? 24 : 16; if ( ! driCheckDriDdxDrmVersions2( "tdfx", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &tdfxAPI); - - if (psp != NULL) { - /* divined from tdfx_dri.c, sketchy */ - TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv; - int bpp = (dri_priv->cpp > 2) ? 24 : 16; + psp->DriverAPI = tdfxAPI; + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + driInitExtensions( NULL, napalm_extensions, GL_FALSE ); - /* XXX i wish it was like this */ - /* bpp = dri_priv->bpp */ + if (!tdfxInitDriver(psp)) + return NULL; - *driver_modes = tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24, - (bpp == 16) ? 0 : 8, - (dri_priv->backOffset!=dri_priv->depthOffset)); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - driInitExtensions( NULL, napalm_extensions, GL_FALSE ); - } - - return (void *)psp; + return tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24, + (bpp == 16) ? 0 : 8, + (dri_priv->backOffset!=dri_priv->depthOffset)); } diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index 1d2a49e6f4..81098bc9cd 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -418,7 +418,6 @@ tridentInitDriver(__DRIscreenPrivate *sPriv) } static struct __DriverAPIRec tridentAPI = { - tridentInitDriver, tridentDestroyScreen, tridentCreateContext, tridentDestroyContext, @@ -430,43 +429,36 @@ static struct __DriverAPIRec tridentAPI = { }; -PUBLIC void * -__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +/** + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver + */ +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 3, 1, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 }; - - dri_interface = interface; - + if ( ! driCheckDriDdxDrmVersions2( "Trident", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &tridentAPI); + psp->DriverAPI = tridentAPI; + + if (!tridentInitDriver(psp)) + return NULL; - if ( psp != NULL ) { + /* Wait... what? This driver doesn't report any modes... */ #if 0 - TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; - *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, - GL_TRUE ); + TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; + *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, + GL_TRUE ); #endif - } - return (void *) psp; + + return NULL; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 22e4bcebc9..53f4c5c564 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -325,7 +325,6 @@ viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) static struct __DriverAPIRec viaAPI = { - .InitDriver = viaInitDriver, .DestroyScreen = viaDestroyScreen, .CreateContext = viaCreateContext, .DestroyContext = viaDestroyContext, @@ -407,66 +406,47 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { VIA_DRIDDX_VERSION_MAJOR, VIA_DRIDDX_VERSION_MINOR, VIA_DRIDDX_VERSION_PATCH }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 3, 0 }; static const char *driver_name = "Unichrome"; - - dri_interface = interface; + VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv; if ( ! driCheckDriDdxDrmVersions2( driver_name, - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected) ) return NULL; - } - - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &viaAPI); - if ( psp != NULL ) { - VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv; - *driver_modes = viaFillInModes( dri_priv->bytesPerPixel * 8, - GL_TRUE ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - return (void *) psp; + psp->DriverAPI = viaAPI; + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!viaInitDriver(psp)) + return NULL; + + return viaFillInModes( dri_priv->bytesPerPixel * 8, GL_TRUE ); + } -- cgit v1.2.3 From 295dc2d225ccac1951c0fcc2c08119f31d1b575c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 14 May 2007 17:07:16 -0400 Subject: Stop passing in unused fbconfigs to createNewScreen. --- src/mesa/drivers/dri/common/dri_util.c | 5 ----- src/mesa/drivers/dri/common/dri_util.h | 11 ----------- 2 files changed, 16 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 9c96392654..84a6d819de 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -657,9 +657,6 @@ static void driDestroyScreen(__DRIscreen *screen) (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); (void)drmCloseOnce(psp->fd); - if ( psp->modes != NULL ) { - (*dri_interface->destroyContextModes)( psp->modes ); - } _mesa_free(psp); } @@ -699,7 +696,6 @@ static void driDestroyScreen(__DRIscreen *screen) */ PUBLIC void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, @@ -720,7 +716,6 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, return NULL; psp->psc = psc; - psp->modes = NULL; /* ** NOT_DONE: This is used by the X server to detect when the client diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index f56f1fa96a..5ac2eea722 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -458,17 +458,6 @@ struct __DRIscreenPrivateRec { */ void *private; - /** - * GLX visuals / FBConfigs for this screen. These are stored as a - * linked list. - * - * \note - * This field is \b only used in conjunction with the old interfaces. If - * the new interfaces are used, this field will be set to \c NULL and will - * not be dereferenced. - */ - __GLcontextModes *modes; - /** * Pointer back to the \c __DRIscreen that contains this structure. */ -- cgit v1.2.3 From f616a263a25eda135800bea7d3a863c569b93e30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 15 May 2007 12:31:31 -0400 Subject: Implement new screen extension API. This new API lets the loader examine DRI level extensions provided by the driver in a forward compatible manner. Much of the churn in the DRI interface is adding support for new extensions or removing old, unused extensions. This new extension mechanism lets the loader query the extensions provided by the driver and implement the extensions it knows about. Deprecating extensions is done by not exporting that extension in the list, which doesn't require keeping old function pointers around to preserve ABI. --- src/mesa/drivers/dri/common/dri_util.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 84a6d819de..c8be7b0706 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -624,6 +624,14 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, } /*@}*/ +static const __DRIextension ** +driGetExtensions(__DRIscreen *screen) +{ + __DRIscreenPrivate *psp = screen->private; + static const __DRIextension *extensions[1]; + + return extensions; +} /*****************************************************************/ /** \name Screen handling functions */ @@ -750,6 +758,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psp->dummyContextPriv.driScreenPriv = NULL; psc->destroyScreen = driDestroyScreen; + psc->getExtensions = driGetExtensions; psc->createNewDrawable = driCreateNewDrawable; psc->getMSC = driGetMSC; psc->createNewContext = driCreateNewContext; -- cgit v1.2.3 From ac3e838fa748c8c8a6ffc04d1ab13da71f75f103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 15 May 2007 15:17:30 -0400 Subject: Move the copySubBuffer extension over to the new mechanism. --- src/mesa/drivers/dri/common/dri_util.c | 14 ++++++++------ src/mesa/drivers/dri/common/dri_util.h | 11 ++++++++++- src/mesa/drivers/dri/i915/intel_screen.c | 10 ++++++++-- src/mesa/drivers/dri/i965/intel_screen.c | 7 ++++++- src/mesa/drivers/dri/radeon/radeon_screen.c | 7 ++++++- 5 files changed, 38 insertions(+), 11 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index c8be7b0706..fc7755797d 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -431,6 +431,10 @@ static void driCopySubBuffer(__DRIdrawable *drawable, dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); } +const __DRIcopySubBufferExtension driCopySubBufferExtension = { + { __DRI_COPY_SUB_BUFFER }, driCopySubBuffer +}; + /** * This is called via __DRIscreenRec's createNewDrawable pointer. */ @@ -493,9 +497,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdraw->frameTracking = NULL; pdraw->queryFrameTracking = driQueryFrameTracking; - if (driCompareGLXAPIVersion (20060314) >= 0) - pdraw->copySubBuffer = driCopySubBuffer; - /* This special default value is replaced with the configured * default value when the drawable is first bound to a direct * rendering context. @@ -624,13 +625,13 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, } /*@}*/ + static const __DRIextension ** driGetExtensions(__DRIscreen *screen) { __DRIscreenPrivate *psp = screen->private; - static const __DRIextension *extensions[1]; - return extensions; + return psp->extensions; } /*****************************************************************/ @@ -715,7 +716,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, { __DRIscreenPrivate *psp; - + static const __DRIextension emptyExtensionList[] = { NULL }; dri_interface = interface; api_ver = internal_api_version; @@ -747,6 +748,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psp->pDevPriv = frame_buffer->dev_priv; psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; + psp->extensions = emptyExtensionList; psp->fd = fd; psp->myNum = scrn; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 5ac2eea722..59bb66d21b 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -73,6 +73,11 @@ typedef struct __DRIutilversionRec2 __DRIutilversion2; */ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); +/** + * Extensions. + */ +extern const __DRIcopySubBufferExtension driCopySubBufferExtension; + /** * Used by DRI_VALIDATE_DRAWABLE_INFO */ @@ -461,8 +466,12 @@ struct __DRIscreenPrivateRec { /** * Pointer back to the \c __DRIscreen that contains this structure. */ - __DRIscreen *psc; + + /** + * Extensions provided by this driver. + */ + const __DRIextension **extensions; }; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index a75133ec73..792f26b5ed 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -419,9 +419,13 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } +static const __DRIextension *intelExtensions[] = { + &driCopySubBufferExtension.base, + NULL +}; -static GLboolean -intelInitDriver(__DRIscreenPrivate * sPriv) + +static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) { intelScreenPrivate *intelScreen; I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv; @@ -522,6 +526,8 @@ intelInitDriver(__DRIscreenPrivate * sPriv) } } + sPriv->extensions = intelExtensions; + if (glx_enable_extension != NULL) { (*glx_enable_extension) (sPriv->psc, "GLX_SGI_swap_control"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index f0bce146b0..1f74103f65 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -264,6 +264,10 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, intelPrintSAREA(sarea); } +static const __DRIextension *intelExtensions[] = { + &driCopySubBufferExtension.base, + NULL +}; static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) { @@ -350,13 +354,14 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) } } + sPriv->extensions = intelExtensions; + if (glx_enable_extension != NULL) { (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" ); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index b7e0b5a0fa..7e533fef2c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -332,6 +332,10 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, return modes; } +static const __DRIextension *radeonExtensions[] = { + &driCopySubBufferExtension.base, + NULL +}; /* Create the device specific screen private data struct. */ @@ -731,6 +735,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) dri_priv->log2GARTTexGran; } + sPriv->extensions = radeonExtensions; + if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); @@ -742,7 +748,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) if (IS_R200_CLASS(screen)) (*glx_enable_extension)( sPriv->psc, "GLX_MESA_allocate_memory" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } -- cgit v1.2.3 From efaf90b03e8b69e04909bce071f8ef6b65cc0e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 15 May 2007 16:09:44 -0400 Subject: Move swap_interval to new extension mechanism. --- src/mesa/drivers/dri/common/dri_util.c | 28 ++++++++++++++++++++++++---- src/mesa/drivers/dri/common/dri_util.h | 7 +++++++ src/mesa/drivers/dri/common/vblank.c | 10 +++++----- src/mesa/drivers/dri/i915/intel_context.c | 2 +- src/mesa/drivers/dri/i915/intel_screen.c | 3 +-- src/mesa/drivers/dri/i965/intel_screen.c | 3 +-- src/mesa/drivers/dri/mach64/mach64_screen.c | 8 ++++++-- src/mesa/drivers/dri/mach64/mach64_screen.h | 2 ++ src/mesa/drivers/dri/mga/mga_xmesa.c | 9 +++++++-- src/mesa/drivers/dri/r128/r128_screen.c | 7 +++++-- src/mesa/drivers/dri/r128/r128_screen.h | 2 ++ src/mesa/drivers/dri/radeon/radeon_screen.c | 14 ++++++-------- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 ++ src/mesa/drivers/dri/unichrome/via_screen.c | 7 +++++-- src/mesa/drivers/dri/unichrome/via_screen.h | 2 ++ 15 files changed, 76 insertions(+), 30 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index fc7755797d..ba677f6ff8 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -435,6 +435,27 @@ const __DRIcopySubBufferExtension driCopySubBufferExtension = { { __DRI_COPY_SUB_BUFFER }, driCopySubBuffer }; +static void driSetSwapInterval(__DRIdrawable *drawable, unsigned int interval) +{ + __DRIdrawablePrivate *dpriv = drawable->private; + + dpriv->swap_interval = interval; +} + +static unsigned int driGetSwapInterval(__DRIdrawable *drawable) +{ + __DRIdrawablePrivate *dpriv = drawable->private; + + return dpriv->swap_interval; +} + +const __DRIswapControlExtension driSwapControlExtension = { + { __DRI_SWAP_CONTROL }, + driSetSwapInterval, + driGetSwapInterval +}; + + /** * This is called via __DRIscreenRec's createNewDrawable pointer. */ @@ -501,7 +522,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen, * default value when the drawable is first bound to a direct * rendering context. */ - pdraw->swap_interval = (unsigned)-1; + pdp->swap_interval = (unsigned)-1; pdp->swapBuffers = psp->DriverAPI.SwapBuffers; @@ -716,7 +737,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, { __DRIscreenPrivate *psp; - static const __DRIextension emptyExtensionList[] = { NULL }; + static const __DRIextension *emptyExtensionList[] = { NULL }; dri_interface = interface; api_ver = internal_api_version; @@ -868,8 +889,7 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, if ( (*dri_interface->getMSCRate)(dPriv->pdraw, &n, &d) ) { - interval = (dPriv->pdraw->swap_interval != 0) - ? dPriv->pdraw->swap_interval : 1; + interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1; /* We want to calculate diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 59bb66d21b..78320307d6 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -77,6 +77,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); * Extensions. */ extern const __DRIcopySubBufferExtension driCopySubBufferExtension; +extern const __DRIswapControlExtension driSwapControlExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO @@ -327,6 +328,12 @@ struct __DRIdrawablePrivateRec { * Called via glXSwapBuffers(). */ void (*swapBuffers)( __DRIdrawablePrivate *dPriv ); + + /** + * Controls swap interval as used by GLX_SGI_swap_control and + * GLX_MESA_swap_control. + */ + unsigned int swap_interval; }; /** diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index e7ed545f13..3b5acfecb1 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -255,13 +255,13 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags, GLuint *vbl_seq ) { - if ( priv->pdraw->swap_interval == (unsigned)-1 ) { + if ( priv->swap_interval == (unsigned)-1 ) { /* Get current vertical blank sequence */ drmVBlank vbl = { .request={ .type = DRM_VBLANK_RELATIVE, .sequence = 0 } }; do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd ); - priv->pdraw->swap_interval = (flags & (VBLANK_FLAG_THROTTLE | - VBLANK_FLAG_SYNC)) != 0 ? 1 : 0; + priv->swap_interval = (flags & (VBLANK_FLAG_THROTTLE | + VBLANK_FLAG_SYNC)) != 0 ? 1 : 0; } } @@ -277,9 +277,9 @@ driGetVBlankInterval( const __DRIdrawablePrivate *priv, GLuint flags ) if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) { /* this must have been initialized when the drawable was first bound * to a direct rendering context. */ - assert ( priv->pdraw->swap_interval != (unsigned)-1 ); + assert ( priv->swap_interval != (unsigned)-1 ); - return priv->pdraw->swap_interval; + return priv->swap_interval; } else if ( (flags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) { return 1; diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 041a155fe7..d7af432ad6 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -613,7 +613,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, if (intel->ctx.DrawBuffer == &intel_fb->Base) { if (intel->driDrawable != driDrawPriv) { - if (driDrawPriv->pdraw->swap_interval == (unsigned)-1) { + if (driDrawPriv->swap_interval == (unsigned)-1) { int i; intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0) diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 792f26b5ed..f507a3bf05 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -421,6 +421,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, + &driSwapControlExtension.base, NULL }; @@ -529,9 +530,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; if (glx_enable_extension != NULL) { - (*glx_enable_extension) (sPriv->psc, "GLX_SGI_swap_control"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); - (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_control"); (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 1f74103f65..c75a86bf5b 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -266,6 +266,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, + &driSwapControlExtension.base, NULL }; @@ -357,9 +358,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; if (glx_enable_extension != NULL) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index ff261c841d..46314b426f 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -210,6 +210,7 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); + int i; if (sPriv->devPrivSize != sizeof(ATIDRIRec)) { fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n"); @@ -318,15 +319,18 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) mach64Screen->driScreen = sPriv; + i = 0; if ( glx_enable_extension != NULL ) { if ( mach64Screen->irq != 0 ) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + mach64Screen->extensions[i++] = &driSwapControlExtension.base; + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } + mach64Screen->extensions[i++] = NULL; + sPriv->extensions = mach64Screen->extensions; return mach64Screen; } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h index 5305058e2f..36da715770 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.h +++ b/src/mesa/drivers/dri/mach64/mach64_screen.h @@ -73,6 +73,8 @@ typedef struct { __DRIscreenPrivate *driScreen; driOptionCache optionCache; + + const __DRIextension *extensions[2]; } mach64ScreenRec, *mach64ScreenPtr; #endif /* __MACH64_SCREEN_H__ */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 5b4693983a..eba96486f6 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -193,6 +193,11 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, } +static const __DRIextension *mgaExtensions[] = { + &driSwapControlExtension.base, + NULL +}; + static GLboolean mgaInitDriver(__DRIscreenPrivate *sPriv) { @@ -234,11 +239,11 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) } } + sPriv->extensions = mgaExtensions; + if ( glx_enable_extension != NULL ) { - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 446280c399..9e5c25d720 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -100,6 +100,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); + int i; if (sPriv->devPrivSize != sizeof(R128DRIRec)) { fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n"); @@ -225,15 +226,17 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen->driScreen = sPriv; + i = 0; if ( glx_enable_extension != NULL ) { if ( r128Screen->irq != 0 ) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + r128Screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } + r128Screen->extensions[i++] = NULL; + sPriv->extensions = r128Screen->extensions; return r128Screen; } diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 8db8eea358..9733927274 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -78,6 +78,8 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; + const __DRIextension *extensions[2]; + } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 7e533fef2c..46160babb0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -332,11 +332,6 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, return modes; } -static const __DRIextension *radeonExtensions[] = { - &driCopySubBufferExtension.base, - NULL -}; - /* Create the device specific screen private data struct. */ static radeonScreenPtr @@ -347,6 +342,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) unsigned char *RADEONMMIO; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); + int i; if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n"); @@ -735,13 +731,13 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) dri_priv->log2GARTTexGran; } - sPriv->extensions = radeonExtensions; + i = 0; + screen->extensions[i++] = &driCopySubBufferExtension.base; if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); @@ -750,6 +746,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } + screen->extensions[i++] = NULL; + sPriv->extensions = screen->extensions; #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) if (IS_R200_CLASS(screen)) { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 25e6fcf399..eceab53f5f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -103,6 +103,8 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; + + const __DRIextension *extensions[3]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 53f4c5c564..153e401a16 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -100,6 +100,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv) VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); + int i; if (sPriv->devPrivSize != sizeof(VIADRIRec)) { fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n"); @@ -174,16 +175,18 @@ viaInitDriver(__DRIscreenPrivate *sPriv) viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset; + i = 0; if ( glx_enable_extension != NULL ) { if ( viaScreen->irqEnabled ) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + viaScreen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } + viaScreen->extensions[i++] = NULL; + sPriv->extensions = viaScreen->extensions; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 84aa5aef88..85f87c4da3 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -70,6 +70,8 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; + + const __DRIextension *extensions[2]; } viaScreenPrivate; -- cgit v1.2.3 From 78a6aa57a0155d72280dd91c05513c847bf76f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 16 May 2007 14:10:29 -0400 Subject: Move GLX_MESA_allocate_memory related functions to new extension mechanism. --- src/mesa/drivers/dri/i915/intel_screen.c | 8 ++++++++ src/mesa/drivers/dri/radeon/radeon_screen.c | 26 ++++++++++++++++---------- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- 3 files changed, 25 insertions(+), 11 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index f507a3bf05..27bf5e12a2 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -419,9 +419,17 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } +static const __DRIallocateExtension intelAllocateExtension = { + { __DRI_ALLOCATE }, + intelAllocateMemoryMESA, + intelFreeMemoryMESA, + intelGetMemoryOffsetMESA +}; + static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, + &intelAllocateExtension.base, NULL }; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 46160babb0..362d70f9e5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -332,6 +332,17 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, return modes; } +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) + +static const __DRIallocateExtension r200AllocateExtension = { + { __DRI_ALLOCATE }, + r200AllocateMemoryMESA, + r200FreeMemoryMESA, + r200GetMemoryOffsetMESA +}; + +#endif + /* Create the device specific screen private data struct. */ static radeonScreenPtr @@ -741,22 +752,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); - if (IS_R200_CLASS(screen)) - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_allocate_memory" ); - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } - screen->extensions[i++] = NULL; - sPriv->extensions = screen->extensions; #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - if (IS_R200_CLASS(screen)) { - sPriv->psc->allocateMemory = (void *) r200AllocateMemoryMESA; - sPriv->psc->freeMemory = (void *) r200FreeMemoryMESA; - sPriv->psc->memoryOffset = (void *) r200GetMemoryOffsetMESA; - } + if (IS_R200_CLASS(screen)) + screen->extensions[i++] = &r200AllocateExtension.base; #endif + screen->extensions[i++] = NULL; + sPriv->extensions = screen->extensions; + screen->driScreen = sPriv; screen->sarea_priv_offset = dri_priv->sarea_priv_offset; return screen; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index eceab53f5f..954096f677 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ -- cgit v1.2.3 From a7a0a2beb54dcb78d7e0ab64cf2f5a6ede8191a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 16 May 2007 15:50:40 -0400 Subject: Move GLX_MESA_swap_frame_usage DRI entry points to the new mechanism. --- src/mesa/drivers/dri/common/dri_util.c | 18 +++++++++++------- src/mesa/drivers/dri/common/dri_util.h | 1 + src/mesa/drivers/dri/i915/intel_screen.c | 2 +- src/mesa/drivers/dri/i965/intel_screen.c | 2 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 3 +-- src/mesa/drivers/dri/mach64/mach64_screen.h | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 2 +- src/mesa/drivers/dri/r128/r128_screen.c | 3 +-- src/mesa/drivers/dri/r128/r128_screen.h | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- src/mesa/drivers/dri/unichrome/via_screen.c | 2 +- src/mesa/drivers/dri/unichrome/via_screen.h | 2 +- 13 files changed, 23 insertions(+), 20 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ba677f6ff8..7815f361a8 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -52,11 +52,6 @@ static const int empty_attribute_list[1] = { None }; */ static int api_ver = 0; -/* forward declarations */ -static int driQueryFrameTracking( __DRIdrawable *drawable, - int64_t *sbc, int64_t *missedFrames, - float *lastMissedUsage, float *usage ); - static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, __DRIdrawable *pdraw, @@ -515,8 +510,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdraw->waitForSBC = driWaitForSBC; pdraw->waitForMSC = driWaitForMSC; pdraw->swapBuffersMSC = driSwapBuffersMSC; - pdraw->frameTracking = NULL; - pdraw->queryFrameTracking = driQueryFrameTracking; /* This special default value is replaced with the configured * default value when the drawable is first bound to a direct @@ -825,6 +818,12 @@ int driCompareGLXAPIVersion( GLint required_version ) } +static int +driFrameTracking(__DRIdrawable *drawable, GLboolean enable) +{ + return GLX_BAD_CONTEXT; +} + static int driQueryFrameTracking(__DRIdrawable *drawable, int64_t * sbc, int64_t * missedFrames, @@ -849,6 +848,11 @@ driQueryFrameTracking(__DRIdrawable *drawable, return status; } +const __DRIframeTrackingExtension driFrameTrackingExtension = { + { __DRI_FRAME_TRACKING }, + driFrameTracking, + driQueryFrameTracking +}; /** * Calculate amount of swap interval used between GLX buffer swaps. diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 78320307d6..a7149bc552 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -78,6 +78,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); */ extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; +extern const __DRIframeTrackingExtension driFrameTrackingExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 27bf5e12a2..041ff6bef0 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -430,6 +430,7 @@ static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, &intelAllocateExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -539,7 +540,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) if (glx_enable_extension != NULL) { (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); - (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index c75a86bf5b..ed8d207a49 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -267,6 +267,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -359,7 +360,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) if (glx_enable_extension != NULL) { (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 46314b426f..adbed09877 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -320,14 +320,13 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) mach64Screen->driScreen = sPriv; i = 0; + mach64Screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( mach64Screen->irq != 0 ) { mach64Screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } mach64Screen->extensions[i++] = NULL; sPriv->extensions = mach64Screen->extensions; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h index 36da715770..732cb3f23a 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.h +++ b/src/mesa/drivers/dri/mach64/mach64_screen.h @@ -74,7 +74,7 @@ typedef struct { driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } mach64ScreenRec, *mach64ScreenPtr; #endif /* __MACH64_SCREEN_H__ */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index eba96486f6..198c5d5ca9 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -195,6 +195,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, static const __DRIextension *mgaExtensions[] = { &driSwapControlExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -242,7 +243,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = mgaExtensions; if ( glx_enable_extension != NULL ) { - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 9e5c25d720..c7bd876283 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -227,13 +227,12 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen->driScreen = sPriv; i = 0; + r128Screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( r128Screen->irq != 0 ) { r128Screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } r128Screen->extensions[i++] = NULL; sPriv->extensions = r128Screen->extensions; diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 9733927274..75dc084d9d 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -78,7 +78,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 362d70f9e5..4eaff652c7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -744,6 +744,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) i = 0; screen->extensions[i++] = &driCopySubBufferExtension.base; + screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { @@ -751,7 +752,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 954096f677..1001210917 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[4]; + const __DRIextension *extensions[5]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 153e401a16..025d8f63af 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -176,6 +176,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv) viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset; i = 0; + viaScreen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( viaScreen->irqEnabled ) { viaScreen->extensions[i++] = &driSwapControlExtension.base; @@ -183,7 +184,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) } (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } viaScreen->extensions[i++] = NULL; sPriv->extensions = viaScreen->extensions; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 85f87c4da3..3dc52ba96a 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -71,7 +71,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } viaScreenPrivate; -- cgit v1.2.3 From 106a6f29bbdc71982afd629bdf89369cefd1459e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 16 May 2007 18:13:41 -0400 Subject: Move media stream counter entry points to new extension. --- src/mesa/drivers/dri/common/dri_util.c | 45 ++++------------------------- src/mesa/drivers/dri/common/dri_util.h | 1 + src/mesa/drivers/dri/i915/intel_screen.c | 2 +- src/mesa/drivers/dri/i965/intel_screen.c | 5 ++-- src/mesa/drivers/dri/mach64/mach64_screen.c | 11 ++----- src/mesa/drivers/dri/mach64/mach64_screen.h | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 5 ++-- src/mesa/drivers/dri/r128/r128_screen.c | 10 ++----- src/mesa/drivers/dri/r128/r128_screen.h | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 13 ++++----- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- src/mesa/drivers/dri/unichrome/via_screen.c | 12 ++++---- src/mesa/drivers/dri/unichrome/via_screen.h | 2 +- 13 files changed, 32 insertions(+), 80 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 7815f361a8..e20c4fe5fa 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -358,31 +358,6 @@ static int driGetMSC( __DRIscreen *screen, int64_t *msc ) return sPriv->DriverAPI.GetMSC( sPriv, msc ); } -/** - * Called directly from a number of higher-level GLX functions. - */ -static int driGetSBC(__DRIdrawable *drawable, int64_t *sbc) -{ - __DRIdrawablePrivate *dPriv = drawable->private; - __DRIswapInfo sInfo; - int status; - - - status = dPriv->driScreenPriv->DriverAPI.GetSwapInfo( dPriv, & sInfo ); - *sbc = sInfo.swap_count; - - return status; -} - -static int driWaitForSBC(__DRIdrawable *drawable, int64_t target_sbc, - int64_t * msc, int64_t * sbc) -{ - __DRIdrawablePrivate *dPriv = drawable->private; - - return dPriv->driScreenPriv->DriverAPI.WaitForSBC( dPriv, target_sbc, - msc, sbc ); -} - static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc, int64_t * sbc) @@ -409,15 +384,11 @@ static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, return status; } -static int64_t driSwapBuffersMSC(__DRIdrawable *drawable, int64_t target_msc, - int64_t divisor, int64_t remainder) -{ - __DRIdrawablePrivate *dPriv = drawable->private; - - return dPriv->driScreenPriv->DriverAPI.SwapBuffersMSC( dPriv, target_msc, - divisor, - remainder ); -} +const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { + { __DRI_MEDIA_STREAM_COUNTER }, + driGetMSC, + driWaitForMSC, +}; static void driCopySubBuffer(__DRIdrawable *drawable, int x, int y, int w, int h) @@ -506,11 +477,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdraw->destroyDrawable = driDestroyDrawable; pdraw->swapBuffers = driSwapBuffers; /* called by glXSwapBuffers() */ - pdraw->getSBC = driGetSBC; - pdraw->waitForSBC = driWaitForSBC; - pdraw->waitForMSC = driWaitForMSC; - pdraw->swapBuffersMSC = driSwapBuffersMSC; - /* This special default value is replaced with the configured * default value when the drawable is first bound to a direct * rendering context. @@ -776,7 +742,6 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psc->destroyScreen = driDestroyScreen; psc->getExtensions = driGetExtensions; psc->createNewDrawable = driCreateNewDrawable; - psc->getMSC = driGetMSC; psc->createNewContext = driCreateNewContext; if (internal_api_version >= 20070121) diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index a7149bc552..e43a5b752e 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -79,6 +79,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; extern const __DRIframeTrackingExtension driFrameTrackingExtension; +extern const __DRImediaStreamCounterExtension driMediaStreamCounterExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 041ff6bef0..60d375874d 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -431,6 +431,7 @@ static const __DRIextension *intelExtensions[] = { &driSwapControlExtension.base, &intelAllocateExtension.base, &driFrameTrackingExtension.base, + &driMediaStreamCounterExtension.base, NULL }; @@ -539,7 +540,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; if (glx_enable_extension != NULL) { - (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index ed8d207a49..a4d63599e5 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -268,6 +268,7 @@ static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, &driFrameTrackingExtension.base, + &driMediaStreamCounterExtension.base, NULL }; @@ -358,10 +359,8 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; - if (glx_enable_extension != NULL) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + if (glx_enable_extension != NULL) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - } return GL_TRUE; } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index adbed09877..04eb081514 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -208,8 +208,6 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) { mach64ScreenPtr mach64Screen; ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); int i; if (sPriv->devPrivSize != sizeof(ATIDRIRec)) { @@ -321,12 +319,9 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) i = 0; mach64Screen->extensions[i++] = &driFrameTrackingExtension.base; - if ( glx_enable_extension != NULL ) { - if ( mach64Screen->irq != 0 ) { - mach64Screen->extensions[i++] = &driSwapControlExtension.base; - - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } + if ( mach64Screen->irq != 0 ) { + mach64Screen->extensions[i++] = &driSwapControlExtension.base; + mach64Screen->extensions[i++] = &driMediaStreamCounterExtension.base; } mach64Screen->extensions[i++] = NULL; sPriv->extensions = mach64Screen->extensions; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h index 732cb3f23a..766554d7e4 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.h +++ b/src/mesa/drivers/dri/mach64/mach64_screen.h @@ -74,7 +74,7 @@ typedef struct { driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } mach64ScreenRec, *mach64ScreenPtr; #endif /* __MACH64_SCREEN_H__ */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 198c5d5ca9..6f138351cc 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -196,6 +196,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, static const __DRIextension *mgaExtensions[] = { &driSwapControlExtension.base, &driFrameTrackingExtension.base, + &driMediaStreamCounterExtension.base, NULL }; @@ -242,10 +243,8 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = mgaExtensions; - if ( glx_enable_extension != NULL ) { + if ( glx_enable_extension != NULL ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } if (serverInfo->chipset != MGA_CARD_TYPE_G200 && serverInfo->chipset != MGA_CARD_TYPE_G400) { diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index c7bd876283..9d65ebddf7 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -98,8 +98,6 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) { r128ScreenPtr r128Screen; R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); int i; if (sPriv->devPrivSize != sizeof(R128DRIRec)) { @@ -228,11 +226,9 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) i = 0; r128Screen->extensions[i++] = &driFrameTrackingExtension.base; - if ( glx_enable_extension != NULL ) { - if ( r128Screen->irq != 0 ) { - r128Screen->extensions[i++] = &driSwapControlExtension.base; - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } + if ( r128Screen->irq != 0 ) { + r128Screen->extensions[i++] = &driSwapControlExtension.base; + r128Screen->extensions[i++] = &driMediaStreamCounterExtension.base; } r128Screen->extensions[i++] = NULL; sPriv->extensions = r128Screen->extensions; diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 75dc084d9d..c333713766 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -78,7 +78,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 4eaff652c7..56493f5a3a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -745,15 +745,12 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) i = 0; screen->extensions[i++] = &driCopySubBufferExtension.base; screen->extensions[i++] = &driFrameTrackingExtension.base; - - if ( glx_enable_extension != NULL ) { - if ( screen->irq != 0 ) { - screen->extensions[i++] = &driSwapControlExtension.base; - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } - - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); + if ( screen->irq != 0 ) { + screen->extensions[i++] = &driSwapControlExtension.base; + screen->extensions[i++] = &driMediaStreamCounterExtension.base; } + if ( glx_enable_extension != NULL ) + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) if (IS_R200_CLASS(screen)) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 1001210917..0caac17daf 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[5]; + const __DRIextension *extensions[6]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 025d8f63af..fddf079934 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -177,14 +177,14 @@ viaInitDriver(__DRIscreenPrivate *sPriv) i = 0; viaScreen->extensions[i++] = &driFrameTrackingExtension.base; - if ( glx_enable_extension != NULL ) { - if ( viaScreen->irqEnabled ) { - viaScreen->extensions[i++] = &driSwapControlExtension.base; - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } + if ( viaScreen->irqEnabled ) { + viaScreen->extensions[i++] = &driSwapControlExtension.base; + viaScreen->extensions[i++] = &driMediaStreamCounterExtension.base; + } + if ( glx_enable_extension != NULL ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - } + viaScreen->extensions[i++] = NULL; sPriv->extensions = viaScreen->extensions; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 3dc52ba96a..5e5bc851b0 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -71,7 +71,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } viaScreenPrivate; -- cgit v1.2.3 From f968f67e6214416f04b8875ce59a94a02f464c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 17 May 2007 14:39:06 -0400 Subject: Add a DRI_ReadDrawable marker extension to signal read drawable capability. --- src/mesa/drivers/dri/common/dri_util.c | 8 ++++++++ src/mesa/drivers/dri/common/dri_util.h | 1 + src/mesa/drivers/dri/i915/intel_screen.c | 9 +-------- src/mesa/drivers/dri/i965/intel_screen.c | 6 +----- src/mesa/drivers/dri/mga/mga_xmesa.c | 6 +----- src/mesa/drivers/dri/radeon/radeon_screen.c | 6 ++---- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- src/mesa/drivers/dri/savage/savage_xmesa.c | 11 +++++------ src/mesa/drivers/dri/tdfx/tdfx_screen.c | 10 +++++----- src/mesa/drivers/dri/unichrome/via_screen.c | 6 +----- src/mesa/drivers/dri/unichrome/via_screen.h | 2 +- 11 files changed, 27 insertions(+), 40 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index e20c4fe5fa..b88592313e 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -46,6 +46,14 @@ const __DRIinterfaceMethods * dri_interface = NULL; static const int empty_attribute_list[1] = { None }; +/** + * This is just a token extension used to signal that the driver + * supports setting a read drawable. + */ +const __DRIextension driReadDrawableExtension = { + __DRI_READ_DRAWABLE +}; + /** * Cached copy of the internal API version used by libGL and the client-side * DRI driver. diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index e43a5b752e..91992a9a24 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -76,6 +76,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); /** * Extensions. */ +extern const __DRIextension driReadDrawableExtension; extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; extern const __DRIframeTrackingExtension driFrameTrackingExtension; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 60d375874d..191d26e84b 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -427,6 +427,7 @@ static const __DRIallocateExtension intelAllocateExtension = { }; static const __DRIextension *intelExtensions[] = { + &driReadDrawableExtension, &driCopySubBufferExtension.base, &driSwapControlExtension.base, &intelAllocateExtension.base, @@ -442,10 +443,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv; drmI830Sarea *sarea; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface-> - getProcAddress("glxEnableExtension")); - if (sPriv->devPrivSize != sizeof(I830DRIRec)) { fprintf(stderr, "\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n"); @@ -539,10 +536,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; - if (glx_enable_extension != NULL) { - (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); - } - /* If we've got a new enough DDX that's initializing TTM and giving us * object handles for the shared buffers, use that. */ diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index a4d63599e5..e35f7da938 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -265,6 +265,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, } static const __DRIextension *intelExtensions[] = { + &driReadDrawableExtension, &driCopySubBufferExtension.base, &driSwapControlExtension.base, &driFrameTrackingExtension.base, @@ -276,8 +277,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) { intelScreenPrivate *intelScreen; I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); volatile drmI830Sarea *sarea; if (sPriv->devPrivSize != sizeof(I830DRIRec)) { @@ -358,9 +357,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) } sPriv->extensions = intelExtensions; - - if (glx_enable_extension != NULL) - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 6f138351cc..99a2ea0491 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -194,6 +194,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, static const __DRIextension *mgaExtensions[] = { + &driReadDrawableExtension, &driSwapControlExtension.base, &driFrameTrackingExtension.base, &driMediaStreamCounterExtension.base, @@ -205,8 +206,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) { mgaScreenPrivate *mgaScreen; MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); if (sPriv->devPrivSize != sizeof(MGADRIRec)) { fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n"); @@ -243,9 +242,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = mgaExtensions; - if ( glx_enable_extension != NULL ) - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - if (serverInfo->chipset != MGA_CARD_TYPE_G200 && serverInfo->chipset != MGA_CARD_TYPE_G400) { FREE(mgaScreen); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 56493f5a3a..269620cec4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -351,8 +351,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) radeonScreenPtr screen; RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv; unsigned char *RADEONMMIO; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); int i; if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { @@ -745,12 +743,12 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) i = 0; screen->extensions[i++] = &driCopySubBufferExtension.base; screen->extensions[i++] = &driFrameTrackingExtension.base; + screen->extensions[i++] = &driReadDrawableExtension; + if ( screen->irq != 0 ) { screen->extensions[i++] = &driSwapControlExtension.base; screen->extensions[i++] = &driMediaStreamCounterExtension.base; } - if ( glx_enable_extension != NULL ) - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) if (IS_R200_CLASS(screen)) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 0caac17daf..68755c985a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[6]; + const __DRIextension *extensions[7]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 3750c8948a..013e88216f 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -168,6 +168,10 @@ static const struct tnl_pipeline_stage *savage_pipeline[] = { }; +static const __DRIextension *savageExtensions[] = { + &driReadDrawableExtension, +}; + /* this is first function called in dirver*/ static GLboolean @@ -175,9 +179,6 @@ savageInitDriver(__DRIscreenPrivate *sPriv) { savageScreenPrivate *savageScreen; SAVAGEDRIPtr gDRIPriv = (SAVAGEDRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - if (sPriv->devPrivSize != sizeof(SAVAGEDRIRec)) { fprintf(stderr,"\nERROR! sizeof(SAVAGEDRIRec) does not match passed size from device driver\n"); @@ -265,9 +266,7 @@ savageInitDriver(__DRIscreenPrivate *sPriv) driParseOptionInfo (&savageScreen->optionCache, __driConfigOptions, __driNConfigOptions); - if (glx_enable_extension != NULL) { - (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read"); - } + sPriv->extensions = savageExtensions; #if 0 savageDDFastPathInit(); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 081a534035..5bdb446d15 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -63,6 +63,10 @@ DRI_CONF_BEGIN DRI_CONF_SECTION_END DRI_CONF_END; +static const __DRIextension *tdfxExtensions[] = { + &driReadDrawableExtension, +}; + static const GLuint __driNConfigOptions = 1; extern const struct dri_extension card_extensions[]; @@ -73,8 +77,6 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) { tdfxScreenPrivate *fxScreen; TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) { fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n"); @@ -115,9 +117,7 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) return GL_FALSE; } - if (glx_enable_extension != NULL) { - (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read"); - } + sPriv->extensions = tdfxExtensions; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index fddf079934..f3912ac352 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -98,8 +98,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) { viaScreenPrivate *viaScreen; VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); int i; if (sPriv->devPrivSize != sizeof(VIADRIRec)) { @@ -177,14 +175,12 @@ viaInitDriver(__DRIscreenPrivate *sPriv) i = 0; viaScreen->extensions[i++] = &driFrameTrackingExtension.base; + viaScreen->extensions[i++] = &driReadDrawableExtension; if ( viaScreen->irqEnabled ) { viaScreen->extensions[i++] = &driSwapControlExtension.base; viaScreen->extensions[i++] = &driMediaStreamCounterExtension.base; } - if ( glx_enable_extension != NULL ) - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - viaScreen->extensions[i++] = NULL; sPriv->extensions = viaScreen->extensions; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 5e5bc851b0..c3ef722ff0 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -71,7 +71,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[4]; + const __DRIextension *extensions[5]; } viaScreenPrivate; -- cgit v1.2.3 From ecdb45cb29e3209287cc297081596126e955ff2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 17 May 2007 16:11:19 -0400 Subject: Convert a left-over private void * to __DRIcontext *. --- src/mesa/drivers/dri/common/dri_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index b88592313e..20fee27f0a 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -553,7 +553,7 @@ driDestroyContext(__DRIcontext *context) * \param modes Mode used to create the new context. * \param render_type Type of rendering target. \c GLX_RGBA is the only * type likely to ever be supported for direct-rendering. - * \param sharedPrivate The shared context dependent methods or \c NULL if + * \param shared The shared context dependent methods or \c NULL if * non-existent. * \param pctx DRI context to receive the context dependent methods. * @@ -569,11 +569,11 @@ driDestroyContext(__DRIcontext *context) */ static void * driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, - int render_type, void *sharedPrivate, + int render_type, __DRIcontext *shared, drm_context_t hwContext, __DRIcontext *pctx) { __DRIcontextPrivate *pcp; - __DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate; + __DRIcontextPrivate *pshare = (shared != NULL) ? shared->private : NULL; __DRIscreenPrivate *psp; void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL; -- cgit v1.2.3 From f29f0ae8383888a6493b615edc3bab254cf6df39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 22 May 2007 12:26:02 -0400 Subject: Move new texOffset extension to the new extension mechanism. --- src/mesa/drivers/dri/common/dri_util.c | 3 --- src/mesa/drivers/dri/radeon/radeon_screen.c | 14 ++++++++++---- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 20fee27f0a..2209321978 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -752,9 +752,6 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psc->createNewDrawable = driCreateNewDrawable; psc->createNewContext = driCreateNewContext; - if (internal_api_version >= 20070121) - psc->setTexOffset = psp->DriverAPI.setTexOffset; - *driver_modes = __driDriverInitScreen(psp); if (*driver_modes == NULL) { _mesa_free(psp); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 269620cec4..84c6885d50 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -333,14 +333,19 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, } #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - static const __DRIallocateExtension r200AllocateExtension = { { __DRI_ALLOCATE }, r200AllocateMemoryMESA, r200FreeMemoryMESA, r200GetMemoryOffsetMESA }; +#endif +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) +static const __DRItexOffsetExtension r300texOffsetExtension = { + { __DRI_TEX_OFFSET }, + r300SetTexOffset, +}; #endif /* Create the device specific screen private data struct. @@ -755,6 +760,10 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->extensions[i++] = &r200AllocateExtension.base; #endif +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) + screen->extensions[i++] = &r300texOffsetExtension.base; +#endif + screen->extensions[i++] = NULL; sPriv->extensions = screen->extensions; @@ -956,9 +965,6 @@ static struct __DriverAPIRec radeonAPI = { .WaitForSBC = NULL, .SwapBuffersMSC = NULL, .CopySubBuffer = radeonCopySubBuffer, -#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) - .setTexOffset = r300SetTexOffset, -#endif }; #else static const struct __DriverAPIRec r200API = { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 68755c985a..184b0d225e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[7]; + const __DRIextension *extensions[8]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ -- cgit v1.2.3 From ccff0cb26378ce370fc8697a2a2ada138d2e119e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 7 Jun 2007 19:35:54 -0400 Subject: Add a version field to __DRIextension. --- src/mesa/drivers/dri/common/dri_util.c | 11 ++++++----- src/mesa/drivers/dri/i915/intel_screen.c | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 2209321978..d59ea0ddad 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -51,7 +51,7 @@ static const int empty_attribute_list[1] = { None }; * supports setting a read drawable. */ const __DRIextension driReadDrawableExtension = { - __DRI_READ_DRAWABLE + __DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION }; /** @@ -393,7 +393,7 @@ static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, } const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { - { __DRI_MEDIA_STREAM_COUNTER }, + { __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION }, driGetMSC, driWaitForMSC, }; @@ -406,7 +406,8 @@ static void driCopySubBuffer(__DRIdrawable *drawable, } const __DRIcopySubBufferExtension driCopySubBufferExtension = { - { __DRI_COPY_SUB_BUFFER }, driCopySubBuffer + { __DRI_COPY_SUB_BUFFER, __DRI_COPY_SUB_BUFFER_VERSION }, + driCopySubBuffer }; static void driSetSwapInterval(__DRIdrawable *drawable, unsigned int interval) @@ -424,7 +425,7 @@ static unsigned int driGetSwapInterval(__DRIdrawable *drawable) } const __DRIswapControlExtension driSwapControlExtension = { - { __DRI_SWAP_CONTROL }, + { __DRI_SWAP_CONTROL, __DRI_SWAP_CONTROL_VERSION }, driSetSwapInterval, driGetSwapInterval }; @@ -819,7 +820,7 @@ driQueryFrameTracking(__DRIdrawable *drawable, } const __DRIframeTrackingExtension driFrameTrackingExtension = { - { __DRI_FRAME_TRACKING }, + { __DRI_FRAME_TRACKING, __DRI_FRAME_TRACKING_VERSION }, driFrameTracking, driQueryFrameTracking }; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 191d26e84b..b5eab5ba00 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -420,7 +420,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, } static const __DRIallocateExtension intelAllocateExtension = { - { __DRI_ALLOCATE }, + { __DRI_ALLOCATE, __DRI_ALLOCATE_VERSION }, intelAllocateMemoryMESA, intelFreeMemoryMESA, intelGetMemoryOffsetMESA diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 84c6885d50..10d3c2b27c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -334,7 +334,7 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) static const __DRIallocateExtension r200AllocateExtension = { - { __DRI_ALLOCATE }, + { __DRI_ALLOCATE, __DRI_ALLOCATE_VERSION }, r200AllocateMemoryMESA, r200FreeMemoryMESA, r200GetMemoryOffsetMESA @@ -343,7 +343,7 @@ static const __DRIallocateExtension r200AllocateExtension = { #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) static const __DRItexOffsetExtension r300texOffsetExtension = { - { __DRI_TEX_OFFSET }, + { __DRI_TEX_OFFSET, __DRI_TEX_OFFSET_VERSION }, r300SetTexOffset, }; #endif -- cgit v1.2.3 From a2494462cb7d557a7643452c720e0ab8fa9f4f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 11 Oct 2007 12:49:26 -0400 Subject: Drop no longer implemented MESA allocate extension from i915. --- src/mesa/drivers/dri/i915/intel_screen.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index b5eab5ba00..df616f43b9 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -419,18 +419,10 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } -static const __DRIallocateExtension intelAllocateExtension = { - { __DRI_ALLOCATE, __DRI_ALLOCATE_VERSION }, - intelAllocateMemoryMESA, - intelFreeMemoryMESA, - intelGetMemoryOffsetMESA -}; - static const __DRIextension *intelExtensions[] = { &driReadDrawableExtension, &driCopySubBufferExtension.base, &driSwapControlExtension.base, - &intelAllocateExtension.base, &driFrameTrackingExtension.base, &driMediaStreamCounterExtension.base, NULL -- cgit v1.2.3