diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glx/x11/glxclient.h | 4 | ||||
-rw-r--r-- | src/glx/x11/glxcmds.c | 40 | ||||
-rw-r--r-- | src/glx/x11/glxext.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/dri_util.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/common/dri_util.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_screen.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mach64/mach64_screen.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mach64/mach64_screen.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mga/mga_xmesa.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_screen.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r128/r128_screen.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_screen.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_screen.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_screen.h | 2 |
16 files changed, 53 insertions, 45 deletions
diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index b60d8a0b904..d9fc7a5a6c3 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -489,6 +489,10 @@ struct __GLXscreenConfigsRec { __DRIallocateExtension *allocate; #endif +#ifdef __DRI_FRAME_TRACKING + __DRIframeTrackingExtension *frameTracking; +#endif + #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index e2deca59686..2b0403d37c9 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1835,15 +1835,13 @@ static int __glXGetSwapIntervalMESA(void) 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; @@ -1855,15 +1853,13 @@ static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable 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; @@ -1876,18 +1872,19 @@ static GLint __glXGetFrameUsageMESA(Display *dpy, GLXDrawable 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; @@ -1903,17 +1900,16 @@ static GLint __glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, 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; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 8275b4b9e07..8a70e677342 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1024,7 +1024,6 @@ static void queryExtensions(__GLXscreenConfigs *psc) psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; __glXScrEnableExtension(&psc->driScreen, "GLX_MESA_copy_sub_buffer"); - } #endif @@ -1035,7 +1034,6 @@ static void queryExtensions(__GLXscreenConfigs *psc) "GLX_SGI_swap_control"); __glXScrEnableExtension(&psc->driScreen, "GLX_MESA_swap_control"); - } #endif @@ -1046,7 +1044,14 @@ static void queryExtensions(__GLXscreenConfigs *psc) "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 diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ba677f6ff86..7815f361a83 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -52,11 +52,6 @@ static const int empty_attribute_list[1] = { None }; */ static int api_ver = 0; -/* forward declarations */ -static int driQueryFrameTracking( __DRIdrawable *drawable, - int64_t *sbc, int64_t *missedFrames, - float *lastMissedUsage, float *usage ); - static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, __DRIdrawable *pdraw, @@ -515,8 +510,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdraw->waitForSBC = driWaitForSBC; pdraw->waitForMSC = driWaitForMSC; pdraw->swapBuffersMSC = driSwapBuffersMSC; - pdraw->frameTracking = NULL; - pdraw->queryFrameTracking = driQueryFrameTracking; /* This special default value is replaced with the configured * default value when the drawable is first bound to a direct @@ -826,6 +819,12 @@ int driCompareGLXAPIVersion( GLint required_version ) static int +driFrameTracking(__DRIdrawable *drawable, GLboolean enable) +{ + return GLX_BAD_CONTEXT; +} + +static int driQueryFrameTracking(__DRIdrawable *drawable, int64_t * sbc, int64_t * missedFrames, float * lastMissedUsage, float * usage) @@ -849,6 +848,11 @@ driQueryFrameTracking(__DRIdrawable *drawable, return status; } +const __DRIframeTrackingExtension driFrameTrackingExtension = { + { __DRI_FRAME_TRACKING }, + driFrameTracking, + driQueryFrameTracking +}; /** * Calculate amount of swap interval used between GLX buffer swaps. diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 78320307d60..a7149bc5525 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -78,6 +78,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); */ extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; +extern const __DRIframeTrackingExtension driFrameTrackingExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 27bf5e12a20..041ff6bef08 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -430,6 +430,7 @@ static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, &intelAllocateExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -539,7 +540,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) if (glx_enable_extension != NULL) { (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); - (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index c75a86bf5b2..ed8d207a494 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -267,6 +267,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -359,7 +360,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) if (glx_enable_extension != NULL) { (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 46314b426f7..adbed098777 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -320,14 +320,13 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) mach64Screen->driScreen = sPriv; i = 0; + mach64Screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( mach64Screen->irq != 0 ) { mach64Screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } mach64Screen->extensions[i++] = NULL; sPriv->extensions = mach64Screen->extensions; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h index 36da7157707..732cb3f23ad 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.h +++ b/src/mesa/drivers/dri/mach64/mach64_screen.h @@ -74,7 +74,7 @@ typedef struct { driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } mach64ScreenRec, *mach64ScreenPtr; #endif /* __MACH64_SCREEN_H__ */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index eba96486f67..198c5d5ca95 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -195,6 +195,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, static const __DRIextension *mgaExtensions[] = { &driSwapControlExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -242,7 +243,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = mgaExtensions; if ( glx_enable_extension != NULL ) { - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 9e5c25d7207..c7bd8762831 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -227,13 +227,12 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen->driScreen = sPriv; i = 0; + r128Screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( r128Screen->irq != 0 ) { r128Screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } r128Screen->extensions[i++] = NULL; sPriv->extensions = r128Screen->extensions; diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 97339272742..75dc084d9d1 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -78,7 +78,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 362d70f9e57..4eaff652c7c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -744,6 +744,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) i = 0; screen->extensions[i++] = &driCopySubBufferExtension.base; + screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { @@ -751,7 +752,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 954096f6770..10012109179 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[4]; + const __DRIextension *extensions[5]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 153e401a165..025d8f63af4 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -176,6 +176,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv) viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset; i = 0; + viaScreen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( viaScreen->irqEnabled ) { viaScreen->extensions[i++] = &driSwapControlExtension.base; @@ -183,7 +184,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) } (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } viaScreen->extensions[i++] = NULL; sPriv->extensions = viaScreen->extensions; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 85f87c4da39..3dc52ba96a8 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -71,7 +71,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } viaScreenPrivate; |