Title: [126878] trunk/Source/WebKit/blackberry
Revision
126878
Author
[email protected]
Date
2012-08-28 08:12:58 -0700 (Tue, 28 Aug 2012)

Log Message

[BlackBerry] One shot drawing synchronization broken
https://bugs.webkit.org/show_bug.cgi?id=95179

Patch by Andrew Lo <[email protected]> on 2012-08-28
Reviewed by Antonio Gomes.
Internally reviewed by Arvid Nilsson.

Make sure no backing store blits happen during one shot drawing
synchronization.
Since we always blit during commit now, make sure we don't blit if
we commit after a render.
We no longer need a deferred blit since we don't commit during renderContents
now. Instead, we only commit & blit once after a full render job.

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate):
(BlackBerry::WebKit::BackingStorePrivate::repaint):
(BlackBerry::WebKit::BackingStorePrivate::slowScroll):
(BlackBerry::WebKit::BackingStorePrivate::renderJob):
(BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
(BlackBerry::WebKit::BackingStorePrivate::blitContents):
(BlackBerry::WebKit::BackingStorePrivate::renderContents):
(WebKit):
(BlackBerry::WebKit::BackingStorePrivate::drawAndBlendLayersForDirectRendering):
(BlackBerry::WebKit::BackingStorePrivate::didRenderContent):
* Api/BackingStore_p.h:
(BackingStorePrivate):
* Api/WebPage.cpp:
(WebKit):
(BlackBerry::WebKit::WebPagePrivate::rootLayerCommitTimerFired):
* Api/WebPage_p.h:
(WebPagePrivate):
* WebKitSupport/RenderQueue.cpp:
(BlackBerry::WebKit::RenderQueue::renderAllCurrentRegularRenderJobs):
(BlackBerry::WebKit::RenderQueue::renderRegularRenderJob):
(BlackBerry::WebKit::RenderQueue::visibleScrollJobsCompleted):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/BackingStore.cpp (126877 => 126878)


--- trunk/Source/WebKit/blackberry/Api/BackingStore.cpp	2012-08-28 15:03:30 UTC (rev 126877)
+++ trunk/Source/WebKit/blackberry/Api/BackingStore.cpp	2012-08-28 15:12:58 UTC (rev 126878)
@@ -208,7 +208,6 @@
     , m_currentWindowBackBuffer(0)
     , m_preferredTileMatrixDimension(Vertical)
 #if USE(ACCELERATED_COMPOSITING)
-    , m_needsDrawLayersOnCommit(false)
     , m_isDirectRenderingAnimationMessageScheduled(false)
 #endif
 {
@@ -390,7 +389,7 @@
 
         if (immediate) {
             if (render(rect)) {
-                if (!shouldDirectRenderingToWindow())
+                if (!shouldDirectRenderingToWindow() && !m_webPage->d->commitRootLayerIfNeeded())
                     blitVisibleContents();
                 m_webPage->d->m_client->notifyContentRendered(rect);
             }
@@ -413,7 +412,7 @@
     Platform::IntRect rect = m_webPage->d->mapToTransformed(m_client->mapFromViewportToContents(windowRect));
 
     if (immediate) {
-        if (render(rect) && !isSuspended() && !shouldDirectRenderingToWindow())
+        if (render(rect) && !isSuspended() && !shouldDirectRenderingToWindow() && !m_webPage->d->commitRootLayerIfNeeded())
             blitVisibleContents();
     } else {
         m_renderQueue->addToQueue(RenderQueue::VisibleScroll, rect);
@@ -523,7 +522,7 @@
     m_renderQueue->render(!m_suspendRegularRenderJobs);
 
 #if USE(ACCELERATED_COMPOSITING)
-    drawLayersOnCommitIfNeeded();
+    m_webPage->d->commitRootLayerIfNeeded();
 #endif
 
     if (shouldPerformRenderJobs())
@@ -1147,11 +1146,6 @@
     }
 
     if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
-#if USE(ACCELERATED_COMPOSITING)
-        // The blit will draw accelerated compositing layers if necessary
-        m_needsDrawLayersOnCommit = false;
-#endif
-
         BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchMessage(
             BlackBerry::Platform::createMethodCallMessage(
                 &BackingStorePrivate::blitVisibleContents, this, force));
@@ -1247,11 +1241,6 @@
     }
 
     if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
-#if USE(ACCELERATED_COMPOSITING)
-        // The blit will draw accelerated compositing layers if necessary
-        m_needsDrawLayersOnCommit = false;
-#endif
-
         BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchMessage(
             BlackBerry::Platform::createMethodCallMessage(
                 &BackingStorePrivate::blitContents, this, dstRect, srcRect, force));
@@ -2288,18 +2277,6 @@
     if (contentsSize.isEmpty())
         return;
 
-#if USE(ACCELERATED_COMPOSITING)
-    // When committing the pending accelerated compositing layer changes, it's
-    // necessary to draw the new layer appearance. This is normally done as
-    // part of a blit, but if no blit happens because of this rendering, for
-    // example because we're rendering an offscreen rectangle, someone needs to
-    // catch this flag and make sure those layers get drawn.
-    // This is just a complicated way to do
-    // "if (commitRootLayerIfNeeded()) drawLayersOnCommit();"
-    if (m_webPage->d->commitRootLayerIfNeeded())
-        m_needsDrawLayersOnCommit = true;
-#endif
-
     BlackBerry::Platform::Graphics::Drawable* bufferDrawable =
         BlackBerry::Platform::Graphics::lockBufferDrawable(targetBuffer);
 
@@ -2601,18 +2578,6 @@
 }
 
 #if USE(ACCELERATED_COMPOSITING)
-bool BackingStorePrivate::drawLayersOnCommitIfNeeded()
-{
-    // Check if rendering caused a commit and we need to redraw the layers
-    if (!m_needsDrawLayersOnCommit)
-        return false;
-
-    m_needsDrawLayersOnCommit = false;
-    m_webPage->d->drawLayersOnCommit();
-
-    return true;
-}
-
 void BackingStorePrivate::drawAndBlendLayersForDirectRendering(const Platform::IntRect& dirtyRect)
 {
     ASSERT(BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread());
@@ -2628,7 +2593,6 @@
         WebCore::IntRect(WebCore::IntPoint(0, 0), m_webPage->d->transformedViewportSize()));
 
     // Check if rendering caused a commit and we need to redraw the layers.
-    m_needsDrawLayersOnCommit = false;
     if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor())
         compositor->drawLayers(dstRect, untransformedContentsRect);
 
