<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - EGL application crashes with BadDrawable at SwapBuffers"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=75797">75797</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>EGL application crashes with BadDrawable at SwapBuffers
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>scampa.giovanni@gmail.com
          </td>
        </tr>

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

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

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

        <tr>
          <th>Component</th>
          <td>EGL
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=95167" name="attach_95167" title="Test case">attachment 95167</a> <a href="attachment.cgi?id=95167&action=edit" title="Test case">[details]</a></span>
Test case

If you create two X windows, make one EGL context current to the first one and
then to the second one, then clear and swap the second one, you will get an X
error at swap buffers time.

After debugging, I found that the glClear is optimized away because the
gl_framebuffer has Width and Height == 0, despite the glViewport call that
invalidated the drawable. Thus intel_prepare_render() is never reached (the
viewport is already initialized in the second MakeCurrent call) and we never
query X for the DRI2 buffers for the second window.

X logs include
[107772.804] (EE) intel(0): [DRI2] DRI2SwapBuffers: drawable has no back or
front?


Test case attached. This is 100% reproducible here.

Mesa is befbda56a246f77797bdf13fc005353441db2879, from Feb 22, master branch.
Driver is i965 DRI, on a GM45 card.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>