Commit 5c29ddca authored by aroben@apple.com's avatar aroben@apple.com

Disable accelerated compositing on Windows machines that don't support it

This includes machines without the necessary graphics hardware, and machines without
WebKitQuartzCoreAdditions (like the Windows 7 Release (WebKit2 Tests) bots).

Fixes <http://webkit.org/b/57870> REGRESSION (r82960): Lots of tests crashing in
DrawingAreaImpl::enterAcceleratedCompositingMode on Windows 7 Release (WebKit2 Tests)

Reviewed by Anders Carlsson.

* WebProcess/WebPage/LayerTreeHost.h:
(WebKit::LayerTreeHost::supportsAcceleratedCompositing): Added. On platforms other than
Windows, this always returns true.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Only enable accelerated compositing-related
preferences if the machine supports accelerated compositing.

* WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp:
(WebKit::LayerTreeHostCAWin::supportsAcceleratedCompositing): Added. Creates a view, asks it
if it can draw, and returns the result.

* WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h: Added supportsAcceleratedCompositing.

* WebProcess/WebPage/win/LayerTreeHostWin.cpp: Added.
(WebKit::LayerTreeHost::supportsAcceleratedCompositing): Added. Calls through to
LayerTreeHostCAWin in configurations that support that class. Otherwise just returns false.

* win/WebKit2.vcproj: Added LayerTreeHostWin.cpp. Let VS reorder some other files.

