summaryrefslogtreecommitdiff
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
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>
-rw-r--r--glx/glxdri2.c25
-rw-r--r--glx/glxdriswrast.c19
-rw-r--r--glx/glxscreens.h3
-rw-r--r--hw/xquartz/GL/indirect.c13
-rw-r--r--hw/xwin/glx/indirect.c15
5 files changed, 36 insertions, 39 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);
};
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index f857325a5..9eaeb9441 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -112,9 +112,6 @@ typedef struct __GLXAquaDrawable __GLXAquaDrawable;
*/
struct __GLXAquaScreen {
__GLXscreen base;
-
- /* Supported GLX extensions */
- unsigned char glx_enable_bits[__GLX_EXT_BYTES];
};
struct __GLXAquaContext {
@@ -542,19 +539,19 @@ __glXAquaScreenProbe(ScreenPtr pScreen)
screen->base.fbconfigs = __glXAquaCreateVisualConfigs(
&screen->base.numFBConfigs, pScreen->myNum);
- __glXInitExtensionEnableBits(screen->glx_enable_bits);
+ __glXInitExtensionEnableBits(screen->base.glx_enable_bits);
__glXScreenInit(&screen->base, pScreen);
- //__glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context");
- //__glXEnableExtension(screen->glx_enable_bits, "GLX_ARB_create_context_profile");
+ //__glXEnableExtension(screen->base.glx_enable_bits, "GLX_ARB_create_context");
+ //__glXEnableExtension(screen->base.glx_enable_bits, "GLX_ARB_create_context_profile");
// Generate the GLX extensions string (overrides that set by __glXScreenInit())
{
unsigned int buffer_size =
- __glXGetExtensionString(screen->glx_enable_bits, NULL);
+ __glXGetExtensionString(screen->base.glx_enable_bits, NULL);
if (buffer_size > 0) {
screen->base.GLXextensions = xnfalloc(buffer_size);
- __glXGetExtensionString(screen->glx_enable_bits,
+ __glXGetExtensionString(screen->base.glx_enable_bits,
screen->base.GLXextensions);
}
}
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 70d88d788..3b8210f9e 100644
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -136,9 +136,6 @@ struct __GLXWinDrawable {
struct __GLXWinScreen {
__GLXscreen base;
- /* Supported GLX extensions */
- unsigned char glx_enable_bits[__GLX_EXT_BYTES];
-
Bool has_WGL_ARB_multisample;
Bool has_WGL_ARB_pixel_format;
Bool has_WGL_ARB_pbuffer;
@@ -632,7 +629,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
// Based on the WGL extensions available, enable various GLX extensions
// XXX: make this table-driven ?
//
- __glXInitExtensionEnableBits(screen->glx_enable_bits);
+ __glXInitExtensionEnableBits(screen->base.glx_enable_bits);
if (strstr(wgl_extensions, "WGL_ARB_make_current_read"))
screen->has_WGL_ARB_make_current_read = TRUE;
@@ -640,13 +637,13 @@ glxWinScreenProbe(ScreenPtr pScreen)
LogMessage(X_WARNING, "AIGLX: missing WGL_ARB_make_current_read\n")
if (strstr(gl_extensions, "GL_WIN_swap_hint")) {
- __glXEnableExtension(screen->glx_enable_bits,
+ __glXEnableExtension(screen->base.glx_enable_bits,
"GLX_MESA_copy_sub_buffer");
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
}
if (strstr(wgl_extensions, "WGL_EXT_swap_control")) {
- __glXEnableExtension(screen->glx_enable_bits,
+ __glXEnableExtension(screen->base.glx_enable_bits,
"GLX_SGI_swap_control");
LogMessage(X_INFO, "AIGLX: enabled GLX_SGI_swap_control\n");
}
@@ -654,7 +651,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
/* // Hmm? screen->texOffset */
/* if (strstr(wgl_extensions, "WGL_ARB_render_texture")) */
/* { */
-/* __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_texture_from_pixmap"); */
+/* __glXEnableExtension(screen->base.glx_enable_bits, "GLX_EXT_texture_from_pixmap"); */
/* LogMessage(X_INFO, "AIGLX: GLX_EXT_texture_from_pixmap backed by buffer objects\n"); */
/* screen->has_WGL_ARB_render_texture = TRUE; */
/* } */
@@ -713,10 +710,10 @@ glxWinScreenProbe(ScreenPtr pScreen)
// Generate the GLX extensions string (overrides that set by __glXScreenInit())
{
unsigned int buffer_size =
- __glXGetExtensionString(screen->glx_enable_bits, NULL);
+ __glXGetExtensionString(screen->base.glx_enable_bits, NULL);
if (buffer_size > 0) {
screen->base.GLXextensions = xnfalloc(buffer_size);
- __glXGetExtensionString(screen->glx_enable_bits,
+ __glXGetExtensionString(screen->base.glx_enable_bits,
screen->base.GLXextensions);
}
}