summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-22 02:19:26 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-22 02:19:26 +0000
commit4d4ba0b64982ce288ac816c7a33a0d7c228ffd75 (patch)
tree3412caae112ec950c55399673d86a6fe5cdea480 /cc
parent9c1418de65f3be1de23b696ca7cc6531ae1fea89 (diff)
downloadchromium_src-4d4ba0b64982ce288ac816c7a33a0d7c228ffd75.zip
chromium_src-4d4ba0b64982ce288ac816c7a33a0d7c228ffd75.tar.gz
chromium_src-4d4ba0b64982ce288ac816c7a33a0d7c228ffd75.tar.bz2
Use more granularity in scheduling software texture uploads.
"Texture" uploads in the software rendering case happen in the CPU on the impl thread, so each individual update can be checked to make sure that it won't hit the deadline, and they don't need to be batched up. BUG=269919 Review URL: https://chromiumcodereview.appspot.com/23190021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@218902 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/resources/resource_provider.cc13
-rw-r--r--cc/resources/resource_provider.h1
-rw-r--r--cc/resources/resource_update_controller.cc8
3 files changed, 17 insertions, 5 deletions
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index ff339e9..1911d86 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -30,6 +30,10 @@ namespace cc {
namespace {
+// Measured in seconds.
+const double kSoftwareUploadTickRate = 0.000250;
+const double kTextureUploadTickRate = 0.004;
+
GLenum TextureToStorageFormat(GLenum texture_format) {
GLenum storage_format = GL_RGBA8_OES;
switch (texture_format) {
@@ -461,6 +465,15 @@ void ResourceProvider::ReleaseCachedData() {
texture_uploader_->ReleaseCachedQueries();
}
+base::TimeDelta ResourceProvider::TextureUpdateTickRate() {
+ // Software resource uploads happen on impl thread, so don't bother batching
+ // them up and trying to wait for them to complete.
+ double rate =
+ texture_uploader_ ? kTextureUploadTickRate : kSoftwareUploadTickRate;
+ return base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond *
+ rate);
+}
+
void ResourceProvider::Flush() {
DCHECK(thread_checker_.CalledOnValidThread());
WebGraphicsContext3D* context3d = Context3d();
diff --git a/cc/resources/resource_provider.h b/cc/resources/resource_provider.h
index 73b6e2b..146ceb1 100644
--- a/cc/resources/resource_provider.h
+++ b/cc/resources/resource_provider.h
@@ -118,6 +118,7 @@ class CC_EXPORT ResourceProvider {
double EstimatedUploadsPerSecond();
void FlushUploads();
void ReleaseCachedData();
+ base::TimeDelta TextureUpdateTickRate();
// Flush all context operations, kicking uploads and ensuring ordering with
// respect to other contexts.
diff --git a/cc/resources/resource_update_controller.cc b/cc/resources/resource_update_controller.cc
index a46a7d1..3c8b1e7 100644
--- a/cc/resources/resource_update_controller.cc
+++ b/cc/resources/resource_update_controller.cc
@@ -16,9 +16,6 @@ namespace {
const size_t kPartialTextureUpdatesMax = 12;
// Measured in seconds.
-const double kTextureUpdateTickRate = 0.004;
-
-// Measured in seconds.
const double kUploaderBusyTickRate = 0.001;
// Number of blocking update intervals to allow.
@@ -36,7 +33,8 @@ size_t ResourceUpdateController::MaxFullUpdatesPerTick(
ResourceProvider* resource_provider) {
double textures_per_second = resource_provider->EstimatedUploadsPerSecond();
size_t textures_per_tick =
- floor(kTextureUpdateTickRate * textures_per_second);
+ floor(resource_provider->TextureUpdateTickRate().InSecondsF() *
+ textures_per_second);
return textures_per_tick ? textures_per_tick : 1;
}
@@ -119,7 +117,7 @@ base::TimeTicks ResourceUpdateController::Now() const {
}
base::TimeDelta ResourceUpdateController::UpdateMoreTexturesTime() const {
- return base::TimeDelta::FromMilliseconds(kTextureUpdateTickRate * 1000);
+ return resource_provider_->TextureUpdateTickRate();
}
size_t ResourceUpdateController::UpdateMoreTexturesSize() const {