summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2007-05-11 16:11:23 -0400
committerKristian Høgsberg <[email protected]>2007-10-10 18:00:13 -0400
commitaac367f48afc62176faf67aa6f329fbeae2004b4 (patch)
tree9afce18cf316c930ca764e27caeadb2b0fb2f0be
parentfa72013adaab4d0755e852805e2e44d1a879a204 (diff)
Remove screenConfigs from __DRIscreen.
The screenConfigs field of __DRIscreen points back to the containing __GLXscreenConfigs struct. This is a serious abstraction violation; it assumes that the loader is libGL and that there *is* a __GLXscreenConfigs type in the loader. Using the containerOf macro, we can get from the __DRIscreen pointer to the containing __GLXscreenConfigs struct, at a place in the stack where the above is a valid assumption. Besides, the __DRI* structs shouldn't hold state other than the private pointer.
-rw-r--r--include/GL/internal/dri_interface.h13
-rw-r--r--src/glx/x11/glxext.c1
-rw-r--r--src/glx/x11/glxextensions.c7
-rw-r--r--src/glx/x11/glxextensions.h9
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c11
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c13
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c9
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c11
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c9
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c15
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c3
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c3
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c11
13 files changed, 54 insertions, 61 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 9cb5920aa01..752dd417dcc 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -87,7 +87,8 @@ typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName);
* \c __DRIinterfaceMethods::getProcAddress. This function is used to enable
* a GLX extension on the specified screen.
*/
-typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name );
+typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) (__DRIscreen *screen,
+ const char *name);
/*@}*/
@@ -300,16 +301,6 @@ struct __DRIscreenRec {
int (*getMSC)( void *screenPrivate, int64_t *msc );
/**
- * Opaque pointer that points back to the containing
- * \c __GLXscreenConfigs. This data structure is shared with DRI drivers
- * but \c __GLXscreenConfigs is not. However, they are needed by some GLX
- * functions called by DRI drivers.
- *
- * \since Internal API version 20030813.
- */
- void *screenConfigs;
-
- /**
* Functions associated with MESA_allocate_memory.
*
* \since Internal API version 20030815.
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 85c990d4fc1..45b1dde91b6 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -1203,7 +1203,6 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv)
if (priv->driDisplay.createNewScreen &&
priv->driDisplay.createNewScreen[i]) {
- psc->driScreen.screenConfigs = (void *)psc;
psc->driScreen.private =
CallCreateNewScreen(dpy, i, psc,
& priv->driDisplay,
diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c
index 1d99b61db08..96964d1db10 100644
--- a/src/glx/x11/glxextensions.c
+++ b/src/glx/x11/glxextensions.c
@@ -356,6 +356,7 @@ __glXProcessServerString( const struct extension_info * ext,
}
}
+#ifdef GLX_DIRECT_RENDERING
/**
* Enable a named GLX extension on a given screen.
@@ -370,14 +371,18 @@ __glXProcessServerString( const struct extension_info * ext,
* \since Internal API version 20030813.
*/
void
-__glXScrEnableExtension( __GLXscreenConfigs *psc, const char * name )
+__glXScrEnableExtension( __DRIscreen *driScreen, const char * name )
{
+ __GLXscreenConfigs *psc =
+ containerOf(driScreen, __GLXscreenConfigs, driScreen);
+
__glXExtensionsCtr();
__glXExtensionsCtrScreen(psc);
set_glx_extension( known_glx_extensions, name, strlen( name ), GL_TRUE,
psc->direct_support );
}
+#endif
/**
* Initialize global extension support tables.
diff --git a/src/glx/x11/glxextensions.h b/src/glx/x11/glxextensions.h
index a4241b6b7f9..62bbf116e93 100644
--- a/src/glx/x11/glxextensions.h
+++ b/src/glx/x11/glxextensions.h
@@ -234,7 +234,14 @@ extern GLboolean __glXExtensionBitIsEnabled( struct __GLXscreenConfigsRec *psc,
extern const char * __glXGetClientExtensions( void );
extern void __glXCalculateUsableExtensions( struct __GLXscreenConfigsRec *psc,
GLboolean display_is_direct_capable, int server_minor_version );
-extern void __glXScrEnableExtension( struct __GLXscreenConfigsRec *psc, const char * name );
+
+#ifdef GLX_DIRECT_RENDERING
+
+struct __DRIscreenRec;
+extern void __glXScrEnableExtension( struct __DRIscreenRec *driScreen, const char * name );
+
+#endif
+
extern void __glXCalculateUsableGLExtensions( struct __GLXcontextRec * gc,
const char * server_string, int major_version, int minor_version );
extern void __glXGetGLVersion( int * major_version, int * minor_version );
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 7a11672a8f1..6ecde574b4f 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -430,7 +430,6 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->
getProcAddress("glxEnableExtension"));
- void *const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
fprintf(stderr,
@@ -524,11 +523,11 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
}
if (glx_enable_extension != NULL) {
- (*glx_enable_extension) (psc, "GLX_SGI_swap_control");
- (*glx_enable_extension) (psc, "GLX_SGI_video_sync");
- (*glx_enable_extension) (psc, "GLX_MESA_swap_control");
- (*glx_enable_extension) (psc, "GLX_MESA_swap_frame_usage");
- (*glx_enable_extension) (psc, "GLX_SGI_make_current_read");
+ (*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");
}
/* If we've got a new enough DDX that's initializing TTM and giving us
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 29ea07d78ef..97ccba09d82 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -271,7 +271,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
volatile drmI830Sarea *sarea;
if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
@@ -352,12 +351,12 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
}
if (glx_enable_extension != NULL) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
- (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" );
+ (*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" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" );
}
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index 52b96bf0bc0..733a16b6aef 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -210,7 +210,6 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(ATIDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n");
@@ -321,12 +320,12 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv )
if ( glx_enable_extension != NULL ) {
if ( mach64Screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
+ (*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)( psc, "GLX_MESA_swap_frame_usage" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
}
return mach64Screen;
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 372d2ce4339..5b9d09d0bf3 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -200,7 +200,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(MGADRIRec)) {
fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n");
@@ -236,11 +235,11 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
}
if ( glx_enable_extension != NULL ) {
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( 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" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" );
}
if (serverInfo->chipset != MGA_CARD_TYPE_G200 &&
diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c
index a84b54924ac..9df9c65faef 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -100,7 +100,6 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(R128DRIRec)) {
fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n");
@@ -228,12 +227,12 @@ r128CreateScreen( __DRIscreenPrivate *sPriv )
if ( glx_enable_extension != NULL ) {
if ( r128Screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
+ (*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)( psc, "GLX_MESA_swap_frame_usage" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
}
return r128Screen;
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 2d44532a843..8f9509de5b2 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -343,7 +343,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
unsigned char *RADEONMMIO;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n");
@@ -734,17 +733,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
if ( glx_enable_extension != NULL ) {
if ( screen->irq != 0 ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
+ (*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)( psc, "GLX_MESA_swap_frame_usage" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
if (IS_R200_CLASS(screen))
- (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_MESA_allocate_memory" );
- (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" );
- (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
}
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index e8a63ae51b9..9678c526aa0 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -266,8 +266,7 @@ savageInitDriver(__DRIscreenPrivate *sPriv)
__driConfigOptions, __driNConfigOptions);
if (glx_enable_extension != NULL) {
- (*glx_enable_extension)(sPriv->psc->screenConfigs,
- "GLX_SGI_make_current_read");
+ (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read");
}
#if 0
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index 899963d06d3..e9033c5ef3a 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -75,7 +75,6 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv )
TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void *const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n");
@@ -117,7 +116,7 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv )
}
if (glx_enable_extension != NULL) {
- (*glx_enable_extension)(psc, "GLX_SGI_make_current_read");
+ (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read");
}
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index c10b7d1a9b1..22e4bcebc91 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -100,7 +100,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
(PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
- void * const psc = sPriv->psc->screenConfigs;
if (sPriv->devPrivSize != sizeof(VIADRIRec)) {
fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n");
@@ -177,13 +176,13 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
if ( glx_enable_extension != NULL ) {
if ( viaScreen->irqEnabled ) {
- (*glx_enable_extension)( psc, "GLX_SGI_swap_control" );
- (*glx_enable_extension)( psc, "GLX_SGI_video_sync" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_control" );
+ (*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)( psc, "GLX_SGI_make_current_read" );
- (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
+ (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" );
}
return GL_TRUE;