summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-26 23:09:50 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-26 23:09:50 +0000
commita10b4a0972de06031b1d066534da70548eb82f48 (patch)
treede841db2231c3beadc3255eb11d8d426d0cc16b0 /gpu
parentfa4b6c35cfd7e06656d44dd8881aebf5b9d0912f (diff)
downloadchromium_src-a10b4a0972de06031b1d066534da70548eb82f48.zip
chromium_src-a10b4a0972de06031b1d066534da70548eb82f48.tar.gz
chromium_src-a10b4a0972de06031b1d066534da70548eb82f48.tar.bz2
Only check for context lost when finishing a batch of flushed commands.
The check for context lost is too expensive to do after every single draw call, so instead do it after a batch of commands has been issued. BUG=160318 Review URL: https://chromiumcodereview.appspot.com/11417112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169523 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc10
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_mock.h1
-rw-r--r--gpu/command_buffer/service/gpu_scheduler.cc7
4 files changed, 10 insertions, 10 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 29b92c3..406f728 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1365,7 +1365,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>,
size_t GetBackbufferMemoryTotal();
// Returns true if the context was just lost due to e.g. GL_ARB_robustness.
- bool WasContextLost();
+ virtual bool WasContextLost() OVERRIDE;
#if defined(OS_MACOSX)
void ReleaseIOSurfaceForTexture(GLuint texture_id);
@@ -5542,10 +5542,6 @@ error::Error GLES2DecoderImpl::DoDrawArrays(
if (simulated_attrib_0) {
RestoreStateForAttrib(0);
}
- if (WasContextLost()) {
- LOG(ERROR) << " GLES2DecoderImpl: Context lost during DrawArrays.";
- return error::kLostContext;
- }
}
return error::kNoError;
}
@@ -5661,10 +5657,6 @@ error::Error GLES2DecoderImpl::DoDrawElements(
if (simulated_attrib_0) {
RestoreStateForAttrib(0);
}
- if (WasContextLost()) {
- LOG(ERROR) << " GLES2DecoderImpl: Context lost during DrawElements.";
- return error::kLostContext;
- }
}
return error::kNoError;
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index cd2be50..160a301 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -186,6 +186,8 @@ class GPU_EXPORT GLES2Decoder : public CommonDecoder {
virtual base::TimeDelta GetTotalProcessingCommandsTime() = 0;
virtual void AddProcessingCommandsTime(base::TimeDelta) = 0;
+ virtual bool WasContextLost() = 0;
+
static bool IsAngle();
// Used for testing only
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
index be58b3c0..427c44e 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_mock.h
@@ -80,6 +80,7 @@ class MockGLES2Decoder : public GLES2Decoder {
MOCK_METHOD0(GetTotalTextureUploadTime, base::TimeDelta());
MOCK_METHOD0(GetTotalProcessingCommandsTime, base::TimeDelta());
MOCK_METHOD1(AddProcessingCommandsTime, void(base::TimeDelta));
+ MOCK_METHOD0(WasContextLost, bool());
DISALLOW_COPY_AND_ASSIGN(MockGLES2Decoder);
};
diff --git a/gpu/command_buffer/service/gpu_scheduler.cc b/gpu/command_buffer/service/gpu_scheduler.cc
index c78ae71..9702945 100644
--- a/gpu/command_buffer/service/gpu_scheduler.cc
+++ b/gpu/command_buffer/service/gpu_scheduler.cc
@@ -106,9 +106,14 @@ void GpuScheduler::PutChanged() {
break;
}
- if (decoder_)
+ if (decoder_) {
+ if (!error::IsError(error) && decoder_->WasContextLost()) {
+ command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
+ command_buffer_->SetParseError(error::kLostContext);
+ }
decoder_->AddProcessingCommandsTime(
base::TimeTicks::HighResNow() - begin_time);
+ }
}
void GpuScheduler::SetScheduled(bool scheduled) {