@@ -2648,6 +2612,20 @@
     return BackingStorePrivate::s_currentBackingStoreOwner == m_webPage && SurfacePool::globalSurfacePool()->isActive();
 }
 
+void BackingStorePrivate::didRenderContent(const Platform::IntRect& renderedRect)
+{
+    if (isScrollingOrZooming())
+        return;
+
+    if (!shouldDirectRenderingToWindow()) {
+        if (!m_webPage->d->needsOneShotDrawingSynchronization())
+            blitVisibleContents();
+    } else
+        invalidateWindow();
+
+    m_webPage->client()->notifyContentRendered(renderedRect);
+}
+
 BackingStore::BackingStore(WebPage* webPage, BackingStoreClient* client)
     : d(new BackingStorePrivate)
 {

Modified: trunk/Source/WebKit/blackberry/Api/BackingStore_p.h (126877 => 126878)


--- trunk/Source/WebKit/blackberry/Api/BackingStore_p.h	2012-08-28 15:03:30 UTC (rev 126877)
+++ trunk/Source/WebKit/blackberry/Api/BackingStore_p.h	2012-08-28 15:12:58 UTC (rev 126878)
@@ -334,6 +334,8 @@
     BlackBerry::Platform::IntSize surfaceSize() const;
     BlackBerry::Platform::Graphics::Buffer* buffer() const;
 
+    void didRenderContent(const Platform::IntRect& renderedRect);
+
     static WebPage* s_currentBackingStoreOwner;
 
     unsigned m_suspendScreenUpdates;

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (126877 => 126878)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-08-28 15:03:30 UTC (rev 126877)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-08-28 15:12:58 UTC (rev 126878)
@@ -5486,31 +5486,6 @@
 }
 
 #if USE(ACCELERATED_COMPOSITING)
-void WebPagePrivate::drawLayersOnCommit()
-{
-    if (!Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
-        // This method will only be called when the layer appearance changed due to
-        // animations. And only if we don't need a one shot drawing sync.
-        ASSERT(!needsOneShotDrawingSynchronization());
-
-        if (!m_webPage->isVisible())
-            return;
-
-        m_backingStore->d->willDrawLayersOnCommit();
-
-        Platform::userInterfaceThreadMessageClient()->dispatchMessage(
-            Platform::createMethodCallMessage(&WebPagePrivate::drawLayersOnCommit, this));
-        return;
-    }
-
-#if DEBUG_AC_COMMIT
-    Platform::log(Platform::LogLevelCritical, "%s", WTF_PRETTY_FUNCTION);
-#endif
-
-    if (!m_backingStore->d->shouldDirectRenderingToWindow())
-        m_backingStore->d->blitVisibleContents();
-}
-
 void WebPagePrivate::scheduleRootLayerCommit()
 {
     if (!(m_frameLayers && m_frameLayers->hasLayer()) && !m_overlayLayer)
@@ -5759,10 +5734,7 @@
         }
     }
 
-    // If the web page needs layout, the commit will fail.
-    // No need to draw the layers if nothing changed.
-    if (commitRootLayerIfNeeded())
-        drawLayersOnCommit();
+    commitRootLayerIfNeeded();
 }
 
 void WebPagePrivate::resetCompositingSurface()

Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (126877 => 126878)


--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h	2012-08-28 15:03:30 UTC (rev 126877)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h	2012-08-28 15:12:58 UTC (rev 126878)
@@ -409,7 +409,6 @@
 
     // Thread safe.
     void resetCompositingSurface();
