[GTK] Use XDamage to simplify RedirectedXCompositeWindow
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2012 15:53:42 +0000 (15:53 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2012 15:53:42 +0000 (15:53 +0000)
commit8b2fdc2e32590ecada3c770d75bd1d6b3ab1948c
tree8bd41dd00fd607498e7bccfc6a0de1f4cf904608
parent93969d1278be2019264addcc3553501a5f6f849e
[GTK] Use XDamage to simplify RedirectedXCompositeWindow
https://bugs.webkit.org/show_bug.cgi?id=97267

Reviewed by Alejandro G. Castro.

Use XDamage to queue redraws of the widget when redirecting accelerated compositing
to an offscreen window. This allows removing a finicky timer-based approach, improves
performance, and allows simplifying things greatly.

.:

* configure.ac: Add support for finding XDamage via pkg-config.

Source/WebCore:

No new tests. This is covered by existing tests.

* GNUmakefile.am: Add the XDamage CFLAGS in the appropriate place.
* platform/gtk/RedirectedXCompositeWindow.cpp:
(WebCore::getWindowHashMap): Added.
(WebCore::filterXDamageEvent): Added.
(WebCore::supportsXDamageAndXComposite): Added.
(WebCore::RedirectedXCompositeWindow::create): Fail to create the window if
the XServer doesn't support XDamage and XComposite.
(WebCore::RedirectedXCompositeWindow::RedirectedXCompositeWindow): Add XDamage support and
remove the m_usable size distinction. Add the window the window HashMap now.
(WebCore::RedirectedXCompositeWindow::~RedirectedXCompositeWindow): Remove the window
from the window HashMap.
(WebCore::RedirectedXCompositeWindow::resize): Now just immediately update the size.
(WebCore::RedirectedXCompositeWindow::callDamageNotifyCallback): Added.
* platform/gtk/RedirectedXCompositeWindow.h:
(WebCore::RedirectedXCompositeWindow::setDamageNotifyCallback): Added.

Source/WebKit/gtk:

* GNUmakefile.am: Add the XDamage CFLAGS and LIBS.
* WebCoreSupport/AcceleratedCompositingContext.h:
(AcceleratedCompositingContext): Change the signature of compositeLayersToContext
to accept an enum that explains the composite purpose.
* WebCoreSupport/AcceleratedCompositingContextGL.cpp:
(WebKit::redirectedWindowDamagedCallback): Added.
(WebKit::AcceleratedCompositingContext::initialize): Handle the situation where
the RedirectedXCompositeWindow returns a null pointer.
(WebKit::AcceleratedCompositingContext::enabled): Ditto.
(WebKit::AcceleratedCompositingContext::renderLayersToWindow): Remove the code handling
the usable size of the RedirectedXCompositeWindow. The usable size is now always equal
to the size.
(WebKit::AcceleratedCompositingContext::compositeLayersToContext): When drawing for a
resize, first clear the entire context. Remove the double swap-buffer, as it's no
longer necessary.
(WebKit::AcceleratedCompositingContext::setRootCompositingLayer): Handle the case that
the redirected window is null.
(WebKit::AcceleratedCompositingContext::resizeRootLayer): Instead of doing another
immediate layer flush, just recomposite the current layer state and schedule a new
flush. This should make resizing faster.
(WebKit::AcceleratedCompositingContext::flushAndRenderLayers): We no longer need to
queue a redraw, unless we want to force one.

Source/WebKit2:

* GNUmakefile.am: Add the XDamage CFLAGS and LIBS to the appropriate places.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(_WebKitWebViewBasePrivate): Remove readyToRenderAcceleratedCompositingResults as
it's no longer necessary.
(webkit_web_view_base_init): Handle the situation where the RedirectedXCompositeWindow
is null.
(webkitWebViewRenderAcceleratedCompositingResults): Ditto.
(resizeWebKitWebViewBaseFromAllocation): Ditto.
(webkitWebViewBaseCreateWebPage): Ditto.
(redirectedWindowDamagedCallback): Added.
* UIProcess/WebPageProxy.h: Remove InvalidateWidget message.
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/gtk/WebPageProxyGtk.cpp: Ditto.
* WebProcess/WebPage/WebPage.h: Ditto.
* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::compositeLayersToContext): No longer need to
trigger the invalidateWindow message.
* WebProcess/WebPage/gtk/WebPageGtk.cpp: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/platform/gtk/RedirectedXCompositeWindow.cpp
Source/WebCore/platform/gtk/RedirectedXCompositeWindow.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/GNUmakefile.am
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h
Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.am
Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
configure.ac