summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-03-23 15:36:52 -0400
committerAdam Jackson <ajax@redhat.com>2016-03-30 11:13:57 -0400
commite21de4bf3c5ff8cbb9c5ea023d04162e5e56b3df (patch)
treeda6a80c8f8f0419c9dbf3016e9713f7bff848780 /glx
parent23cce73221c0b96e7778da34616f8c3f4d6aa819 (diff)
glx: Move glx_enable_bits up to the GLX screen base class
Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxdri2.c25
-rw-r--r--glx/glxdriswrast.c19
-rw-r--r--glx/glxscreens.h3
3 files changed, 25 insertions, 22 deletions
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index ad97eb5f0..fa93da1ea 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -75,8 +75,6 @@ struct __GLXDRIscreen {
const __DRIswapControlExtension *swapControl;
const __DRItexBufferExtension *texBuffer;
const __DRIconfig **driConfigs;
-
- unsigned char glx_enable_bits[__GLX_EXT_BYTES];
};
struct __GLXDRIcontext {
@@ -847,18 +845,19 @@ glxDRILeaveVT(ScrnInfoPtr scrn)
* @param screen The screen where glx_enable_bits are to be set.
*/
static void
-initializeExtensions(__GLXDRIscreen * screen)
+initializeExtensions(__GLXscreen * screen)
{
- ScreenPtr pScreen = screen->base.pScreen;
+ ScreenPtr pScreen = screen->pScreen;
+ __GLXDRIscreen *dri = (__GLXDRIscreen *)screen;
const __DRIextension **extensions;
int i;
- extensions = screen->core->getExtensions(screen->driScreen);
+ extensions = dri->core->getExtensions(dri->driScreen);
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
- if (screen->dri2->base.version >= 3) {
+ if (dri->dri2->base.version >= 3) {
__glXEnableExtension(screen->glx_enable_bits,
"GLX_ARB_create_context");
__glXEnableExtension(screen->glx_enable_bits,
@@ -901,7 +900,7 @@ initializeExtensions(__GLXDRIscreen * screen)
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
- screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
+ dri->texBuffer = (const __DRItexBufferExtension *) extensions[i];
__glXEnableExtension(screen->glx_enable_bits,
"GLX_EXT_texture_from_pixmap");
LogMessage(X_INFO,
@@ -910,11 +909,11 @@ initializeExtensions(__GLXDRIscreen * screen)
if (strcmp(extensions[i]->name, __DRI2_FLUSH) == 0 &&
extensions[i]->version >= 3) {
- screen->flush = (__DRI2flushExtension *) extensions[i];
+ dri->flush = (__DRI2flushExtension *) extensions[i];
}
if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0 &&
- screen->dri2->base.version >= 3) {
+ dri->dri2->base.version >= 3) {
__glXEnableExtension(screen->glx_enable_bits,
"GLX_ARB_create_context_robustness");
LogMessage(X_INFO,
@@ -960,7 +959,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->base.swapInterval = __glXDRIdrawableSwapInterval;
screen->base.pScreen = pScreen;
- __glXInitExtensionEnableBits(screen->glx_enable_bits);
+ __glXInitExtensionEnableBits(screen->base.glx_enable_bits);
screen->driver =
glxProbeDriver(driverName, (void **) &screen->core, __DRI_CORE, 1,
@@ -980,7 +979,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
goto handle_error;
}
- initializeExtensions(screen);
+ initializeExtensions(&screen->base);
screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
GLX_WINDOW_BIT |
@@ -993,10 +992,10 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
* This allows us to allocate some memory to hold the extension string,
* but it requires that we call __glXGetExtensionString a second time.
*/
- buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
+ buffer_size = __glXGetExtensionString(screen->base.glx_enable_bits, NULL);
if (buffer_size > 0) {
screen->base.GLXextensions = xnfalloc(buffer_size);
- (void) __glXGetExtensionString(screen->glx_enable_bits,
+ (void) __glXGetExtensionString(screen->base.glx_enable_bits,
screen->base.GLXextensions);
}
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 65abdffd7..27c98ed3e 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -391,15 +391,16 @@ static const __DRIextension *loader_extensions[] = {
};
static void
-initializeExtensions(__GLXDRIscreen * screen)
+initializeExtensions(__GLXscreen * screen)
{
const __DRIextension **extensions;
+ __GLXDRIscreen *dri = (__GLXDRIscreen *)screen;
int i;
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
- if (screen->swrast->base.version >= 3) {
+ if (dri->swrast->base.version >= 3) {
__glXEnableExtension(screen->glx_enable_bits,
"GLX_ARB_create_context");
__glXEnableExtension(screen->glx_enable_bits,
@@ -415,16 +416,16 @@ initializeExtensions(__GLXDRIscreen * screen)
__glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_fbconfig_float");
__glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_fbconfig_packed_float");
- extensions = screen->core->getExtensions(screen->driScreen);
+ extensions = dri->core->getExtensions(dri->driScreen);
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) {
- screen->copySubBuffer =
+ dri->copySubBuffer =
(const __DRIcopySubBufferExtension *) extensions[i];
}
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0) {
- screen->texBuffer = (const __DRItexBufferExtension *) extensions[i];
+ dri->texBuffer = (const __DRItexBufferExtension *) extensions[i];
__glXEnableExtension(screen->glx_enable_bits,
"GLX_EXT_texture_from_pixmap\n");
}
@@ -459,7 +460,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
screen->base.swapInterval = NULL;
screen->base.pScreen = pScreen;
- __glXInitExtensionEnableBits(screen->glx_enable_bits);
+ __glXInitExtensionEnableBits(screen->base.glx_enable_bits);
screen->driver = glxProbeDriver(driverName,
(void **) &screen->core,
@@ -480,7 +481,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
goto handle_error;
}
- initializeExtensions(screen);
+ initializeExtensions(&screen->base);
screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
GLX_WINDOW_BIT |
@@ -493,10 +494,10 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
* This allows us to allocate some memory to hold the extension string,
* but it requires that we call __glXGetExtensionString a second time.
*/
- buffer_size = __glXGetExtensionString(screen->glx_enable_bits, NULL);
+ buffer_size = __glXGetExtensionString(screen->base.glx_enable_bits, NULL);
if (buffer_size > 0) {
screen->base.GLXextensions = xnfalloc(buffer_size);
- (void) __glXGetExtensionString(screen->glx_enable_bits,
+ (void) __glXGetExtensionString(screen->base.glx_enable_bits,
screen->base.GLXextensions);
}
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index 0fe85e69b..c63fb5684 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -35,6 +35,8 @@
* Silicon Graphics, Inc.
*/
+#include "extension_string.h"
+
typedef struct __GLXconfig __GLXconfig;
struct __GLXconfig {
__GLXconfig *next;
@@ -141,6 +143,7 @@ struct __GLXscreen {
char *GLextensions;
char *GLXextensions;
+ unsigned char glx_enable_bits[__GLX_EXT_BYTES];
Bool (*CloseScreen) (ScreenPtr pScreen);
};