<br><br><div class="gmail_quote">2013/1/29 Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 01/09/2013 05:46 AM, Tomasz Lis wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
From: Tomasz Lis <<a href="mailto:tomasz.lis@intel.com" target="_blank">tomasz.lis@intel.com</a>><br>
<br>
Changes to correctly initialize the sRGB capability attribute and<br>
transfer it between XServer and the client. Modifications include<br>
extension string, transferring visual config attribs and fbconfig<br>
attribs. Also, attribute is initialized in the modules which do not<br>
really use it (xquartz and xwin).<br>
This version advertises both ARB and EXT strings, and initializes<br>
the capability to default value of FALSE. It has corrected required<br>
GLX version and does not influence swrast. The sRGB capable attribute<br>
is attached only to those configs which do have this capability.<br>
<br>
Signed-off-by: Tomasz Lis <<a href="mailto:tomasz.lis@intel.com" target="_blank">tomasz.lis@intel.com</a>><br>
</blockquote>
<br></div>
Other than the one thing below, this patch looks good. Sorry for the massive lag. I've been overwhelmed by OpenGL ES 3.0 work all year so far. :(<div><div class="h5"><br></div></div></blockquote><div>I think we should work on improving the communication. I hope that together we will be able to prepare a path which would allow to close reviews of future patches within 2 weeks max.<br>
Long review process forces us to spend resources on temporary workarounds, and we'd very much like to avoid that in the future.<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
glx/extension_string.c | 2 ++<br>
glx/extension_string.h | 2 ++<br>
glx/glxcmds.c | 26 ++++++++++++++++++++++----<br>
glx/glxdri2.c | 7 +++++++<br>
glx/glxdricommon.c | 4 +++-<br>
glx/glxscreens.h | 3 +++<br>
hw/xquartz/GL/visualConfigs.c | 3 +++<br>
hw/xwin/glx/indirect.c | 2 ++<br>
8 files changed, 44 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/glx/extension_string.c b/glx/extension_string.c<br>
index 544ca1f..58f930f 100644<br>
--- a/glx/extension_string.c<br>
+++ b/glx/extension_string.c<br>
@@ -71,9 +71,11 @@ static const struct extension_info known_glx_extensions[] = {<br>
{ GLX(ARB_create_context), VER(0,0), N, },<br>
{ GLX(ARB_create_context_<u></u>profile), VER(0,0), N, },<br>
{ GLX(ARB_create_context_<u></u>robustness), VER(0,0), N, },<br>
+ { GLX(ARB_framebuffer_sRGB), VER(0,0), N, },<br>
{ GLX(ARB_multisample), VER(1,4), Y, },<br>
<br>
{ GLX(EXT_create_context_es2_<u></u>profile), VER(0,0), N, },<br>
+ { GLX(EXT_framebuffer_sRGB), VER(0,0), N, },<br>
{ GLX(EXT_import_context), VER(0,0), Y, },<br>
{ GLX(EXT_texture_from_pixmap), VER(0,0), Y, },<br>
{ GLX(EXT_visual_info), VER(0,0), Y, },<br>
</blockquote>
<br></div></div>
Do we want to expose both extensions together always? As far as I can tell, these are the same other than the name. Is that your understanding as well? This is how I treat them on the client side.<div class="im"><br></div>
</blockquote><div>Actually, there are simple differences in the specs - it's quite easy to use 'diff' on them. Still, they are non-exclusive - one code can be used to support both EXT and ARB.<br><br>The differences are in attributes returned by GetBooleanv and similar functions. There is a <pname> value in EXT which was removed from ARB, because it was replaced by FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING (which is defined in different extension).<br>
The pname code is different, and also values returned aren't matching (EXT one gives true/false, and the one from ARB gives LINEAR/SRGB which are defined as some hex values).<br><br>Do you think we should sometimes expose only one of the extension names? Please provide some details.<br>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff --git a/glx/extension_string.h b/glx/extension_string.h<br>
index 7a4a8b1..3ce5593 100644<br>
--- a/glx/extension_string.h<br>
+++ b/glx/extension_string.h<br>
@@ -39,8 +39,10 @@ enum {<br>
ARB_create_context_bit = 0,<br>
ARB_create_context_profile_<u></u>bit,<br>
ARB_create_context_robustness_<u></u>bit,<br>
+ ARB_framebuffer_sRGB_bit,<br>
ARB_multisample_bit,<br>
EXT_create_context_es2_<u></u>profile_bit,<br>
+ EXT_framebuffer_sRGB_bit,<br>
EXT_import_context_bit,<br>
EXT_texture_from_pixmap_bit,<br>
EXT_visual_info_bit,<br>
</blockquote>
<br></div>
If we decide yes to the above, we can handle this the same way I did on the client:<br>
<br>
#define EXT_framebuffer_sRGB_bit ARB_framebuffer_sRGB_bit<div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div> You're right, this can be handled together. Agreed to change EXT bit into #define.<br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff --git a/glx/glxcmds.c b/glx/glxcmds.c<br>
index c1f4e22..5b7a628 100644<br>
--- a/glx/glxcmds.c<br>
+++ b/glx/glxcmds.c<br>
@@ -913,7 +913,7 @@ __glXDisp_CopyContext(__<u></u>GLXclientState * cl, GLbyte * pc)<br>
<br>
enum {<br>
GLX_VIS_CONFIG_UNPAIRED = 18,<br>
- GLX_VIS_CONFIG_PAIRED = 20<br>
+ GLX_VIS_CONFIG_PAIRED = 22<br>
};<br>
<br>
enum {<br>
@@ -1005,8 +1005,17 @@ __glXDisp_GetVisualConfigs(__<u></u>GLXclientState * cl, GLbyte * pc)<br>
buf[p++] = modes->samples;<br>
buf[p++] = GLX_SAMPLE_BUFFERS_SGIS;<br>
buf[p++] = modes->sampleBuffers;<br>
- buf[p++] = 0; /* copy over visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)<u></u>? */<br>
- buf[p++] = 0;<br>
+ /* Add attribute only if its value is not default. */<br>
+ if (modes->sRGBCapable != GL_FALSE) {<br>
+ buf[p++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_<u></u>EXT;<br>
+ buf[p++] = modes->sRGBCapable;<br>
+ }<br>
+ /* Don't add visualSelectGroup (GLX_VISUAL_SELECT_GROUP_SGIX)<u></u>?<br>
+ * Pad the remaining place with zeroes, so that attributes count is constant. */<br>
+ while (p < GLX_VIS_CONFIG_TOTAL) {<br>
+ buf[p++] = 0;<br>
+ buf[p++] = 0;<br>
+ }<br>
<br>
assert(p == GLX_VIS_CONFIG_TOTAL);<br>
if (client->swapped) {<br>
@@ -1017,7 +1026,7 @@ __glXDisp_GetVisualConfigs(__<u></u>GLXclientState * cl, GLbyte * pc)<br>
return Success;<br>
}<br>
<br>
-#define __GLX_TOTAL_FBCONFIG_ATTRIBS (36)<br>
+#define __GLX_TOTAL_FBCONFIG_ATTRIBS (37)<br>
#define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2)<br>
/**<br>
* Send the set of GLXFBConfigs to the client. There is not currently<br>
@@ -1109,6 +1118,15 @@ DoGetFBConfigs(__<u></u>GLXclientState * cl, unsigned screen)<br>
WRITE_PAIR(GLX_BIND_TO_MIPMAP_<u></u>TEXTURE_EXT, modes->bindToMipmapTexture);<br>
WRITE_PAIR(GLX_BIND_TO_<u></u>TEXTURE_TARGETS_EXT,<br>
modes->bindToTextureTargets);<br>
+ /* Add attribute only if its value is not default. */<br>
+ if (modes->sRGBCapable != GL_FALSE) {<br>
+ WRITE_PAIR(GLX_FRAMEBUFFER_<u></u>SRGB_CAPABLE_EXT, modes->sRGBCapable);<br>
+ }<br>
+ /* Pad the remaining place with zeroes, so that attributes count is constant. */<br>
+ while (p < __GLX_FBCONFIG_ATTRIBS_LENGTH) {<br>
+ WRITE_PAIR(0, 0);<br>
+ }<br>
+ assert(p == __GLX_FBCONFIG_ATTRIBS_LENGTH)<u></u>;<br>
<br>
if (client->swapped) {<br>
__GLX_SWAP_INT_ARRAY(buf, __GLX_FBCONFIG_ATTRIBS_LENGTH)<u></u>;<br>
diff --git a/glx/glxdri2.c b/glx/glxdri2.c<br>
index bce1bfa..ef7afb4 100644<br>
--- a/glx/glxdri2.c<br>
+++ b/glx/glxdri2.c<br>
@@ -882,6 +882,13 @@ initializeExtensions(__<u></u>GLXDRIscreen * screen)<br>
"AIGLX: enabled GLX_SGI_swap_control and GLX_MESA_swap_control\n");<br>
}<br>
<br>
+ /* enable EXT_framebuffer_sRGB extension (even if there are no sRGB capable fbconfigs) */<br>
+ {<br>
+ __glXEnableExtension(screen-><u></u>glx_enable_bits,<br>
+ "GLX_EXT_framebuffer_sRGB");<br>
+ LogMessage(X_INFO, "AIGLX: enabled GLX_EXT_framebuffer_sRGB\n");<br>
+ }<br>
+<br>
for (i = 0; extensions[i]; i++) {<br>
#ifdef __DRI_READ_DRAWABLE<br>
if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) {<br>
diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c<br>
index c90f380..b027f24 100644<br>
--- a/glx/glxdricommon.c<br>
+++ b/glx/glxdricommon.c<br>
@@ -105,7 +105,9 @@ __ATTRIB(__DRI_ATTRIB_BUFFER_<u></u>SIZE, rgbBits),<br>
__ATTRIB(__DRI_ATTRIB_BIND_TO_<u></u>TEXTURE_RGB, bindToTextureRgb),<br>
__ATTRIB(__DRI_ATTRIB_BIND_TO_<u></u>TEXTURE_RGBA, bindToTextureRgba),<br>
__ATTRIB(__DRI_ATTRIB_BIND_TO_<u></u>MIPMAP_TEXTURE, bindToMipmapTexture),<br>
- __ATTRIB(__DRI_ATTRIB_<u></u>YINVERTED, yInverted),};<br>
+ __ATTRIB(__DRI_ATTRIB_<u></u>YINVERTED, yInverted),<br>
+ __ATTRIB(__DRI_ATTRIB_<u></u>FRAMEBUFFER_SRGB_CAPABLE, sRGBCapable),<br>
+ };<br>
<br>
static void<br>
setScalar(__GLXconfig * config, unsigned int attrib, unsigned int value)<br>
diff --git a/glx/glxscreens.h b/glx/glxscreens.h<br>
index b29df58..0a7b604 100644<br>
--- a/glx/glxscreens.h<br>
+++ b/glx/glxscreens.h<br>
@@ -102,6 +102,9 @@ struct __GLXconfig {<br>
GLint bindToMipmapTexture;<br>
GLint bindToTextureTargets;<br>
GLint yInverted;<br>
+<br>
+ /* ARB_framebuffer_sRGB */<br>
+ GLint sRGBCapable;<br>
};<br>
<br>
GLint glxConvertToXVisualType(int visualType);<br>
diff --git a/hw/xquartz/GL/visualConfigs.<u></u>c b/hw/xquartz/GL/visualConfigs.<u></u>c<br>
index e37eefb..5efd04f 100644<br>
--- a/hw/xquartz/GL/visualConfigs.<u></u>c<br>
+++ b/hw/xquartz/GL/visualConfigs.<u></u>c<br>
@@ -326,6 +326,9 @@ __glXAquaCreateVisualConfigs(<u></u>int *numConfigsPtr, int screenNumber)<br>
c->bindToTextureTargets = 0;<br>
c->yInverted = 0;<br>
<br>
+ /* EXT_framebuffer_sRGB */<br>
+ c->sRGBCapable = GL_FALSE;<br>
+<br>
c = c->next;<br>
}<br>
}<br>
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c<br>
index c0069a2..e6faf19 100644<br>
--- a/hw/xwin/glx/indirect.c<br>
+++ b/hw/xwin/glx/indirect.c<br>
@@ -2017,6 +2017,7 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen)<br>
c->base.bindToMipmapTexture = -1;<br>
c->base.bindToTextureTargets = -1;<br>
c->base.yInverted = -1;<br>
+ c->base.sRGBCapable = 0;<br>
<br>
n++;<br>
<br>
@@ -2411,6 +2412,7 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen)<br>
GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT |<br>
GLX_TEXTURE_RECTANGLE_BIT_EXT;<br>
c->base.yInverted = -1;<br>
+ c->base.sRGBCapable = 0;<br>
<br>
n++;<br>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br>