Title: [126540] trunk/Source
- Revision
- 126540
- Author
- [email protected]
- Date
- 2012-08-23 22:00:01 -0700 (Thu, 23 Aug 2012)
Log Message
[chromium] Fix lost context when textures are evicted
https://bugs.webkit.org/show_bug.cgi?id=94892
Reviewed by James Robinson.
After eviction, the CCPrioritizedTextureManager is in a limbo state
where all its resources are invalid. If we try to release them we will
double-destroy them.
New test: CCLayerTreeHostTestLostContextAfterEvictTextures.
Source/WebCore:
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::recreateContextOnImplThread):
Source/WebKit/chromium:
* tests/CCLayerTreeHostTest.cpp:
(CCLayerTreeHostTestLostContextAfterEvictTextures):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::CCLayerTreeHostTestLostContextAfterEvictTextures):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::beginTest):
(EvictTexturesAndLoseContextTask):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::EvictTexturesAndLoseContextTask):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::~EvictTexturesAndLoseContextTask):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::run):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::postEvictTexturesAndLoseContext):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::didCommitAndDrawFrame):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::commitCompleteOnCCThread):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::didRecreateOutputSurface):
(WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::afterTest):
(WTF):
(WTF::TEST_F):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (126539 => 126540)
--- trunk/Source/WebCore/ChangeLog 2012-08-24 04:55:37 UTC (rev 126539)
+++ trunk/Source/WebCore/ChangeLog 2012-08-24 05:00:01 UTC (rev 126540)
@@ -1,3 +1,19 @@
+2012-08-23 Antoine Labour <[email protected]>
+
+ [chromium] Fix lost context when textures are evicted
+ https://bugs.webkit.org/show_bug.cgi?id=94892
+
+ Reviewed by James Robinson.
+
+ After eviction, the CCPrioritizedTextureManager is in a limbo state
+ where all its resources are invalid. If we try to release them we will
+ double-destroy them.
+
+ New test: CCLayerTreeHostTestLostContextAfterEvictTextures.
+
+ * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+ (WebCore::CCThreadProxy::recreateContextOnImplThread):
+
2012-08-23 Keishi Hattori <[email protected]>
REGRESSION(r126132): thumb doesn't match click position for rtl input type=range
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp (126539 => 126540)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp 2012-08-24 04:55:37 UTC (rev 126539)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp 2012-08-24 05:00:01 UTC (rev 126540)
@@ -156,7 +156,8 @@
bool initialized;
{
DebugScopedSetImplThread impl;
- m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
+ if (!m_layerTreeHostImpl->contentsTexturesPurged())
+ m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
initialized = m_layerTreeHostImpl->initializeRenderer(context.release(), UnthrottledUploader);
if (initialized) {
m_RendererCapabilitiesForMainThread = m_layerTreeHostImpl->rendererCapabilities();
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (126539 => 126540)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2012-08-24 04:55:37 UTC (rev 126539)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2012-08-24 05:00:01 UTC (rev 126540)
@@ -892,7 +892,8 @@
{
TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread");
ASSERT(isImplThread());
- m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
+ if (!m_layerTreeHostImpl->contentsTexturesPurged())
+ m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider());
*recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(adoptPtr(contextPtr), textureUploader);
if (*recreateSucceeded) {
*capabilities = m_layerTreeHostImpl->rendererCapabilities();
Modified: trunk/Source/WebKit/chromium/ChangeLog (126539 => 126540)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-24 04:55:37 UTC (rev 126539)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-24 05:00:01 UTC (rev 126540)
@@ -1,5 +1,34 @@
2012-08-23 Antoine Labour <[email protected]>
+ [chromium] Fix lost context when textures are evicted
+ https://bugs.webkit.org/show_bug.cgi?id=94892
+
+ Reviewed by James Robinson.
+
+ After eviction, the CCPrioritizedTextureManager is in a limbo state
+ where all its resources are invalid. If we try to release them we will
+ double-destroy them.
+
+ New test: CCLayerTreeHostTestLostContextAfterEvictTextures.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (CCLayerTreeHostTestLostContextAfterEvictTextures):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::CCLayerTreeHostTestLostContextAfterEvictTextures):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::beginTest):
+ (EvictTexturesAndLoseContextTask):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::EvictTexturesAndLoseContextTask):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::~EvictTexturesAndLoseContextTask):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::EvictTexturesAndLoseContextTask::run):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::postEvictTexturesAndLoseContext):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::didCommitAndDrawFrame):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::didRecreateOutputSurface):
+ (WTF::CCLayerTreeHostTestLostContextAfterEvictTextures::afterTest):
+ (WTF):
+ (WTF::TEST_F):
+
+2012-08-23 Antoine Labour <[email protected]>
+
[chromium] Add OVERRIDEs in test code
https://bugs.webkit.org/show_bug.cgi?id=94894
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (126539 => 126540)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-08-24 04:55:37 UTC (rev 126539)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-08-24 05:00:01 UTC (rev 126540)
@@ -30,6 +30,7 @@
#include "CCLayerTreeHostImpl.h"
#include "CCOcclusionTrackerTestCommon.h"
#include "CCSettings.h"
+#include "CCSingleThreadProxy.h"
#include "CCTextureUpdateQueue.h"
#include "CCThreadedTest.h"
#include "CCTimingFunction.h"
@@ -2592,4 +2593,97 @@
runTest(true);
}
+class CCLayerTreeHostTestLostContextAfterEvictTextures : public CCLayerTreeHostTest {
+public:
+ CCLayerTreeHostTestLostContextAfterEvictTextures()
+ : m_layer(EvictionTestLayer::create())
+ , m_implForEvictTextures(0)
+ , m_numCommits(0)
+ {
+ }
+
+ virtual void beginTest() OVERRIDE
+ {
+ m_layerTreeHost->setRootLayer(m_layer);
+ m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20));
+
+ WebTransformationMatrix identityMatrix;
+ setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true);
+ }
+
+ class EvictTexturesTask : public WebKit::WebThread::Task {
+ public:
+ EvictTexturesTask(CCLayerTreeHostTestLostContextAfterEvictTextures* test) : m_test(test) { }
+ virtual ~EvictTexturesTask() { }
+ virtual void run() OVERRIDE
+ {
+ m_test->evictTexturesOnImplThread();
+ }
+
+ private:
+ CCLayerTreeHostTestLostContextAfterEvictTextures* m_test;
+ };
+
+ void postEvictTextures()
+ {
+ if (webThread())
+ webThread()->postTask(new EvictTexturesTask(this));
+ else {
+ DebugScopedSetImplThread impl;
+ evictTexturesOnImplThread();
+ }
+ }
+
+ void evictTexturesOnImplThread()
+ {
+ ASSERT(m_implForEvictTextures);
+ m_implForEvictTextures->releaseContentsTextures();
+ }
+
+ // Commit 1: Just commit and draw normally, then at the end, set ourselves
+ // invisible (to prevent a commit that would recreate textures after
+ // eviction, before the context recovery), and post a task that will evict
+ // textures, then cause the context to be lost, and then set ourselves
+ // visible again (to allow commits, since that's what causes context
+ // recovery in single thread).
+ virtual void didCommitAndDrawFrame() OVERRIDE
+ {
+ ++m_numCommits;
+ switch (m_numCommits) {
+ case 1:
+ EXPECT_TRUE(m_layer->updated());
+ m_layerTreeHost->setVisible(false);
+ postEvictTextures();
+ m_layerTreeHost->loseContext(1);
+ m_layerTreeHost->setVisible(true);
+ break;
+ default:
+ break;
+ }
+ }
+
+ virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
+ {
+ m_implForEvictTextures = impl;
+ }
+
+ virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE
+ {
+ EXPECT_TRUE(succeeded);
+ endTest();
+ }
+
+ virtual void afterTest() OVERRIDE
+ {
+ }
+
+private:
+ MockContentLayerDelegate m_delegate;
+ RefPtr<EvictionTestLayer> m_layer;
+ CCLayerTreeHostImpl* m_implForEvictTextures;
+ int m_numCommits;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLostContextAfterEvictTextures)
+
} // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes