summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer
diff options
context:
space:
mode:
authorjbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 00:23:23 +0000
committerjbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-20 00:23:23 +0000
commit89d6ed0dd24285258c7371b3c24f5a5859b99ae3 (patch)
tree0b7afa63575886659ae332818ac62e331a1587b8 /gpu/command_buffer
parent9d38ff95854ce51a1873601dc9ef4566a36b4ddf (diff)
downloadchromium_src-89d6ed0dd24285258c7371b3c24f5a5859b99ae3.zip
chromium_src-89d6ed0dd24285258c7371b3c24f5a5859b99ae3.tar.gz
chromium_src-89d6ed0dd24285258c7371b3c24f5a5859b99ae3.tar.bz2
With latch support and higher level frame throttling, we no longer need to limit SwapBuffers calls by using glSet/TestFenceNV in GpuScheduler.
BUG=79940 TEST=open page with CSS 3D transform animation; open about:gpu and start tracing; verify that between frames, there are not many short calls to ProcessCommands Review URL: http://codereview.chromium.org/6873095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r--gpu/command_buffer/common/constants.h13
-rw-r--r--gpu/command_buffer/service/cmd_parser.cc4
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc13
-rw-r--r--gpu/command_buffer/service/gpu_scheduler.cc40
-rw-r--r--gpu/command_buffer/service/gpu_scheduler.h3
5 files changed, 11 insertions, 62 deletions
diff --git a/gpu/command_buffer/common/constants.h b/gpu/command_buffer/common/constants.h
index 6ef22aa..ca1d5a8 100644
--- a/gpu/command_buffer/common/constants.h
+++ b/gpu/command_buffer/common/constants.h
@@ -26,14 +26,13 @@ namespace error {
// This is not an error. It is returned by WaitLatch when it is blocked.
// When blocked, the context will not reschedule itself until another
// context executes a SetLatch command.
- kWaiting,
-
- // This is not an error. It is returned by commands to mark a position
- // in the command buffer that should not be issued to the the GL backend
- // until no more than a fixed number of such positions have already been
- // issued.
- kThrottle
+ kWaiting
};
+
+ // Return true if the given error code is an actual error.
+ inline bool IsError(Error error) {
+ return (error != kNoError && error != kWaiting);
+ }
}
// Invalid shared memory Id, returned by RegisterSharedMemory in case of
diff --git a/gpu/command_buffer/service/cmd_parser.cc b/gpu/command_buffer/service/cmd_parser.cc
index 199eb05..9ed3fca 100644
--- a/gpu/command_buffer/service/cmd_parser.cc
+++ b/gpu/command_buffer/service/cmd_parser.cc
@@ -59,9 +59,7 @@ error::Error CommandParser::ProcessCommand() {
// TODO(gman): If you want to log errors this is the best place to catch them.
// It seems like we need an official way to turn on a debug mode and
// get these errors.
- if (result != error::kNoError &&
- result != error::kThrottle &&
- result != error::kWaiting) {
+ if (error::IsError(result)) {
ReportError(header.command, result);
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index db58132..42f9a2b 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -6341,7 +6341,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
if (swap_buffers_callback_.get()) {
swap_buffers_callback_->Run();
}
- return error::kThrottle;
+ return error::kNoError;
} else {
ScopedFrameBufferBinder binder(this,
offscreen_target_frame_buffer_->id());
@@ -6363,7 +6363,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
if (swap_buffers_callback_.get()) {
swap_buffers_callback_->Run();
}
- return error::kThrottle;
+ return error::kNoError;
}
} else {
if (!context_->SwapBuffers()) {
@@ -6376,14 +6376,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
swap_buffers_callback_->Run();
}
- // Do not throttle SwapBuffers by returning kThrottle. The intent of
- // throttling the offscreen command buffers to a fixed number of frames
- // ahead is to prevent them from rendering faster than they can be
- // presented, not to limit the rate at which we present.
- //
- // This does not hold for ANGLE, possibly because all the GL contexts in a
- // share group are actually one D3D device. Found by trial and error.
- return IsAngle() ? error::kThrottle : error::kNoError;
+ return error::kNoError;
}
error::Error GLES2DecoderImpl::HandleSetLatchCHROMIUM(
diff --git a/gpu/command_buffer/service/gpu_scheduler.cc b/gpu/command_buffer/service/gpu_scheduler.cc
index 1ae36c4..1782dec 100644
--- a/gpu/command_buffer/service/gpu_scheduler.cc
+++ b/gpu/command_buffer/service/gpu_scheduler.cc
@@ -13,15 +13,12 @@
using ::base::SharedMemory;
-static size_t kNumThrottleFences = 1;
-
namespace gpu {
GpuScheduler::GpuScheduler(CommandBuffer* command_buffer,
gles2::ContextGroup* group)
: command_buffer_(command_buffer),
commands_per_update_(100),
- num_throttle_fences_(0),
#if defined(OS_MACOSX)
swap_buffers_count_(0),
acknowledged_swap_buffers_count_(0),
@@ -38,7 +35,6 @@ GpuScheduler::GpuScheduler(CommandBuffer* command_buffer,
int commands_per_update)
: command_buffer_(command_buffer),
commands_per_update_(commands_per_update),
- num_throttle_fences_(0),
#if defined(OS_MACOSX)
swap_buffers_count_(0),
acknowledged_swap_buffers_count_(0),
@@ -66,11 +62,6 @@ bool GpuScheduler::InitializeCommon(
if (!context->MakeCurrent())
return false;
- // If the NV_fence extension is present, use fences to defer the issue of
- // commands once a certain fixed number of frames have been rendered.
- num_throttle_fences_ =
- context->HasExtension("GL_NV_fence") ? kNumThrottleFences : 0;
-
// Do not limit to a certain number of commands before scheduling another
// update when rendering onscreen.
if (!context->IsOffscreen())
@@ -153,19 +144,6 @@ void GpuScheduler::ProcessCommands() {
}
#endif
- // Defer this command until the fence queue is not full.
- while (num_throttle_fences_ > 0 &&
- throttle_fences_.size() >= num_throttle_fences_) {
- GLuint fence = throttle_fences_.front();
- if (!glTestFenceNV(fence)) {
- ScheduleProcessCommands();
- return;
- }
-
- glDeleteFencesNV(1, &fence);
- throttle_fences_.pop();
- }
-
error::Error error = error::kNoError;
int commands_processed = 0;
while (commands_processed < commands_per_update_ && !parser_->IsEmpty()) {
@@ -174,23 +152,7 @@ void GpuScheduler::ProcessCommands() {
break;
}
- // If the command indicated it should be throttled, insert a new fence into
- // the fence queue.
- if (error == error::kThrottle) {
- if (num_throttle_fences_ > 0 &&
- throttle_fences_.size() < num_throttle_fences_) {
- GLuint fence;
- glGenFencesNV(1, &fence);
- glSetFenceNV(fence, GL_ALL_COMPLETED_NV);
- throttle_fences_.push(fence);
-
- // Neither glTestFenceNV or glSetFenceNV are guaranteed to flush.
- // Without an explicit flush, the glTestFenceNV loop might never
- // make progress.
- glFlush();
- break;
- }
- } else if (error != error::kNoError) {
+ if (error::IsError(error)) {
command_buffer_->SetParseError(error);
return;
}
diff --git a/gpu/command_buffer/service/gpu_scheduler.h b/gpu/command_buffer/service/gpu_scheduler.h
index 36cc009..173e953 100644
--- a/gpu/command_buffer/service/gpu_scheduler.h
+++ b/gpu/command_buffer/service/gpu_scheduler.h
@@ -151,9 +151,6 @@ class GpuScheduler : public CommandBufferEngine {
scoped_ptr<gles2::GLES2Decoder> decoder_;
scoped_ptr<CommandParser> parser_;
- size_t num_throttle_fences_;
- std::queue<unsigned> throttle_fences_;
-
#if defined(OS_MACOSX)
scoped_ptr<AcceleratedSurface> surface_;
uint64 swap_buffers_count_;