Title: [123416] trunk/Source
Revision
123416
Author
[email protected]
Date
2012-07-23 19:03:53 -0700 (Mon, 23 Jul 2012)

Log Message

[chromium] Use shallow flushes that don't glFlush
https://bugs.webkit.org/show_bug.cgi?id=90325

Patch by Brian Anderson <[email protected]> on 2012-07-23
Reviewed by Kenneth Russell.

Source/Platform:

Adds shallowFlushCHROMIUM to WebGraphicsContext3D.

* chromium/public/WebGraphicsContext3D.h:
(WebGraphicsContext3D):
(WebKit::WebGraphicsContext3D::shallowFlushCHROMIUM):

Source/WebCore:

Adds plumbing for the shallowFlushCHROMIUM extension and uses
shallow flushes instead of normal flushes when uploading textures.
Shallow flushes allow us to initiate command buffer flushes to
the GPU thread/process without the overhead of a true glFlush.

CCTextureUpdaterTest updated to recognize shallow flushes.

* platform/chromium/support/Extensions3DChromium.cpp:
(WebCore::Extensions3DChromium::shallowFlushCHROMIUM):
(WebCore):
* platform/graphics/chromium/Extensions3DChromium.h:
(Extensions3DChromium):
* platform/graphics/chromium/cc/CCGraphicsContext.h:
* platform/graphics/chromium/cc/CCResourceProvider.cpp:
(WebCore::CCResourceProvider::shallowFlushIfSupported):
(WebCore):
(WebCore::CCResourceProvider::CCResourceProvider):
(WebCore::CCResourceProvider::initialize):
* platform/graphics/chromium/cc/CCResourceProvider.h:
(CCResourceProvider):
* platform/graphics/chromium/cc/CCTextureUpdater.cpp:
(WebCore::CCTextureUpdater::update):

Source/WebKit/chromium:

Changed CCTextureUpdaterTest to recognize shallowFlushCHROMIUM().

* tests/CCTextureUpdaterTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (123415 => 123416)


--- trunk/Source/Platform/ChangeLog	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/Platform/ChangeLog	2012-07-24 02:03:53 UTC (rev 123416)
@@ -1,3 +1,16 @@
+2012-07-23  Brian Anderson  <[email protected]>
+
+        [chromium] Use shallow flushes that don't glFlush
+        https://bugs.webkit.org/show_bug.cgi?id=90325
+
+        Reviewed by Kenneth Russell.
+
+        Adds shallowFlushCHROMIUM to WebGraphicsContext3D.
+
+        * chromium/public/WebGraphicsContext3D.h:
+        (WebGraphicsContext3D):
+        (WebKit::WebGraphicsContext3D::shallowFlushCHROMIUM):
+
 2012-07-23  Tommy Widenflycht  <[email protected]>
 
         [chromium] MediaStream API: Clean up the MockWebKitPlatformSupport object at shutdown

Modified: trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h (123415 => 123416)


--- trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2012-07-24 02:03:53 UTC (rev 123416)
@@ -421,6 +421,9 @@
     virtual void copyTextureCHROMIUM(WGC3Denum target, WGC3Duint sourceId,
                                      WGC3Duint destId, WGC3Dint level, WGC3Denum internalFormat) { }
 
+    // GL_CHROMIUM_shallow_flush
+    virtual void shallowFlushCHROMIUM() { }
+
     GrGLInterface* createGrGLInterface();
 
 protected:

Modified: trunk/Source/WebCore/ChangeLog (123415 => 123416)


