Title: [102698] trunk/Source
Revision
102698
Author
[email protected]
Date
2011-12-13 13:12:40 -0800 (Tue, 13 Dec 2011)

Log Message

[chromium] compositing/masks layout tests fail with accelerated drawing
https://bugs.webkit.org/show_bug.cgi?id=72760

Reviewed by Stephen White.

Source/WebCore:

Accelerated drawing path used to render bottom-up upright textures, which was opposite of what the software path rendered.
The textures produced by the accelerated path was flipped along Y in the shader to make it upside down as expected by the compositor.
This strategy does not work in case of masks which do not go through a shader and hence do not get flipped,
which results in a case where texture in the render surface is top-down, while that in the mask is bottom-up.
This patch makes accelerated drawing path render textures in the same orientation as the software path.
LayerTextureUpdater::Orientation was added to support the difference in texture orientation between software and accelerated paths.
Now that both paths produce textures in the same orientation, there is no need for it.

No new tests needed. Covered by existing compositing tests.

* platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h:
* platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
* platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
(WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
* platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:
* platform/graphics/chromium/ImageLayerChromium.cpp:
* platform/graphics/chromium/LayerTextureUpdater.h:
* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::TiledLayerChromium):
(WebCore::TiledLayerChromium::setLayerTreeHost):
(WebCore::TiledLayerChromium::pushPropertiesTo):
* platform/graphics/chromium/TiledLayerChromium.h:
* platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
(WebCore::CCTiledLayerImpl::drawTiles):
* platform/graphics/chromium/cc/CCTiledLayerImpl.h:
(WebCore::CCTiledLayerImpl::setSkipsDraw):

Source/WebKit/chromium:

* tests/TiledLayerChromiumTest.cpp:
(WTF::FakeLayerTextureUpdater::createTexture):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102697 => 102698)


--- trunk/Source/WebCore/ChangeLog	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/ChangeLog	2011-12-13 21:12:40 UTC (rev 102698)
@@ -1,3 +1,37 @@
+2011-12-13  Alok Priyadarshi  <[email protected]>
+
+        [chromium] compositing/masks layout tests fail with accelerated drawing
+        https://bugs.webkit.org/show_bug.cgi?id=72760
+
+        Reviewed by Stephen White.
+
+        Accelerated drawing path used to render bottom-up upright textures, which was opposite of what the software path rendered.
+        The textures produced by the accelerated path was flipped along Y in the shader to make it upside down as expected by the compositor.
+        This strategy does not work in case of masks which do not go through a shader and hence do not get flipped,
+        which results in a case where texture in the render surface is top-down, while that in the mask is bottom-up.
+        This patch makes accelerated drawing path render textures in the same orientation as the software path.
+        LayerTextureUpdater::Orientation was added to support the difference in texture orientation between software and accelerated paths.
+        Now that both paths produce textures in the same orientation, there is no need for it.
+
+        No new tests needed. Covered by existing compositing tests.
+
+        * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h:
+        * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h:
+        * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp:
+        (WebCore::FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect):
+        * platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h:
+        * platform/graphics/chromium/ImageLayerChromium.cpp:
+        * platform/graphics/chromium/LayerTextureUpdater.h:
+        * platform/graphics/chromium/TiledLayerChromium.cpp:
+        (WebCore::TiledLayerChromium::TiledLayerChromium):
+        (WebCore::TiledLayerChromium::setLayerTreeHost):
+        (WebCore::TiledLayerChromium::pushPropertiesTo):
+        * platform/graphics/chromium/TiledLayerChromium.h:
+        * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp:
+        (WebCore::CCTiledLayerImpl::drawTiles):
+        * platform/graphics/chromium/cc/CCTiledLayerImpl.h:
+        (WebCore::CCTiledLayerImpl::setSkipsDraw):
+
 2011-12-09  Zhenyao Mo  <[email protected]>
 
         Implement GLES2 CheckFramebufferStatus() behavior

Modified: trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h	2011-12-13 21:12:40 UTC (rev 102698)
@@ -57,7 +57,6 @@
     virtual ~BitmapCanvasLayerTextureUpdater();
 
     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 updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);

Modified: trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h	2011-12-13 21:12:40 UTC (rev 102698)
@@ -56,7 +56,6 @@
     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);

Modified: trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp	2011-12-13 21:12:40 UTC (rev 102698)
@@ -147,6 +147,11 @@
     SkCanvas* canvas = buffer.initialize(context, allocator, texture);
 
     canvas->clipRect(SkRect(destRect));
+    // The compositor expects the textures to be upside-down so it can flip
+    // the final composited image. Ganesh renders the image upright so we
+    // need to do a y-flip.
+    canvas->translate(0.0, texture->size().height());
+    canvas->scale(1.0, -1.0);
     // Translate the origin of contentRect to that of destRect.
     // Note that destRect is defined relative to sourceRect.
     canvas->translate(contentRect().x() - sourceRect.x() + destRect.x(),

Modified: trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/FrameBufferSkPictureCanvasLayerTextureUpdater.h	2011-12-13 21:12:40 UTC (rev 102698)
@@ -53,7 +53,6 @@
     virtual ~FrameBufferSkPictureCanvasLayerTextureUpdater();
 
     virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager*);
-    virtual Orientation orientation() { return LayerTextureUpdater::TopDownOrientation; }
     virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat);
     void updateTextureRect(GraphicsContext3D*, TextureAllocator*, ManagedTexture*, const IntRect& sourceRect, const IntRect& destRect);
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp	2011-12-13 21:12:40 UTC (rev 102698)
@@ -77,8 +77,6 @@
         return adoptPtr(new Texture(this, ManagedTexture::create(manager)));
     }
 
