Commit 3f1d4939 authored by epenner@chromium.org's avatar epenner@chromium.org

cc: Fix resource provider fences and add DCHECKs.

When I added the resource provider fence concept, I didn't
extend the read-fence long enough (it currently only protects
the current frame). This extends the read-lock for one frame.

BUG=172995

Review URL: https://chromiumcodereview.appspot.com/12220095

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182162 0039d316-1c4b-4281-b951-d872f2087c98
parent ebbffaef
...@@ -1324,11 +1324,6 @@ bool GLRenderer::swapBuffers() ...@@ -1324,11 +1324,6 @@ bool GLRenderer::swapBuffers()
TRACE_EVENT0("cc", "GLRenderer::swapBuffers"); TRACE_EVENT0("cc", "GLRenderer::swapBuffers");
// We're done! Time to swapbuffers! // We're done! Time to swapbuffers!
scoped_refptr<ResourceProvider::Fence> lastSwapFence = m_resourceProvider->getReadLockFence();
if (lastSwapFence)
static_cast<SimpleSwapFence*>(lastSwapFence.get())->setHasPassed();
m_resourceProvider->setReadLockFence(new SimpleSwapFence());
if (m_capabilities.usingPartialSwap) { if (m_capabilities.usingPartialSwap) {
// If supported, we can save significant bandwidth by only swapping the damaged/scissored region (clamped to the viewport) // If supported, we can save significant bandwidth by only swapping the damaged/scissored region (clamped to the viewport)
m_swapBufferRect.Intersect(gfx::Rect(gfx::Point(), viewportSize())); m_swapBufferRect.Intersect(gfx::Rect(gfx::Point(), viewportSize()));
...@@ -1342,6 +1337,14 @@ bool GLRenderer::swapBuffers() ...@@ -1342,6 +1337,14 @@ bool GLRenderer::swapBuffers()
m_swapBufferRect = gfx::Rect(); m_swapBufferRect = gfx::Rect();
// We don't have real fences, so we mark read fences as passed
// assuming a double-buffered GPU pipeline. A texture can be
// written to after one full frame has past since it was last read.
if (m_lastSwapFence)
static_cast<SimpleSwapFence*>(m_lastSwapFence.get())->setHasPassed();
m_lastSwapFence = m_resourceProvider->getReadLockFence();
m_resourceProvider->setReadLockFence(new SimpleSwapFence());
return true; return true;
} }
......
...@@ -231,6 +231,8 @@ private: ...@@ -231,6 +231,8 @@ private:
scoped_ptr<ResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; scoped_ptr<ResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock;
scoped_refptr<ResourceProvider::Fence> m_lastSwapFence;
DISALLOW_COPY_AND_ASSIGN(GLRenderer); DISALLOW_COPY_AND_ASSIGN(GLRenderer);
}; };
......
...@@ -149,10 +149,10 @@ namespace { ...@@ -149,10 +149,10 @@ namespace {
void CompositorOutputSurface::UpdateSmoothnessTakesPriority( void CompositorOutputSurface::UpdateSmoothnessTakesPriority(
bool prefers_smoothness) { bool prefers_smoothness) {
#if ENABLE_DCHECK #ifndef NDEBUG
// If we use different compositor threads, we need to // If we use different compositor threads, we need to
// use an atomic int to track prefer smoothness count. // use an atomic int to track prefer smoothness count.
static int g_last_thread = base::PlatformThread::CurrentId(); base::PlatformThreadId g_last_thread = base::PlatformThread::CurrentId();
DCHECK_EQ(g_last_thread, base::PlatformThread::CurrentId()); DCHECK_EQ(g_last_thread, base::PlatformThread::CurrentId());
#endif #endif
if (prefers_smoothness_ == prefers_smoothness) if (prefers_smoothness_ == prefers_smoothness)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment