summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-17 16:55:06 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-17 16:55:06 +0000
commit362e6d600309ea070f10aac6c4edda2342fc3123 (patch)
tree2468ee0d4f8356d101f99e68e73b84abce05f29c /gpu
parenta8738b81011aa754331d4a5f65af529259f39ee5 (diff)
downloadchromium_src-362e6d600309ea070f10aac6c4edda2342fc3123.zip
chromium_src-362e6d600309ea070f10aac6c4edda2342fc3123.tar.gz
chromium_src-362e6d600309ea070f10aac6c4edda2342fc3123.tar.bz2
Disable automatic flushes on compositor contexts.
The compositor contexts handle flushes themselves, so they don't need the automatic flushes, which can hurt performance. BUG=152393 Review URL: https://chromiumcodereview.appspot.com/11099029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.cc10
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.h5
2 files changed, 13 insertions, 2 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index d556b5e..54df89e 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -28,9 +28,14 @@ CommandBufferHelper::CommandBufferHelper(CommandBuffer* command_buffer)
commands_issued_(0),
usable_(true),
context_lost_(false),
+ flush_automatically_(true),
last_flush_time_(0) {
}
+void CommandBufferHelper::SetAutomaticFlushes(bool enabled) {
+ flush_automatically_ = enabled;
+}
+
bool CommandBufferHelper::IsContextLost() {
if (!context_lost_) {
context_lost_ = error::IsError(command_buffer()->GetLastError());
@@ -241,8 +246,9 @@ void CommandBufferHelper::WaitForAvailableEntries(int32 count) {
((get_offset() == last_put_sent_) ? 16 : 2);
if (pending > limit) {
Flush();
- } else if (commands_issued_ % kCommandsPerFlushCheck == 0) {
-#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
+ } else if (flush_automatically_ &&
+ (commands_issued_ % kCommandsPerFlushCheck == 0)) {
+#if !defined(OS_ANDROID)
// Allow this command buffer to be pre-empted by another if a "reasonable"
// amount of work has been done. On highend machines, this reduces the
// latency of GPU commands. However, on Android, this can cause the
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.h b/gpu/command_buffer/client/cmd_buffer_helper.h
index 9922794..8e7cd78 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.h
+++ b/gpu/command_buffer/client/cmd_buffer_helper.h
@@ -44,6 +44,10 @@ class GPU_EXPORT CommandBufferHelper {
// buffer.
bool Initialize(int32 ring_buffer_size);
+ // Sets whether the command buffer should automatically flush periodically
+ // to try to increase performance. Defaults to true.
+ void SetAutomaticFlushes(bool enabled);
+
// True if the context is lost.
bool IsContextLost();
@@ -292,6 +296,7 @@ class GPU_EXPORT CommandBufferHelper {
int commands_issued_;
bool usable_;
bool context_lost_;
+ bool flush_automatically_;
// Using C runtime instead of base because this file cannot depend on base.
clock_t last_flush_time_;