https://bugs.webkit.org/show_bug.cgi?id=142865
Reviewed by Žan Doberšek.
.:
The Redirected XComposite Window was added to support some
features like GtkOverlay, but in cases where we don't need such
features, it's more efficient to use the XID of the WebKitWebView
window as the native surface handle for the accelerated
compositing. This patch adds USE_REDIRECTED_XCOMPOSITE_WINDOW,
that is enabled by default for X11 target when OpenGL is enabled.
* Source/cmake/OptionsGTK.cmake:
Source/WebKit2:
Use USE(REDIRECTED_XCOMPOSITE_WINDOW) instead of
USE(TEXTURE_MAPPER_GL) && PLATFORM(X11).
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseRealize): Use the XID of the WebKitWebView
window as native surface handle when REDIRECTED_XCOMPOSITE_WINDOW
is disabled.
(webkitWebViewRenderAcceleratedCompositingResults):
(resizeWebKitWebViewBaseFromAllocation):
(webkitWebViewBaseEnterAcceleratedCompositingMode):
(webkitWebViewBaseExitAcceleratedCompositingMode):
* UIProcess/gtk/RedirectedXCompositeWindow.cpp:
* UIProcess/gtk/RedirectedXCompositeWindow.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181847
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-03-23 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add a configure option to build without Redirected XComposite Window
+ https://bugs.webkit.org/show_bug.cgi?id=142865
+
+ Reviewed by Žan Doberšek.
+
+ The Redirected XComposite Window was added to support some
+ features like GtkOverlay, but in cases where we don't need such
+ features, it's more efficient to use the XID of the WebKitWebView
+ window as the native surface handle for the accelerated
+ compositing. This patch adds USE_REDIRECTED_XCOMPOSITE_WINDOW,
+ that is enabled by default for X11 target when OpenGL is enabled.
+
+ * Source/cmake/OptionsGTK.cmake:
+
2015-03-20 Zan Dobersek <zdobersek@igalia.com>
[GTK] Search for the Wayland dependency when enabling Wayland target
+2015-03-23 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Add a configure option to build without Redirected XComposite Window
+ https://bugs.webkit.org/show_bug.cgi?id=142865
+
+ Reviewed by Žan Doberšek.
+
+ Use USE(REDIRECTED_XCOMPOSITE_WINDOW) instead of
+ USE(TEXTURE_MAPPER_GL) && PLATFORM(X11).
+
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (webkitWebViewBaseRealize): Use the XID of the WebKitWebView
+ window as native surface handle when REDIRECTED_XCOMPOSITE_WINDOW
+ is disabled.
+ (webkitWebViewRenderAcceleratedCompositingResults):
+ (resizeWebKitWebViewBaseFromAllocation):
+ (webkitWebViewBaseEnterAcceleratedCompositingMode):
+ (webkitWebViewBaseExitAcceleratedCompositingMode):
+ * UIProcess/gtk/RedirectedXCompositeWindow.cpp:
+ * UIProcess/gtk/RedirectedXCompositeWindow.h:
+
2015-03-22 Eric Carlson <eric.carlson@apple.com>
[Mac] Enable WIRELESS_PLAYBACK_TARGET for WK1
#include "WebFullScreenManagerProxy.h"
#endif
-#if PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
#include <gdk/gdkx.h>
#endif
+
#if PLATFORM(WAYLAND)
#include <gdk/gdkwayland.h>
#endif
WebFullScreenClientGtk fullScreenClient;
#endif
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
std::unique_ptr<RedirectedXCompositeWindow> redirectedWindow;
#endif
WebKitWebViewBase* webView = WEBKIT_WEB_VIEW_BASE(widget);
WebKitWebViewBasePrivate* priv = webView->priv;
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
if (GDK_IS_X11_DISPLAY(display)) {
priv->redirectedWindow = RedirectedXCompositeWindow::create(
gtk_widget_set_window(widget, window);
gdk_window_set_user_data(window, widget);
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
+ DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
+ drawingArea->setNativeSurfaceHandleForCompositing(GDK_WINDOW_XID(window));
+#endif
+
gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
gtk_im_context_set_client_window(priv->inputMethodFilter.context(), window);
if (!drawingArea->isInAcceleratedCompositingMode())
return false;
-#if PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
// To avoid flashes when initializing accelerated compositing for the first
// time, we wait until we know there's a frame ready before rendering.
WebKitWebViewBasePrivate* priv = webViewBase->priv;
DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
if (sizeChanged && priv->redirectedWindow && drawingArea && drawingArea->isInAcceleratedCompositingMode())
priv->redirectedWindow->resize(viewRect.size());
#endif
void webkitWebViewBaseEnterAcceleratedCompositingMode(WebKitWebViewBase* webkitWebViewBase)
{
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
if (!priv->redirectedWindow)
return;
void webkitWebViewBaseExitAcceleratedCompositingMode(WebKitWebViewBase* webkitWebViewBase)
{
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
if (priv->redirectedWindow)
priv->redirectedWindow->resize(IntSize());
#include "config.h"
#include "RedirectedXCompositeWindow.h"
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
#include <X11/extensions/Xcomposite.h>
#include <X11/extensions/Xdamage.h>
} // namespace WebCore
-#endif // USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#endif // USE(REDIRECTED_XCOMPOSITE_WINDOW)
#ifndef RedirectedXCompositeWindow_h
#define RedirectedXCompositeWindow_h
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
#include <WebCore/IntSize.h>
#include <WebCore/RefPtrCairo.h>
} // namespace WebKit
-#endif // USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
+#endif // USE(REDIRECTED_XCOMPOSITE_WINDOW)
#endif // RedirectedXCompositeWindow_h
WEBKIT_OPTION_BEGIN()
WEBKIT_OPTION_DEFINE(ENABLE_PLUGIN_PROCESS_GTK2 "Whether to build WebKitPluginProcess2 to load GTK2 based plugins." ON)
+WEBKIT_OPTION_DEFINE(USE_REDIRECTED_XCOMPOSITE_WINDOW "Whether to use a Redirected XComposite Window for accelerated compositing in X11." ON)
if ((OPENGL_FOUND OR OPENGLES2_FOUND) AND (GLX_FOUND OR EGL_FOUND))
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL ON)
+ if (ENABLE_X11_TARGET)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_REDIRECTED_XCOMPOSITE_WINDOW ON)
+ else ()
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_REDIRECTED_XCOMPOSITE_WINDOW OFF)
+ endif ()
+
if (OPENGL_FOUND)
if (GLX_FOUND)
list(APPEND CAIRO_GL_COMPONENTS cairo-glx)
else ()
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL OFF)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS OFF)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_REDIRECTED_XCOMPOSITE_WINDOW OFF)
endif ()
if (ENABLE_ACCELERATED_2D_CANVAS AND NOT(CAIRO_GL_FOUND))
add_definitions(-DWTF_USE_TEXTURE_MAPPER_GL=1)
add_definitions(-DENABLE_3D_RENDERING=1)
+ if (ENABLE_X11_TARGET AND USE_REDIRECTED_XCOMPOSITE_WINDOW)
+ add_definitions(-DWTF_USE_REDIRECTED_XCOMPOSITE_WINDOW=1)
+ endif ()
+
if (OPENGLES2_FOUND)
set(WTF_USE_OPENGL_ES_2 1)
add_definitions(-DWTF_USE_OPENGL_ES_2=1)