summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@hinata.boston.redhat.com>2007-05-15 16:09:44 -0400
committerKristian Høgsberg <krh@redhat.com>2007-10-10 19:14:10 -0400
commitefaf90b03e8b69e04909bce071f8ef6b65cc0e9d (patch)
tree04ec5f1e1f7e6b96ee986763ee6b48d4de43b5f3 /src/mesa/drivers
parentac3e838fa748c8c8a6ffc04d1ab13da71f75f103 (diff)
Move swap_interval to new extension mechanism.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c28
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h7
-rw-r--r--src/mesa/drivers/dri/common/vblank.c10
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c3
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c8
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.h2
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c9
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c7
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.h2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c14
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.h2
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c7
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.h2
15 files changed, 76 insertions, 30 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index fc7755797d..ba677f6ff8 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -435,6 +435,27 @@ const __DRIcopySubBufferExtension driCopySubBufferExtension = {
{ __DRI_COPY_SUB_BUFFER }, driCopySubBuffer
};
+static void driSetSwapInterval(__DRIdrawable *drawable, unsigned int interval)
+{
+ __DRIdrawablePrivate *dpriv = drawable->private;
+
+ dpriv->swap_interval = interval;
+}
+
+static unsigned int driGetSwapInterval(__DRIdrawable *drawable)
+{
+ __DRIdrawablePrivate *dpriv = drawable->private;
+
+ return dpriv->swap_interval;
+}
+
+const __DRIswapControlExtension driSwapControlExtension = {
+ { __DRI_SWAP_CONTROL },
+ driSetSwapInterval,
+ driGetSwapInterval
+};
+
+
/**
* This is called via __DRIscreenRec's createNewDrawable pointer.
*/
@@ -501,7 +522,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen,
* default value when the drawable is first bound to a direct
* rendering context.
*/
- pdraw->swap_interval = (unsigned)-1;
+ pdp->swap_interval = (unsigned)-1;
pdp->swapBuffers = psp->DriverAPI.SwapBuffers;
@@ -716,7 +737,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc,
{
__DRIscreenPrivate *psp;
- static const __DRIextension emptyExtensionList[] = { NULL };
+ static const __DRIextension *emptyExtensionList[] = { NULL };
dri_interface = interface;
api_ver = internal_api_version;
@@ -868,8 +889,7 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust,
if ( (*dri_interface->getMSCRate)(dPriv->pdraw, &n, &d) ) {
- interval = (dPriv->pdraw->swap_interval != 0)
- ? dPriv->pdraw->swap_interval : 1;
+ interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1;
/* We want to calculate
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 59bb66d21b..78320307d6 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -77,6 +77,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp);
* Extensions.
*/
extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
+extern const __DRIswapControlExtension driSwapControlExtension;
/**
* Used by DRI_VALIDATE_DRAWABLE_INFO
@@ -327,6 +328,12 @@ struct __DRIdrawablePrivateRec {
* Called via glXSwapBuffers().
*/
void (*swapBuffers)( __DRIdrawablePrivate *dPriv );
+
+ /**
+ * Controls swap interval as used by GLX_SGI_swap_control and
+ * GLX_MESA_swap_control.
+ */
+ unsigned int swap_interval;
};
/**
diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c
index e7ed545f13..3b5acfecb1 100644
--- a/src/mesa/drivers/dri/common/vblank.c
+++ b/src/mesa/drivers/dri/common/vblank.c
@@ -255,13 +255,13 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd )
void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags,
GLuint *vbl_seq )
{
- if ( priv->pdraw->swap_interval == (unsigned)-1 ) {
+ if ( priv->swap_interval == (unsigned)-1 ) {
/* Get current vertical blank sequence */
drmVBlank vbl = { .request={ .type = DRM_VBLANK_RELATIVE, .sequence = 0 } };
do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd );
- priv->pdraw->swap_interval = (flags & (VBLANK_FLAG_THROTTLE |
- VBLANK_FLAG_SYNC)) != 0 ? 1 : 0;
+ priv->swap_interval = (flags & (VBLANK_FLAG_THROTTLE |
+ VBLANK_FLAG_SYNC)) != 0 ? 1 : 0;
}
}
@@ -277,9 +277,9 @@ driGetVBlankInterval( const __DRIdrawablePrivate *priv, GLuint flags )
if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) {
/* this must have been initialized when the drawable was first bound
* to a direct rendering context. */
- assert ( priv->pdraw->swap_interval != (unsigned)-1 );
+ assert ( priv->swap_interval != (unsigned)-1 );
- return priv->pdraw->swap_interval;
+ return priv->swap_interval;
}
else if ( (flags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) {
return 1;
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index 041a155fe7..d7af432ad6 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -613,7 +613,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
if (intel->ctx.DrawBuffer == &intel_fb->Base) {
if (intel->driDrawable != driDrawPriv) {
- if (driDrawPriv->pdraw->swap_interval == (unsigned)-1) {
+ if (driDrawPriv->swap_interval == (unsigned)-1) {
int i;
intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0)
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 792f26b5ed..f507a3bf05 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -421,6 +421,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen,
static const __DRIextension *intelExtensions[] = {
&driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
NULL
};
@@ -529,9 +530,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
sPriv->extensions = intelExtensions;
if (glx_enable_extension != NULL) {
- (*glx_enable_extension) (sPriv->psc, "GLX_SGI_swap_control");
(*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync");
- (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_control");
(*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 1f74103f65..c75a86bf5b 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -266,6 +266,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen,
static const __DRIextension *intelExtensions[] = {
&driCopySubBufferExtension.base,
+ &driSwapControlExtension.base,
NULL
};
@@ -357,9 +358,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
sPriv->extensions = intelExtensions;
if (glx_enable_extension != NULL) {
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
(*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 ff261c841d..46314b426f 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -210,6 +210,7 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+ int i;
if (sPriv->devPrivSize != sizeof(ATIDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n");
@@ -318,15 +319,18 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
mach64Screen->driScreen = sPriv;
+ i = 0;
if ( glx_enable_extension != NULL ) {
if ( mach64Screen->irq != 0 ) {
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+ mach64Screen->extensions[i++] = &driSwapControlExtension.base;
+
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
}
(*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
}
+ mach64Screen->extensions[i++] = NULL;
+ sPriv->extensions = mach64Screen->extensions;
return mach64Screen;
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h
index 5305058e2f..36da715770 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.h
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.h
@@ -73,6 +73,8 @@ typedef struct {
__DRIscreenPrivate *driScreen;
driOptionCache optionCache;
+
+ const __DRIextension *extensions[2];
} 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 5b4693983a..eba96486f6 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -193,6 +193,11 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits,
}
+static const __DRIextension *mgaExtensions[] = {
+ &driSwapControlExtension.base,
+ NULL
+};
+
static GLboolean
mgaInitDriver(__DRIscreenPrivate *sPriv)
{
@@ -234,11 +239,11 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
}
}
+ sPriv->extensions = mgaExtensions;
+
if ( glx_enable_extension != NULL ) {
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
(*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_swap_control" );
(*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 446280c399..9e5c25d720 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -100,6 +100,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+ int i;
if (sPriv->devPrivSize != sizeof(R128DRIRec)) {
fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n");
@@ -225,15 +226,17 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
r128Screen->driScreen = sPriv;
+ i = 0;
if ( glx_enable_extension != NULL ) {
if ( r128Screen->irq != 0 ) {
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+ r128Screen->extensions[i++] = &driSwapControlExtension.base;
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
}
(*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
}
+ r128Screen->extensions[i++] = NULL;
+ sPriv->extensions = r128Screen->extensions;
return r128Screen;
}
diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h
index 8db8eea358..9733927274 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.h
+++ b/src/mesa/drivers/dri/r128/r128_screen.h
@@ -78,6 +78,8 @@ typedef struct {
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
+ const __DRIextension *extensions[2];
+
} r128ScreenRec, *r128ScreenPtr;
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 7e533fef2c..46160babb0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -332,11 +332,6 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits,
return modes;
}
-static const __DRIextension *radeonExtensions[] = {
- &driCopySubBufferExtension.base,
- NULL
-};
-
/* Create the device specific screen private data struct.
*/
static radeonScreenPtr
@@ -347,6 +342,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
unsigned char *RADEONMMIO;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+ int i;
if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
@@ -735,13 +731,13 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
dri_priv->log2GARTTexGran;
}
- sPriv->extensions = radeonExtensions;
+ i = 0;
+ screen->extensions[i++] = &driCopySubBufferExtension.base;
if ( glx_enable_extension != NULL ) {
if ( screen->irq != 0 ) {
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+ screen->extensions[i++] = &driSwapControlExtension.base;
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
}
(*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
@@ -750,6 +746,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
}
+ screen->extensions[i++] = NULL;
+ sPriv->extensions = screen->extensions;
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
if (IS_R200_CLASS(screen)) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h
index 25e6fcf399..eceab53f5f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.h
@@ -103,6 +103,8 @@ typedef struct {
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
+
+ const __DRIextension *extensions[3];
} 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 53f4c5c564..153e401a16 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -100,6 +100,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
+ int i;
if (sPriv->devPrivSize != sizeof(VIADRIRec)) {
fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n");
@@ -174,16 +175,18 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset;
+ i = 0;
if ( glx_enable_extension != NULL ) {
if ( viaScreen->irqEnabled ) {
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+ viaScreen->extensions[i++] = &driSwapControlExtension.base;
(*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" );
}
(*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;
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h
index 84aa5aef88..85f87c4da3 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.h
+++ b/src/mesa/drivers/dri/unichrome/via_screen.h
@@ -70,6 +70,8 @@ typedef struct {
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
+
+ const __DRIextension *extensions[2];
} viaScreenPrivate;