<html>
    <head>
      <base href="https://bugs.webkit.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 - Stop using glReadPixels() to blit AC surfaces in the UIProcess"
   href="https://bugs.webkit.org/show_bug.cgi?id=161530">161530</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Stop using glReadPixels() to blit AC surfaces in the UIProcess
          </td>
        </tr>

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

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Local Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>WebKit Gtk
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>emanuele.aina&#64;collabora.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>bugs-noreply&#64;webkitgtk.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>glReadPixels() is quite obviously suboptimal in the AC paint loop under Wayland[1], and we need a better mechanism to blit surfaces on the window.

One option would be to rely on gdk_cairo_draw_from_gl()[1], but unfortunately we can't trivially use that as it results in the image being y-flipped on screen. Apparently gdk_cairo_draw_from_gl() is already doing its own y-flipping[3], so in my current limited understanding of how GL and its GTK+ integration works the best option would be to flip rendering in the UIProcess and then pipe the resulting surfaces through gdk_cairo_draw_from_gl().

I'm not sure if the current rendering is wrong or it's a weird GL inconsistency that we would have to work around, but at least this approach would just work with current GTK+. :)

[1] <a href="https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp?rev=205116#L74">https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp?rev=205116#L74</a>
[2] <a href="https://git.gnome.org/browse/gtk+/tree/gdk/gdkgl.c#n330">https://git.gnome.org/browse/gtk+/tree/gdk/gdkgl.c#n330</a>
[3] <a href="https://git.gnome.org/browse/gtk+/tree/gdk/gdkgl.c#n455">https://git.gnome.org/browse/gtk+/tree/gdk/gdkgl.c#n455</a></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>