WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-71869-20111205203134.patch (text/plain), 18.65 KB, created by
David Reveman
on 2011-12-05 17:31:35 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
David Reveman
Created:
2011-12-05 17:31:35 PST
Size:
18.65 KB
patch
obsolete
>Subversion Revision: 102067 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 46008af60cc463a00a9aeed2fa673c4bd94fd0a8..d6894e2529247e82195fb006e1c8f19296645379 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,37 @@ >+2011-12-05 David Reveman <reveman@chromium.org> >+ >+ [Chromium] Implement tile-sized painting using SkPicture >+ https://bugs.webkit.org/show_bug.cgi?id=71869 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-05 Adam Klein <adamk@chromium.org> > > V8RecursionScope should call didLeaveScriptContext when recursionLevel reaches zero >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index 3d93fb4fe926baa5168130639fb0fe4f76576cb5..cf2f22ca84cf9c3474928fc82a3ccd29cb08c93a 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,22 @@ >+2011-12-05 David Reveman <reveman@chromium.org> >+ >+ [Chromium] Implement tile-sized painting using SkPicture >+ https://bugs.webkit.org/show_bug.cgi?id=71869 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-01 Vangelis Kokkevis <vangelis@chromium.org> > > Use ANGLE's texture_usage and texture_storage extensions when allocating compositor textures. >diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi >index 27ee42705470bddc34e63b93109ca76bd7a8b2d6..ed398f8b6185a2de0adc68d8de47e07a57d431eb 100644 >--- a/Source/WebCore/WebCore.gypi >+++ b/Source/WebCore/WebCore.gypi >@@ -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', >diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..8221dd2e521bd63fe0e6f0f9d6224e38dfb34298 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp >@@ -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) >diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9422639d3c92b73fdcb48cfade81751c43e42a81 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h >@@ -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: >+ explicit BitmapSkPictureCanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>, bool useMapTexSubImage); >+ >+ LayerTextureSubImage m_texSubImage; >+}; >+} // namespace WebCore >+#endif // USE(SKIA) >+#endif // USE(ACCELERATED_COMPOSITING) >+#endif // BitmapSkPictureCanvasLayerTextureUpdater_h >diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp >index 3aec3ebff0f12ac618d68ff26170cb26074d1fbb..2a2466d9129aec364093229cb935af82d50724b6 100644 >--- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp >+++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp >@@ -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 @@ void ContentLayerChromium::createTextureUpdater(const CCLayerTreeHost* host) > 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); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >index 872c3c833ee92eca5cdba2f4a09a20e2af6749be..aaad14229d3510ee191021c764c75b4fb473ab55 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >@@ -73,13 +73,15 @@ struct CCSettings { > , 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 >diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h >index dd774990b63a1498ba438ab6f59017d89aecf4b3..356d06723917d83bb47c586d1155751ec4d6e73d 100644 >--- a/Source/WebKit/chromium/public/WebSettings.h >+++ b/Source/WebKit/chromium/public/WebSettings.h >@@ -132,6 +132,8 @@ public: > 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() { } >diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp >index 84ec84331267d5ae4cd885a9abdacf420e216301..d922fc106140bf47a10bbdc5c5e91c022ffd5c21 100644 >--- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp >+++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp >@@ -50,6 +50,7 @@ WebSettingsImpl::WebSettingsImpl(Settings* settings) > , m_compositeToTextureEnabled(false) > , m_showFPSCounter(false) > , m_showPlatformLayerTree(false) >+ , m_perTilePainting(false) > { > ASSERT(settings); > } >@@ -493,4 +494,9 @@ void WebSettingsImpl::setShouldDisplayTextDescriptions(bool enabled) > } > > >+void WebSettingsImpl::setPerTilePainting(bool enabled) >+{ >+ m_perTilePainting = enabled; >+} >+ > } // namespace WebKit >diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h >index 1a09394f00fac8b2ad5e144ec25616a739e18a87..fc593751a5066527ae7ce9da4e4ba3019c4adb64 100644 >--- a/Source/WebKit/chromium/src/WebSettingsImpl.h >+++ b/Source/WebKit/chromium/src/WebSettingsImpl.h >@@ -127,12 +127,15 @@ public: > 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 >diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp >index 06c097296eb8617d20c6b7b2471533d17a230231..6315b52ad87d8ed26caba00c456557046bc67a35 100644 >--- a/Source/WebKit/chromium/src/WebViewImpl.cpp >+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp >@@ -2898,10 +2898,13 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) > 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) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 71869
:
114191
|
114366
|
114545
|
114787
|
115221
|
115891
|
115895
|
116007
|
116294
|
117653
|
117961
|
118100