, m_currentWindowBackBuffer(0)
, m_preferredTileMatrixDimension(Vertical)
, m_blitGeneration(-1)
+#if USE(ACCELERATED_COMPOSITING)
+ , m_needsDrawLayersOnCommit(false)
+#endif
{
m_frontState = reinterpret_cast<unsigned>(new BackingStoreGeometry);
m_backState = reinterpret_cast<unsigned>(new BackingStoreGeometry);
while (m_renderQueue->hasCurrentVisibleZoomJob() || m_renderQueue->hasCurrentVisibleScrollJob())
m_renderQueue->render(!m_suspendRegularRenderJobs);
- if (!shouldPerformRegularRenderJobs() || !m_renderQueue->hasCurrentRegularRenderJob())
- return;
+ if (shouldPerformRegularRenderJobs() && m_renderQueue->hasCurrentRegularRenderJob())
+ m_renderQueue->renderAllCurrentRegularRenderJobs();
- m_renderQueue->renderAllCurrentRegularRenderJobs();
+#if USE(ACCELERATED_COMPOSITING)
+ drawLayersOnCommitIfNeeded();
+#endif
}
void BackingStorePrivate::renderOnIdle()
#endif
m_renderQueue->render(!m_suspendRegularRenderJobs);
+
+#if USE(ACCELERATED_COMPOSITING)
+ drawLayersOnCommitIfNeeded();
+#endif
}
bool BackingStorePrivate::willFireTimer()
if (m_renderQueue->hasCurrentRegularRenderJob())
m_renderQueue->renderAllCurrentRegularRenderJobs();
+#if USE(ACCELERATED_COMPOSITING)
+ drawLayersOnCommitIfNeeded();
+#endif
+
// Let the caller yield and reschedule the timer.
return false;
}
renderContents(0, origin, dirtyRect);
windowBackBufferState()->addBlittedRegion(screenRect);
-#if USE(ACCELERATED_COMPOSITING) && ENABLE_COMPOSITING_SURFACE
+#if USE(ACCELERATED_COMPOSITING)
+ drawLayersOnCommitIfNeeded();
+#if ENABLE_COMPOSITING_SURFACE
if (m_webPage->d->m_client->window()->windowUsage() != BlackBerry::Platform::Graphics::Window::GLES2Usage) {
Platform::IntRect clippedRect = intersection(dirtyRect, visibleContentsRect());
blendCompositingSurface(clippedRect);
}
#endif
+#endif
invalidateWindow(screenRect);
return true;
TileMap currentMap = currentState->tileMap();
Platform::IntRect dirtyContentsRect;
- const Platform::IntRect contentsRect = Platform::IntRect(Platform::IntPoint(0, 0), m_client->transformedContentsSize());
- const Platform::IntRect viewportRect = Platform::IntRect(Platform::IntPoint(0, 0), m_client->transformedViewportSize());
for (size_t i = 0; i < tileRectList.size(); ++i) {
TileRect tileRect = tileRectList[i];
}
if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
+#if USE(ACCELERATED_COMPOSITING)
+ // The blit will call drawSubLayers if necessary
+ m_needsDrawLayersOnCommit = false;
+#endif
+
BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchMessage(
BlackBerry::Platform::createMethodCallMessage(
&BackingStorePrivate::blitVisibleContents, this, force));
}
if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
+#if USE(ACCELERATED_COMPOSITING)
+ // The blit will call drawSubLayers if necessary
+ m_needsDrawLayersOnCommit = false;
+#endif
+
BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchMessage(
BlackBerry::Platform::createMethodCallMessage(
&BackingStorePrivate::blitContents, this, dstRect, srcRect, force));
return;
#if USE(ACCELERATED_COMPOSITING)
- m_webPage->d->commitRootLayerIfNeeded();
+ // 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 =
WebCore::FloatRect(WebCore::IntRect(src)));
return m_webPage->d->drawSubLayers(dst, contentsRect);
}
+
+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;
+}
#endif
bool BackingStorePrivate::isActive() const
+2012-03-02 Arvid Nilsson <anilsson@rim.com>
+
+ Accelerated compositing: Checkerboard never goes away
+ https://bugs.webkit.org/show_bug.cgi?id=79020
+ RIM PR #134164
+
+ Reviewed by Adam Treat.
+
+ Checkerboard appears in accelerated compositing layers when there's no
+ texture for (part of) a layer. The layer renderer queues up some render
+ jobs and schedules a commit to make the WebKit thread process those
+ jobs. Render jobs performed during commit cause texture upload jobs to
+ be scheduled on the UI thread. Texture uploads are performed when next
+ drawing the layers.
+
+ Unfortunately, sometimes commit operation happens without a subsequent
+ call draw the layers.
+
+ In order to implement one-shot drawing sync, I added a call to
+ commitRootLayerIfNeeded() in BackingStore::renderContents(), and
+ I was lucky that most of the time, renderContents() is followed by
+ blit(Visible)Contents() which in turn draws the layers.
+ However, render is not always followed by a blit, for example when
+ rendering offscreen tiles in BackingStore::renderOnIdle(), and in
+ direct rendering mode.
+
+ Fixed by making sure that every call to commitRootLayerIfNeeded() that
+ returns true is followed by a call to drawLayersOnCommit(), unless a
+ blit was requested already.
+
+ Also tweak the logic for one-shot drawing sync to make the code in
+ drawLayersOnCommit() reusable outside of rootLayerCommitTimerFired().
+
+ * Api/BackingStore.cpp:
+ (BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate):
+ (BlackBerry::WebKit::BackingStorePrivate::renderOnTimer):
+ (BlackBerry::WebKit::BackingStorePrivate::renderOnIdle):
+ (BlackBerry::WebKit::BackingStorePrivate::willFireTimer):
+ (BlackBerry::WebKit::BackingStorePrivate::renderDirectToWindow):
+ (BlackBerry::WebKit::BackingStorePrivate::render):
+ (BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
+ (BlackBerry::WebKit::BackingStorePrivate::blitContents):
+ (BlackBerry::WebKit::BackingStorePrivate::renderContents):
+ (WebKit):
+ (BlackBerry::WebKit::BackingStorePrivate::drawLayersOnCommitIfNeeded):
+ * Api/BackingStore_p.h:
+ (BackingStorePrivate):
+ (BlackBerry::WebKit::BackingStorePrivate::willDrawLayersOnCommit):
+
2012-03-02 Adam Treat <atreat@rim.com>
https://bugs.webkit.org/show_bug.cgi?id=80161