summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-03-30 14:04:04 -0400
committerAdam Jackson <ajax@redhat.com>2016-09-06 10:29:14 -0400
commit392da389d7b0e9dd970741dcd5321a4e0fd3aef5 (patch)
treeda068fb709331a2259bd91f8c223a12675fd02e3 /glx
parent589f42e9830e66a7e26475fc9a8b91034b5aad86 (diff)
glx: Fix computation of GLX_X_RENDERABLE fbconfig attribute
>From the GLX spec: "GLX_X_RENDERABLE is a boolean indicating whether X can be used to render into a drawable created with the GLXFBConfig. This attribute is True if the GLXFBConfig supports GLX windows and/or pixmaps." Every backend was setting this to true unconditionally, and then the core ignored that value and sent true unconditionally on its own. This is broken for ARB_fbconfig_float and EXT_fbconfig_packed_float, which only apply to pbuffers, which are not renderable from non-GLX APIs. Instead compute GLX_X_RENDERABLE from the supported drawable types. The dri backends were getting _that_ wrong too, so fix that as well. This is not a functional change, as there are no mesa drivers that claim to support __DRI_ATTRIB_{UNSIGNED_,}FLOAT_BIT yet. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxcmds.c5
-rw-r--r--glx/glxdri2.c6
-rw-r--r--glx/glxdricommon.c62
-rw-r--r--glx/glxdricommon.h3
-rw-r--r--glx/glxdriswrast.c6
-rw-r--r--glx/glxscreens.h1
6 files changed, 31 insertions, 52 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 3c4209af5..481dfb9e3 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1104,7 +1104,10 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
WRITE_PAIR(GLX_VISUAL_ID, modes->visualID);
WRITE_PAIR(GLX_FBCONFIG_ID, modes->fbconfigID);
- WRITE_PAIR(GLX_X_RENDERABLE, GL_TRUE);
+ WRITE_PAIR(GLX_X_RENDERABLE,
+ (modes->drawableType & (GLX_WINDOW_BIT | GLX_PIXMAP_BIT)
+ ? GL_TRUE
+ : GL_FALSE));
WRITE_PAIR(GLX_RGBA,
(modes->renderType & GLX_RGBA_BIT) ? GL_TRUE : GL_FALSE);
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 3a95a8f8c..c2dab90d0 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -994,10 +994,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
initializeExtensions(&screen->base);
- screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
- GLX_WINDOW_BIT |
- GLX_PIXMAP_BIT |
- GLX_PBUFFER_BIT);
+ screen->base.fbconfigs = glxConvertConfigs(screen->core,
+ screen->driConfigs);
options = xnfalloc(sizeof(GLXOptions));
memcpy(options, GLXOptions, sizeof(GLXOptions));
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index 62cce131d..f6c6fcdf2 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -122,14 +122,28 @@ setScalar(__GLXconfig * config, unsigned int attrib, unsigned int value)
}
}
+static Bool
+render_type_is_pbuffer_only(unsigned renderType)
+{
+ /* The GL_ARB_color_buffer_float spec says:
+ *
+ * "Note that floating point rendering is only supported for
+ * GLXPbuffer drawables. The GLX_DRAWABLE_TYPE attribute of the
+ * GLXFBConfig must have the GLX_PBUFFER_BIT bit set and the
+ * GLX_RENDER_TYPE attribute must have the GLX_RGBA_FLOAT_BIT set."
+ */
+ return !!(renderType & (__DRI_ATTRIB_UNSIGNED_FLOAT_BIT
+ | __DRI_ATTRIB_FLOAT_BIT));
+}
+
static __GLXconfig *
createModeFromConfig(const __DRIcoreExtension * core,
const __DRIconfig * driConfig,
- unsigned int visualType, unsigned int drawableType)
+ unsigned int visualType)
{
__GLXDRIconfig *config;
GLint renderType = 0;
- unsigned int attrib, value;
+ unsigned int attrib, value, drawableType = GLX_PBUFFER_BIT;
int i;
config = calloc(1, sizeof *config);
@@ -173,8 +187,10 @@ createModeFromConfig(const __DRIcoreExtension * core,
}
}
+ if (!render_type_is_pbuffer_only(renderType))
+ drawableType |= GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+
config->config.next = NULL;
- config->config.xRenderable = GL_TRUE;
config->config.visualType = visualType;
config->config.renderType = renderType;
config->config.drawableType = drawableType;
@@ -183,23 +199,9 @@ createModeFromConfig(const __DRIcoreExtension * core,
return &config->config;
}
-static Bool
-render_type_is_pbuffer_only(unsigned renderType)
-{
- /* The GL_ARB_color_buffer_float spec says:
- *
- * "Note that floating point rendering is only supported for
- * GLXPbuffer drawables. The GLX_DRAWABLE_TYPE attribute of the
- * GLXFBConfig must have the GLX_PBUFFER_BIT bit set and the
- * GLX_RENDER_TYPE attribute must have the GLX_RGBA_FLOAT_BIT set."
- */
- return !!(renderType & (__DRI_ATTRIB_UNSIGNED_FLOAT_BIT
- | __DRI_ATTRIB_FLOAT_BIT));
-}
-
__GLXconfig *
glxConvertConfigs(const __DRIcoreExtension * core,
- const __DRIconfig ** configs, unsigned int drawableType)
+ const __DRIconfig ** configs)
{
__GLXconfig head, *tail;
int i;
@@ -208,17 +210,7 @@ glxConvertConfigs(const __DRIcoreExtension * core,
head.next = NULL;
for (i = 0; configs[i]; i++) {
- unsigned renderType = 0;
- if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE,
- &renderType)) {
- if (render_type_is_pbuffer_only(renderType) &&
- !(drawableType & GLX_PBUFFER_BIT))
- continue;
- }
- /* Add all the others */
- tail->next = createModeFromConfig(core,
- configs[i], GLX_TRUE_COLOR,
- drawableType);
+ tail->next = createModeFromConfig(core, configs[i], GLX_TRUE_COLOR);
if (tail->next == NULL)
break;
@@ -226,17 +218,7 @@ glxConvertConfigs(const __DRIcoreExtension * core,
}
for (i = 0; configs[i]; i++) {
- unsigned int renderType = 0;
- if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE,
- &renderType)) {
- if (render_type_is_pbuffer_only(renderType) &&
- !(drawableType & GLX_PBUFFER_BIT))
- continue;
- }
- /* Add all the others */
- tail->next = createModeFromConfig(core,
- configs[i], GLX_DIRECT_COLOR,
- drawableType);
+ tail->next = createModeFromConfig(core, configs[i], GLX_DIRECT_COLOR);
if (tail->next == NULL)
break;
diff --git a/glx/glxdricommon.h b/glx/glxdricommon.h
index f4fcf009e..2db46dc07 100644
--- a/glx/glxdricommon.h
+++ b/glx/glxdricommon.h
@@ -33,8 +33,7 @@ struct __GLXDRIconfig {
};
__GLXconfig *glxConvertConfigs(const __DRIcoreExtension * core,
- const __DRIconfig ** configs,
- unsigned int drawableType);
+ const __DRIconfig ** configs);
extern const __DRIsystemTimeExtension systemTimeExtension;
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index be3252704..ac8bda869 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -482,10 +482,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
initializeExtensions(&screen->base);
- screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs,
- GLX_WINDOW_BIT |
- GLX_PIXMAP_BIT |
- GLX_PBUFFER_BIT);
+ screen->base.fbconfigs = glxConvertConfigs(screen->core,
+ screen->driConfigs);
#if !defined(XQUARTZ) && !defined(WIN32)
screen->base.glvnd = strdup("mesa");
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index 15196fa43..0f9a2b9af 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -78,7 +78,6 @@ struct __GLXconfig {
/* SGIX_fbconfig / GLX 1.3 */
GLint drawableType;
GLint renderType;
- GLint xRenderable;
GLint fbconfigID;
/* SGIX_pbuffer / GLX 1.3 */