Use __DRIextension mechanism providing loader functionality to the driver.
authorKristian Høgsberg <krh@redhat.com>
Thu, 28 Feb 2008 15:32:28 +0000 (10:32 -0500)
committerKristian Høgsberg <krh@redhat.com>
Fri, 29 Feb 2008 20:05:39 +0000 (15:05 -0500)
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.

28 files changed:
include/GL/internal/dri_interface.h
progs/xdemos/glxgears.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/fb/fb_dri.c
src/mesa/drivers/dri/ffb/ffb_xmesa.c
src/mesa/drivers/dri/i810/i810screen.c
src/mesa/drivers/dri/intel/intel_buffers.c
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/mach64/mach64_screen.c
src/mesa/drivers/dri/mga/mga_xmesa.c
src/mesa/drivers/dri/mga/mgaioctl.c
src/mesa/drivers/dri/nouveau/nouveau_screen.c
src/mesa/drivers/dri/r128/r128_screen.c
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/r200/r200_ioctl.c
src/mesa/drivers/dri/r300/radeon_context.c
src/mesa/drivers/dri/r300/radeon_ioctl.c
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/drivers/dri/radeon/radeon_ioctl.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/savage/savage_xmesa.c
src/mesa/drivers/dri/sis/sis_screen.c
src/mesa/drivers/dri/tdfx/tdfx_screen.c
src/mesa/drivers/dri/unichrome/via_context.c
src/mesa/drivers/dri/unichrome/via_ioctl.c
src/mesa/drivers/dri/unichrome/via_screen.c

index ed71e56..175ff2d 100644 (file)
@@ -55,7 +55,6 @@ typedef struct __DRIdrawableRec               __DRIdrawable;
 typedef struct __DRIdriverRec          __DRIdriver;
 typedef struct __DRIframebufferRec     __DRIframebuffer;
 typedef struct __DRIversionRec         __DRIversion;
-typedef struct __DRIinterfaceMethodsRec        __DRIinterfaceMethods;
 
 typedef struct __DRIextensionRec               __DRIextension;
 typedef struct __DRIcopySubBufferExtensionRec  __DRIcopySubBufferExtension;
@@ -244,13 +243,12 @@ struct __DRItexBufferExtensionRec {
  */
 /*@{*/
 
-#define __DRI_INTERFACE_VERSION 20070105
+#define __DRI_INTERFACE_VERSION 20080226
 
 typedef void *(CREATENEWSCREENFUNC)(int scr, __DRIscreen *psc,
     const __DRIversion * ddx_version, const __DRIversion * dri_version,
     const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer,
-    void * pSAREA, int fd, int internal_api_version,
-    const __DRIinterfaceMethods * interface,
+    void * pSAREA, int fd, const __DRIextension ** extensions,
     __GLcontextModes ** driver_modes);
 typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC;
 
@@ -267,7 +265,7 @@ extern CREATENEWSCREENFUNC __DRI_CREATE_NEW_SCREEN;
 
 typedef void *(__DRI2_CREATE_NEW_SCREEN_FUNC)(int scr, __DRIscreen *psc,
     int fd, unsigned int sarea_handle,
-    const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes);
+    const __DRIextension **extensions, __GLcontextModes ** driver_modes);
 #define __DRI2_CREATE_NEW_SCREEN \
     __DRI_MAKE_VERSION(__dri2CreateNewScreen, __DRI_INTERFACE_VERSION)
 
@@ -301,15 +299,35 @@ struct __DRIversionRec {
     int    patch;        /**< Patch-level. */
 };
 
+/**
+ * The following extensions describe loader features that the DRI
+ * driver can make use of.  Some of these are mandatory, such as the
+ * getDrawableInfo extension for DRI and the coreDRI2 extensions for
+ * DRI2, while others are optional, and if present allow the driver to
+ * expose certain features.  The loader pass in a NULL terminated
+ * array of these extensions to the driver in the createNewScreen
+ * constructor.
+ */
 
