Changeset 109168 in webkit


Ignore:
Timestamp:
Feb 28, 2012 4:27:41 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Reset damage tracker on visibility change.
https://bugs.webkit.org/show_bug.cgi?id=79267

Patch by Jonathan Backer <backer@chromium.org> on 2012-02-28
Reviewed by James Robinson.

Source/WebCore:

Unit tests: CCLayerTreeHostImplTest.cpp

  • platform/graphics/chromium/LayerRendererChromium.cpp:

(WebCore::LayerRendererChromium::setVisible):

Source/WebKit/chromium:

  • tests/CCLayerTreeHostImplTest.cpp:

(WebKit::PartialSwapTrackerContext::getString):
(WebKit):
(WebKit::TEST_F):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109162 r109168  
     12012-02-28  Jonathan Backer  <backer@chromium.org>
     2
     3        [chromium] Reset damage tracker on visibility change.
     4        https://bugs.webkit.org/show_bug.cgi?id=79267
     5
     6        Reviewed by James Robinson.
     7
     8        Unit tests: CCLayerTreeHostImplTest.cpp
     9
     10        * platform/graphics/chromium/LayerRendererChromium.cpp:
     11        (WebCore::LayerRendererChromium::setVisible):
     12
    1132012-02-28  Sheriff Bot  <webkit.review.bot@gmail.com>
    214
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r108675 r109168  
    286286    if (!visible)
    287287        releaseRenderSurfaceTextures();
     288
     289    // TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manage front/backbuffers
     290    // crbug.com/116049
    288291    if (m_capabilities.usingSetVisibility) {
    289292        Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(m_context->getExtensions());
    290293        extensions3DChromium->setVisibilityCHROMIUM(visible);
     294
     295        // Reset the damage tracker because the front/back buffers may have been damaged by the GPU
     296        // process on visibility change.
     297        if (visible && m_capabilities.usingPartialSwap)
     298            m_owner->setFullRootLayerDamage();
    291299    }
    292300}
  • trunk/Source/WebKit/chromium/ChangeLog

    r109155 r109168  
     12012-02-28  Jonathan Backer  <backer@chromium.org>
     2
     3        [chromium] Reset damage tracker on visibility change.
     4        https://bugs.webkit.org/show_bug.cgi?id=79267
     5
     6        Reviewed by James Robinson.
     7
     8        * tests/CCLayerTreeHostImplTest.cpp:
     9        (WebKit::PartialSwapTrackerContext::getString):
     10        (WebKit):
     11        (WebKit::TEST_F):
     12
    1132012-02-28  Tim Dresser  <tdresser@chromium.org>
    214
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

    r108941 r109168  
    746746    {
    747747        if (name == GraphicsContext3D::EXTENSIONS)
    748             return WebString("GL_CHROMIUM_post_sub_buffer");
     748            return WebString("GL_CHROMIUM_post_sub_buffer GL_CHROMIUM_set_visibility");
    749749
    750750        return WebString();
     
    823823}
    824824
     825// Make sure that we reset damage tracking on visibility change because the
     826// state of the front buffer that we push to with PostSubBuffer is undefined.
     827TEST_F(CCLayerTreeHostImplTest, visibilityChangeResetsDamage)
     828{
     829    PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext();
     830    RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
     831
     832    // This test creates its own CCLayerTreeHostImpl, so
     833    // that we can force partial swap enabled.
     834    CCSettings settings;
     835    settings.partialSwapEnabled = true;
     836    OwnPtr<CCLayerTreeHostImpl> layerTreeHostImpl = CCLayerTreeHostImpl::create(settings, this);
     837    layerTreeHostImpl->initializeLayerRenderer(context);
     838    layerTreeHostImpl->setViewportSize(IntSize(500, 500));
     839
     840    CCLayerImpl* root = new FakeDrawableCCLayerImpl(1);
     841    root->setAnchorPoint(FloatPoint(0, 0));
     842    root->setBounds(IntSize(500, 500));
     843    root->setDrawsContent(true);
     844    layerTreeHostImpl->setRootLayer(adoptPtr(root));
     845
     846    // First frame: ignore.
     847    layerTreeHostImpl->drawLayers();
     848    layerTreeHostImpl->swapBuffers();
     849 
     850    // Second frame: nothing has changed --- so we souldn't push anything with partial swap.
     851    layerTreeHostImpl->drawLayers();
     852    layerTreeHostImpl->swapBuffers();
     853    EXPECT_TRUE(partialSwapTracker->partialSwapRect().isEmpty());
     854
     855    // Third frame: visibility change --- so we should push a full frame with partial swap.
     856    layerTreeHostImpl->setVisible(false);
     857    layerTreeHostImpl->setVisible(true);
     858    layerTreeHostImpl->drawLayers();
     859    layerTreeHostImpl->swapBuffers();
     860    IntRect actualSwapRect = partialSwapTracker->partialSwapRect();
     861    IntRect expectedSwapRect = IntRect(IntPoint::zero(), IntSize(500, 500));
     862    EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
     863    EXPECT_EQ(expectedSwapRect.y(), actualSwapRect.y());
     864    EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width());
     865    EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height());
     866}
     867
    825868} // namespace
Note: See TracChangeset for help on using the changeset viewer.