Changeset 206424 in webkit
- Timestamp:
- Sep 27, 2016 2:06:41 AM (8 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r206413 r206424 1 2016-09-27 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 3 [GTK] Should check whether GDK can use GL before asking it to 4 https://bugs.webkit.org/show_bug.cgi?id=162598 5 6 Reviewed by Michael Catanzaro. 7 8 gdk_cairo_draw_from_gl can fail even when WebKit itself has been able to use GL (its 9 context creation code might be buggy, GL may have been disabled using GDK_GL=disable, …). 10 Unfortunately it does not have any error reporting other than a warning printed to 11 stderr, so we cannot fallback from it. We have to first check if GL can be used by GDK 12 by trying to create a context. 13 14 See https://bugzilla.redhat.com/show_bug.cgi?id=1378987 15 16 * UIProcess/gtk/AcceleratedBackingStoreWayland.cpp: 17 (WebKit::AcceleratedBackingStoreWayland::canGdkUseGL): decide whether GDK can use GL by 18 trying to create a context for a GdkWindow. 19 (WebKit::AcceleratedBackingStoreWayland::paint): fallback to glReadPixels if GDK cannot 20 use GL. 21 * UIProcess/gtk/AcceleratedBackingStoreWayland.h: 22 1 23 2016-09-26 Tim Horton <timothy_horton@apple.com> 2 24 -
trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp
r206216 r206424 62 62 } 63 63 64 #if GTK_CHECK_VERSION(3, 16, 0) 65 bool AcceleratedBackingStoreWayland::canGdkUseGL() const 66 { 67 static bool initialized = false; 68 static bool canCreateGLContext = false; 69 70 if (initialized) 71 return canCreateGLContext; 72 73 initialized = true; 74 75 GUniqueOutPtr<GError> error; 76 GdkWindow* gdkWindow = gtk_widget_get_window(m_webPage.viewWidget()); 77 GRefPtr<GdkGLContext> gdkContext(gdk_window_create_gl_context(gdkWindow, &error.outPtr())); 78 if (!gdkContext) { 79 g_warning("GDK is not able to create a GL context, falling back to glReadPixels (slow!): %s", error->message); 80 return false; 81 } 82 83 canCreateGLContext = true; 84 85 return true; 86 } 87 #endif 88 64 89 bool AcceleratedBackingStoreWayland::paint(cairo_t* cr, const IntRect& clipRect) 65 90 { … … 73 98 74 99 #if GTK_CHECK_VERSION(3, 16, 0) 75 gdk_cairo_draw_from_gl(cr, gtk_widget_get_window(m_webPage.viewWidget()), texture, GL_TEXTURE, m_webPage.deviceScaleFactor(), 0, 0, textureSize.width(), textureSize.height()); 76 #else 100 if (canGdkUseGL()) { 101 gdk_cairo_draw_from_gl(cr, gtk_widget_get_window(m_webPage.viewWidget()), texture, GL_TEXTURE, m_webPage.deviceScaleFactor(), 0, 0, textureSize.width(), textureSize.height()); 102 cairo_restore(cr); 103 return true; 104 } 105 #endif 106 77 107 if (!m_surface || cairo_image_surface_get_width(m_surface.get()) != textureSize.width() || cairo_image_surface_get_height(m_surface.get()) != textureSize.height()) 78 108 m_surface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, textureSize.width(), textureSize.height())); … … 125 155 cairo_set_operator(cr, CAIRO_OPERATOR_OVER); 126 156 cairo_fill(cr); 127 #endif128 157 129 158 cairo_restore(cr); -
trunk/Source/WebKit2/UIProcess/gtk/AcceleratedBackingStoreWayland.h
r205116 r206424 31 31 32 32 #include <WebCore/RefPtrCairo.h> 33 #include <gtk/gtk.h> 33 34 34 35 namespace WebKit { … … 41 42 static std::unique_ptr<AcceleratedBackingStoreWayland> create(WebPageProxy&); 42 43 ~AcceleratedBackingStoreWayland(); 44 45 #if GTK_CHECK_VERSION(3, 16, 0) 46 bool canGdkUseGL() const; 47 #endif 43 48 44 49 private:
Note: See TracChangeset
for help on using the changeset viewer.