-typedef void (*__DRIfuncPtr)(void);
+typedef struct __DRIcontextModesExtensionRec __DRIcontextModesExtension;
+typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
+typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
+typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
+typedef struct __DRIcoreDRI2ExtensionRec __DRIcoreDRI2Extension;
+
+/**
+ * Memory management for __GLcontextModes
+ */
+#define __DRI_CONTEXT_MODES "DRI_ContextModes"
+#define __DRI_CONTEXT_MODES_VERSION 1
+struct __DRIcontextModesExtensionRec {
+    __DRIextension base;
 
-struct __DRIinterfaceMethodsRec {
     /**
      * Create a list of \c __GLcontextModes structures.
      */
     __GLcontextModes * (*createContextModes)(unsigned count,
-        size_t minimum_bytes_per_struct);
+                                            size_t minimum_bytes_per_struct);
 
     /**
      * Destroy a list of \c __GLcontextModes structures.
@@ -318,16 +336,16 @@ struct __DRIinterfaceMethodsRec {
      * Determine if the drivers actually need to call this.
      */
     void (*destroyContextModes)( __GLcontextModes * modes );
+};
 
 
-    /**
-     * \name Client/server protocol functions.
-     *
-     * These functions implement the DRI client/server protocol for
-     * context and drawable operations.  Platforms that do not implement
-     * the wire protocol (e.g., EGL) will implement glorified no-op functions.
-     */
-    /*@{*/
+/**
+ * Callback to getDrawableInfo protocol
+ */
+#define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
+#define __DRI_GET_DRAWABLE_INFO_VERSION 1
+struct __DRIgetDrawableInfoExtensionRec {
+    __DRIextension base;
 
     /**
      * This function is used to get information about the position, size, and
@@ -339,14 +357,17 @@ struct __DRIinterfaceMethodsRec {
         int * numClipRects, drm_clip_rect_t ** pClipRects,
         int * backX, int * backY,
         int * numBackClipRects, drm_clip_rect_t ** pBackClipRects );
-    /*@}*/
+};
 
+/**
+ * Callback to get system time for media stream counter extensions.
+ */
+#define __DRI_SYSTEM_TIME "DRI_SystemTime"
+#define __DRI_SYSTEM_TIME_VERSION 1
+struct __DRIsystemTimeExtensionRec {
+    __DRIextension base;
 
     /**
-     * \name Timing related functions.
-     */
-    /*@{*/
-    /**
      * Get the 64-bit unadjusted system time (UST).
      */
     int (*getUST)(int64_t * ust);
@@ -360,7 +381,15 @@ struct __DRIinterfaceMethodsRec {
      */
     GLboolean (*getMSCRate)(__DRIdrawable *draw,
                            int32_t * numerator, int32_t * denominator);
-    /*@}*/
+};
+
+/**
+ * Damage reporting
+ */
+#define __DRI_DAMAGE "DRI_Damage"
+#define __DRI_DAMAGE_VERSION 1
+struct __DRIdamageExtensionRec {
+    __DRIextension base;
 
     /**
      * Reports areas of the given drawable which have been modified by the
@@ -380,6 +409,15 @@ struct __DRIinterfaceMethodsRec {
                         int x, int y,
                         drm_clip_rect_t *rects, int num_rects,
                         GLboolean front_buffer);
+};
+
+/**
+ * DRI2 core
+ */
+#define __DRI_CORE_DRI2 "DRI_CoreDRI2"
+#define __DRI_CORE_DRI2_VERSION 1
+struct __DRIcoreDRI2ExtensionRec {
+    __DRIextension base;
 
     /**
      * Ping the windowing system to get it to reemit info for the
index ec431c1..f89d99f 100644 (file)
@@ -522,6 +522,7 @@ event_loop(Display *dpy, Window win)
 
          draw();
          glXSwapBuffers(dpy, win);
+        glFinish();
 
          frames++;
 
index b429a82..89c1a09 100644 (file)
 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;
 
 
index cb9e890..e665981 100644 (file)
@@ -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_ */
index a6d7590..16efd33 100644 (file)
@@ -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);
index 0293a61..d54c65c 100644 (file)
@@ -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 );
 }
index a0d8103..c5c2a0d 100644 (file)
@@ -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);
 }
index 8f59eb5..5199f83 100644 (file)
@@ -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;
index e3622db..d3f0681 100644 (file)
@@ -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;
 
index 7ac7240..8b8eeb7 100644 (file)
@@ -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;
 }
index e59cc91..63b9d80 100644 (file)
@@ -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);
 }
index b0282e5..7f2f71d 100644 (file)
@@ -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) );
index ff26b94..dee9399 100644 (file)
@@ -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 );
 }
 
 
index f6274ac..9fe8e86 100644 (file)
@@ -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);
index e24fb50..335af97 100644 (file)
@@ -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) );
index 982bd9e..20c1107 100644 (file)
@@ -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
index 34e7ada..7008832 100644 (file)
@@ -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 ) {
index 787d4b5..9c0a586 100644 (file)
@@ -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;
 }
index 866b1de..31a000d 100644 (file)
@@ -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);
index 18d9b0b..7aa0e3e 100644 (file)
@@ -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
index 2430158..078ac9a 100644 (file)
@@ -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.
index 0b303b3..93b239a 100644 (file)
@@ -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) );
index f23409f..0773fa8 100644 (file)
@@ -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) );
index d361d14..ad2fe51 100644 (file)
@@ -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);
 }
index 53c04e7..9c7ded0 100644 (file)
@@ -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));
 }
index a06b652..bbb198b 100644 (file)
@@ -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);
index a14a461..482a1a6 100644 (file)
@@ -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
index e6cc99e..faf6505 100644 (file)
@@ -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 );
 
 }