From 6cb3f5c4d8618a14bb7ad1d9df10ed7e648a7b2b Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 28 Feb 2008 10:32:28 -0500 Subject: Use __DRIextension mechanism providing loader functionality to the driver. Instead of passing in a fixed struct, the loader now passes in a list of __DRIextension structs, to advertise the functionality it can provide to the driver. Each extension is individually versioned and can be extended or phased out as the interface develops. --- src/mesa/drivers/dri/common/dri_util.c | 105 +++++++++----------------- src/mesa/drivers/dri/common/dri_util.h | 26 ++----- src/mesa/drivers/dri/fb/fb_dri.c | 9 ++- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 9 ++- src/mesa/drivers/dri/i810/i810screen.c | 7 +- src/mesa/drivers/dri/intel/intel_buffers.c | 4 +- src/mesa/drivers/dri/intel/intel_context.c | 3 +- src/mesa/drivers/dri/intel/intel_screen.c | 13 ++-- src/mesa/drivers/dri/mach64/mach64_screen.c | 9 ++- src/mesa/drivers/dri/mga/mga_xmesa.c | 10 ++- src/mesa/drivers/dri/mga/mgaioctl.c | 6 +- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 12 +-- src/mesa/drivers/dri/r128/r128_screen.c | 8 +- src/mesa/drivers/dri/r200/r200_context.c | 2 +- src/mesa/drivers/dri/r200/r200_ioctl.c | 8 +- src/mesa/drivers/dri/r300/radeon_context.c | 2 +- src/mesa/drivers/dri/r300/radeon_ioctl.c | 8 +- src/mesa/drivers/dri/radeon/radeon_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_ioctl.c | 10 ++- src/mesa/drivers/dri/radeon/radeon_screen.c | 10 ++- src/mesa/drivers/dri/savage/savage_xmesa.c | 8 +- src/mesa/drivers/dri/sis/sis_screen.c | 6 +- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 8 +- src/mesa/drivers/dri/unichrome/via_context.c | 2 +- src/mesa/drivers/dri/unichrome/via_ioctl.c | 9 ++- src/mesa/drivers/dri/unichrome/via_screen.c | 7 +- 26 files changed, 146 insertions(+), 157 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 b429a824abd..89c1a099d9d 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -37,16 +37,6 @@ typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); #endif -/* This pointer *must* be set by the driver's __driCreateNewScreen funciton! - */ -const __DRIinterfaceMethods * dri_interface = NULL; - -/** - * This is used in a couple of places that call \c driCreateNewDrawable. - */ -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. @@ -55,12 +45,6 @@ const __DRIextension driReadDrawableExtension = { __DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION }; -/** - * Cached copy of the internal API version used by libGL and the client-side - * DRI driver. - */ -static int api_ver = 0; - static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, __DRIdrawable *pdraw, @@ -253,7 +237,7 @@ static GLboolean driBindContext(__DRIcontext * ctx, void __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) { - __DRIscreenPrivate *psp; + __DRIscreenPrivate *psp = pdp->driScreenPriv; __DRIcontextPrivate *pcp = pdp->driContextPriv; if (!pcp @@ -264,15 +248,6 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) */ } - psp = pdp->driScreenPriv; - if (!psp) { - /* ERROR!!! */ - _mesa_problem(NULL, "Warning! Possible infinite loop due to bug " - "in file %s, line %d\n", - __FILE__, __LINE__); - return; - } - if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; @@ -285,7 +260,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - if (! (*dri_interface->getDrawableInfo)(pdp->pdraw, + if (! (*psp->getDrawableInfo->getDrawableInfo)(pdp->pdraw, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, @@ -328,7 +303,7 @@ __driParseEvents(__DRIscreenPrivate *psp, __DRIdrawablePrivate *pdp) * server overwrote it and we have to reset our tail * pointer. */ DRM_UNLOCK(psp->fd, psp->lock, pcp->hHWContext); - (*dri_interface->reemitDrawableInfo)(pdp->pdraw); + (*psp->dri2.core->reemitDrawableInfo)(pdp->pdraw); DRM_LIGHT_LOCK(psp->fd, psp->lock, pcp->hHWContext); } @@ -426,6 +401,7 @@ __driParseEvents(__DRIscreenPrivate *psp, __DRIdrawablePrivate *pdp) static void driSwapBuffers(__DRIdrawable *drawable) { __DRIdrawablePrivate *dPriv = drawable->private; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; drm_clip_rect_t rect; if (!dPriv->numClipRects) @@ -434,7 +410,7 @@ static void driSwapBuffers(__DRIdrawable *drawable) dPriv->swapBuffers(dPriv); /* Check that we actually have the new damage report method */ - if (api_ver < 20070105 || dri_interface->reportDamage == NULL) + if (psp->damage == NULL) return; /* Assume it's affecting the whole drawable for now */ @@ -447,8 +423,8 @@ static void driSwapBuffers(__DRIdrawable *drawable) * front buffer, so we report the damage there rather than to the backing * store (if any). */ - (*dri_interface->reportDamage)(dPriv->pdraw, dPriv->x, dPriv->y, - &rect, 1, GL_TRUE); + (*psp->damage->reportDamage)(dPriv->pdraw, + dPriv->x, dPriv->y, &rect, 1, GL_TRUE); } static int driDrawableGetMSC( __DRIscreen *screen, __DRIdrawable *drawable, @@ -767,6 +743,26 @@ static void driDestroyScreen(__DRIscreen *screen) } } +static void +setupLoaderExtensions(__DRIscreenPrivate *psp, + const __DRIextension **extensions) +{ + int i; + + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_CONTEXT_MODES) == 0) + psp->contextModes = (__DRIcontextModesExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_GET_DRAWABLE_INFO) == 0) + psp->getDrawableInfo = (__DRIgetDrawableInfoExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_DAMAGE) == 0) + psp->damage = (__DRIdamageExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_SYSTEM_TIME) == 0) + psp->systemTime = (__DRIsystemTimeExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_CORE_DRI2) == 0) + psp->dri2.core = (__DRIcoreDRI2Extension *) extensions[i]; + } +} + /** * This is the bootstrap function for the driver. libGL supplies all of the * requisite information about the system, and the driver initializes itself. @@ -805,15 +801,12 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, + const __DRIextension ** extensions, __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; static const __DRIextension *emptyExtensionList[] = { NULL }; - dri_interface = interface; - api_ver = internal_api_version; psp = _mesa_malloc(sizeof(*psp)); if (!psp) @@ -821,6 +814,8 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psp->psc = psc; + setupLoaderExtensions(psp, extensions); + /* ** NOT_DONE: This is used by the X server to detect when the client ** has died while holding the drawable lock. The client sets the @@ -873,12 +868,11 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, PUBLIC void * __DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, int fd, unsigned int sarea_handle, - const __DRIinterfaceMethods *interface, + const __DRIextension **extensions, __GLcontextModes **driver_modes) { __DRIscreenPrivate *psp; static const __DRIextension *emptyExtensionList[] = { NULL }; - dri_interface = interface; unsigned int *p; drmVersionPtr version; __GLcontextModes *(*initScreen)(__DRIscreenPrivate *psc); @@ -891,6 +885,8 @@ __DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, if (!psp) return NULL; + setupLoaderExtensions(psp, extensions); + psp->psc = psc; version = drmGetVersion(fd); @@ -950,33 +946,6 @@ __DRI2_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, return psp; } -/** - * Compare the current GLX API version with a driver supplied required version. - * - * The minimum required version is compared with the API version exported by - * the \c __glXGetInternalVersion function (in libGL.so). - * - * \param required_version Minimum required internal GLX API version. - * \return A tri-value return, as from strcmp is returned. A value less - * than, equal to, or greater than zero will be returned if the - * internal GLX API version is less than, equal to, or greater - * than \c required_version. - * - * \sa __glXGetInternalVersion(). - */ -int driCompareGLXAPIVersion( GLint required_version ) -{ - if ( api_ver > required_version ) { - return 1; - } - else if ( api_ver == required_version ) { - return 0; - } - - return -1; -} - - static int driFrameTracking(__DRIdrawable *drawable, GLboolean enable) { @@ -992,7 +961,7 @@ driQueryFrameTracking(__DRIdrawable *drawable, int status; int64_t ust; __DRIdrawablePrivate * dpriv = drawable->private; - + __DRIscreenPrivate *psp = dpriv->driScreenPriv; status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo ); if ( status == 0 ) { @@ -1000,7 +969,7 @@ driQueryFrameTracking(__DRIdrawable *drawable, *missedFrames = sInfo.swap_missed_count; *lastMissedUsage = sInfo.swap_missed_usage; - (*dri_interface->getUST)( & ust ); + (*psp->systemTime->getUST)( & ust ); *usage = driCalculateSwapUsage( dpriv, sInfo.swap_ust, ust ); } @@ -1049,9 +1018,9 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, int32_t d; int interval; float usage = 1.0; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; - - if ( (*dri_interface->getMSCRate)(dPriv->pdraw, &n, &d) ) { + if ( (*psp->systemTime->getMSCRate)(dPriv->pdraw, &n, &d) ) { interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index cb9e8909b7e..e6659811d75 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -517,6 +517,12 @@ struct __DRIscreenPrivateRec { */ const __DRIextension **extensions; + /* Extensions provided by the loader. */ + const __DRIcontextModesExtension *contextModes; + const __DRIgetDrawableInfoExtension *getDrawableInfo; + const __DRIsystemTimeExtension *systemTime; + const __DRIdamageExtension *damage; + struct { /* Flag to indicate that this is a DRI2 screen. Many of the above * fields will not be valid or initializaed in that case. */ @@ -525,6 +531,7 @@ struct __DRIscreenPrivateRec { void *sarea; __DRIEventBuffer *buffer; __DRILock *lock; + __DRIcoreDRI2Extension *core; } dri2; /* The lock actually in use, old sarea or DRI2 */ @@ -554,27 +561,8 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp); extern int __driParseEvents(__DRIscreenPrivate *psp, __DRIdrawablePrivate *pdp); -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, - const struct __DriverAPIRec *driverAPI ); - -/* Test the version of the internal GLX API. Returns a value like strcmp. */ -extern int -driCompareGLXAPIVersion( GLint required_version ); - extern float driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, int64_t current_ust ); -/** - * Pointer to the \c __DRIinterfaceMethods passed to the driver by the loader. - * - * This pointer is set in the driver's \c __driCreateNewScreen function and - * is defined in dri_util.c. - */ -extern const __DRIinterfaceMethods * dri_interface; - #endif /* _DRI_UTIL_H_ */ diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index a6d7590eff7..16efd33368e 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -657,8 +657,9 @@ struct DRIDriverRec __driDriver = { }; static __GLcontextModes * -fbFillInModes( unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer ) +fbFillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; __GLcontextModes * m; @@ -705,7 +706,7 @@ fbFillInModes( unsigned pixel_bits, unsigned depth_bits, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; if ( ! driFillInModes( & m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, @@ -776,7 +777,7 @@ void * __driCreateNewScreen( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc frame_buffer, pSAREA, fd, internal_api_version, &fbAPI); if ( psp != NULL ) { - *driver_modes = fbFillInModes( psp->fbBPP, + *driver_modes = fbFillInModes( psp, psp->fbBPP, (psp->fbBPP == 16) ? 16 : 24, (psp->fbBPP == 16) ? 0 : 8, 1); diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 0293a6185c3..d54c65cda43 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -622,8 +622,9 @@ static const struct __DriverAPIRec ffbAPI = { static __GLcontextModes * -ffbFillInModes( unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer ) +ffbFillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; __GLcontextModes * m; @@ -670,7 +671,7 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; if ( ! driFillInModes( & m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, @@ -726,5 +727,5 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!ffbInitDriver(psp)) return NULL; - return ffbFillInModes( 32, 16, 0, GL_TRUE ); + return ffbFillInModes( psp, 32, 16, 0, GL_TRUE ); } diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index a0d8103dc1c..c5c2a0d6fb3 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -122,7 +122,8 @@ static __GLcontextModes *fill_in_modes( __GLcontextModes *modes, static __GLcontextModes * -i810FillInModes( unsigned pixel_bits, unsigned depth_bits, +i810FillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; __GLcontextModes * m; @@ -158,7 +159,7 @@ i810FillInModes( unsigned pixel_bits, unsigned depth_bits, num_modes = depth_buffer_factor * back_buffer_factor * 4; - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; for ( i = 0 ; i < depth_buffer_factor ; i++ ) { m = fill_in_modes( m, pixel_bits, @@ -445,5 +446,5 @@ PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!i810InitDriver(psp)) return NULL; - return i810FillInModes(16, 16, 0, 1); + return i810FillInModes(psp, 16, 16, 0, 1); } diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 8f59eb5c2bf..5199f833e2c 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -812,6 +812,8 @@ intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target) void intelSwapBuffers(__DRIdrawablePrivate * dPriv) { + __DRIscreenPrivate *psp = dPriv->driScreenPriv; + if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { GET_CURRENT_CONTEXT(ctx); struct intel_context *intel; @@ -837,7 +839,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv) } intel_fb->swap_count++; - (*dri_interface->getUST) (&ust); + (*psp->systemTime->getUST) (&ust); if (missed_target) { intel_fb->swap_missed_count++; intel_fb->swap_missed_ust = ust - intel_fb->swap_ust; diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index e3622db5966..d3f0681807e 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -746,6 +746,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, __DRIdrawablePrivate * driDrawPriv, __DRIdrawablePrivate * driReadPriv) { + __DRIscreenPrivate *psp = driDrawPriv->driScreenPriv; if (driContextPriv) { struct intel_context *intel = @@ -809,7 +810,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, ? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ; - (*dri_interface->getUST) (&intel_fb->swap_ust); + (*psp->systemTime->getUST) (&intel_fb->swap_ust); driDrawableInitVBlank(driDrawPriv); intel_fb->vbl_waited = driDrawPriv->vblSeq; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 7ac7240b56a..8b8eeb77aa3 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -676,7 +676,8 @@ static const struct __DriverAPIRec intelAPI = { static __GLcontextModes * -intelFillInModes(unsigned pixel_bits, unsigned depth_bits, +intelFillInModes(__DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer) { __GLcontextModes *modes; @@ -728,8 +729,8 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits, } modes = - (*dri_interface->createContextModes) (num_modes, - sizeof(__GLcontextModes)); + (*psp->contextModes->createContextModes) (num_modes, + sizeof(__GLcontextModes)); m = modes; if (!driFillInModes(&m, fb_format, fb_type, depth_bits_array, stencil_bits_array, @@ -802,7 +803,7 @@ PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!intelInitDriver(psp)) return NULL; - return intelFillInModes(dri_priv->cpp * 8, + return intelFillInModes(psp, dri_priv->cpp * 8, (dri_priv->cpp == 2) ? 16 : 24, (dri_priv->cpp == 2) ? 0 : 8, 1); } @@ -883,10 +884,10 @@ PUBLIC __GLcontextModes *__dri2DriverInitScreen(__DRIscreenPrivate *psp) psp->extensions = intelExtensions; - modes = intelFillInModes(16, 16, 0, 1); + modes = intelFillInModes(psp, 16, 16, 0, 1); for (m = modes; m->next != NULL; m = m->next) ; - m->next = intelFillInModes(32, 24, 8, 1); + m->next = intelFillInModes(psp, 32, 24, 8, 1); return modes; } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index e59cc914c8b..63b9d8077dc 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -136,8 +136,9 @@ static __GLcontextModes * fill_in_modes( __GLcontextModes * modes, static __GLcontextModes * -mach64FillInModes( unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer ) +mach64FillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; __GLcontextModes * m; @@ -173,7 +174,7 @@ mach64FillInModes( unsigned pixel_bits, unsigned depth_bits, num_modes = depth_buffer_factor * back_buffer_factor * 4; - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; for ( i = 0 ; i < depth_buffer_factor ; i++ ) { m = fill_in_modes( m, pixel_bits, @@ -527,5 +528,5 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!mach64InitDriver(psp)) return NULL; - return mach64FillInModes( dri_priv->cpp * 8, 16, 0, 1); + return mach64FillInModes( psp, 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 b0282e5f65b..7f2f71d3094 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -115,7 +115,8 @@ int MGA_DEBUG = 0; static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); static __GLcontextModes * -mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, +mgaFillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; @@ -163,7 +164,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; if ( ! driFillInModes( & m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, @@ -650,7 +651,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis, debug_control ); #endif - (*dri_interface->getUST)( & mmesa->swap_ust ); + (*sPriv->systemTime->getUST)( & mmesa->swap_ust ); if (driQueryOptionb(&mmesa->optionCache, "no_rast")) { fprintf(stderr, "disabling 3D acceleration\n"); @@ -998,7 +999,8 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!mgaInitDriver(psp)) return NULL; - return mgaFillInModes( dri_priv->cpp * 8, + return mgaFillInModes( psp, + 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/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index ff26b9475b9..dee93995566 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -417,7 +417,7 @@ void mgaCopyBuffer( __DRIdrawablePrivate *dPriv ) GLint ret; GLint i; GLboolean missed_target; - + __DRIscreenPrivate *psp = dPriv->driScreenPriv; assert(dPriv); assert(dPriv->driContextPriv); @@ -431,7 +431,7 @@ void mgaCopyBuffer( __DRIdrawablePrivate *dPriv ) driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { mmesa->swap_missed_count++; - (void) (*dri_interface->getUST)( & mmesa->swap_missed_ust ); + (void) (*psp->systemTime->getUST)( & mmesa->swap_missed_ust ); } LOCK_HARDWARE( mmesa ); @@ -469,7 +469,7 @@ void mgaCopyBuffer( __DRIdrawablePrivate *dPriv ) mmesa->dirty |= MGA_UPLOAD_CLIPRECTS; mmesa->swap_count++; - (void) (*dri_interface->getUST)( & mmesa->swap_ust ); + (void) (*psp->systemTime->getUST)( & mmesa->swap_ust ); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index f6274ac1f2b..9fe8e868704 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -214,8 +214,9 @@ static const struct __DriverAPIRec nouveauAPI = { static __GLcontextModes * -nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer ) +nouveauFillInModes( __DRIscreenPRiv *psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; __GLcontextModes * m; @@ -248,8 +249,8 @@ nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits, num_modes = ((pixel_bits==16) ? 1 : 2) * depth_buffer_factor * back_buffer_factor * 4; - modes = (*dri_interface->createContextModes)(num_modes, - sizeof(__GLcontextModes)); + modes = (*psp->contextModes->createContextModes)(num_modes, + sizeof(__GLcontextModes)); m = modes; for (i=((pixel_bits==16)?0:1);i<((pixel_bits==16)?1:3);i++) { @@ -342,7 +343,8 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!nouveauInitDriver(psp)) return NULL; - return nouveauFillInModes(dri_priv->bpp, + return nouveauFillInModes(psp, + 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 e24fb509278..335af974cff 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -419,7 +419,8 @@ static struct __DriverAPIRec r128API = { static __GLcontextModes * -r128FillInModes( unsigned pixel_bits, unsigned depth_bits, +r128FillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; @@ -467,7 +468,7 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_bits, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; if ( ! driFillInModes( & m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, @@ -535,7 +536,8 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!r128InitDriver(psp)) return NULL; - return r128FillInModes( dri_priv->bpp, + return r128FillInModes( psp, + 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/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 982bd9e62a8..20c11079476 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -502,7 +502,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, rmesa->prefer_gart_client_texturing = (getenv("R200_GART_CLIENT_TEXTURES") != 0); - (*dri_interface->getUST)( & rmesa->swap_ust ); + (*sPriv->systemTime->getUST)( & rmesa->swap_ust ); #if DO_DEBUG diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 34e7ada34b4..7008832965a 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -426,6 +426,7 @@ void r200CopyBuffer( __DRIdrawablePrivate *dPriv, GLint nbox, i, ret; GLboolean missed_target; int64_t ust; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; assert(dPriv); assert(dPriv->driContextPriv); @@ -501,7 +502,7 @@ void r200CopyBuffer( __DRIdrawablePrivate *dPriv, rmesa->hw.all_dirty = GL_TRUE; rmesa->swap_count++; - (*dri_interface->getUST)( & ust ); + (*psp->systemTime->getUST)( & ust ); if ( missed_target ) { rmesa->swap_missed_count++; rmesa->swap_missed_ust = ust - rmesa->swap_ust; @@ -518,6 +519,7 @@ void r200PageFlip( __DRIdrawablePrivate *dPriv ) r200ContextPtr rmesa; GLint ret; GLboolean missed_target; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; assert(dPriv); assert(dPriv->driContextPriv); @@ -556,7 +558,7 @@ void r200PageFlip( __DRIdrawablePrivate *dPriv ) driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { rmesa->swap_missed_count++; - (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust ); + (void) (*psp->systemTime->getUST)( & rmesa->swap_missed_ust ); } LOCK_HARDWARE( rmesa ); @@ -570,7 +572,7 @@ void r200PageFlip( __DRIdrawablePrivate *dPriv ) } rmesa->swap_count++; - (void) (*dri_interface->getUST)( & rmesa->swap_ust ); + (void) (*psp->systemTime->getUST)( & rmesa->swap_ust ); #if 000 if ( rmesa->sarea->pfCurrentPage == 1 ) { diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 787d4b5c57c..9c0a5868b5f 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -177,7 +177,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->do_usleeps ? "usleeps" : "busy waits", fthrottle_mode, radeon->radeonScreen->irq); - (*dri_interface->getUST) (&radeon->swap_ust); + (*sPriv->systemTime->getUST) (&radeon->swap_ust); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c index 866b1deaa05..31a000d5e66 100644 --- a/src/mesa/drivers/dri/r300/radeon_ioctl.c +++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c @@ -164,6 +164,7 @@ void radeonCopyBuffer(__DRIdrawablePrivate * dPriv, GLint nbox, i, ret; GLboolean missed_target; int64_t ust; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; assert(dPriv); assert(dPriv->driContextPriv); @@ -240,7 +241,7 @@ void radeonCopyBuffer(__DRIdrawablePrivate * dPriv, ((r300ContextPtr)radeon)->hw.all_dirty = GL_TRUE; radeon->swap_count++; - (*dri_interface->getUST) (&ust); + (*psp->systemTime->getUST) (&ust); if (missed_target) { radeon->swap_missed_count++; radeon->swap_missed_ust = ust - radeon->swap_ust; @@ -257,6 +258,7 @@ void radeonPageFlip(__DRIdrawablePrivate * dPriv) radeonContextPtr radeon; GLint ret; GLboolean missed_target; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; assert(dPriv); assert(dPriv->driContextPriv); @@ -295,7 +297,7 @@ void radeonPageFlip(__DRIdrawablePrivate * dPriv) driWaitForVBlank(dPriv, &missed_target); if (missed_target) { radeon->swap_missed_count++; - (void)(*dri_interface->getUST) (&radeon->swap_missed_ust); + (void)(*psp->systemTime->getUST) (&radeon->swap_missed_ust); } LOCK_HARDWARE(radeon); @@ -309,7 +311,7 @@ void radeonPageFlip(__DRIdrawablePrivate * dPriv) } radeon->swap_count++; - (void)(*dri_interface->getUST) (&radeon->swap_ust); + (void)(*psp->systemTime->getUST) (&radeon->swap_ust); driFlipRenderbuffers(radeon->glCtx->WinSysDrawBuffer, radeon->sarea->pfCurrentPage); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 18d9b0b65a5..7aa0e3eac8d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -424,7 +424,7 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); - (*dri_interface->getUST)( & rmesa->swap_ust ); + (*sPriv->systemTime->getUST)( & rmesa->swap_ust ); #if DO_DEBUG diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 2430158db2d..078ac9a29a2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -870,6 +870,7 @@ void radeonCopyBuffer( __DRIdrawablePrivate *dPriv, GLint nbox, i, ret; GLboolean missed_target; int64_t ust; + __DRIscreenPrivate *psp; assert(dPriv); assert(dPriv->driContextPriv); @@ -940,8 +941,9 @@ void radeonCopyBuffer( __DRIdrawablePrivate *dPriv, UNLOCK_HARDWARE( rmesa ); if (!rect) { + psp = dPriv->driScreenPriv; rmesa->swap_count++; - (*dri_interface->getUST)( & ust ); + (*psp->systemTime->getUST)( & ust ); if ( missed_target ) { rmesa->swap_missed_count++; rmesa->swap_missed_ust = ust - rmesa->swap_ust; @@ -957,12 +959,14 @@ void radeonPageFlip( __DRIdrawablePrivate *dPriv ) radeonContextPtr rmesa; GLint ret; GLboolean missed_target; + __DRIscreenPrivate *psp; assert(dPriv); assert(dPriv->driContextPriv); assert(dPriv->driContextPriv->driverPrivate); rmesa = (radeonContextPtr) dPriv->driContextPriv->driverPrivate; + psp = dPriv->driScreenPriv; if ( RADEON_DEBUG & DEBUG_IOCTL ) { fprintf(stderr, "%s: pfCurrentPage: %d\n", __FUNCTION__, @@ -990,7 +994,7 @@ void radeonPageFlip( __DRIdrawablePrivate *dPriv ) driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { rmesa->swap_missed_count++; - (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust ); + (void) (*psp->systemTime->getUST)( & rmesa->swap_missed_ust ); } LOCK_HARDWARE( rmesa ); @@ -1004,7 +1008,7 @@ void radeonPageFlip( __DRIdrawablePrivate *dPriv ) } rmesa->swap_count++; - (void) (*dri_interface->getUST)( & rmesa->swap_ust ); + (void) (*psp->systemTime->getUST)( & rmesa->swap_ust ); /* Get ready for drawing next frame. Update the renderbuffers' * flippedOffset/Pitch fields so we draw into the right place. diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 0b303b3c34a..93b239ae9f1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -253,8 +253,9 @@ radeonGetParam(int fd, int param, void *value) } static __GLcontextModes * -radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, - unsigned stencil_bits, GLboolean have_back_buffer ) +radeonFillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, + unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; __GLcontextModes * m; @@ -301,7 +302,7 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; if ( ! driFillInModes( & m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, @@ -1082,7 +1083,8 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!radeonInitDriver(psp)) return NULL; - return radeonFillInModes( dri_priv->bpp, + return radeonFillInModes( psp, + 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/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index f23409fcbc9..0773fa893a4 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -930,7 +930,8 @@ static const struct __DriverAPIRec savageAPI = { static __GLcontextModes * -savageFillInModes( unsigned pixel_bits, unsigned depth_bits, +savageFillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; @@ -981,7 +982,7 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_bits, fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; if ( ! driFillInModes( & m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, @@ -1050,7 +1051,8 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!savageInitDriver(psp)) return NULL; - return savageFillInModes( dri_priv->cpp*8, + return savageFillInModes( psp, + 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 d361d14e62e..ad2fe51e448 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -66,7 +66,7 @@ static const GLuint __driNConfigOptions = 3; extern const struct dri_extension card_extensions[]; static __GLcontextModes * -sisFillInModes(int bpp) +sisFillInModes(__DRIscreenPrivate *psp, int bpp) { __GLcontextModes *modes; __GLcontextModes *m; @@ -104,7 +104,7 @@ sisFillInModes(int bpp) fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*dri_interface->createContextModes)(num_modes, sizeof(__GLcontextModes)); + modes = (*psp->contextModes->createContextModes)(num_modes, sizeof(__GLcontextModes)); m = modes; if (!driFillInModes(&m, fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, @@ -359,5 +359,5 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!sisInitDriver(psp)) return NULL; - return sisFillInModes(dri_priv->bytesPerPixel * 8); + return sisFillInModes(psp, 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 53c04e7bb14..9c7ded0180f 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -361,7 +361,8 @@ static const struct __DriverAPIRec tdfxAPI = { }; -static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, +static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp, + unsigned pixel_bits, unsigned depth_bits, unsigned stencil_bits, GLboolean have_back_buffer) @@ -381,7 +382,7 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, num_modes = (depth_bits == 16) ? 32 : 16; - modes = (*dri_interface->createContextModes)(num_modes, sizeof(__GLcontextModes)); + modes = (*psp->contextModes->createContextModes)(num_modes, sizeof(__GLcontextModes)); m = modes; for (i = 0; i <= 1; i++) { @@ -473,7 +474,8 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!tdfxInitDriver(psp)) return NULL; - return tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24, + return tdfxFillInModes(psp, + bpp, (bpp == 16) ? 16 : 24, (bpp == 16) ? 0 : 8, (dri_priv->backOffset!=dri_priv->depthOffset)); } diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index a06b65224d1..bbb198bf0e8 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -661,7 +661,7 @@ viaCreateContext(const __GLcontextModes *visual, if (getenv("VIA_PAGEFLIP")) vmesa->allowPageFlip = 1; - (*dri_interface->getUST)( &vmesa->swap_ust ); + (*sPriv->systemTime->getUST)( &vmesa->swap_ust ); vmesa->regMMIOBase = (GLuint *)((unsigned long)viaScreen->reg); diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index a14a4613d3e..482a1a63d70 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -512,6 +512,7 @@ static void viaWaitIdleVBlank( __DRIdrawablePrivate *dPriv, GLuint value ) { GLboolean missed_target; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; VIA_FLUSH_DMA(vmesa); @@ -526,7 +527,7 @@ static void viaWaitIdleVBlank( __DRIdrawablePrivate *dPriv, driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { vmesa->swap_missed_count++; - (*dri_interface->getUST)( &vmesa->swap_missed_ust ); + (*psp->systemTime->getUST)( &vmesa->swap_missed_ust ); } } while (!viaCheckBreadcrumb(vmesa, value)); @@ -594,6 +595,7 @@ void viaCopyBuffer(__DRIdrawablePrivate *dPriv) { struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; if (VIA_DEBUG & DEBUG_IOCTL) fprintf(stderr, @@ -629,7 +631,7 @@ void viaCopyBuffer(__DRIdrawablePrivate *dPriv) viaEmitBreadcrumbLocked(vmesa); UNLOCK_HARDWARE(vmesa); - (*dri_interface->getUST)( &vmesa->swap_ust ); + (*psp->systemTime->getUST)( &vmesa->swap_ust ); } @@ -638,6 +640,7 @@ void viaPageFlip(__DRIdrawablePrivate *dPriv) struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; struct via_renderbuffer buffer_tmp; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; VIA_FLUSH_DMA(vmesa); if (dPriv->vblFlags == VBLANK_FLAG_SYNC && @@ -653,7 +656,7 @@ void viaPageFlip(__DRIdrawablePrivate *dPriv) viaEmitBreadcrumbLocked(vmesa); UNLOCK_HARDWARE(vmesa); - (*dri_interface->getUST)( &vmesa->swap_ust ); + (*psp->systemTime->getUST)( &vmesa->swap_ust ); /* KW: FIXME: When buffers are freed, could free frontbuffer by diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index e6cc99eb86a..faf6505bfd9 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -341,7 +341,8 @@ static struct __DriverAPIRec viaAPI = { static __GLcontextModes * -viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) +viaFillInModes( __DRIscreenPrivate *psp, + unsigned pixel_bits, GLboolean have_back_buffer ) { __GLcontextModes * modes; __GLcontextModes * m; @@ -378,7 +379,7 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } - modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); + modes = (*psp->contextModes->createContextModes)( num_modes, sizeof( __GLcontextModes ) ); m = modes; if ( ! driFillInModes( & m, fb_format, fb_type, depth_bits_array, stencil_bits_array, @@ -444,7 +445,7 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) if (!viaInitDriver(psp)) return NULL; - return viaFillInModes( dri_priv->bytesPerPixel * 8, GL_TRUE ); + return viaFillInModes( psp, dri_priv->bytesPerPixel * 8, GL_TRUE ); } -- cgit v1.2.3