aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glx
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/glx')
-rw-r--r--xorg-server/glx/extension_string.c2
-rw-r--r--xorg-server/glx/extension_string.h5
-rw-r--r--xorg-server/glx/glxcmds.c26
-rw-r--r--xorg-server/glx/glxdri.c2
-rw-r--r--xorg-server/glx/glxdri2.c11
-rw-r--r--xorg-server/glx/glxdricommon.c4
-rw-r--r--xorg-server/glx/glxscreens.h3
7 files changed, 46 insertions, 7 deletions
diff --git a/xorg-server/glx/extension_string.c b/xorg-server/glx/extension_string.c
index 544ca1f5e..58f930f75 100644
--- a/xorg-server/glx/extension_string.c
+++ b/xorg-server/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/xorg-server/glx/extension_string.h b/xorg-server/glx/extension_string.h
index 7a4a8b1c2..81b7de372 100644
--- a/xorg-server/glx/extension_string.h
+++ b/xorg-server/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/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c
index 900349a60..d5d14b7a6 100644
--- a/xorg-server/glx/glxcmds.c
+++ b/xorg-server/glx/glxcmds.c
@@ -926,7 +926,7 @@ __glXDisp_CopyContext(__GLXclientState * cl, GLbyte * pc)
enum {
GLX_VIS_CONFIG_UNPAIRED = 18,
- GLX_VIS_CONFIG_PAIRED = 20
+ GLX_VIS_CONFIG_PAIRED = 22
};
enum {
@@ -1018,8 +1018,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) {
@@ -1030,7 +1039,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
@@ -1122,6 +1131,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/xorg-server/glx/glxdri.c b/xorg-server/glx/glxdri.c
index 9355394c5..11914eb85 100644
--- a/xorg-server/glx/glxdri.c
+++ b/xorg-server/glx/glxdri.c
@@ -974,6 +974,8 @@ __glXDRIscreenProbe(ScreenPtr pScreen)
size_t buffer_size;
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ framebuffer.base = NULL;
+
if (!xf86LoaderCheckSymbol("DRIQueryDirectRenderingCapable") ||
!DRIQueryDirectRenderingCapable(pScreen, &isCapable) || !isCapable) {
LogMessage(X_INFO,
diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c
index b26e501dc..e07cb5632 100644
--- a/xorg-server/glx/glxdri2.c
+++ b/xorg-server/glx/glxdri2.c
@@ -857,8 +857,6 @@ initializeExtensions(__GLXDRIscreen * screen)
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_copy_sub_buffer");
LogMessage(X_INFO, "AIGLX: enabled GLX_MESA_copy_sub_buffer\n");
- __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
- LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
#if __DRI_DRI2_VERSION >= 3
if (screen->dri2->base.version >= 3) {
@@ -876,12 +874,21 @@ initializeExtensions(__GLXDRIscreen * screen)
#endif
if (DRI2HasSwapControl(pScreen)) {
+ __glXEnableExtension(screen->glx_enable_bits, "GLX_INTEL_swap_event");
__glXEnableExtension(screen->glx_enable_bits, "GLX_SGI_swap_control");
__glXEnableExtension(screen->glx_enable_bits, "GLX_MESA_swap_control");
+ LogMessage(X_INFO, "AIGLX: enabled GLX_INTEL_swap_event\n");
LogMessage(X_INFO,
"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/xorg-server/glx/glxdricommon.c b/xorg-server/glx/glxdricommon.c
index 43b5e5b5f..7710de303 100644
--- a/xorg-server/glx/glxdricommon.c
+++ b/xorg-server/glx/glxdricommon.c
@@ -117,7 +117,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/xorg-server/glx/glxscreens.h b/xorg-server/glx/glxscreens.h
index b29df58a5..0a7b6043e 100644
--- a/xorg-server/glx/glxscreens.h
+++ b/xorg-server/glx/glxscreens.h
@@ -102,6 +102,9 @@ struct __GLXconfig {
GLint bindToMipmapTexture;
GLint bindToTextureTargets;
GLint yInverted;
+
+ /* ARB_framebuffer_sRGB */
+ GLint sRGBCapable;
};
GLint glxConvertToXVisualType(int visualType);