Title: [113033] trunk/Source
Revision
113033
Author
[email protected]
Date
2012-04-03 07:48:33 -0700 (Tue, 03 Apr 2012)

Log Message

[chromium] Canvas2DLayerChromium::updateCompositorResources should flush after copying
https://bugs.webkit.org/show_bug.cgi?id=83013

Patch by Sami Kyostila <[email protected]> on 2012-04-03
Reviewed by Stephen White.

Source/WebCore:

We need to flush the GPU command queue after copying the canvas back
buffer into the front buffer. Otherwise the copy might be delayed to a
point where new contents have already been drawn into the back buffer,
leading to flickering.

Added test to Canvas2DLayerChromiumTest.

* platform/graphics/chromium/Canvas2DLayerChromium.cpp:
(WebCore::Canvas2DLayerChromium::updateCompositorResources):

Source/WebKit/chromium:

* tests/Canvas2DLayerChromiumTest.cpp: Make sure context is flushed after copying.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113032 => 113033)


--- trunk/Source/WebCore/ChangeLog	2012-04-03 14:29:32 UTC (rev 113032)
+++ trunk/Source/WebCore/ChangeLog	2012-04-03 14:48:33 UTC (rev 113033)
@@ -1,3 +1,20 @@
+2012-04-03  Sami Kyostila  <[email protected]>
+
+        [chromium] Canvas2DLayerChromium::updateCompositorResources should flush after copying
+        https://bugs.webkit.org/show_bug.cgi?id=83013
+
+        Reviewed by Stephen White.
+
+        We need to flush the GPU command queue after copying the canvas back
+        buffer into the front buffer. Otherwise the copy might be delayed to a
+        point where new contents have already been drawn into the back buffer,
+        leading to flickering.
+
+        Added test to Canvas2DLayerChromiumTest.
+
+        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
+        (WebCore::Canvas2DLayerChromium::updateCompositorResources):
+
 2012-04-03  Alexis Menard  <[email protected]>
 
         [Part 2] We should use CSSPropertyID rather than integers when manipulating CSS property ids.

Modified: trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp (113032 => 113033)


--- trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp	2012-04-03 14:29:32 UTC (rev 113032)
+++ trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp	2012-04-03 14:48:33 UTC (rev 113033)
@@ -136,6 +136,7 @@
 
     m_frontTexture->allocate(updater.allocator());
     updater.copier()->copyTexture(context, m_backTextureId, m_frontTexture->textureId(), m_size);
+    GLC(context, context->flush());
 }
 
 void Canvas2DLayerChromium::pushPropertiesTo(CCLayerImpl* layer)

Modified: trunk/Source/WebKit/chromium/ChangeLog (113032 => 113033)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-04-03 14:29:32 UTC (rev 113032)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-04-03 14:48:33 UTC (rev 113033)
@@ -1,3 +1,12 @@
+2012-04-03  Sami Kyostila  <[email protected]>
+
+        [chromium] Canvas2DLayerChromium::updateCompositorResources should flush after copying
+        https://bugs.webkit.org/show_bug.cgi?id=83013
+
+        Reviewed by Stephen White.
+
+        * tests/Canvas2DLayerChromiumTest.cpp: Make sure context is flushed after copying.
+
 2012-04-03  Pavel Feldman  <[email protected]>
 
         Web Inspector: [chromium] add provisional save method into the frontend client.

Modified: trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp (113032 => 113033)


--- trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp	2012-04-03 14:29:32 UTC (rev 113032)
+++ trunk/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp	2012-04-03 14:48:33 UTC (rev 113033)
@@ -74,17 +74,7 @@
 
 class MockCanvasContext : public FakeWebGraphicsContext3D {
 public:
-    MOCK_METHOD0(createFramebuffer, WebGLId());
-    MOCK_METHOD0(createTexture, WebGLId());
-
-    MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId));
-    MOCK_METHOD5(framebufferTexture2D, void(WGC3Denum, WGC3Denum, WGC3Denum, WebGLId, WGC3Dint));
-
-    MOCK_METHOD2(bindTexture, void(WGC3Denum, WebGLId));
-    MOCK_METHOD8(copyTexSubImage2D, void(WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei));
-
-    MOCK_METHOD1(deleteFramebuffer, void(WebGLId));
-    MOCK_METHOD1(deleteTexture, void(WebGLId));
+    MOCK_METHOD0(flush, void(void));
 };
 
 class MockTextureAllocator : public TextureAllocator {
@@ -107,6 +97,9 @@
         RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
         RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
 
+        MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get()));
+        MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get()));
+
         MockTextureAllocator allocatorMock;
         MockTextureCopier copierMock;
         CCTextureUpdater updater(&allocatorMock, &copierMock);
@@ -127,6 +120,9 @@
         {
             InSequence sequence;
 
+            // Paint canvas contents on the main thread.
+            EXPECT_CALL(mainMock, flush());
+
             // Note that the canvas backing texture is doublebuffered only when using the threaded
             // compositor.
             if (threaded) {
@@ -134,6 +130,7 @@
                 EXPECT_CALL(allocatorMock, createTexture(size, GraphicsContext3D::RGBA))
                     .WillOnce(Return(frontTextureId));
                 EXPECT_CALL(copierMock, copyTexture(implContext.get(), backTextureId, frontTextureId, size));
+                EXPECT_CALL(implMock, flush());
 
                 // Teardown TextureManager.
                 EXPECT_CALL(allocatorMock, deleteTexture(frontTextureId, size, GraphicsContext3D::RGBA));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to