summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2007-05-17 14:39:06 -0400
committerKristian Høgsberg <[email protected]>2007-10-11 11:22:55 -0400
commitf968f67e6214416f04b8875ce59a94a02f464c81 (patch)
treec7e3fd482e54a55b1e6b6545e79ea8d0d385613b
parent106a6f29bbdc71982afd629bdf89369cefd1459e (diff)
Add a DRI_ReadDrawable marker extension to signal read drawable capability.
-rw-r--r--include/GL/internal/dri_interface.h5
-rw-r--r--src/glx/x11/glxext.c7
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c8
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h1
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c9
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c6
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.c6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_screen.h2
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c11
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c10
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c6
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.h2
13 files changed, 39 insertions, 40 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 2c91876e0db..cce3b6fcf02 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -79,6 +79,11 @@ struct __DRIextensionRec {
};
/**
+ * Used by drivers to indicate support for setting the read drawable.
+ */
+#define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
+
+/**
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
*/
#define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c
index 643db487c58..3db163af1ee 100644
--- a/src/glx/x11/glxext.c
+++ b/src/glx/x11/glxext.c
@@ -1068,6 +1068,13 @@ static void queryExtensions(__GLXscreenConfigs *psc)
* not defined in dri_interface.h. Will enable
* GLX_OML_sync_control if implemented. */
#endif
+
+#ifdef __DRI_READ_DRAWABLE
+ if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
+ __glXScrEnableExtension(&psc->driScreen,
+ "GLX_SGI_make_current_read");
+ }
+#endif
/* Ignore unknown extensions */
}
}
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index e20c4fe5fac..b88592313ed 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -47,6 +47,14 @@ 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.
+ */
+const __DRIextension driReadDrawableExtension = {
+ __DRI_READ_DRAWABLE
+};
+
+/**
* Cached copy of the internal API version used by libGL and the client-side
* DRI driver.
*/
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index e43a5b752e8..91992a9a242 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -76,6 +76,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp);
/**
* Extensions.
*/
+extern const __DRIextension driReadDrawableExtension;
extern const __DRIcopySubBufferExtension driCopySubBufferExtension;
extern const __DRIswapControlExtension driSwapControlExtension;
extern const __DRIframeTrackingExtension driFrameTrackingExtension;
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 60d375874df..191d26e84bd 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -427,6 +427,7 @@ static const __DRIallocateExtension intelAllocateExtension = {
};
static const __DRIextension *intelExtensions[] = {
+ &driReadDrawableExtension,
&driCopySubBufferExtension.base,
&driSwapControlExtension.base,
&intelAllocateExtension.base,
@@ -442,10 +443,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv;
drmI830Sarea *sarea;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->
- getProcAddress("glxEnableExtension"));
-
if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
fprintf(stderr,
"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n");
@@ -539,10 +536,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
sPriv->extensions = intelExtensions;
- if (glx_enable_extension != NULL) {
- (*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
* object handles for the shared buffers, use that.
*/
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index a4d63599e55..e35f7da9387 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -265,6 +265,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen,
}
static const __DRIextension *intelExtensions[] = {
+ &driReadDrawableExtension,
&driCopySubBufferExtension.base,
&driSwapControlExtension.base,
&driFrameTrackingExtension.base,
@@ -276,8 +277,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
{
intelScreenPrivate *intelScreen;
I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
volatile drmI830Sarea *sarea;
if (sPriv->devPrivSize != sizeof(I830DRIRec)) {
@@ -358,9 +357,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv)
}
sPriv->extensions = intelExtensions;
-
- if (glx_enable_extension != NULL)
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 6f138351ccd..99a2ea04911 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -194,6 +194,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits,
static const __DRIextension *mgaExtensions[] = {
+ &driReadDrawableExtension,
&driSwapControlExtension.base,
&driFrameTrackingExtension.base,
&driMediaStreamCounterExtension.base,
@@ -205,8 +206,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
{
mgaScreenPrivate *mgaScreen;
MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
if (sPriv->devPrivSize != sizeof(MGADRIRec)) {
fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n");
@@ -243,9 +242,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv)
sPriv->extensions = mgaExtensions;
- if ( glx_enable_extension != NULL )
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
-
if (serverInfo->chipset != MGA_CARD_TYPE_G200 &&
serverInfo->chipset != MGA_CARD_TYPE_G400) {
FREE(mgaScreen);
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 56493f5a3aa..269620cec47 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -351,8 +351,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
radeonScreenPtr screen;
RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv;
unsigned char *RADEONMMIO;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
int i;
if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) {
@@ -745,12 +743,12 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
i = 0;
screen->extensions[i++] = &driCopySubBufferExtension.base;
screen->extensions[i++] = &driFrameTrackingExtension.base;
+ screen->extensions[i++] = &driReadDrawableExtension;
+
if ( screen->irq != 0 ) {
screen->extensions[i++] = &driSwapControlExtension.base;
screen->extensions[i++] = &driMediaStreamCounterExtension.base;
}
- if ( glx_enable_extension != NULL )
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
#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 0caac17dafb..68755c985a6 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[6];
+ const __DRIextension *extensions[7];
} radeonScreenRec, *radeonScreenPtr;
#define IS_R100_CLASS(screen) \
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 3750c8948ac..013e88216fa 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -168,6 +168,10 @@ static const struct tnl_pipeline_stage *savage_pipeline[] = {
};
+static const __DRIextension *savageExtensions[] = {
+ &driReadDrawableExtension,
+};
+
/* this is first function called in dirver*/
static GLboolean
@@ -175,9 +179,6 @@ savageInitDriver(__DRIscreenPrivate *sPriv)
{
savageScreenPrivate *savageScreen;
SAVAGEDRIPtr gDRIPriv = (SAVAGEDRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
-
if (sPriv->devPrivSize != sizeof(SAVAGEDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(SAVAGEDRIRec) does not match passed size from device driver\n");
@@ -265,9 +266,7 @@ savageInitDriver(__DRIscreenPrivate *sPriv)
driParseOptionInfo (&savageScreen->optionCache,
__driConfigOptions, __driNConfigOptions);
- if (glx_enable_extension != NULL) {
- (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read");
- }
+ sPriv->extensions = savageExtensions;
#if 0
savageDDFastPathInit();
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index 081a5340357..5bdb446d155 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -63,6 +63,10 @@ DRI_CONF_BEGIN
DRI_CONF_SECTION_END
DRI_CONF_END;
+static const __DRIextension *tdfxExtensions[] = {
+ &driReadDrawableExtension,
+};
+
static const GLuint __driNConfigOptions = 1;
extern const struct dri_extension card_extensions[];
@@ -73,8 +77,6 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv )
{
tdfxScreenPrivate *fxScreen;
TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) {
fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n");
@@ -115,9 +117,7 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv )
return GL_FALSE;
}
- if (glx_enable_extension != NULL) {
- (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read");
- }
+ sPriv->extensions = tdfxExtensions;
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index fddf0799346..f3912ac3521 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -98,8 +98,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
{
viaScreenPrivate *viaScreen;
VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv;
- PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension =
- (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension"));
int i;
if (sPriv->devPrivSize != sizeof(VIADRIRec)) {
@@ -177,14 +175,12 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
i = 0;
viaScreen->extensions[i++] = &driFrameTrackingExtension.base;
+ viaScreen->extensions[i++] = &driReadDrawableExtension;
if ( viaScreen->irqEnabled ) {
viaScreen->extensions[i++] = &driSwapControlExtension.base;
viaScreen->extensions[i++] = &driMediaStreamCounterExtension.base;
}
- if ( glx_enable_extension != NULL )
- (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" );
-
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 5e5bc851b05..c3ef722ff07 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[4];
+ const __DRIextension *extensions[5];
} viaScreenPrivate;