[GTK] Should check whether GDK can use GL before asking it to
https://bugs.webkit.org/show_bug.cgi?id=162598

Reviewed by Michael Catanzaro.

gdk_cairo_draw_from_gl can fail even when WebKit itself has been able to use GL (its
context creation code might be buggy, GL may have been disabled using GDK_GL=disable, …).
Unfortunately it does not have any error reporting other than a warning printed to
stderr, so we cannot fallback from it. We have to first check if GL can be used by GDK
by trying to create a context.

See https://bugzilla.redhat.com/show_bug.cgi?id=1378987

* UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:
(WebKit::AcceleratedBackingStoreWayland::canGdkUseGL): decide whether GDK can use GL by
trying to create a context for a GdkWindow.
(WebKit::AcceleratedBackingStoreWayland::paint): fallback to glReadPixels if GDK cannot
use GL.
* UIProcess/gtk/AcceleratedBackingStoreWayland.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@206424 268f45cc-cd09-0410-ab3c-d52691b4dbfc
3 files changed