summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorTomasz Lis <tomasz.lis@intel.com>2013-03-11 10:21:28 +0100
committerKeith Packard <keithp@keithp.com>2013-03-18 10:02:00 -0700
commitcf89aa53748b964f9d9eceaa12a7d6f1a076d1ee (patch)
tree46c8e4ba7b451f64d96c3a9633178c297a029214 /glx
parent679ccecd8bc6d797e99f3b707f8041b727ca7a49 (diff)
Full support of sRGB capable fbconfigs.
Changes to correctly initialize the sRGB capability attribute and transfer it between XServer and the client. Modifications include extension string, transferring visual config attribs and fbconfig attribs. Also, attribute is initialized in the modules which do not really use it (xquartz and xwin). This version advertises both ARB and EXT strings, and initializes the capability to default value of FALSE. It has corrected required GLX version and does not influence swrast. The sRGB capable attribute is attached only to those configs which do have this capability. Both ARB and EXT versions share the same GLX extension enabling bit. Signed-off-by: Tomasz Lis <tomasz.lis@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/extension_string.c2
-rw-r--r--glx/extension_string.h5
-rw-r--r--glx/glxcmds.c26
-rw-r--r--glx/glxdri2.c7
-rw-r--r--glx/glxdricommon.c4
-rw-r--r--glx/glxscreens.h3
6 files changed, 42 insertions, 5 deletions
diff --git a/glx/extension_string.c b/glx/extension_string.c
index 544ca1f5e..58f930f75 100644
--- a/glx/extension_string.c
+++ b/glx/extension_string.c
@@ -71,9 +71,11 @@ static const struct extension_info known_glx_extensions[] = {
{ GLX(ARB_create_context), VER(0,0), N, },
{ GLX(ARB_create_context_profile), VER(0,0), N, },
{ GLX(ARB_create_context_robustness), VER(0,0), N, },
+ { GLX(ARB_framebuffer_sRGB), VER(0,0), N, },
{ GLX(ARB_multisample), VER(1,4), Y, },
{ GLX(EXT_create_context_es2_profile), VER(0,0), N, },
+ { GLX(EXT_framebuffer_sRGB), VER(0,0), N, },
{ GLX(EXT_import_context), VER(0,0), Y, },
{ GLX(EXT_texture_from_pixmap), VER(0,0), Y, },
{ GLX(EXT_visual_info), VER(0,0), Y, },
diff --git a/glx/extension_string.h b/glx/extension_string.h
index 7a4a8b1c2..81b7de372 100644
--- a/glx/extension_string.h
+++ b/glx/extension_string.h
@@ -39,6 +39,7 @@ enum {
ARB_create_context_bit = 0,
ARB_create_context_profile_bit,
ARB_create_context_robustness_bit,
+ ARB_framebuffer_sRGB_bit,
ARB_multisample_bit,
EXT_create_context_es2_profile_bit,
EXT_import_context_bit,
@@ -58,6 +59,10 @@ enum {
__NUM_GLX_EXTS,
};
+/* For extensions which have identical ARB and EXT implementation
+ * in GLX area, use one enabling bit for both. */
+#define EXT_framebuffer_sRGB_bit ARB_framebuffer_sRGB_bit
+
#define __GLX_EXT_BYTES ((__NUM_GLX_EXTS + 7) / 8)
extern int __glXGetExtensionString(const unsigned char *enable_bits,
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index c1f4e22f8..5b7a628cc 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -913,7 +913,7 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
enum {
GLX_VIS_CONFIG_UNPAIRED = 18,
- GLX_VIS_CONFIG_PAIRED = 20
+ GLX_VIS_CONFIG_PAIRED = 22
};
enum {
@@ -1005,8 +1005,17 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
buf[p++] = modes->samples;
buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;
buf[p++] = modes->sampleBuffers;
- buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)? */
- buf[p++] = 0;
+ /* Add attribute only if its value is not default. */
+ if (modes->sRGBCapable != GL_FALSE) {
+ buf[p++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT;
+ buf[p++] = modes->sRGBCapable;
+ }
+ /* Don't add visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)?
+ * Pad the remaining place with zeroes, so that attributes count is constant. */
+ while (p < GLX_VIS_CONFIG_TOTAL) {
+ buf[p++] = 0;
+ buf[p++] = 0;
+ }
assert(p == GLX_VIS_CONFIG_TOTAL);
if (client->swapped) {
@@ -1017,7 +1026,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc)
return Success;
}
-#define __GLX_TOTAL_FBCONFIG_ATTRIBS (36)
+#define __GLX_TOTAL_FBCONFIG_ATTRIBS (37)
#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)
/**
* Send the set of GLXFBConfigs to the client. There is not currently
@@ -1109,6 +1118,15 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen)
WRITE_PAIR(GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture);
WRITE_PAIR(GLX_BIND_TO_TEXTURE_TARGETS_EXT,
modes->bindToTextureTargets);
+ /* Add attribute only if its value is not default. */
+ if (modes->sRGBCapable != GL_FALSE) {
+ WRITE_PAIR(GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, modes->sRGBCapable);
+ }
+ /* Pad the remaining place with zeroes, so that attributes count is constant. */
+ while (p < __GLX_FBCONFIG_ATTRIBS_LENGTH) {
+ WRITE_PAIR(0, 0);
+ }
+ assert(p == __GLX_FBCONFIG_ATTRIBS_LENGTH);
if (client->swapped) {
__GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH);
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index b26e501dc..8fba6a87d 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -882,6 +882,13 @@ initializeExtensions(__GLXDRIscreen * screen)
"AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");
}
+ /* enable EXT_framebuffer_sRGB extension (even if there are no sRGB capable fbconfigs) */
+ {
+ __glXEnableExtension(screen->glx_enable_bits,
+ "GLX_EXT_framebuffer_sRGB");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_EXT_framebuffer_sRGB\n");
+ }
+
for (i = 0; extensions[i]; i++) {
#ifdef __DRI_READ_DRAWABLE
if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index c90f38098..b027f2498 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -105,7 +105,9 @@ __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb),
__ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba),
__ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture),
- __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),};
+ __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted),
+ __ATTRIB(__DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE, sRGBCapable),
+ };
static void
setScalar(__GLXconfig * config, unsigned int attrib, unsigned int value)
diff --git a/glx/glxscreens.h b/glx/glxscreens.h
index b29df58a5..0a7b6043e 100644
--- a/glx/glxscreens.h
+++ b/glx/glxscreens.h
@@ -102,6 +102,9 @@ struct __GLXconfig {
GLint bindToMipmapTexture;
GLint bindToTextureTargets;
GLint yInverted;
+
+ /* ARB_framebuffer_sRGB */
+ GLint sRGBCapable;
};
GLint glxConvertToXVisualType(int visualType);