typedef struct __DRIdriverRec __DRIdriver;
typedef struct __DRIframebufferRec __DRIframebuffer;
typedef struct __DRIversionRec __DRIversion;
-typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods;
typedef struct __DRIextensionRec __DRIextension;
typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
*/
/*@{*/
-#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;
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)
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.
* 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
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).
*/
*/
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
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
draw();
glXSwapBuffers(dpy, win);
+ glFinish();
frames++;
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.
__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,
void
__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
{
- __DRIscreenPrivate *psp;
+ __DRIscreenPrivate *psp = pdp->driScreenPriv;
__DRIcontextPrivate *pcp = pdp->driContextPriv;
if (!pcp
*/
}
- 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;
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,
* 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);
}
static void driSwapBuffers(__DRIdrawable *drawable)
{
__DRIdrawablePrivate *dPriv = drawable->private;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
drm_clip_rect_t rect;
if (!dPriv->numClipRects)
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 */
* 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,
}
}
+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.
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)
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
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);
if (!psp)
return NULL;
+ setupLoaderExtensions(psp, extensions);
+
psp->psc = psc;
version = drmGetVersion(fd);
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)
{
int status;
int64_t ust;
__DRIdrawablePrivate * dpriv = drawable->private;
-
+ __DRIscreenPrivate *psp = dpriv->driScreenPriv;
status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo );
if ( status == 0 ) {
*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 );
}
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;
*/
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. */
void *sarea;
__DRIEventBuffer *buffer;
__DRILock *lock;
+ __DRIcoreDRI2Extension *core;
} dri2;
/* The lock actually in use, old sarea or DRI2 */
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_ */
};
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;
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,
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);
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;
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,
if (!ffbInitDriver(psp))
return NULL;
- return ffbFillInModes( 32, 16, 0, GL_TRUE );
+ return ffbFillInModes( psp, 32, 16, 0, GL_TRUE );
}
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;
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,
if (!i810InitDriver(psp))
return NULL;
- return i810FillInModes(16, 16, 0, 1);
+ return i810FillInModes(psp, 16, 16, 0, 1);
}
void
intelSwapBuffers(__DRIdrawablePrivate * dPriv)
{
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
+
if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) {
GET_CURRENT_CONTEXT(ctx);
struct intel_context *intel;
}
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;
__DRIdrawablePrivate * driDrawPriv,
__DRIdrawablePrivate * driReadPriv)
{
+ __DRIscreenPrivate *psp = driDrawPriv->driScreenPriv;
if (driContextPriv) {
struct intel_context *intel =
? 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;
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;
}
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,
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);
}
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;
}
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;
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,
if (!mach64InitDriver(psp))
return NULL;
- return mach64FillInModes( dri_priv->cpp * 8, 16, 0, 1);
+ return mach64FillInModes( psp, dri_priv->cpp * 8, 16, 0, 1);
}
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;
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,
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");
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) );
GLint ret;
GLint i;
GLboolean missed_target;
-
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
assert(dPriv);
assert(dPriv->driContextPriv);
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 );
mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
mmesa->swap_count++;
- (void) (*dri_interface->getUST)( & mmesa->swap_ust );
+ (void) (*psp->systemTime->getUST)( & mmesa->swap_ust );
}
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;
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++) {
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);
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;
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,
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) );
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
GLint nbox, i, ret;
GLboolean missed_target;
int64_t ust;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
assert(dPriv);
assert(dPriv->driContextPriv);
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;
r200ContextPtr rmesa;
GLint ret;
GLboolean missed_target;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
assert(dPriv);
assert(dPriv->driContextPriv);
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 );
}
rmesa->swap_count++;
- (void) (*dri_interface->getUST)( & rmesa->swap_ust );
+ (void) (*psp->systemTime->getUST)( & rmesa->swap_ust );
#if 000
if ( rmesa->sarea->pfCurrentPage == 1 ) {
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;
}
GLint nbox, i, ret;
GLboolean missed_target;
int64_t ust;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
assert(dPriv);
assert(dPriv->driContextPriv);
((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;
radeonContextPtr radeon;
GLint ret;
GLboolean missed_target;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
assert(dPriv);
assert(dPriv->driContextPriv);
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);
}
radeon->swap_count++;
- (void)(*dri_interface->getUST) (&radeon->swap_ust);
+ (void)(*psp->systemTime->getUST) (&radeon->swap_ust);
driFlipRenderbuffers(radeon->glCtx->WinSysDrawBuffer,
radeon->sarea->pfCurrentPage);
rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS);
- (*dri_interface->getUST)( & rmesa->swap_ust );
+ (*sPriv->systemTime->getUST)( & rmesa->swap_ust );
#if DO_DEBUG
GLint nbox, i, ret;
GLboolean missed_target;
int64_t ust;
+ __DRIscreenPrivate *psp;
assert(dPriv);
assert(dPriv->driContextPriv);
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;
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__,
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 );
}
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.
}
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;
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,
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) );
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;
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,
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) );
extern const struct dri_extension card_extensions[];
static __GLcontextModes *
-sisFillInModes(int bpp)
+sisFillInModes(__DRIscreenPrivate *psp, int bpp)
{
__GLcontextModes *modes;
__GLcontextModes *m;
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,
if (!sisInitDriver(psp))
return NULL;
- return sisFillInModes(dri_priv->bytesPerPixel * 8);
+ return sisFillInModes(psp, dri_priv->bytesPerPixel * 8);
}
};
-static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits,
+static __GLcontextModes *tdfxFillInModes(__DRIscreenPrivate *psp,
+ unsigned pixel_bits,
unsigned depth_bits,
unsigned stencil_bits,
GLboolean have_back_buffer)
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++) {
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));
}
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);
GLuint value )
{
GLboolean missed_target;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
VIA_FLUSH_DMA(vmesa);
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));
{
struct via_context *vmesa =
(struct via_context *)dPriv->driContextPriv->driverPrivate;
+ __DRIscreenPrivate *psp = dPriv->driScreenPriv;
if (VIA_DEBUG & DEBUG_IOCTL)
fprintf(stderr,
viaEmitBreadcrumbLocked(vmesa);
UNLOCK_HARDWARE(vmesa);
- (*dri_interface->getUST)( &vmesa->swap_ust );
+ (*psp->systemTime->getUST)( &vmesa->swap_ust );
}
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 &&
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
static __GLcontextModes *
-viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer )
+viaFillInModes( __DRIscreenPrivate *psp,
+ unsigned pixel_bits, GLboolean have_back_buffer )
{
__GLcontextModes * modes;
__GLcontextModes * m;
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,
if (!viaInitDriver(psp))
return NULL;
- return viaFillInModes( dri_priv->bytesPerPixel * 8, GL_TRUE );
+ return viaFillInModes( psp, dri_priv->bytesPerPixel * 8, GL_TRUE );
}