Diff
Modified: trunk/Source/WebCore/ChangeLog (102180 => 102181)
--- trunk/Source/WebCore/ChangeLog 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebCore/ChangeLog 2011-12-06 22:37:12 UTC (rev 102181)
@@ -1,3 +1,37 @@
+2011-12-06 David Reveman <reve...@chromium.org>
+
+ [Chromium] Implement tile-sized painting using SkPicture.
+ https://bugs.webkit.org/show_bug.cgi?id=71869
+
+ Reviewed by James Robinson.
+
+ Add texture uploader that paints tile-sized chunks using SkPicture
+ recording and playback. Expose setting which allows this texture
+ updater to be enabled.
+
+ No new tests. Covered by existing tests.
+
+ * WebCore.gypi:
+ * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp: Added.
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::create):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::~BitmapSkPictureCanvasLayerTextureUpdater):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::createTexture):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::sampledTexelFormat):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::prepareToUpdate):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::updateTextureRect):
+ * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: Added.
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::textureUpdater):
+ (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::orientation):
+ * platform/graphics/chromium/ContentLayerChromium.cpp:
+ (WebCore::ContentLayerChromium::createTextureUpdater):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ (WebCore::CCSettings::CCSettings):
+
2011-12-06 Adrienne Walker <e...@google.com>
[chromium] Don't crash if tile upload happens without painting first
Modified: trunk/Source/WebCore/WebCore.gypi (102180 => 102181)
--- trunk/Source/WebCore/WebCore.gypi 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebCore/WebCore.gypi 2011-12-06 22:37:12 UTC (rev 102181)
@@ -3483,6 +3483,8 @@
'platform/graphics/cg/TransformationMatrixCG.cpp',
'platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp',
'platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h',
+ 'platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp',
+ 'platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h',
'platform/graphics/chromium/Canvas2DLayerChromium.cpp',
'platform/graphics/chromium/Canvas2DLayerChromium.h',
'platform/graphics/chromium/CanvasLayerChromium.cpp',
Added: trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp (0 => 102181)
--- trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp 2011-12-06 22:37:12 UTC (rev 102181)
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2011 Google 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 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 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"
+
+#if USE(ACCELERATED_COMPOSITING)
+#if USE(SKIA)
+
+#include "BitmapSkPictureCanvasLayerTextureUpdater.h"
+
+#include "LayerPainterChromium.h"
+#include "SkCanvas.h"
+#include "skia/ext/platform_canvas.h"
+
+namespace WebCore {
+
+BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater, PassOwnPtr<ManagedTexture> texture)
+ : CanvasLayerTextureUpdater::Texture(texture)
+ , m_textureUpdater(textureUpdater)
+{
+}
+
+void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRect& sourceRect)
+{
+ size_t bufferSize = TextureManager::memoryUseBytes(sourceRect.size(), texture()->format());
+ m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]);
+ OwnPtr<SkCanvas> canvas = adoptPtr(new skia::PlatformCanvas(sourceRect.width(), sourceRect.height(), false, m_pixelData.get()));
+ textureUpdater()->paintContentsRect(canvas.get(), sourceRect);
+}
+
+void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect)
+{
+ texture()->bindTexture(context, allocator);
+ ASSERT(m_pixelData.get());
+ textureUpdater()->updateTextureRect(context, texture()->format(), destRect, m_pixelData.get());
+ m_pixelData.clear();
+}
+
+PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage)
+{
+ return adoptRef(new BitmapSkPictureCanvasLayerTextureUpdater(painter, useMapTexSubImage));
+}
+
+BitmapSkPictureCanvasLayerTextureUpdater::BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage)
+ : SkPictureCanvasLayerTextureUpdater(painter)
+ , m_texSubImage(useMapTexSubImage)
+{
+}
+
+BitmapSkPictureCanvasLayerTextureUpdater::~BitmapSkPictureCanvasLayerTextureUpdater()
+{
+}
+
+PassOwnPtr<LayerTextureUpdater::Texture> BitmapSkPictureCanvasLayerTextureUpdater::createTexture(TextureManager* manager)
+{
+ return adoptPtr(new Texture(this, ManagedTexture::create(manager)));
+}
+
+LayerTextureUpdater::SampledTexelFormat BitmapSkPictureCanvasLayerTextureUpdater::sampledTexelFormat(GC3Denum textureFormat)
+{
+ // The component order may be bgra if we uploaded bgra pixels to rgba textures.
+ return PlatformColor::sameComponentOrder(textureFormat) ?
+ LayerTextureUpdater::SampledTexelFormatRGBA : LayerTextureUpdater::SampledTexelFormatBGRA;
+}
+
+void BitmapSkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale)
+{
+ m_texSubImage.setSubImageSize(tileSize);
+ SkPictureCanvasLayerTextureUpdater::prepareToUpdate(contentRect, tileSize, borderTexels, contentsScale);
+}
+
+void BitmapSkPictureCanvasLayerTextureUpdater::paintContentsRect(SkCanvas* canvas, const IntRect& sourceRect)
+{
+ // Translate the origin of contentRect to that of sourceRect.
+ canvas->translate(contentRect().x() - sourceRect.x(),
+ contentRect().y() - sourceRect.y());
+ drawPicture(canvas);
+}
+
+void BitmapSkPictureCanvasLayerTextureUpdater::updateTextureRect(GraphicsContext3D* context, GC3Denum format, const IntRect& destRect, const uint8_t* pixels)
+{
+ m_texSubImage.upload(pixels, destRect, destRect, destRect, format, context);
+}
+
+} // namespace WebCore
+#endif // USE(SKIA)
+#endif // USE(ACCELERATED_COMPOSITING)
Added: trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h (0 => 102181)
--- trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h 2011-12-06 22:37:12 UTC (rev 102181)
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2011 Google 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 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 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.
+ */
+
+
+#ifndef BitmapSkPictureCanvasLayerTextureUpdater_h
+#define BitmapSkPictureCanvasLayerTextureUpdater_h
+
+#if USE(ACCELERATED_COMPOSITING)
+#if USE(SKIA)
+
+#include "LayerTextureSubImage.h"
+#include "PlatformColor.h"
+#include "SkPictureCanvasLayerTextureUpdater.h"
+
+namespace WebCore {
+
+class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater {
+public:
+ class Texture : public CanvasLayerTextureUpdater::Texture {
+ public:
+ Texture(BitmapSkPictureCanvasLayerTextureUpdater*, PassOwnPtr<ManagedTexture>);
+
+ virtual void prepareRect(const IntRect& sourceRect);
+ virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect);
+
+ private:
+ BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; }
+
+ OwnArrayPtr<uint8_t> m_pixelData;
+ BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater;
+ };
+
+ static PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> create(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage);
+ virtual ~BitmapSkPictureCanvasLayerTextureUpdater();
+
+ virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*);
+ virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; }
+ virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
+ virtual void prepareToUpdate(const IntRect& contentRect, const IntSize& tileSize, int borderTexels, float contentsScale);
+ void paintContentsRect(SkCanvas*, const IntRect& sourceRect);
+ void updateTextureRect(GraphicsContext3D*, GC3Denum format, const IntRect& destRect, const uint8_t* pixels);
+
+private:
+ BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage);
+
+ LayerTextureSubImage m_texSubImage;
+};
+} // namespace WebCore
+#endif // USE(SKIA)
+#endif // USE(ACCELERATED_COMPOSITING)
+#endif // BitmapSkPictureCanvasLayerTextureUpdater_h
Modified: trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp (102180 => 102181)
--- trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp 2011-12-06 22:37:12 UTC (rev 102181)
@@ -35,6 +35,7 @@
#include "ContentLayerChromium.h"
#include "BitmapCanvasLayerTextureUpdater.h"
+#include "BitmapSkPictureCanvasLayerTextureUpdater.h"
#include "FrameBufferSkPictureCanvasLayerTextureUpdater.h"
#include "LayerPainterChromium.h"
#include "LayerRendererChromium.h"
@@ -120,6 +121,11 @@
m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate));
return;
}
+
+ if (host->settings().perTilePainting) {
+ m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub);
+ return;
+ }
#endif // USE(SKIA)
m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub);
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (102180 => 102181)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2011-12-06 22:37:12 UTC (rev 102181)
@@ -73,13 +73,15 @@
, compositeOffscreen(false)
, showFPSCounter(false)
, showPlatformLayerTree(false)
- , refreshRate(0) { }
+ , refreshRate(0)
+ , perTilePainting(false) { }
bool acceleratePainting;
bool compositeOffscreen;
bool showFPSCounter;
bool showPlatformLayerTree;
double refreshRate;
+ bool perTilePainting;
};
// Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost
Modified: trunk/Source/WebKit/chromium/ChangeLog (102180 => 102181)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-12-06 22:37:12 UTC (rev 102181)
@@ -1,3 +1,22 @@
+2011-12-06 David Reveman <reve...@chromium.org>
+
+ [Chromium] Implement tile-sized painting using SkPicture.
+ https://bugs.webkit.org/show_bug.cgi?id=71869
+
+ Reviewed by James Robinson.
+
+ Add perTilePainting setting that is used by compositor to determine
+ what texture uploader to use.
+
+ * public/WebSettings.h:
+ * src/WebSettingsImpl.cpp:
+ (WebKit::WebSettingsImpl::WebSettingsImpl):
+ (WebKit::WebSettingsImpl::setPerTilePainting):
+ * src/WebSettingsImpl.h:
+ (WebKit::WebSettingsImpl::perTilePainting):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
+
2011-12-06 Dana Jansens <dan...@chromium.org>
[chromium] Set opaque flag for ImageLayerChromium
Modified: trunk/Source/WebKit/chromium/public/WebSettings.h (102180 => 102181)
--- trunk/Source/WebKit/chromium/public/WebSettings.h 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebKit/chromium/public/WebSettings.h 2011-12-06 22:37:12 UTC (rev 102181)
@@ -133,6 +133,8 @@
virtual void setEnableScrollAnimator(bool) = 0;
virtual void setHixie76WebSocketProtocolEnabled(bool) = 0;
virtual void setVisualWordMovementEnabled(bool) = 0;
+ virtual void setPerTilePainting(bool) = 0;
+ virtual bool perTilePainting() const = 0;
protected:
~WebSettings() { }
Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp (102180 => 102181)
--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.cpp 2011-12-06 22:37:12 UTC (rev 102181)
@@ -50,6 +50,7 @@
, m_compositeToTextureEnabled(false)
, m_showFPSCounter(false)
, m_showPlatformLayerTree(false)
+ , m_perTilePainting(false)
{
ASSERT(settings);
}
@@ -498,4 +499,9 @@
}
+void WebSettingsImpl::setPerTilePainting(bool enabled)
+{
+ m_perTilePainting = enabled;
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/chromium/src/WebSettingsImpl.h (102180 => 102181)
--- trunk/Source/WebKit/chromium/src/WebSettingsImpl.h 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebKit/chromium/src/WebSettingsImpl.h 2011-12-06 22:37:12 UTC (rev 102181)
@@ -128,12 +128,15 @@
virtual void setShouldDisplaySubtitles(bool);
virtual void setShouldDisplayCaptions(bool);
virtual void setShouldDisplayTextDescriptions(bool);
+ virtual void setPerTilePainting(bool);
+ virtual bool perTilePainting() const { return m_perTilePainting; }
private:
WebCore::Settings* m_settings;
bool m_compositeToTextureEnabled;
bool m_showFPSCounter;
bool m_showPlatformLayerTree;
+ bool m_perTilePainting;
};
} // namespace WebKit
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (102180 => 102181)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-12-06 22:26:27 UTC (rev 102180)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-12-06 22:37:12 UTC (rev 102181)
@@ -2898,10 +2898,13 @@
ccSettings.showFPSCounter = settings()->showFPSCounter();
ccSettings.showPlatformLayerTree = settings()->showPlatformLayerTree();
ccSettings.refreshRate = screenRefreshRate(page()->mainFrame()->view());
+
ASSERT(ccSettings.refreshRate >= 0);
if (!ccSettings.refreshRate)
ccSettings.refreshRate = defaultRefreshRate;
+ ccSettings.perTilePainting = settings()->perTilePainting();
+
m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this));
m_layerTreeHost = CCLayerTreeHost::create(this, ccSettings);
if (m_layerTreeHost) {