--- trunk/Source/WebCore/ChangeLog	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebCore/ChangeLog	2012-07-24 02:03:53 UTC (rev 123416)
@@ -1,3 +1,33 @@
+2012-07-23  Brian Anderson  <[email protected]>
+
+        [chromium] Use shallow flushes that don't glFlush
+        https://bugs.webkit.org/show_bug.cgi?id=90325
+
+        Reviewed by Kenneth Russell.
+
+        Adds plumbing for the shallowFlushCHROMIUM extension and uses
+        shallow flushes instead of normal flushes when uploading textures.
+        Shallow flushes allow us to initiate command buffer flushes to
+        the GPU thread/process without the overhead of a true glFlush.
+
+        CCTextureUpdaterTest updated to recognize shallow flushes.
+
+        * platform/chromium/support/Extensions3DChromium.cpp:
+        (WebCore::Extensions3DChromium::shallowFlushCHROMIUM):
+        (WebCore):
+        * platform/graphics/chromium/Extensions3DChromium.h:
+        (Extensions3DChromium):
+        * platform/graphics/chromium/cc/CCGraphicsContext.h:
+        * platform/graphics/chromium/cc/CCResourceProvider.cpp:
+        (WebCore::CCResourceProvider::shallowFlushIfSupported):
+        (WebCore):
+        (WebCore::CCResourceProvider::CCResourceProvider):
+        (WebCore::CCResourceProvider::initialize):
+        * platform/graphics/chromium/cc/CCResourceProvider.h:
+        (CCResourceProvider):
+        * platform/graphics/chromium/cc/CCTextureUpdater.cpp:
+        (WebCore::CCTextureUpdater::update):
+
 2012-07-23  Hanyee Kim  <[email protected]>
 
         When using TextureMapper, WebKit does not retain final value of opacity in animations, unless it is specified on the last key frame.

Modified: trunk/Source/WebCore/platform/chromium/support/Extensions3DChromium.cpp (123415 => 123416)


--- trunk/Source/WebCore/platform/chromium/support/Extensions3DChromium.cpp	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebCore/platform/chromium/support/Extensions3DChromium.cpp	2012-07-24 02:03:53 UTC (rev 123416)
@@ -176,4 +176,9 @@
     m_private->webContext()->copyTextureCHROMIUM(target, sourceId, destId, level, internalFormat);
 }
 
+void Extensions3DChromium::shallowFlushCHROMIUM()
+{
+    return m_private->webContext()->shallowFlushCHROMIUM();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h (123415 => 123416)


--- trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h	2012-07-24 02:03:53 UTC (rev 123416)
@@ -38,6 +38,7 @@
     virtual ~Extensions3DChromium();
 
     // Supported extensions:
+    //   GL_CHROMIUM_shallow_flush  : only supported if an ipc command buffer is used.
     //   GL_CHROMIUM_resource_safe  : indicating that textures/renderbuffers are always initialized before read/write.
     //   GL_CHROMIUM_strict_attribs : indicating a GL error is generated for out-of-bounds buffer accesses.
     //   GL_CHROMIUM_post_sub_buffer
@@ -122,6 +123,9 @@
     // GL_CHROMIUM_copy_texture
     void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum);
 
+    // GL_CHROMIUM_shallow_flush
+    virtual void shallowFlushCHROMIUM();
+
 private:
     // Instances of this class are strictly owned by the GraphicsContext3D implementation and do not
     // need to be instantiated by any other code.

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h (123415 => 123416)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h	2012-07-24 02:03:53 UTC (rev 123416)
@@ -48,12 +48,6 @@
 
     WebKit::WebGraphicsContext3D* context3D() { return m_context3D.get(); }
 
-    void flush()
-    {
-        if (m_context3D)
-            m_context3D->flush();
-    }
-
 private:
     CCGraphicsContext() { }
     explicit CCGraphicsContext(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp (123415 => 123416)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.cpp	2012-07-24 02:03:53 UTC (rev 123416)
@@ -195,6 +195,20 @@
     context3d->flush();
 }
 
+bool CCResourceProvider::shallowFlushIfSupported()
+{
+    ASSERT(CCProxy::isImplThread());
+    WebGraphicsContext3D* context3d = m_context->context3D();
+    if (!context3d) {
+        // FIXME: Implement this path for software compositing.
+        return false;
+    }
+
+    if (m_useShallowFlush)
+        context3d->shallowFlushCHROMIUM();
+    return m_useShallowFlush;
+}
+
 unsigned CCResourceProvider::lockForRead(ResourceId id)
 {
     ASSERT(CCProxy::isImplThread());
@@ -217,6 +231,7 @@
     , m_nextId(1)
     , m_useTextureStorageExt(false)
     , m_useTextureUsageHint(false)
+    , m_useShallowFlush(false)
     , m_maxTextureSize(0)
 {
 }
@@ -240,6 +255,8 @@
             m_useTextureUsageHint = true;
         else if (extensions[i] == "GL_CHROMIUM_map_sub")
             useMapSub = true;
+        else if (extensions[i] == "GL_CHROMIUM_shallow_flush")
+            m_useShallowFlush = true;
     }
 
     m_texSubImage = adoptPtr(new LayerTextureSubImage(useMapSub));

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h (123415 => 123416)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCResourceProvider.h	2012-07-24 02:03:53 UTC (rev 123416)
@@ -85,6 +85,10 @@
     // respect to other contexts.
     void flush();
 
