Changeset 142677 in webkit


Ignore:
Timestamp:
Feb 12, 2013 3:09:10 PM (11 years ago)
Author:
jpetsovits@rim.com
Message:

[BlackBerry] Eliminate the direct rendering option.
https://bugs.webkit.org/show_bug.cgi?id=109608
RIM PR 293298

Reviewed by Rob Buis.
Internally reviewed by Arvid Nilsson.

It added a lot of complexity and we're not going to use it anymore.
This patch removes direct rendering functionality from
WebKit/blackberry together with the assumption that blitting on the
WebKit thread is possible or acceptable. It now isn't anymore.

  • Api/BackingStore.cpp:

(BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate):
(BlackBerry::WebKit::BackingStorePrivate::resumeScreenUpdates):
(BlackBerry::WebKit::BackingStorePrivate::updateSuspendScreenUpdateState):
(BlackBerry::WebKit::BackingStorePrivate::slowScroll):
(BlackBerry::WebKit::BackingStorePrivate::scroll):
(BlackBerry::WebKit::BackingStorePrivate::shouldPerformRenderJobs):
(BlackBerry::WebKit::BackingStorePrivate::render):
(BlackBerry::WebKit::BackingStorePrivate::renderAndBlitImmediately):
(BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
(BlackBerry::WebKit::BackingStorePrivate::blitToWindow):
(BlackBerry::WebKit::BackingStorePrivate::fillWindow):
(BlackBerry::WebKit::BackingStorePrivate::invalidateWindow):
(BlackBerry::WebKit::BackingStorePrivate::clearWindow):
(BlackBerry::WebKit::BackingStorePrivate::setScrollingOrZooming):
(BlackBerry::WebKit::BackingStorePrivate::didRenderContent):

  • Api/BackingStore.h:
  • Api/BackingStore_p.h:

(BackingStorePrivate):

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::resumeBackingStore):
(BlackBerry::WebKit::WebPagePrivate::setViewportSize):
(BlackBerry::WebKit::WebPagePrivate::rootLayerCommitTimerFired):
(WebKit):
(BlackBerry::WebKit::WebPagePrivate::scheduleCompositingRun):

  • Api/WebPageCompositor.cpp:

(BlackBerry::WebKit::WebPageCompositorPrivate::animationFrameChanged):

  • Api/WebPage_p.h:

(WebPagePrivate):

  • Api/WebSettings.cpp:

(WebKit):

  • Api/WebSettings.h:
  • WebKitSupport/RenderQueue.cpp:

(BlackBerry::WebKit::RenderQueue::renderRegularRenderJobs):
(BlackBerry::WebKit::RenderQueue::renderScrollZoomJobs):

  • WebKitSupport/SurfacePool.cpp:

(BlackBerry::WebKit::SurfacePool::initialize):

