<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - GL_ALPHA_BITS set to non-zero with EGL_PLATFORM_GBM_MESA"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=109330">109330</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GL_ALPHA_BITS set to non-zero with EGL_PLATFORM_GBM_MESA
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Drivers/DRI/nouveau
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>nouveau@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>contact@emersion.fr
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>nouveau@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When creating an EGL context with EGL_PLATFORM_GBM_MESA and EGL_ALPHA_SIZE=1,
Nouveau produces completely transparent images when using glReadPixels. Note
that my code works with other drivers (i915, amdgpu), only Nouveau is affected.

How to reproduce:

1. Create an EGL context with these attribs:

static const EGLint config_attribs[] = {
        EGL_RED_SIZE, 1,
        EGL_GREEN_SIZE, 1,
        EGL_BLUE_SIZE, 1,
        EGL_ALPHA_SIZE, 1,
        EGL_NONE,
};

Set platform to EGL_PLATFORM_GBM_MESA and visual to GBM_FORMAT_ARGB8888.

2. Try to get the alpha size:

eglGetConfigAttrib(EGL_ALPHA_SIZE)
glGetIntegerv(GL_ALPHA_BITS)

Both return 8, meaning an alpha channel is present.

3. Try to read pixels with glReadPixels and GL_BGRA_EXT. The resulting image
has an alpha channel which sets the pixels to be completely transparent.
Editing the image with gimp reveals that inverting the alpha channel makes the
image correct.

Software is wlroots [1] with grim [2]. To reproduce, compile both, start
rootston, run grim. Let me know if you need more info.

[1]: <a href="https://github.com/swaywm/wlroots">https://github.com/swaywm/wlroots</a>
[2]: <a href="https://github.com/emersion/grim">https://github.com/emersion/grim</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>