+    // Only flush the command buffer if supported.
+    // Returns true if the shallow flush occurred, false otherwise.
+    bool shallowFlushIfSupported();
+
 private:
     friend class CCScopedLockResourceForRead;
     friend class CCScopedLockResourceForWrite;
@@ -117,6 +121,7 @@
 
     bool m_useTextureStorageExt;
     bool m_useTextureUsageHint;
+    bool m_useShallowFlush;
     OwnPtr<LayerTextureSubImage> m_texSubImage;
     int m_maxTextureSize;
 };

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp (123415 => 123416)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp	2012-07-24 02:03:53 UTC (rev 123416)
@@ -102,12 +102,12 @@
             uploader->uploadTexture(entry.texture, resourceProvider, entry.sourceRect, entry.destRect);
             fullUploadCount++;
             if (!(fullUploadCount % kUploadFlushPeriod))
-                resourceProvider->flush();
+                resourceProvider->shallowFlushIfSupported();
         }
 
         // Make sure there are no dangling uploads without a flush.
         if (fullUploadCount % kUploadFlushPeriod)
-            resourceProvider->flush();
+            resourceProvider->shallowFlushIfSupported();
 
         bool moreUploads = maxIndex < m_fullEntries.size();
 
@@ -127,14 +127,14 @@
             UpdateEntry& entry = m_partialEntries[index];
             uploader->uploadTexture(entry.texture, resourceProvider, entry.sourceRect, entry.destRect);
             if (!((index+1) % kUploadFlushPeriod))
-                resourceProvider->flush();
+                resourceProvider->shallowFlushIfSupported();
         }
 
         // Make sure there are no dangling partial uploads without a flush.
         // Note: We don't need to use (index+1) in this case because index was
         // incremented at the end of the for loop.
         if (index % kUploadFlushPeriod)
-            resourceProvider->flush();
+            resourceProvider->shallowFlushIfSupported();
 
         uploader->endUploads();
     }

Modified: trunk/Source/WebKit/chromium/ChangeLog (123415 => 123416)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-24 02:03:53 UTC (rev 123416)
@@ -1,3 +1,14 @@
+2012-07-23  Brian Anderson  <[email protected]>
+
+        [chromium] Use shallow flushes that don't glFlush
+        https://bugs.webkit.org/show_bug.cgi?id=90325
+
+        Reviewed by Kenneth Russell.
+
+        Changed CCTextureUpdaterTest to recognize shallowFlushCHROMIUM().
+
+        * tests/CCTextureUpdaterTest.cpp:
+
 2012-07-23  Adrienne Walker  <[email protected]>
 
         [chromium] Add more compositor unit tests for high DPI transforms

Modified: trunk/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp (123415 => 123416)


--- trunk/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp	2012-07-24 01:59:17 UTC (rev 123415)
+++ trunk/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp	2012-07-24 02:03:53 UTC (rev 123416)
@@ -51,12 +51,25 @@
 
 class WebGraphicsContext3DForUploadTest : public FakeWebGraphicsContext3D {
 public:
-    WebGraphicsContext3DForUploadTest(CCTextureUpdaterTest *test) : m_test(test) { }
+    WebGraphicsContext3DForUploadTest(CCTextureUpdaterTest *test)
+        : m_test(test)
+        , m_supportShallowFlush(true)
+    { }
+
     virtual void flush(void);
+    virtual void shallowFlushCHROMIUM(void);
     virtual GrGLInterface* onCreateGrGLInterface() { return 0; }
 
+    virtual WebString getString(WGC3Denum name)
+    {
+        if (m_supportShallowFlush)
+            return WebString("GL_CHROMIUM_shallow_flush");
+        return WebString("");
+    }
+
 private:
     CCTextureUpdaterTest* m_test;
+    bool m_supportShallowFlush;
 };
 
 
@@ -231,6 +244,11 @@
     m_test->onFlush();
 }
 
+void WebGraphicsContext3DForUploadTest::shallowFlushCHROMIUM(void)
+{
+    m_test->onFlush();
+}
+
 void TextureUploaderForUploadTest::beginUploads()
 {
     m_test->onBeginUploads();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to