summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/common/cmd_buffer_common.h
diff options
context:
space:
mode:
authorpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-23 00:57:35 +0000
committerpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-23 00:57:35 +0000
commit6b7a63f77940d7746e85b1165073cb1c1cc13deb (patch)
treed2a63c42e07a53641bc19a3191f612a8665619c8 /gpu/command_buffer/common/cmd_buffer_common.h
parent1a6273b7545c8413208cd1831862870827645f1e (diff)
downloadchromium_src-6b7a63f77940d7746e85b1165073cb1c1cc13deb.zip
chromium_src-6b7a63f77940d7746e85b1165073cb1c1cc13deb.tar.gz
chromium_src-6b7a63f77940d7746e85b1165073cb1c1cc13deb.tar.bz2
Add a yield command to the command buffer.
This allows more graceful scheduling so that waiting on the previous frame's swapbuffers doesn't end up being a Finish. BUG=none TEST=check in about:gpu and verify that SwapBuffers in the renderer process actually only waits for the previous SwapBuffers in the gpu process. Review URL: http://codereview.chromium.org/6899037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/common/cmd_buffer_common.h')
-rw-r--r--gpu/command_buffer/common/cmd_buffer_common.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/gpu/command_buffer/common/cmd_buffer_common.h b/gpu/command_buffer/common/cmd_buffer_common.h
index e8bcd43..80d1e28 100644
--- a/gpu/command_buffer/common/cmd_buffer_common.h
+++ b/gpu/command_buffer/common/cmd_buffer_common.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -157,6 +157,7 @@ namespace cmd {
OP(SetBucketDataImmediate) /* 9 */ \
OP(GetBucketSize) /* 10 */ \
OP(GetBucketData) /* 11 */ \
+ OP(YieldScheduler) /* 12 */ \
// Common commands.
enum CommandId {
@@ -641,6 +642,32 @@ COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_id) == 16,
COMPILE_ASSERT(offsetof(GetBucketData, shared_memory_offset) == 20,
Offsetof_GetBucketData_shared_memory_offset_not_20);
+// A Yield command. Hints the scheduler that this is a good point to update the
+// state and schedule other command buffers.
+struct YieldScheduler {
+ typedef YieldScheduler ValueType;
+ static const CommandId kCmdId = kYieldScheduler;
+ static const cmd::ArgFlags kArgFlags = cmd::kFixed;
+
+ void SetHeader() {
+ header.SetCmd<ValueType>();
+ }
+
+ void Init() {
+ SetHeader();
+ }
+ static void* Set(void* cmd) {
+ static_cast<ValueType*>(cmd)->Init();
+ return NextCmdAddress<ValueType>(cmd);
+ }
+
+ CommandHeader header;
+};
+
+COMPILE_ASSERT(sizeof(YieldScheduler) == 4, Sizeof_YieldScheduler_is_not_4);
+COMPILE_ASSERT(offsetof(YieldScheduler, header) == 0,
+ Offsetof_YieldScheduler_header_not_0);
+
} // namespace cmd
#pragma pack(pop)