After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 769739 - Add a more efficient way to draw EGLImages, gdk_cairo_draw_from_egl_image()
Add a more efficient way to draw EGLImages, gdk_cairo_draw_from_egl_image()
Status: RESOLVED INVALID
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-08-11 11:07 UTC by Emanuele Aina
Modified: 2016-09-28 11:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdk: Add gdk_cairo_draw_from_egl_image() (8.13 KB, patch)
2016-08-11 11:07 UTC, Emanuele Aina
reviewed Details | Review

Description Emanuele Aina 2016-08-11 11:07:29 UTC
While working on the experimental branch of WebKit2GTK+ that enables
Accelerated Compositing under Wayland by way of a nested Wayland compositor, we
needed an efficient way to draw a single EGLImage on screen.

We first tried setting up a GL context, importing the EGLImage as a texture,
and rendering it which worked but had some overhead.

We then developed a more efficient approach that skips some of the above steps
by introducing the gdk_cairo_draw_from_egl_image() function.

Note that this is used by our experimental wayland-ac[1] branch, but for
WebKit2GTK+ upstream we'll likely adopt a different approach by importing the
EGLImages as textures, since the long-term aim in to move composition to the
UIProcess which would need a real GL context and real textures.
In the short term we'd be likely trading off performance for compatibility and
future-proofing, but we thought the current approach may interest other people
for different purposes.


[1] The WebKit2GTK+ wayland-ac branch, don't be fooled by the repository name, no Clutter involved:
https://git.apertis.org/cgit/webkit-gtk-clutter.git/log/?h=wayland-ac
Comment 1 Emanuele Aina 2016-08-11 11:07:35 UTC
Created attachment 333111 [details] [review]
gdk: Add gdk_cairo_draw_from_egl_image()

This complements gdk_cairo_draw_from_gl() when you somehow ends up with
a EGLImage that you want to efficiently paint to screen, instead of a
full GL context.
Comment 2 Matthias Clasen 2016-09-10 13:18:47 UTC
ebassi, this looks like its in your area ?
Comment 3 Emmanuele Bassi (:ebassi) 2016-09-11 16:49:33 UTC
Review of attachment 333111 [details] [review]:

I honestly don't like this approach, and I really don't want to have an explosion of gdk_cairo_draw_from_<random_gl_object_id> functions.

Looking at the implementation, I see a ton of duplication with the existing gdk_cairo_draw_from_gl(). Additional, gdk_cairo_draw_from_gl() already takes two types of GL object ids — textures and render buffers.

Would it be possible to just add support for EGLImage object ids to gdk_cairo_draw_from_gl(), on supported platforms?
Comment 4 Emanuele Aina 2016-09-21 20:37:26 UTC
The codepath is slightly different in several places, but I guess it can be beaten into shape, as the proliferation of similar interface is a very good point.

I'll have a look at that, thanks!
Comment 5 Emanuele Aina 2016-09-28 11:01:15 UTC
Gustavo landed in WebKit a patch to use gdk_cairo_draw_from_gl() by flipping the rendering in the WebProcess with marginal overhead (if any), which makes this the approach of this patch obsolete (the only difference left is indeed the flipping, as we turn the EGLImage to a texture in WebKit).

Closing as INVALID.