-    void drawLayersOnCommit(); // Including backing store blit.
 
     // Compositing thread.
     void setRootLayerCompositingThread(WebCore::LayerCompositingThread*);

Modified: trunk/Source/WebKit/blackberry/ChangeLog (126877 => 126878)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-08-28 15:03:30 UTC (rev 126877)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-08-28 15:12:58 UTC (rev 126878)
@@ -1,3 +1,41 @@
+2012-08-28  Andrew Lo  <[email protected]>
+
+        [BlackBerry] One shot drawing synchronization broken
+        https://bugs.webkit.org/show_bug.cgi?id=95179
+
+        Reviewed by Antonio Gomes.
+        Internally reviewed by Arvid Nilsson.
+
+        Make sure no backing store blits happen during one shot drawing
+        synchronization.
+        Since we always blit during commit now, make sure we don't blit if
+        we commit after a render.
+        We no longer need a deferred blit since we don't commit during renderContents
+        now. Instead, we only commit & blit once after a full render job.
+
+        * Api/BackingStore.cpp:
+        (BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate):
+        (BlackBerry::WebKit::BackingStorePrivate::repaint):
+        (BlackBerry::WebKit::BackingStorePrivate::slowScroll):
+        (BlackBerry::WebKit::BackingStorePrivate::renderJob):
+        (BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
+        (BlackBerry::WebKit::BackingStorePrivate::blitContents):
+        (BlackBerry::WebKit::BackingStorePrivate::renderContents):
+        (WebKit):
+        (BlackBerry::WebKit::BackingStorePrivate::drawAndBlendLayersForDirectRendering):
+        (BlackBerry::WebKit::BackingStorePrivate::didRenderContent):
+        * Api/BackingStore_p.h:
+        (BackingStorePrivate):
+        * Api/WebPage.cpp:
+        (WebKit):
+        (BlackBerry::WebKit::WebPagePrivate::rootLayerCommitTimerFired):
+        * Api/WebPage_p.h:
+        (WebPagePrivate):
+        * WebKitSupport/RenderQueue.cpp:
+        (BlackBerry::WebKit::RenderQueue::renderAllCurrentRegularRenderJobs):
+        (BlackBerry::WebKit::RenderQueue::renderRegularRenderJob):
+        (BlackBerry::WebKit::RenderQueue::visibleScrollJobsCompleted):
+
 2012-08-28  Parth Patel  <[email protected]>
 
         [BlackBerry] Removing unnecessary include of Class BlackBerryPlatformClient

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp (126877 => 126878)


--- trunk/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp	2012-08-28 15:03:30 UTC (rev 126877)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp	2012-08-28 15:12:58 UTC (rev 126878)
@@ -655,14 +655,8 @@
     m_currentRegularRenderJobsBatchRegion = Platform::IntRectRegion();
     m_currentRegularRenderJobsBatchUnderPressure = false;
 
-    // Update the screen only if we're not scrolling or zooming.
-    if (rendered && !m_parent->isScrollingOrZooming()) {
-        if (!m_parent->shouldDirectRenderingToWindow())
-            m_parent->blitVisibleContents();
-        else
-            m_parent->invalidateWindow();
-        m_parent->m_webPage->client()->notifyContentRendered(renderedRect);
-    }
+    if (rendered)
+        m_parent->didRenderContent(renderedRect);
 
     if (m_parent->shouldSuppressNonVisibleRegularRenderJobs() && !regionNotRendered.isEmpty())
         m_parent->updateTilesForScrollOrNotRenderedRegion(false /*checkLoading*/);
@@ -810,14 +804,7 @@
         // Clear the region and the and blit since this batch is now complete.
         m_currentRegularRenderJobsBatchRegion = Platform::IntRectRegion();
         m_currentRegularRenderJobsBatchUnderPressure = false;
-        // Update the screen only if we're not scrolling or zooming.
-        if (!m_parent->isScrollingOrZooming()) {
-            if (!m_parent->shouldDirectRenderingToWindow())
-                m_parent->blitVisibleContents();
-            else
-                m_parent->invalidateWindow();
-            m_parent->m_webPage->client()->notifyContentRendered(renderedRect);
-        }
+        m_parent->didRenderContent(renderedRect);
     }
 
     // Make sure we didn't alter state of the queues that should have been empty
@@ -880,13 +867,8 @@
     // Now blit to the screen if we are done and get rid of the completed list!
     ASSERT(m_visibleScrollJobs.empty());
     m_visibleScrollJobsCompleted.clear();
-    if (shouldBlit && !m_parent->isScrollingOrZooming()) {
-        if (!m_parent->shouldDirectRenderingToWindow())
-            m_parent->blitVisibleContents();
-        else
-            m_parent->invalidateWindow();
-        m_parent->m_webPage->client()->notifyContentRendered(m_parent->visibleContentsRect());
-    }
+    if (shouldBlit)
+        m_parent->didRenderContent(m_parent->visibleContentsRect());
 }
 
 void RenderQueue::nonVisibleScrollJobsCompleted()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to