typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
typedef struct __DRIallocateExtensionRec __DRIallocateExtension;
+typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension;
/*@}*/
GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer);
};
+/**
+ * Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
+ */
+#define __DRI_FRAME_TRACKING "DRI_FrameTracking"
+struct __DRIframeTrackingExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Enable or disable frame usage tracking.
+ *
+ * \since Internal API version 20030317.
+ */
+ int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
+
+ /**
+ * Retrieve frame usage information.
+ *
+ * \since Internal API version 20030317.
+ */
+ int (*queryFrameTracking)(__DRIdrawable *drawable,
+ int64_t * sbc, int64_t * missedFrames,
+ float * lastMissedUsage, float * usage);
+};
+
/**
* \name Functions provided by the driver loader.
*/
int64_t (*swapBuffersMSC)(__DRIdrawable *drawable,
int64_t target_msc,
int64_t divisor, int64_t remainder);
-
- /**
- * Enable or disable frame usage tracking.
- *
- * \since Internal API version 20030317.
- */
- int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
-
- /**
- * Retrieve frame usage information.
- *
- * \since Internal API version 20030317.
- */
- int (*queryFrameTracking)(__DRIdrawable *drawable,
- int64_t * sbc, int64_t * missedFrames,
- float * lastMissedUsage, float * usage);
};
#endif
__DRIallocateExtension *allocate;
#endif
+#ifdef __DRI_FRAME_TRACKING
+ __DRIframeTrackingExtension *frameTracking;
+#endif
+
#endif
/**
static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
{
int status = GLX_BAD_CONTEXT;
-#ifdef GLX_DIRECT_RENDERING
+#ifdef __DRI_FRAME_TRACKING
int screen;
__DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen);
__GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
- if ( (pdraw != NULL) && (pdraw->frameTracking != NULL)
- && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
- status = pdraw->frameTracking(pdraw, GL_TRUE);
- }
+ if (pdraw != NULL && psc->frameTracking != NULL)
+ status = psc->frameTracking->frameTracking(pdraw, GL_TRUE);
#else
(void) dpy;
(void) drawable;
static GLint __glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable)
{
int status = GLX_BAD_CONTEXT;
-#ifdef GLX_DIRECT_RENDERING
+#ifdef __DRI_FRAME_TRACKING
int screen;
__DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen);
__GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
- if ( (pdraw != NULL) && (pdraw->frameTracking != NULL)
- && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
- status = pdraw->frameTracking(pdraw, GL_FALSE);
- }
+ if (pdraw != NULL && psc->frameTracking != NULL)
+ status = psc->frameTracking->frameTracking(pdraw, GL_FALSE);
#else
(void) dpy;
(void) drawable;
GLfloat *usage)
{
int status = GLX_BAD_CONTEXT;
-#ifdef GLX_DIRECT_RENDERING
+#ifdef __DRI_FRAME_TRACKING
int screen;
__DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen);
__GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
- if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL)
- && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
- int64_t sbc, missedFrames;
- float lastMissedUsage;
+ if (pdraw != NULL && psc->frameTracking != NULL) {
+ int64_t sbc, missedFrames;
+ float lastMissedUsage;
- status = pdraw->queryFrameTracking(pdraw, &sbc, &missedFrames,
- &lastMissedUsage, usage);
+ status = psc->frameTracking->queryFrameTracking(pdraw, &sbc,
+ &missedFrames,
+ &lastMissedUsage,
+ usage);
}
#else
(void) dpy;
GLfloat *lastMissedUsage)
{
int status = GLX_BAD_CONTEXT;
-#ifdef GLX_DIRECT_RENDERING
+#ifdef __DRI_FRAME_TRACKING
int screen;
__DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen);
__GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen);
- if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL)
- && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) {
+ if (pdraw != NULL && psc->frameTracking != NULL) {
float usage;
- status = pdraw->queryFrameTracking(pdraw, sbc, missedFrames,
- lastMissedUsage, &usage);
+ status = psc->frameTracking->queryFrameTracking(pdraw, sbc, missedFrames,
+ lastMissedUsage, &usage);
}
#else
(void) dpy;
psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
__glXScrEnableExtension(&psc->driScreen,
"GLX_MESA_copy_sub_buffer");
-
}
#endif
"GLX_SGI_swap_control");
__glXScrEnableExtension(&psc->driScreen,
"GLX_MESA_swap_control");
-
}
#endif
"GLX_SGI_swap_control");
__glXScrEnableExtension(&psc->driScreen,
"GLX_MESA_swap_control");
-
+ }
+#endif
+
+#ifdef __DRI_FRAME_TRACKING
+ if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) {
+ psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i];
+ __glXScrEnableExtension(&psc->driScreen,
+ "GLX_MESA_swap_frame_usage");
}
#endif
*/
static int api_ver = 0;
-/* forward declarations */
-static int driQueryFrameTracking( __DRIdrawable *drawable,
- int64_t *sbc, int64_t *missedFrames,
- float *lastMissedUsage, float *usage );
-
static void *driCreateNewDrawable(__DRIscreen *screen,
const __GLcontextModes *modes,
__DRIdrawable *pdraw,
pdraw->waitForSBC = driWaitForSBC;
pdraw->waitForMSC = driWaitForMSC;
pdraw->swapBuffersMSC = driSwapBuffersMSC;
- pdraw->frameTracking = NULL;
- pdraw->queryFrameTracking = driQueryFrameTracking;
/* This special default value is replaced with the configured
* default value when the drawable is first bound to a direct
}
+static int
+driFrameTracking(__DRIdrawable *drawable, GLboolean enable)
+{
+ return GLX_BAD_CONTEXT;
+}
+
static int
driQueryFrameTracking(__DRIdrawable *drawable,
int64_t * sbc, int64_t * missedFrames,
return status;
}
+const __DRIframeTrackingExtension driFrameTrackingExtension = {
+ { __DRI_FRAME_TRACKING },
+ driFrameTracking,
+ driQueryFrameTracking
+};
/**
* Calculate amount of swap interval used between GLX buffer swaps.
*/
extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
extern const __DRIswapControlExtension driSwapControlExtension;
+extern const __DRIframeTrackingExtension driFrameTrackingExtension;
/**
* Used by DRI_VALIDATE_DRAWABLE_INFO
&driCopySubBufferExtension.base,
&driSwapControlExtension.base,
&intelAllocateExtension.base,
+ &driFrameTrackingExtension.base,
NULL
};
if (glx_enable_extension != NULL) {
(*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync");
- (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage");
(*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read");
}
static const __DRIextension *intelExtensions[] = {
&driCopySubBufferExtension.base,
&driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
NULL
};
if (glx_enable_extension != NULL) {
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
}
mach64Screen->driScreen = sPriv;
i = 0;
+ mach64Screen->extensions[i++] = &driFrameTrackingExtension.base;
if ( glx_enable_extension != NULL ) {
if ( mach64Screen->irq != 0 ) {
mach64Screen->extensions[i++] = &driSwapControlExtension.base;
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
}
-
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
}
mach64Screen->extensions[i++] = NULL;
sPriv->extensions = mach64Screen->extensions;
driOptionCache optionCache;
- const __DRIextension *extensions[2];
+ const __DRIextension *extensions[3];
} mach64ScreenRec, *mach64ScreenPtr;
#endif /* __MACH64_SCREEN_H__ */
static const __DRIextension *mgaExtensions[] = {
&driSwapControlExtension.base,
+ &driFrameTrackingExtension.base,
NULL
};
sPriv->extensions = mgaExtensions;
if ( glx_enable_extension != NULL ) {
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
}
r128Screen->driScreen = sPriv;
i = 0;
+ r128Screen->extensions[i++] = &driFrameTrackingExtension.base;
if ( glx_enable_extension != NULL ) {
if ( r128Screen->irq != 0 ) {
r128Screen->extensions[i++] = &driSwapControlExtension.base;
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
}
-
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
}
r128Screen->extensions[i++] = NULL;
sPriv->extensions = r128Screen->extensions;
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
- const __DRIextension *extensions[2];
+ const __DRIextension *extensions[3];
} r128ScreenRec, *r128ScreenPtr;
i = 0;
screen->extensions[i++] = &driCopySubBufferExtension.base;
+ screen->extensions[i++] = &driFrameTrackingExtension.base;
if ( glx_enable_extension != NULL ) {
if ( screen->irq != 0 ) {
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
}
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
}
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
- const __DRIextension *extensions[4];
+ const __DRIextension *extensions[5];
} radeonScreenRec, *radeonScreenPtr;
#define IS_R100_CLASS(screen) \
viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset;
i = 0;
+ viaScreen->extensions[i++] = &driFrameTrackingExtension.base;
if ( glx_enable_extension != NULL ) {
if ( viaScreen->irqEnabled ) {
viaScreen->extensions[i++] = &driSwapControlExtension.base;
}
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
}
viaScreen->extensions[i++] = NULL;
sPriv->extensions = viaScreen->extensions;
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
- const __DRIextension *extensions[2];
+ const __DRIextension *extensions[3];
} viaScreenPrivate;