<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Regression, bisected] Screen is darker than expected in Supertuxkart"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=92759#c7">Comment # 7</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Regression, bisected] Screen is darker than expected in Supertuxkart"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=92759">bug 92759</a>
              from <span class="vcard"><a class="email" href="mailto:deveee@gmail.com" title="Deve <deveee@gmail.com>"> <span class="fn">Deve</span></a>
</span></b>
        <pre>I was digging around this bug a bit. Thanks to Ilia Mirkin for the help. Here
is what I noticed:

1. This patch doesn't have a sense.

2. During looking at Supertuxkart code, I noticed that we need srgb-capable
visual for proper working. 

3. The difference in intel code, which causes this issue is in intel_screen.c
in intelCreateBuffer() function:

   if (mesaVis->redBits == 5)
      rgbFormat = MESA_FORMAT_B5G6R5_UNORM;
   else if (mesaVis->sRGBCapable)
      rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
   else if (mesaVis->alphaBits == 0)
      rgbFormat = MESA_FORMAT_B8G8R8X8_UNORM;
   else {
      rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
      fb->Visual.sRGBCapable = true;
   }

Before commit 28090b30dd6b5977de085f48c620574214b6b4ba the format
MESA_FORMAT_B8G8R8X8_UNORM was not available, and thus it was using
MESA_FORMAT_B8G8R8A8_SRGB format (which is srgb-capable). Now it is using
MESA_FORMAT_B8G8R8X8_UNORM format, and thus function

    glEnable(GL_FRAMEBUFFER_SRGB) 

doesn't take effect anymore.

4. I tried to force to use srgb-capable visual by setting
GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB in supertuxkart code with glxChooseFBConfig
function, but it doesn't take any effect.

5. The ugly workaround for this issue in supertuxkart code, is to request
GLX_ALPHA_SIZE > 0. It will fallback to last case in intel code, which I
mentioned upwards:

      rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
      fb->Visual.sRGBCapable = true;

6. The <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - SRGB dark rendering"
   href="show_bug.cgi?id=91817">bug 91817</a> (<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - SRGB dark rendering"
   href="show_bug.cgi?id=91817">https://bugs.freedesktop.org/show_bug.cgi?id=91817</a>) seems to
be related to this bug.


Is there a proper way to force using srgb-capable visual?</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>