Location:
trunk/Source/WebKit/blackberry
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/BackingStore.cpp

    r142670 r142677  
    220220    , m_hasBlitJobs(false)
    221221    , m_webPageBackgroundColor(WebCore::Color::white)
    222     , m_currentWindowBackBuffer(0)
    223222    , m_preferredTileMatrixDimension(Vertical)
    224 #if USE(ACCELERATED_COMPOSITING)
    225     , m_isDirectRenderingAnimationMessageScheduled(false)
    226 #endif
    227223{
    228224    m_frontState = reinterpret_cast<unsigned>(new BackingStoreGeometry);
     
    253249{
    254250    WebCore::InspectorInstrumentation::didCancelFrame(WebPagePrivate::core(m_webPage));
    255 }
    256 
    257 bool BackingStorePrivate::shouldDirectRenderingToWindow() const
    258 {
    259     // Direct rendering doesn't work with OpenGL compositing code paths due to
    260     // a race condition on which thread's EGL context gets to make the surface
    261     // current, see PR 105750.
    262     // As a workaround, we will be using compositor to draw the root layer.
    263     if (isOpenGLCompositing())
    264         return false;
    265 
    266     if (m_webPage->settings()->isDirectRenderingToWindowEnabled())
    267         return true;
    268 
    269     // If the BackingStore is inactive, see if there's a compositor to do the
    270     // work of rendering the root layer.
    271     if (!isActive())
    272         return !m_webPage->d->compositorDrawsRootLayer();
    273 
    274     const BackingStoreGeometry* geometry = frontState();
    275     const unsigned tilesNecessary = minimumNumberOfTilesWide() * minimumNumberOfTilesHigh();
    276     const unsigned tilesAvailable = geometry->numberOfTilesWide() * geometry->numberOfTilesHigh();
    277     return tilesAvailable < tilesNecessary;
    278251}
    279252
     
    417390#endif
    418391
    419     // For the direct rendering case, there is no such operation as blit,
    420     // we have to render to get anything to the screen.
    421     if (shouldDirectRenderingToWindow() && op == BackingStore::Blit)
    422         op = BackingStore::RenderAndBlit;
    423 
    424392    // Render visible contents if necessary.
    425393    if (op == BackingStore::RenderAndBlit) {
    426         if (shouldDirectRenderingToWindow())
    427             renderDirectToWindow(visibleContentsRect());
    428         else {
    429             updateTileMatrixIfNeeded();
    430             TileIndexList visibleTiles = visibleTileIndexes(frontState());
    431             TileIndexList renderedTiles = render(visibleTiles);
    432 
    433             if (renderedTiles.size() != visibleTiles.size()) {
    434                 // Add unrendered leftover tiles to the render queue.
    435                 for (unsigned i = 0; i < visibleTiles.size(); ++i) {
    436                     if (!renderedTiles.contains(visibleTiles[i])) {
    437                         Platform::IntRect tileRect(frontState()->originOfTile(visibleTiles[i]), tileSize());
    438                         m_renderQueue->addToQueue(RenderQueue::VisibleZoom, tileRect);
    439                     }
     394        updateTileMatrixIfNeeded();
     395        TileIndexList visibleTiles = visibleTileIndexes(frontState());
     396        TileIndexList renderedTiles = render(visibleTiles);
     397
     398        if (renderedTiles.size() != visibleTiles.size()) {
     399            // Add unrendered leftover tiles to the render queue.
     400            for (unsigned i = 0; i < visibleTiles.size(); ++i) {
     401                if (!renderedTiles.contains(visibleTiles[i])) {
     402                    Platform::IntRect tileRect(frontState()->originOfTile(visibleTiles[i]), tileSize());
     403                    m_renderQueue->addToQueue(RenderQueue::VisibleZoom, tileRect);
    440404                }
    441405            }
     
    460424#else
    461425    // Do some blitting if necessary.
    462     if ((op == BackingStore::Blit || op == BackingStore::RenderAndBlit) && !shouldDirectRenderingToWindow())
     426    if (op == BackingStore::Blit || op == BackingStore::RenderAndBlit)
    463427        blitVisibleContents();
    464428#endif
     
    474438    bool shouldSuspend = m_suspendScreenUpdateCounterWebKitThread
    475439        || !m_webPage->isVisible()
    476         || (!isBackingStoreUsable && !m_webPage->d->compositorDrawsRootLayer() && !shouldDirectRenderingToWindow());
     440        || (!isBackingStoreUsable && !m_webPage->d->compositorDrawsRootLayer());
    477441
    478442    if (m_suspendScreenUpdatesWebKitThread == shouldSuspend)
     
    543507    else {
    544508        m_renderQueue->addToQueue(RenderQueue::VisibleScroll, rect);
    545         // We only blit here if the client did not generate the scroll as the client
    546         // now supports blitting asynchronously during scroll operations.
    547         if (!m_client->isClientGeneratedScroll() && !shouldDirectRenderingToWindow())
     509        // We only blit here if the client did not generate the scroll as the
     510        // client supports blitting asynchronously during scroll operations.
     511        if (!m_client->isClientGeneratedScroll())
    548512            blitVisibleContents();
    549513    }
     
    561525{
    562526    ASSERT(BlackBerry::Platform::webKitThreadMessageClient()->isCurrentThread());
    563 
    564     // If we are direct rendering then we are forced to go down the slow path
    565     // to scrolling.
    566     if (shouldDirectRenderingToWindow()) {
    567         Platform::IntRect viewportRect(Platform::IntPoint(0, 0), m_webPage->d->transformedViewportSize());
    568         slowScroll(delta, m_webPage->d->mapFromTransformed(viewportRect), true /*immediate*/);
    569         return;
    570     }
    571527
    572528#if DEBUG_BACKINGSTORE
     
    616572bool BackingStorePrivate::shouldPerformRenderJobs() const
    617573{
    618     return (isActive() || shouldDirectRenderingToWindow()) && !m_suspendRenderJobs && !m_suspendBackingStoreUpdates && !m_renderQueue->isEmpty(!m_suspendRegularRenderJobs);
     574    return isActive() && !m_suspendRenderJobs && !m_suspendBackingStoreUpdates && !m_renderQueue->isEmpty(!m_suspendRegularRenderJobs);
    619575}
    620576
     
    10521008}
    10531009
    1054 Platform::IntRect BackingStorePrivate::renderDirectToWindow(const Platform::IntRect& rect)
    1055 {
    1056     requestLayoutIfNeeded();
    1057 
    1058     Platform::IntRect dirtyRect = rect;
    1059     dirtyRect.intersect(unclippedVisibleContentsRect());
    1060 
    1061     if (dirtyRect.isEmpty())
    1062         return Platform::IntRect();
    1063 
    1064     Platform::ViewportAccessor* viewportAccessor = m_webPage->webkitThreadViewportAccessor();
    1065     Platform::IntRect screenRect = viewportAccessor->pixelViewportFromContents(dirtyRect);
    1066     windowFrontBufferState()->clearBlittedRegion(screenRect);
    1067 
    1068     paintDefaultBackground(dirtyRect, viewportAccessor, true /*flush*/);
    1069 
    1070     if (!renderContents(buffer(), screenRect, viewportAccessor->scale(), viewportAccessor->documentFromPixelContents(dirtyRect.location())))
    1071         return Platform::IntRect();
    1072 
    1073     windowBackBufferState()->addBlittedRegion(screenRect);
    1074 
    1075 #if USE(ACCELERATED_COMPOSITING)
    1076     m_isDirectRenderingAnimationMessageScheduled = false;
    1077 
    1078     if (m_webPage->d->isAcceleratedCompositingActive()) {
    1079         BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage(
    1080             BlackBerry::Platform::createMethodCallMessage(
    1081                 &BackingStorePrivate::drawAndBlendLayersForDirectRendering,
    1082                 this, dirtyRect));
    1083     }
    1084 #endif
    1085 
    1086     invalidateWindow(screenRect);
    1087     m_renderQueue->clear(rect, RenderQueue::DontClearCompletedJobs);
    1088     return dirtyRect;
    1089 }
    1090 
    10911010TileIndexList BackingStorePrivate::render(const TileIndexList& tileIndexList)
    10921011{
     
    10961015    requestLayoutIfNeeded();
    10971016
    1098     if (shouldDirectRenderingToWindow()) {
    1099         // We cannot handle tiles in direct rendering mode. Bad function call.
    1100         ASSERT(false);
    1101         return TileIndexList();
    1102     }
    1103 
    1104     // If direct rendering is off, even though we're not active, someone else
    1105     // has to render the root layer. There are no tiles available for us to
    1106     // draw to.
     1017    // If no tiles available for us to draw to, someone else has to render the root layer.
    11071018    if (!isActive())
    11081019        return TileIndexList();
     
    12361147void BackingStorePrivate::renderAndBlitImmediately(const Platform::IntRect& rect)
    12371148{
    1238     if (shouldDirectRenderingToWindow()) {
    1239         renderDirectToWindow(rect);
    1240         return;
    1241     }
    1242 
    12431149    updateTileMatrixIfNeeded();
    12441150    m_renderQueue->addToQueue(RenderQueue::VisibleZoom, rect);
    12451151    renderJob();
    1246 }
    1247 
    1248 void BackingStorePrivate::copyPreviousContentsToBackSurfaceOfWindow()
    1249 {
    1250     Platform::IntRectRegion previousContentsRegion
    1251         = Platform::IntRectRegion::subtractRegions(windowFrontBufferState()->blittedRegion(), windowBackBufferState()->blittedRegion());
    1252 
    1253     if (previousContentsRegion.isEmpty())
    1254         return;
    1255 
    1256     if (Window* window = m_webPage->client()->window())
    1257         window->copyFromFrontToBack(previousContentsRegion);
    1258     windowBackBufferState()->addBlittedRegion(previousContentsRegion);
    12591152}
    12601153
     
    12931186void BackingStorePrivate::blitVisibleContents(bool force)
    12941187{
    1295     // Blitting must never happen for direct rendering case.
    1296     // Use invalidateWindow() instead.
    1297     ASSERT(!shouldDirectRenderingToWindow());
    1298     if (shouldDirectRenderingToWindow()) {
    1299         Platform::logAlways(Platform::LogLevelCritical,
    1300             "BackingStore::blitVisibleContents operation not supported in direct rendering mode");
    1301         return;
    1302     }
    1303 
    13041188    if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
    13051189        BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchMessage(
     
    20901974    ASSERT(BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread());
    20911975
    2092     windowFrontBufferState()->clearBlittedRegion(dstRect);
    2093     windowBackBufferState()->addBlittedRegion(dstRect);
    2094 
    20951976    BlackBerry::Platform::Graphics::Buffer* dstBuffer = buffer();
    20961977    ASSERT(dstBuffer);
     
    21151996{
    21161997    ASSERT(BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread());
    2117 
    2118     windowFrontBufferState()->clearBlittedRegion(dstRect);
    2119     windowBackBufferState()->addBlittedRegion(dstRect);
    21201998
    21211999    BlackBerry::Platform::Graphics::Buffer* dstBuffer = buffer();
     
    21562034}
    21572035
    2158 void BackingStorePrivate::invalidateWindow()
    2159 {
    2160     // Grab a rect appropriate for the current thread.
    2161     if (BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
    2162         if (m_webPage->client()->userInterfaceViewportAccessor())
    2163             invalidateWindow(m_webPage->client()->userInterfaceViewportAccessor()->destinationSurfaceRect());
    2164     } else
    2165         invalidateWindow(Platform::IntRect(Platform::IntPoint(0, 0), m_client->transformedViewportSize()));
    2166 }
    2167 
    21682036void BackingStorePrivate::invalidateWindow(const Platform::IntRect& dst)
    21692037{
     2038    ASSERT(BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread());
     2039
    21702040    if (dst.isEmpty())
    21712041        return;
    2172 
    2173     if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread() && !shouldDirectRenderingToWindow()) {
    2174         // This needs to be sync in order to swap the recently drawn thing...
    2175         // This will only be called from WebKit thread during direct rendering.
    2176         typedef void (BlackBerry::WebKit::BackingStorePrivate::*FunctionType)(const Platform::IntRect&);
    2177         BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage(
    2178             BlackBerry::Platform::createMethodCallMessage<FunctionType, BackingStorePrivate, Platform::IntRect>(
    2179                 &BackingStorePrivate::invalidateWindow, this, dst));
    2180         return;
    2181     }
    21822042
    21832043#if DEBUG_BACKINGSTORE
     
    21872047#endif
    21882048
    2189     // Since our window may also be double buffered, we need to also copy the
    2190     // front buffer's contents to the back buffer before we swap them. It is
    2191     // analogous to what we do with our double buffered tiles by calling
    2192     // copyPreviousContentsToBackingSurfaceOfTile(). It only affects partial
    2193     // screen updates since when we are scrolling or zooming, the whole window
    2194     // is invalidated anyways and no copying is needed.
    2195     copyPreviousContentsToBackSurfaceOfWindow();
    2196 
    21972049    Platform::IntRect dstRect = dst;
    21982050
    2199     Platform::IntRect viewportRect(Platform::IntPoint(0, 0), m_client->transformedViewportSize());
    2200     dstRect.intersect(viewportRect);
     2051    Platform::IntRect surfaceRect(Platform::IntPoint(0, 0), surfaceSize());
     2052    dstRect.intersect(surfaceRect);
    22012053
    22022054    if (dstRect.width() <= 0 || dstRect.height() <= 0)
     
    22092061#endif
    22102062
    2211     m_currentWindowBackBuffer = (m_currentWindowBackBuffer + 1) % 2;
    22122063    if (Window* window = m_webPage->client()->window())
    22132064        window->post(dstRect);
     
    22202071                                      unsigned char alpha)
    22212072{
    2222     if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread() && !shouldDirectRenderingToWindow()) {
     2073    if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()) {
    22232074        typedef void (BlackBerry::WebKit::BackingStorePrivate::*FunctionType)(const Platform::IntRect&,
    22242075                                                                           unsigned char,
     
    22432094        Platform::logAlways(Platform::LogLevelWarn, "Empty window buffer, couldn't clearWindow");
    22442095
    2245     windowFrontBufferState()->clearBlittedRegion(rect);
    2246     windowBackBufferState()->addBlittedRegion(rect);
    2247 
    22482096    BlackBerry::Platform::Graphics::clearBuffer(dstBuffer, rect, red, green, blue, alpha);
    22492097}
     
    22772125        m_renderQueue->setCurrentRegularRenderJobBatchUnderPressure(false);
    22782126#if ENABLE_SCROLLBARS
    2279     else if (shouldBlit && !shouldDirectRenderingToWindow())
     2127    else if (shouldBlit)
    22802128        blitVisibleContents();
    22812129#endif
     
    23452193}
    23462194
    2347 BackingStoreWindowBufferState* BackingStorePrivate::windowFrontBufferState() const
    2348 {
    2349     return &m_windowBufferState[(m_currentWindowBackBuffer + 1) % 2];
    2350 }
    2351 
    2352 BackingStoreWindowBufferState* BackingStorePrivate::windowBackBufferState() const
    2353 {
    2354     return &m_windowBufferState[m_currentWindowBackBuffer];
    2355 }
    2356 
    2357 #if USE(ACCELERATED_COMPOSITING)
    2358 void BackingStorePrivate::drawAndBlendLayersForDirectRendering(const Platform::IntRect& dirtyRect)
    2359 {
    2360     ASSERT(BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread());
    2361     if (!BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread())
    2362         return;
    2363 
    2364     // Because we're being called sync from the WebKit thread, we can use
    2365     // regular WebPage size and transformation functions without concerns.
    2366     WebCore::IntRect contentsRect = visibleContentsRect();
    2367     WebCore::FloatRect untransformedContentsRect = m_webPage->d->mapFromTransformedFloatRect(WebCore::FloatRect(contentsRect));
    2368     WebCore::IntRect contentsScreenRect = m_client->mapFromTransformedContentsToTransformedViewport(contentsRect);
    2369     WebCore::IntRect dstRect = intersection(contentsScreenRect,
    2370         WebCore::IntRect(WebCore::IntPoint(0, 0), m_webPage->d->transformedViewportSize()));
    2371 
    2372     // Check if rendering caused a commit and we need to redraw the layers.
    2373     if (WebPageCompositorPrivate* compositor = m_webPage->d->compositor())
    2374         compositor->drawLayers(dstRect, untransformedContentsRect);
    2375 }
    2376 #endif
    2377 
    23782195// static
    23792196void BackingStorePrivate::setCurrentBackingStoreOwner(WebPage* webPage)
     
    23962213void BackingStorePrivate::didRenderContent(const Platform::IntRectRegion& renderedRegion)
    23972214{
    2398     if (!shouldDirectRenderingToWindow()) {
    23992215#if USE(ACCELERATED_COMPOSITING)
    2400         if (m_webPage->d->needsOneShotDrawingSynchronization())
    2401             m_webPage->d->commitRootLayerIfNeeded();
    2402         else
    2403 #endif
    2404         {
    2405             if (isScrollingOrZooming())
    2406                 return; // don't drag down framerates by double-blitting.
    2407 
    2408             blitVisibleContents();
    2409         }
    2410     } else
    2411         invalidateWindow();
     2216    if (m_webPage->d->needsOneShotDrawingSynchronization())
     2217        m_webPage->d->commitRootLayerIfNeeded();
     2218    else
     2219#endif
     2220    {
     2221        if (isScrollingOrZooming())
     2222            return; // don't drag down framerates by double-blitting.
     2223
     2224        blitVisibleContents();
     2225    }
    24122226
    24132227    // Don't issue content rendered calls when all we rendered was filler
     
    25002314}
    25012315
    2502 bool BackingStore::isDirectRenderingToWindow() const
    2503 {
    2504     BackingStoreMutexLocker locker(d);
    2505     return d->shouldDirectRenderingToWindow();
    2506 }
    2507 
    25082316void BackingStore::acquireBackingStoreMemory()
    25092317{
  • trunk/Source/WebKit/blackberry/Api/BackingStore.h

    r142670 r142677  
    7777    void blitOnIdle();
    7878
    79     bool isDirectRenderingToWindow() const;
    80 
    8179    void acquireBackingStoreMemory();
    8280    void releaseOwnedBackingStoreMemory();
  • trunk/Source/WebKit/blackberry/Api/BackingStore_p.h

    r142670 r142677  
    9090};
    9191
    92 class BackingStoreWindowBufferState {
    93 public:
    94     Platform::IntRectRegion blittedRegion() const { return m_blittedRegion; }
    95     void addBlittedRegion(const Platform::IntRectRegion& region)
    96     {
    97         m_blittedRegion = Platform::IntRectRegion::unionRegions(m_blittedRegion, region);
    98     }
    99     void clearBlittedRegion(const Platform::IntRectRegion& region)
    100     {
    101         m_blittedRegion = Platform::IntRectRegion::subtractRegions(m_blittedRegion, region);
    102     }
    103     void clearBlittedRegion() { m_blittedRegion = Platform::IntRectRegion(); }
    104 
    105     bool isRendered(const Platform::IntPoint& scrollPosition, const Platform::IntRectRegion& contents) const
    106     {
    107         return Platform::IntRectRegion::subtractRegions(contents, m_blittedRegion).isEmpty();
    108     }
    109 
    110   private:
    111     Platform::IntRectRegion m_blittedRegion;
    112 };
    113 
    11492class BackingStorePrivate : public BlackBerry::Platform::GuardedPointerBase {
    11593public:
     
    11997    void instrumentBeginFrame();
    12098    void instrumentCancelFrame();
    121 
    122     // Returns whether direct rendering is explicitly turned on or is
    123     // required because the surface pool is not large enough to meet
    124     // the minimum number of tiles required to scroll.
    125     bool shouldDirectRenderingToWindow() const;
    12699
    127100    // Returns whether we're using the OpenGL code path for compositing the
     
    200173    void scrollBackingStore(int deltaX, int deltaY);
    201174
    202     // Render the given dirty rect and invalidate the screen.
    203     Platform::IntRect renderDirectToWindow(const Platform::IntRect&);
    204 
    205175    // Render the given tiles if enough back buffers are available.
    206176    // Return the actual set of rendered tiles.
     
    217187    void renderAndBlitVisibleContentsImmediately();
    218188    void renderAndBlitImmediately(const Platform::IntRect&);
     189    void paintDefaultBackground(const Platform::IntRect& dstRect, BlackBerry::Platform::ViewportAccessor*, bool flush);
    219190    void blitVisibleContents(bool force = false);
    220 
    221     // Assumes the rect to be in window/viewport coordinates.
    222     void copyPreviousContentsToBackSurfaceOfWindow();
    223     void copyPreviousContentsToTileBuffer(const Platform::IntRect& excludeRect, TileBuffer* dstTileBuffer, TileBuffer* srcTileBuffer);
    224     void paintDefaultBackground(const Platform::IntRect& dstRect, BlackBerry::Platform::ViewportAccessor*, bool flush);
    225191    void blitOnIdle();
    226192
     
    236202
    237203    bool drawLayersOnCommitIfNeeded();
    238     void drawAndBlendLayersForDirectRendering(const Platform::IntRect& dirtyRect);
    239204    // WebPage will call this when drawing layers to tell us we don't need to
    240205    void willDrawLayersOnCommit() { m_needsDrawLayersOnCommit = false; }
    241     // WebPageCompositor uses this to cut down on excessive message sending.
    242     bool isDirectRenderingAnimationMessageScheduled() { return m_isDirectRenderingAnimationMessageScheduled; }
    243     void setDirectRenderingAnimationMessageScheduled() { m_isDirectRenderingAnimationMessageScheduled = true; }
    244206#endif
    245207
     
    322284    void setWebPageBackgroundColor(const WebCore::Color&);
    323285
    324     void invalidateWindow();
    325286    void invalidateWindow(const Platform::IntRect& dst);
    326287    void clearWindow(const Platform::IntRect&, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255);
     
    334295    BackingStoreGeometry* frontState() const;
    335296    void adoptAsFrontState(BackingStoreGeometry* newFrontState);
    336 
    337     BackingStoreWindowBufferState* windowFrontBufferState() const;
    338     BackingStoreWindowBufferState* windowBackBufferState() const;
    339297
    340298    static void setCurrentBackingStoreOwner(WebPage*);
     
    373331    mutable unsigned m_frontState;
    374332
    375     unsigned m_currentWindowBackBuffer;
    376     mutable BackingStoreWindowBufferState m_windowBufferState[2];
    377 
    378333    TileMatrixDirection m_preferredTileMatrixDimension;
    379334
     
    384339#if USE(ACCELERATED_COMPOSITING)
    385340    mutable bool m_needsDrawLayersOnCommit; // Not thread safe, WebKit thread only
    386     bool m_isDirectRenderingAnimationMessageScheduled;
    387341#endif
    388342
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r142482 r142677  
    11/*
    2  * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved.
     2 * Copyright (C) 2009, 2010, 2011, 2012, 2013 Research In Motion Limited. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
     
    35683568    ASSERT(m_webPage->isVisible());
    35693569
    3570     bool directRendering = m_backingStore->d->shouldDirectRenderingToWindow();
    3571     if (!m_backingStore->d->isActive()
    3572         || shouldResetTilesWhenShown()
    3573         || directRendering) {
     3570    if (!m_backingStore->d->isActive() || shouldResetTilesWhenShown()) {
    35743571        BackingStorePrivate::setCurrentBackingStoreOwner(m_webPage);
    35753572
     
    36493646
    36503647    bool hasPendingOrientation = m_pendingOrientation != -1;
    3651 
    3652     // The window buffers might have been recreated, cleared, moved, etc., so:
    3653     m_backingStore->d->windowFrontBufferState()->clearBlittedRegion();
    3654     m_backingStore->d->windowBackBufferState()->clearBlittedRegion();
    36553648
    36563649    IntSize viewportSizeBefore = actualVisibleSize();
     
    38073800    // FIXME: Determine why the above comment says "clamping on", yet we
    38083801    //   don't set enforceScaleClamping to true.
    3809     // FIXME: Determine why ensureContentVisible() is only called for !success
    3810     //   in the direct-rendering case, but in all cases otherwise. Chances are
    3811     //   one of these is incorrect and we can unify two branches into one.
    3812     if (m_backingStore->d->shouldDirectRenderingToWindow()) {
    3813         bool success = zoomAboutPoint(scale, anchor, false /* enforceScaleClamping */, true /* forceRendering */);
    3814         if (!success && ensureFocusElementVisible)
    3815             ensureContentVisible(!newVisibleRectContainsOldVisibleRect);
    3816 
    3817     } else if (zoomAboutPoint(scale, anchor, false /*enforceScaleClamping*/, true /*forceRendering*/)) {
     3802    if (zoomAboutPoint(scale, anchor, false /*enforceScaleClamping*/, true /*forceRendering*/)) {
    38183803        if (ensureFocusElementVisible)
    38193804            ensureContentVisible(!newVisibleRectContainsOldVisibleRect);
    3820 
    38213805    } else {
    3822 
    38233806        // Suspend all updates to the backingstore.
    38243807        m_backingStore->d->suspendBackingStoreUpdates();
     
    56085591    // backing store is never necessary, because the backing store draws
    56095592    // nothing.
    5610     if (!compositorDrawsRootLayer()) {
    5611         // If we are doing direct rendering and have a single rendering target,
    5612         // committing is equivalent to a one shot drawing synchronization.
    5613         // We need to re-render the web page, re-render the layers, and
    5614         // then blit them on top of the re-rendered web page.
    5615         if (m_backingStore->d->isOpenGLCompositing() && m_backingStore->d->shouldDirectRenderingToWindow())
    5616             setNeedsOneShotDrawingSynchronization();
    5617 
    5618         if (needsOneShotDrawingSynchronization()) {
     5593    if (!compositorDrawsRootLayer() && needsOneShotDrawingSynchronization()) {
    56195594#if DEBUG_AC_COMMIT
    5620             Platform::logAlways(Platform::LogLevelCritical,
    5621                 "%s: OneShotDrawingSynchronization code path!",
    5622                 WTF_PRETTY_FUNCTION);
    5623 #endif
    5624             const IntRect windowRect = IntRect(IntPoint::zero(), viewportSize());
    5625             m_backingStore->d->repaint(windowRect, true /*contentChanged*/, true /*immediate*/);
    5626             return;
    5627         }
     5595        Platform::logAlways(Platform::LogLevelCritical,
     5596            "%s: OneShotDrawingSynchronization code path!",
     5597            WTF_PRETTY_FUNCTION);
     5598#endif
     5599        const IntRect windowRect = IntRect(IntPoint::zero(), viewportSize());
     5600        m_backingStore->d->repaint(windowRect, true /*contentChanged*/, true /*immediate*/);
     5601        return;
    56285602    }
    56295603
     
    60526026
    60536027#if USE(ACCELERATED_COMPOSITING)
    6054 void WebPagePrivate::blitVisibleContents()
    6055 {
    6056     if (m_backingStore->d->shouldDirectRenderingToWindow())
    6057         return;
    6058 
    6059     m_backingStore->d->blitVisibleContents();
    6060 }
    6061 
    60626028void WebPagePrivate::scheduleCompositingRun()
    60636029{
     
    60686034    }
    60696035
    6070     blitVisibleContents();
    6071 }
    6072 
     6036    m_backingStore->d->blitVisibleContents();
     6037}
    60736038#endif
    60746039
  • trunk/Source/WebKit/blackberry/Api/WebPageCompositor.cpp

    r140816 r142677  
    234234    }
    235235
    236     if (backingStore->d->shouldDirectRenderingToWindow()) {
    237         if (backingStore->d->isDirectRenderingAnimationMessageScheduled())
    238             return; // don't send new messages as long as we haven't rerendered
    239 
    240         using namespace BlackBerry::Platform;
    241 
    242         backingStore->d->setDirectRenderingAnimationMessageScheduled();
    243         webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&BackingStorePrivate::renderAndBlitVisibleContentsImmediately, backingStore->d));
    244         return;
    245     }
    246 
    247236    if (!m_webPage->needsOneShotDrawingSynchronization())
    248         m_webPage->blitVisibleContents();
     237        backingStore->blitVisibleContents();
    249238}
    250239
  • trunk/Source/WebKit/blackberry/Api/WebPage_p.h

    r142220 r142677  
    422422    void suspendRootLayerCommit();
    423423    void resumeRootLayerCommit();
    424     void blitVisibleContents();
    425424
    426425    void scheduleCompositingRun();
  • trunk/Source/WebKit/blackberry/Api/WebSettings.cpp

    r141481 r142677  
    4141DEFINE_STATIC_LOCAL(String, BlackBerryBackgroundColor, (ASCIILiteral("BlackBerryBackgroundColor")));
    4242DEFINE_STATIC_LOCAL(String, BlackBerryCookiesEnabled, (ASCIILiteral("BlackBerryCookiesEnabled")));
    43 DEFINE_STATIC_LOCAL(String, BlackBerryDirectRenderingToWindowEnabled, (ASCIILiteral("BlackBerryDirectRenderingToWindowEnabled")));
    4443DEFINE_STATIC_LOCAL(String, BlackBerryDrawBorderWhileLoadingImages, (ASCIILiteral("BlackBerryDrawBorderWhileLoadingImages")));
    4544DEFINE_STATIC_LOCAL(String, BlackBerryEmailModeEnabled, (ASCIIliteral("BlackBerryEmailModeEnabled")));
     
    745744}
    746745
    747 bool WebSettings::isDirectRenderingToWindowEnabled() const
    748 {
    749     return m_private->getBoolean(BlackBerryDirectRenderingToWindowEnabled);
    750 }
    751 
    752 void WebSettings::setDirectRenderingToWindowEnabled(bool enable)
    753 {
    754     m_private->setBoolean(BlackBerryDirectRenderingToWindowEnabled, enable);
    755 }
    756 
    757746bool WebSettings::isBackingStoreEnabled() const
    758747{
  • trunk/Source/WebKit/blackberry/Api/WebSettings.h

    r141481 r142677  
    215215    void setFrameFlatteningEnabled(bool);
    216216
    217     bool isDirectRenderingToWindowEnabled() const;
    218     void setDirectRenderingToWindowEnabled(bool);
    219 
    220217    unsigned maxPluginInstances() const;
    221218    void setMaxPluginInstances(unsigned num);
  • trunk/Source/WebKit/blackberry/ChangeLog

    r142670 r142677  
     12013-02-12  Jakob Petsovits  <jpetsovits@rim.com>
     2
     3        [BlackBerry] Eliminate the direct rendering option.
     4        https://bugs.webkit.org/show_bug.cgi?id=109608
     5        RIM PR 293298
     6
     7        Reviewed by Rob Buis.
     8        Internally reviewed by Arvid Nilsson.
     9
     10        It added a lot of complexity and we're not going to use it anymore.
     11        This patch removes direct rendering functionality from
     12        WebKit/blackberry together with the assumption that blitting on the
     13        WebKit thread is possible or acceptable. It now isn't anymore.
     14
     15        * Api/BackingStore.cpp:
     16        (BlackBerry::WebKit::BackingStorePrivate::BackingStorePrivate):
     17        (BlackBerry::WebKit::BackingStorePrivate::resumeScreenUpdates):
     18        (BlackBerry::WebKit::BackingStorePrivate::updateSuspendScreenUpdateState):
     19        (BlackBerry::WebKit::BackingStorePrivate::slowScroll):
     20        (BlackBerry::WebKit::BackingStorePrivate::scroll):
     21        (BlackBerry::WebKit::BackingStorePrivate::shouldPerformRenderJobs):
     22        (BlackBerry::WebKit::BackingStorePrivate::render):
     23        (BlackBerry::WebKit::BackingStorePrivate::renderAndBlitImmediately):
     24        (BlackBerry::WebKit::BackingStorePrivate::blitVisibleContents):
     25        (BlackBerry::WebKit::BackingStorePrivate::blitToWindow):
     26        (BlackBerry::WebKit::BackingStorePrivate::fillWindow):
     27        (BlackBerry::WebKit::BackingStorePrivate::invalidateWindow):
     28        (BlackBerry::WebKit::BackingStorePrivate::clearWindow):
     29        (BlackBerry::WebKit::BackingStorePrivate::setScrollingOrZooming):
     30        (BlackBerry::WebKit::BackingStorePrivate::didRenderContent):
     31        * Api/BackingStore.h:
     32        * Api/BackingStore_p.h:
     33        (BackingStorePrivate):
     34        * Api/WebPage.cpp:
     35        (BlackBerry::WebKit::WebPagePrivate::resumeBackingStore):
     36        (BlackBerry::WebKit::WebPagePrivate::setViewportSize):
     37        (BlackBerry::WebKit::WebPagePrivate::rootLayerCommitTimerFired):
     38        (WebKit):
     39        (BlackBerry::WebKit::WebPagePrivate::scheduleCompositingRun):
     40        * Api/WebPageCompositor.cpp:
     41        (BlackBerry::WebKit::WebPageCompositorPrivate::animationFrameChanged):
     42        * Api/WebPage_p.h:
     43        (WebPagePrivate):
     44        * Api/WebSettings.cpp:
     45        (WebKit):
     46        * Api/WebSettings.h:
     47        * WebKitSupport/RenderQueue.cpp:
     48        (BlackBerry::WebKit::RenderQueue::renderRegularRenderJobs):
     49        (BlackBerry::WebKit::RenderQueue::renderScrollZoomJobs):
     50        * WebKitSupport/SurfacePool.cpp:
     51        (BlackBerry::WebKit::SurfacePool::initialize):
     52
    1532013-02-12  Andrew Lo  <anlo@rim.com>
    254
  • trunk/Source/WebKit/blackberry/WebKitSupport/RenderQueue.cpp

    r142670 r142677  
    628628    }
    629629
    630     bool shouldDirectRenderingToWindow = m_parent->shouldDirectRenderingToWindow();
    631630    Platform::IntRect contentsRect = m_parent->expandedContentsRect();
    632631
     
    637636
    638637        // Split the current regular render job region into tiles.
    639         if (!shouldDirectRenderingToWindow) {
    640             // Discard regions outside of the region covered by these tiles.
    641             // They'll be rendered when the geometry changes.
    642             m_regularRenderJobsRegion = Platform::IntRectRegion::intersectRegions(m_regularRenderJobsRegion, m_parent->frontState()->backingStoreRect());
    643             m_currentRegularRenderJobsBatch = tileIndexesIntersectingRegion(m_regularRenderJobsRegion, m_parent->frontState());
    644         }
     638        // Discard regions outside of the region covered by these tiles.
     639        // They'll be rendered when the geometry changes.
     640        m_regularRenderJobsRegion = Platform::IntRectRegion::intersectRegions(m_regularRenderJobsRegion, m_parent->frontState()->backingStoreRect());
     641        m_currentRegularRenderJobsBatch = tileIndexesIntersectingRegion(m_regularRenderJobsRegion, m_parent->frontState());
    645642
    646643        // Create a region object that will be checked when adding new rects before
     
    666663    TileIndexList tilesToRender;
    667664
    668     unsigned numberOfAvailableBackBuffers = shouldDirectRenderingToWindow
    669         ? 0
    670         : SurfacePool::globalSurfacePool()->numberOfAvailableBackBuffers();
     665    unsigned numberOfAvailableBackBuffers = SurfacePool::globalSurfacePool()->numberOfAvailableBackBuffers();
    671666
    672667    while (!outstandingJobs->isEmpty() && numberOfAvailableBackBuffers) {
     
    751746    }
    752747
    753     Platform::IntRectRegion renderedRegion;
    754 
    755     if (shouldDirectRenderingToWindow) {
    756         // Try rendering once, if we're suspended there will be another
    757         // full-screen update later on anyways.
    758         renderedRegion = m_parent->renderDirectToWindow(m_currentRegularRenderJobsBatchRegion.extents());
    759         m_currentRegularRenderJobsBatchRegion = Platform::IntRectRegion();
    760     } else {
    761         renderedRegion = tileRegion(completedJobs, m_parent->frontState());
    762     }
     748    const Platform::IntRectRegion renderedRegion = tileRegion(completedJobs, m_parent->frontState());
    763749
    764750    m_regularRenderJobsNotRenderedRegion = Platform::IntRectRegion::unionRegions(m_regularRenderJobsNotRenderedRegion, regionNotRenderedThisTime);
     
    812798#endif
    813799
    814     bool shouldDirectRenderingToWindow = m_parent->shouldDirectRenderingToWindow();
    815800    Platform::IntRect contentsRect = m_parent->expandedContentsRect();
    816801
    817     unsigned numberOfAvailableBackBuffers = shouldDirectRenderingToWindow
    818         ? 0
    819         : SurfacePool::globalSurfacePool()->numberOfAvailableBackBuffers();
     802    unsigned numberOfAvailableBackBuffers = SurfacePool::globalSurfacePool()->numberOfAvailableBackBuffers();
    820803
    821804    // If we take multiple turns to render, we sort to make them appear in the right order.
     
    881864        if (!allAtOnceIfPossible)
    882865            break; // We can do the rest next time.
    883     }
    884 
    885     if (shouldDirectRenderingToWindow) {
    886         // In direct rendering mode, any zoom or scroll job would require a
    887         // full-screen update.
    888         Platform::IntRect visibleContentsRect = m_parent->visibleContentsRect();
    889         Platform::IntRect renderedRect = m_parent->renderDirectToWindow(visibleContentsRect);
    890         if (!renderedRect.isEmpty())
    891             outstandingJobs->clear();
    892866    }
    893867
  • trunk/Source/WebKit/blackberry/WebKitSupport/SurfacePool.cpp

    r142037 r142677  
    8787
    8888    if (!m_numberOfFrontBuffers)
    89         return; // we only use direct rendering when 0 tiles are specified.
     89        return; // We completely disable tile rendering when 0 tiles are specified.
    9090
    9191    const unsigned numberOfBackBuffers = Platform::Settings::instance()->numberOfBackingStoreBackBuffers();
Note: See TracChangeset for help on using the changeset viewer.