-    virtual Orientation orientation() { return LayerTextureUpdater::BottomUpOrientation; }
-
     virtual SampledTexelFormat sampledTexelFormat(GC3Denum textureFormat)
     {
         return PlatformColor::sameComponentOrder(textureFormat) ?

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h	2011-12-13 21:12:40 UTC (rev 102698)
@@ -60,19 +60,12 @@
 
     virtual ~LayerTextureUpdater() { }
 
-    enum Orientation {
-        BottomUpOrientation,
-        TopDownOrientation,
-        InvalidOrientation,
-    };
     enum SampledTexelFormat {
         SampledTexelFormatRGBA,
         SampledTexelFormatBGRA,
         SampledTexelFormatInvalid,
     };
     virtual PassOwnPtr<Texture> createTexture(TextureManager*) = 0;
-    // Returns the orientation of the texture uploaded by this interface.
-    virtual Orientation orientation() = 0;
     // Returns the format of the texel uploaded by this interface.
     // This format should not be confused by texture internal format.
     // This format specifies the component order in the sampled texel.

Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp	2011-12-13 21:12:40 UTC (rev 102698)
@@ -72,7 +72,6 @@
     : LayerChromium(delegate)
     , m_textureFormat(GraphicsContext3D::INVALID_ENUM)
     , m_skipsDraw(false)
-    , m_textureOrientation(LayerTextureUpdater::InvalidOrientation)
     , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid)
     , m_tilingOption(AutoTile)
 {
@@ -163,7 +162,6 @@
     createTextureUpdater(host);
 
     setTextureFormat(host->layerRendererCapabilities().bestTextureFormat);
-    m_textureOrientation = textureUpdater()->orientation();
     m_sampledTexelFormat = textureUpdater()->sampledTexelFormat(m_textureFormat);
 }
 
@@ -250,7 +248,6 @@
     }
 
     tiledLayer->setSkipsDraw(m_skipsDraw);
-    tiledLayer->setTextureOrientation(m_textureOrientation);
     tiledLayer->setSampledTexelFormat(m_sampledTexelFormat);
     tiledLayer->setTilingData(*m_tiler);
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h	2011-12-13 21:12:40 UTC (rev 102698)
@@ -101,7 +101,6 @@
 
     GC3Denum m_textureFormat;
     bool m_skipsDraw;
-    LayerTextureUpdater::Orientation m_textureOrientation;
     LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;
 
     TilingOption m_tilingOption;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp	2011-12-13 21:12:40 UTC (rev 102698)
@@ -288,13 +288,6 @@
             float fragmentTexScaleX = clampRect.width() / tileWidth;
             float fragmentTexScaleY = clampRect.height() / tileHeight;
 
-            // OpenGL coordinate system is bottom-up.
-            // If tile texture is top-down, we need to flip the texture coordinates.
-            if (m_textureOrientation == LayerTextureUpdater::TopDownOrientation) {
-                fragmentTexTranslateY = 1.0 - fragmentTexTranslateY;
-                fragmentTexScaleY *= -1.0;
-            }
-
             CCLayerQuad::Edge edgeX = contentQuad.right();
             if (i < (m_tiler->numTilesX() - 1)) {
                 FloatPoint p1(tileRect.maxX(), tileRect.y());

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h (102697 => 102698)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h	2011-12-13 21:12:40 UTC (rev 102698)
@@ -49,7 +49,6 @@
     virtual void dumpLayerProperties(TextStream&, int indent) const;
 
     void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
-    void setTextureOrientation(LayerTextureUpdater::Orientation textureOrientation) { m_textureOrientation = textureOrientation; }
     void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTexelFormat) { m_sampledTexelFormat = sampledTexelFormat; }
     void setTilingData(const CCLayerTilingData& tiler);
     void syncTextureId(int, int, Platform3DObject textureId);
@@ -89,7 +88,6 @@
     void drawTiles(LayerRendererChromium*, const IntRect& contentRect, const TransformationMatrix& globalTransform, const TransformationMatrix& deviceTransform, const CCLayerQuad& deviceRect, const CCLayerQuad& contentQuad, float opacity, const T* program, int fragmentTexTransformLocation, int edgeLocation);
 
     bool m_skipsDraw;
-    LayerTextureUpdater::Orientation m_textureOrientation;
     LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;
 
     OwnPtr<CCLayerTilingData> m_tiler;

Modified: trunk/Source/WebKit/chromium/ChangeLog (102697 => 102698)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-12-13 21:12:40 UTC (rev 102698)
@@ -1,3 +1,13 @@
+2011-12-13  Alok Priyadarshi  <[email protected]>
+
+        [chromium] compositing/masks layout tests fail with accelerated drawing
+        https://bugs.webkit.org/show_bug.cgi?id=72760
+
+        Reviewed by Stephen White.
+
+        * tests/TiledLayerChromiumTest.cpp:
+        (WTF::FakeLayerTextureUpdater::createTexture):
+
 2011-12-13  Stephen White  <[email protected]>
 
         Enable CSS_FILTERS in Chromium.

Modified: trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp (102697 => 102698)


--- trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2011-12-13 20:53:17 UTC (rev 102697)
+++ trunk/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2011-12-13 21:12:40 UTC (rev 102698)
@@ -58,7 +58,6 @@
     virtual ~FakeLayerTextureUpdater() { }
 
     virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) { return adoptPtr(new Texture(ManagedTexture::create(manager))); }
-    virtual Orientation orientation() { return BottomUpOrientation; }
     virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; }
     virtual void prepareToUpdate(const IntRect&, const IntSize&, int, float) { }
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to