git-svn-id: svn://svn.chromium.org/blink/trunk@82966 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a8eb24f7
2011-04-05 Adam Roben <aroben@apple.com>
Disable accelerated compositing on Windows machines that don't support it
This includes machines without the necessary graphics hardware, and machines without
WebKitQuartzCoreAdditions (like the Windows 7 Release (WebKit2 Tests) bots).
Fixes <http://webkit.org/b/57870> REGRESSION (r82960): Lots of tests crashing in
DrawingAreaImpl::enterAcceleratedCompositingMode on Windows 7 Release (WebKit2 Tests)
Reviewed by Anders Carlsson.
* WebProcess/WebPage/LayerTreeHost.h:
(WebKit::LayerTreeHost::supportsAcceleratedCompositing): Added. On platforms other than
Windows, this always returns true.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Only enable accelerated compositing-related
preferences if the machine supports accelerated compositing.
* WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp:
(WebKit::LayerTreeHostCAWin::supportsAcceleratedCompositing): Added. Creates a view, asks it
if it can draw, and returns the result.
* WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h: Added supportsAcceleratedCompositing.
* WebProcess/WebPage/win/LayerTreeHostWin.cpp: Added.
(WebKit::LayerTreeHost::supportsAcceleratedCompositing): Added. Calls through to
LayerTreeHostCAWin in configurations that support that class. Otherwise just returns false.
* win/WebKit2.vcproj: Added LayerTreeHostWin.cpp. Let VS reorder some other files.
2011-04-05 Adam Roben <aroben@apple.com> 2011-04-05 Adam Roben <aroben@apple.com>
Make accelerated compositing work in WebKit2 on Windows Make accelerated compositing work in WebKit2 on Windows
......
...@@ -46,6 +46,8 @@ public: ...@@ -46,6 +46,8 @@ public:
static PassRefPtr<LayerTreeHost> create(WebPage*); static PassRefPtr<LayerTreeHost> create(WebPage*);
virtual ~LayerTreeHost(); virtual ~LayerTreeHost();
static bool supportsAcceleratedCompositing();
virtual const LayerTreeContext& layerTreeContext() = 0; virtual const LayerTreeContext& layerTreeContext() = 0;
virtual void scheduleLayerFlush() = 0; virtual void scheduleLayerFlush() = 0;
virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool) = 0; virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool) = 0;
...@@ -74,6 +76,13 @@ protected: ...@@ -74,6 +76,13 @@ protected:
WebPage* m_webPage; WebPage* m_webPage;
}; };
#if !PLATFORM(WIN)
inline bool LayerTreeHost::supportsAcceleratedCompositing()
{
return true;
}
#endif
} // namespace WebKit } // namespace WebKit
#endif // LayerTreeHost_h #endif // LayerTreeHost_h
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "DrawingArea.h" #include "DrawingArea.h"
#include "InjectedBundle.h" #include "InjectedBundle.h"
#include "InjectedBundleBackForwardList.h" #include "InjectedBundleBackForwardList.h"
#include "LayerTreeHost.h"
#include "MessageID.h" #include "MessageID.h"
#include "NetscapePlugin.h" #include "NetscapePlugin.h"
#include "PageOverlay.h" #include "PageOverlay.h"
...@@ -1411,9 +1412,9 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) ...@@ -1411,9 +1412,9 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
settings->setDefaultFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFontSizeKey())); settings->setDefaultFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFontSizeKey()));
settings->setDefaultFixedFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFixedFontSizeKey())); settings->setDefaultFixedFontSize(store.getUInt32ValueForKey(WebPreferencesKey::defaultFixedFontSizeKey()));
settings->setAcceleratedCompositingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedCompositingEnabledKey())); settings->setAcceleratedCompositingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedCompositingEnabledKey()) && LayerTreeHost::supportsAcceleratedCompositing());
settings->setAcceleratedDrawingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedDrawingEnabledKey())); settings->setAcceleratedDrawingEnabled(store.getBoolValueForKey(WebPreferencesKey::acceleratedDrawingEnabledKey()) && LayerTreeHost::supportsAcceleratedCompositing());
settings->setCanvasUsesAcceleratedDrawing(store.getBoolValueForKey(WebPreferencesKey::canvasUsesAcceleratedDrawingKey())); settings->setCanvasUsesAcceleratedDrawing(store.getBoolValueForKey(WebPreferencesKey::canvasUsesAcceleratedDrawingKey()) && LayerTreeHost::supportsAcceleratedCompositing());
settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey())); settings->setShowDebugBorders(store.getBoolValueForKey(WebPreferencesKey::compositingBordersVisibleKey()));
settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey())); settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey()));
settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey())); settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey()));
......
...@@ -76,6 +76,29 @@ static HWND createDummyWindow() ...@@ -76,6 +76,29 @@ static HWND createDummyWindow()
return ::CreateWindowW(dummyWindowClass, 0, WS_POPUP, 0, 0, 10, 10, 0, 0, instanceHandle(), 0); return ::CreateWindowW(dummyWindowClass, 0, WS_POPUP, 0, 0, 10, 10, 0, 0, instanceHandle(), 0);
} }
bool LayerTreeHostCAWin::supportsAcceleratedCompositing()
{
static bool initialized;
static bool supportsAcceleratedCompositing;
if (initialized)
return supportsAcceleratedCompositing;
initialized = true;
ASSERT(!dummyWindow);
dummyWindow = createDummyWindow();
RetainPtr<WKCACFViewRef> view(AdoptCF, WKCACFViewCreate(kWKCACFViewDrawingDestinationImage));
CGRect fakeBounds = CGRectMake(0, 0, 10, 10);
WKCACFViewUpdate(view.get(), dummyWindow, &fakeBounds);
supportsAcceleratedCompositing = WKCACFViewCanDraw(view.get());
WKCACFViewUpdate(view.get(), 0, 0);
::DestroyWindow(dummyWindow);
dummyWindow = 0;
return supportsAcceleratedCompositing;
}
PassRefPtr<LayerTreeHostCAWin> LayerTreeHostCAWin::create(WebPage* webPage) PassRefPtr<LayerTreeHostCAWin> LayerTreeHostCAWin::create(WebPage* webPage)
{ {
RefPtr<LayerTreeHostCAWin> host = adoptRef(new LayerTreeHostCAWin(webPage)); RefPtr<LayerTreeHostCAWin> host = adoptRef(new LayerTreeHostCAWin(webPage));
......
...@@ -41,6 +41,8 @@ namespace WebKit { ...@@ -41,6 +41,8 @@ namespace WebKit {
class LayerTreeHostCAWin : public LayerTreeHostCA, private WebCore::AbstractCACFLayerTreeHost { class LayerTreeHostCAWin : public LayerTreeHostCA, private WebCore::AbstractCACFLayerTreeHost {
public: public:
static bool supportsAcceleratedCompositing();
static PassRefPtr<LayerTreeHostCAWin> create(WebPage*); static PassRefPtr<LayerTreeHostCAWin> create(WebPage*);
virtual ~LayerTreeHostCAWin(); virtual ~LayerTreeHostCAWin();
......
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "LayerTreeHost.h"
#if PLATFORM(CA)
#include "LayerTreeHostCAWin.h"
#endif
namespace WebKit {
bool LayerTreeHost::supportsAcceleratedCompositing()
{
#if PLATFORM(CA) && HAVE(WKQCA)
return LayerTreeHostCAWin::supportsAcceleratedCompositing();
#else
return false;
#endif
}
} // namespace WebKit
...@@ -1904,6 +1904,10 @@ ...@@ -1904,6 +1904,10 @@
RelativePath="..\WebProcess\WebPage\win\ChunkedUpdateDrawingAreaWin.cpp" RelativePath="..\WebProcess\WebPage\win\ChunkedUpdateDrawingAreaWin.cpp"
> >
</File> </File>
<File
RelativePath="..\WebProcess\WebPage\win\LayerTreeHostWin.cpp"
>
</File>
<File <File
RelativePath="..\WebProcess\WebPage\win\WebInspectorWin.cpp" RelativePath="..\WebProcess\WebPage\win\WebInspectorWin.cpp"
> >
...@@ -2767,15 +2771,15 @@ ...@@ -2767,15 +2771,15 @@
> >
</File> </File>
<File <File
RelativePath="..\UIProcess\WebIconDatabaseClient.cpp" RelativePath="..\UIProcess\WebIconDatabase.messages.in"
> >
</File> </File>
<File <File
RelativePath="..\UIProcess\WebIconDatabaseClient.h" RelativePath="..\UIProcess\WebIconDatabaseClient.cpp"
> >
</File> </File>
<File <File
RelativePath="..\UIProcess\WebIconDatabase.messages.in" RelativePath="..\UIProcess\WebIconDatabaseClient.h"
> >
</File> </File>
<File <File
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment