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

Unified Diff: cc/CCTextureUpdateController.cpp

Issue 10917265: cc: Remove partial texture updates from scheduler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove using directive and add comment about uploader being busy Created 8 years, 3 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 | « cc/CCTextureUpdateController.h ('k') | cc/CCThreadProxy.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/CCTextureUpdateController.cpp
diff --git a/cc/CCTextureUpdateController.cpp b/cc/CCTextureUpdateController.cpp
index 73e22c79c00b2c426daa6c7ae9225820c82d5088..22fbd46fe63168aaedb92d29497130692e79e0ee 100644
--- a/cc/CCTextureUpdateController.cpp
+++ b/cc/CCTextureUpdateController.cpp
@@ -19,6 +19,9 @@ static const size_t textureUpdatesPerTick = 12;
// Measured in seconds.
static const double textureUpdateTickRate = 0.004;
+// Measured in seconds.
+static const double uploaderBusyTickRate = 0.001;
+
// Flush interval when performing texture uploads.
static const int textureUploadFlushPeriod = 4;
@@ -131,6 +134,13 @@ void CCTextureUpdateController::updateMoreTextures(double monotonicTimeLimit)
updateMoreTexturesNow();
}
+void CCTextureUpdateController::updateAllTexturesNow()
+{
+ while (m_queue->hasMoreUpdates())
+ updateTextures(m_resourceProvider, m_copier, m_uploader, m_queue.get(),
+ updateMoreTexturesSize());
+}
+
void CCTextureUpdateController::onTimerFired()
{
if (!updateMoreTexturesIfEnoughTimeRemaining())
@@ -154,7 +164,15 @@ size_t CCTextureUpdateController::updateMoreTexturesSize() const
bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
{
- if (!m_queue->hasMoreUpdates())
+ // Uploader might be busy when we're too aggressive in our upload time
+ // estimate. We use a different timeout here to prevent unnecessary
+ // amounts idle time.
+ if (m_uploader->isBusy()) {
+ m_timer->startOneShot(uploaderBusyTickRate);
+ return true;
+ }
+
+ if (!m_queue->fullUploadSize())
return false;
bool hasTimeRemaining = monotonicTimeNow() < m_monotonicTimeLimit - updateMoreTexturesTime();
@@ -166,8 +184,30 @@ bool CCTextureUpdateController::updateMoreTexturesIfEnoughTimeRemaining()
void CCTextureUpdateController::updateMoreTexturesNow()
nduca 2012/09/17 18:26:15 I think you could make this whole patch a lot clea
{
- m_timer->startOneShot(updateMoreTexturesTime());
- updateTextures(m_resourceProvider, m_copier, m_uploader, m_queue.get(), updateMoreTexturesSize());
+ size_t uploads = std::min(
+ m_queue->fullUploadSize(), updateMoreTexturesSize());
+ m_timer->startOneShot(
+ updateMoreTexturesTime() / updateMoreTexturesSize() * uploads);
+
+ if (!uploads)
+ return;
+
+ m_uploader->beginUploads();
+
+ size_t uploadCount = 0;
+ while (uploads--) {
+ m_uploader->uploadTexture(
+ m_resourceProvider, m_queue->takeFirstFullUpload());
+ uploadCount++;
+ if (!(uploadCount % textureUploadFlushPeriod))
+ m_resourceProvider->shallowFlushIfSupported();
+ }
+
+ // Make sure there are no dangling partial uploads without a flush.
+ if (uploadCount % textureUploadFlushPeriod)
+ m_resourceProvider->shallowFlushIfSupported();
+
+ m_uploader->endUploads();
}
}
« no previous file with comments | « cc/CCTextureUpdateController.h ('k') | cc/CCThreadProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698