Bug 163595

Summary: [GTK] Does not use GLES2 in Wayland when rendering with gdk_cairo_draw_from_gl
Product: WebKit Reporter: ManDay <manday>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bugs-noreply, cgarcia, clopez, jmcasanova, mcatanzaro
Priority: P3    
Version: WebKit Nightly Build   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Backtrace none

Description ManDay 2016-10-18 05:52:14 PDT
Compiled with ENABLE_OPENGL=ON  ENABLE_GLES2=ON, Webkit attempts to use GL and fails due to absesence of libGL.so.

I broke on gdk_gl_context_set_use_es where a GdkGLContext is created with NO GLES2 and the backtrace reads as attached
Comment 1 ManDay 2016-10-18 05:53:45 PDT
Created attachment 291943 [details]
Backtrace
Comment 2 ManDay 2016-10-18 07:46:58 PDT
According to a GTK+ dev, Webkit is supposed to request GLES - Gdk does not automatially detect the availability or preference.
Comment 3 Carlos Alberto Lopez Perez 2016-10-18 08:57:04 PDT
Can you check the output of:


1. ldd /path/to/libwebkit2gtk-4.0.so.37

2. ldd /path/to/WebKitWebProcess


Does any of them link with libGL or give any error related to libraries not found?
Comment 4 Michael Catanzaro 2016-10-18 09:08:51 PDT
(In reply to comment #2)
> According to a GTK+ dev, Webkit is supposed to request GLES - Gdk does not
> automatially detect the availability or preference.

If environment variables are the only way, you'll have to set them before starting WebKit. We're not going to mess with that.
Comment 5 Carlos Garcia Campos 2016-10-24 01:22:11 PDT
(In reply to comment #2)
> According to a GTK+ dev, Webkit is supposed to request GLES - Gdk does not
> automatially detect the availability or preference.

That's not really possible I'm afraid. gdk_cairo_draw_from_gl() uses the paint gl context of the given window that is always created with a NULL sharing context and realized right after being created. On realize is when using ES is decided, and the only way to change that for the paint gl context is using the debug flags. I don't think using debug flags for this is the right way. I think there should be a way to tell GDK to use ES globally, maybe in GdkWindow to use that when creating the paint context. Or maybe there's actually a way that is not the debug flags, but I haven't found it reading the code.
Comment 6 Carlos Garcia Campos 2016-10-24 01:24:29 PDT
What I would do as a workaround for now is to fallback to glReadPixels when USE(OPENGL_ES_2) is enabled.