Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: cc/layer_tree_host_impl.cc

Issue 12197004: cc: Enforce correct recycling in resource pool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use fence interface. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/resource_pool.cc » ('j') | cc/resource_pool.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index d1e90409007a922b5268a96b5b7f4a61af1e3151..3e2b083d9b15f33e52205d50f4445fcf49121866 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -841,11 +841,33 @@ const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const
return m_renderer->capabilities();
}
+namespace {
+// This implements a simple fence based on client side swaps.
+// This is to isolate the ResourceProvider from 'frames' which
+// it shouldn't need to care about, while still allowing us to
+// enforce correct texture recycling behavior strictly throughout
+// the compositor. The reason textures are recycled is so that
+// we can avoid writing to them while they are in use on the GPU.
+class SimpleSwapFence : public ResourceProvider::Fence {
+public:
+ SimpleSwapFence() : m_passed(false) {}
+ virtual bool hasPassed() OVERRIDE { return m_passed; }
+ bool setToPassed() { m_passed = true; }
nduca 2013/02/05 22:39:05 m_passed -> m_hasPassed setHasPassed()
epenner 2013/02/05 23:27:36 Done.
+private:
+ bool m_passed;
+};
+}
+
bool LayerTreeHostImpl::swapBuffers()
nduca 2013/02/05 22:39:05 what if output_surface.h had a scoped<RefPtr> Reso
piman 2013/02/05 22:46:47 Sadly I don't think it knows about it yet, though
epenner 2013/02/05 23:27:36 Done.
{
DCHECK(m_renderer);
bool result = m_renderer->swapBuffers();
+ scoped_refptr<ResourceProvider::Fence> lastSwapFence = m_resourceProvider->getReadLockFence();
+ if (lastSwapFence)
+ static_cast<SimpleSwapFence*>(lastSwapFence.get())->setToPassed();
+ m_resourceProvider->setReadLockFence(new SimpleSwapFence());
+
piman 2013/02/05 22:19:07 Can we move that logic to the renderer? It shouldn
epenner 2013/02/05 23:27:36 Done.
if (m_settings.implSidePainting &&
!activeTree()->AreVisibleResourcesReady()) {
m_client->didSwapUseIncompleteTileOnImplThread();
« no previous file with comments | « no previous file | cc/resource_pool.cc » ('j') | cc/resource_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698