Title: [112819] trunk/Source/WebKit/blackberry
Revision
112819
Author
commit-qu...@webkit.org
Date
2012-04-01 14:22:02 -0700 (Sun, 01 Apr 2012)

Log Message

[BlackBerry] Simplify the code that gets accelerated compositing output onto the screen
https://bugs.webkit.org/show_bug.cgi?id=82845

Patch by Arvid Nilsson <anils...@rim.com> on 2012-04-01
Reviewed by Rob Buis.

RIM PR: 136381
The code accounted for a now obsolete setup where we used one OpenGL
window for accelerated compositing and one native window for backing
store output, and let the windowing system composite those two. In that
setup an optimization to try and only update the window that had
changed was viable.

Nowadays, we either use an offscreen surface for accelerated
compositing output, which we blend onto the window containing the
backing store output, or render both backing store and accelerated
compositing output directly to one OpenGL window. We always have to
blit the backingstore contents and draw the accelerated compositing
output every frame with these code paths, so don't try to be clever
about it.

Even when we use an OpenGL window, the compositing surface can be non-
null, so don't try to glFinish() and swap the compositing surface when
the GLES2Context is tied to a window.

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
(BlackBerry::WebKit::BackingStorePrivate::blitContents):
(WebKit):
* Api/BackingStore_p.h:
(BackingStorePrivate):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::drawLayersOnCommit):
* WebKitSupport/GLES2Context.cpp:
(BlackBerry::WebKit::GLES2Context::swapBuffers):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/BackingStore.cpp (112818 => 112819)


--- trunk/Source/WebKit/blackberry/Api/BackingStore.cpp	2012-04-01 20:23:14 UTC (rev 112818)
+++ trunk/Source/WebKit/blackberry/Api/BackingStore.cpp	2012-04-01 21:22:02 UTC (rev 112819)
@@ -1135,7 +1135,7 @@
 
     if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
 #if USE(ACCELERATED_COMPOSITING)
-        // The blit will call drawSubLayers if necessary
+        // The blit will draw accelerated compositing layers if necessary
         m_needsDrawLayersOnCommit = false;
 #endif
 
@@ -1231,7 +1231,7 @@
 
     if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
 #if USE(ACCELERATED_COMPOSITING)
-        // The blit will call drawSubLayers if necessary
+        // The blit will draw accelerated compositing layers if necessary
         m_needsDrawLayersOnCommit = false;
 #endif
 
@@ -1284,14 +1284,7 @@
         transformation = TransformationMatrix::rectToRect(FloatRect(FloatPoint(0.0, 0.0), WebCore::IntSize(contents.size())), WebCore::IntRect(dstRect));
 
     bool blittingDirectlyToCompositingWindow = isOpenGLCompositing();
-#if USE(ACCELERATED_COMPOSITING)
-    BackingStoreCompositingSurface* compositingSurface =
-        SurfacePool::globalSurfacePool()->compositingSurface();
 
-    if (!blittingDirectlyToCompositingWindow)
-        drawSubLayers();
-#endif
-
 #if DEBUG_BACKINGSTORE
     BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical,
                            "BackingStorePrivate::blitContents dstRect=(%d,%d %dx%d) srcRect=(%d,%d %dx%d)",
@@ -1454,14 +1447,13 @@
     }
 
 #if USE(ACCELERATED_COMPOSITING)
-    if (blittingDirectlyToCompositingWindow) {
-        WebCore::FloatRect contentsRect = m_webPage->d->mapFromTransformedFloatRect(
-            WebCore::FloatRect(WebCore::IntRect(contents)));
-        if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor())
-            compositor->drawLayers(dstRect, contentsRect);
-    } else if (compositingSurface)
-        blendCompositingSurface(dstRect);
+    if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor()) {
+        WebCore::FloatRect contentsRect = m_webPage->d->mapFromTransformedFloatRect(WebCore::FloatRect(WebCore::IntRect(contents)));
+        compositor->drawLayers(dstRect, contentsRect);
+    }
 
+    if (!blittingDirectlyToCompositingWindow)
+        blendCompositingSurface(dstRect);
 #endif
 
 #if ENABLE_SCROLLBARS
@@ -2523,28 +2515,6 @@
 }
 
 #if USE(ACCELERATED_COMPOSITING)
-bool BackingStorePrivate::drawSubLayers()
-{
-    ASSERT(BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread());
-    if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread())
-        return false;
-
-    if (m_suspendBackingStoreUpdates && !isOpenGLCompositing())
-        return false;
-
-    if (!m_webPage->d->compositor())
-        return false;
-
-    Platform::IntRect dst = m_webPage->client()->userInterfaceBlittedDestinationRect();
-    if (dst.isEmpty())
-        return false;
-
-    Platform::IntRect src = ""
-    WebCore::FloatRect contentsRect = m_webPage->d->mapFromTransformedFloatRect(
-        WebCore::FloatRect(WebCore::IntRect(src)));
-    return m_webPage->d->compositor()->drawLayers(dst, contentsRect);
-}
-
 bool BackingStorePrivate::drawLayersOnCommitIfNeeded()
 {
     // Check if rendering caused a commit and we need to redraw the layers

Modified: trunk/Source/WebKit/blackberry/Api/BackingStore_p.h (112818 => 112819)


--- trunk/Source/WebKit/blackberry/Api/BackingStore_p.h	2012-04-01 20:23:14 UTC (rev 112818)
+++ trunk/Source/WebKit/blackberry/Api/BackingStore_p.h	2012-04-01 21:22:02 UTC (rev 112819)
@@ -200,7 +200,6 @@
 #if USE(ACCELERATED_COMPOSITING)
     void blendCompositingSurface(const Platform::IntRect& dstRect);
     void clearCompositingSurface();
-    bool drawSubLayers();
     bool drawLayersOnCommitIfNeeded();
     void drawAndBlendLayersForDirectRendering(const Platform::IntRect& dirtyRect);
     // WebPage will call this when drawing layers to tell us we don't need to

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (112818 => 112819)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-04-01 20:23:14 UTC (rev 112818)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-04-01 21:22:02 UTC (rev 112819)
@@ -5181,28 +5181,8 @@
         return;
     }
 
-    if (m_backingStore->d->isOpenGLCompositing()) {
+    if (!m_backingStore->d->shouldDirectRenderingToWindow())
         m_backingStore->d->blitVisibleContents();
-        return; // blitVisibleContents() includes drawSubLayers() in this case.
-    }
-
-    if (!m_backingStore->d->drawSubLayers())
-        return;
-
-    // If we use the compositing surface, we need to re-blit the
-    // backingstore and blend the compositing surface on top of that
-    // in order to get the newly drawn layers on screen.
-    if (!SurfacePool::globalSurfacePool()->compositingSurface())
-        return;
-
-    // If there are no visible layers, return early.
-    if (lastCompositingResults().isEmpty() && lastCompositingResults().wasEmpty)
-        return;
-
-    if (m_backingStore->d->shouldDirectRenderingToWindow())
-        return;
-
-    m_backingStore->d->blitVisibleContents();
 }
 
 void WebPagePrivate::scheduleRootLayerCommit()

Modified: trunk/Source/WebKit/blackberry/ChangeLog (112818 => 112819)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-04-01 20:23:14 UTC (rev 112818)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-04-01 21:22:02 UTC (rev 112819)
@@ -1,3 +1,40 @@
+2012-04-01  Arvid Nilsson  <anils...@rim.com>
+
+        [BlackBerry] Simplify the code that gets accelerated compositing output onto the screen
+        https://bugs.webkit.org/show_bug.cgi?id=82845
+
+        Reviewed by Rob Buis.
+
+        RIM PR: 136381
+        The code accounted for a now obsolete setup where we used one OpenGL
+        window for accelerated compositing and one native window for backing
+        store output, and let the windowing system composite those two. In that
+        setup an optimization to try and only update the window that had
+        changed was viable.
+
+        Nowadays, we either use an offscreen surface for accelerated
+        compositing output, which we blend onto the window containing the
+        backing store output, or render both backing store and accelerated
+        compositing output directly to one OpenGL window. We always have to
+        blit the backingstore contents and draw the accelerated compositing
+        output every frame with these code paths, so don't try to be clever
+        about it.
+
+        Even when we use an OpenGL window, the compositing surface can be non-
+        null, so don't try to glFinish() and swap the compositing surface when
+        the GLES2Context is tied to a window.
+
+        * Api/BackingStore.cpp:
+        (BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
+        (BlackBerry::WebKit::BackingStorePrivate::blitContents):
+        (WebKit):
+        * Api/BackingStore_p.h:
+        (BackingStorePrivate):
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::drawLayersOnCommit):
+        * WebKitSupport/GLES2Context.cpp:
+        (BlackBerry::WebKit::GLES2Context::swapBuffers):
+
 2012-03-31  Jonathan Dong  <jonathan.d...@torchmobile.com.cn>
 
         [BlackBerry] http authenticate dialog popup only once no matter authentication pass or fail

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp (112818 => 112819)


--- trunk/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp	2012-04-01 20:23:14 UTC (rev 112818)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/GLES2Context.cpp	2012-04-01 21:22:02 UTC (rev 112819)
@@ -108,14 +108,19 @@
 {
     ASSERT(glGetError() == GL_NO_ERROR);
 
+    // If there's a window the backing store will swap it when the time is right.
+    // Return early because there might be an unused but non-null compositing surface
+    if (m_window)
+        return true;
+
 #if ENABLE_COMPOSITING_SURFACE
-    // Because we are rendering compositing contents into an off-screen pixmap and
-    // we need to blend the pixmap with the web page window surface we have to call
-    // glFinish() here.
-    glFinish();
-
-    if (BackingStoreCompositingSurface* surface = compositingSurface())
+    if (BackingStoreCompositingSurface* surface = compositingSurface()) {
+        // Because we are rendering compositing contents into an off-screen pixmap and
+        // we need to blend the pixmap with the web page window surface we have to call
+        // glFinish() here.
+        glFinish();
         surface->swapBuffers();
+    }
 #endif
 
     return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to