summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsievers <sievers@chromium.org>2015-06-09 11:58:47 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-09 18:59:23 +0000
commit8694f6333d49f17414ae71f5b43c50596b371096 (patch)
tree22daa69df6f9338cf944b6d91561682d3001e782
parent065551ca956210288a88519a209e5d0dafed9a49 (diff)
downloadchromium_src-8694f6333d49f17414ae71f5b43c50596b371096.zip
chromium_src-8694f6333d49f17414ae71f5b43c50596b371096.tar.gz
chromium_src-8694f6333d49f17414ae71f5b43c50596b371096.tar.bz2
gpu: Move 'exit_on_context_lost' from decoder to stub
There are two intended functional changes: - don't crash for parse errors - record original context lost reason in UMA stats (instead of counting it as 'gpu channel lost') BUG=475676 NOTRY=True (win8_chromium_ng has issues) Review URL: https://codereview.chromium.org/1157843010 Cr-Commit-Position: refs/heads/master@{#333543}
-rw-r--r--content/common/gpu/client/command_buffer_proxy_impl.cc12
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc24
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc24
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h4
4 files changed, 28 insertions, 36 deletions
diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc
index 7eccd84..60cc94a 100644
--- a/content/common/gpu/client/command_buffer_proxy_impl.cc
+++ b/content/common/gpu/client/command_buffer_proxy_impl.cc
@@ -71,7 +71,17 @@ void CommandBufferProxyImpl::OnChannelError() {
scoped_ptr<base::AutoLock> lock;
if (lock_)
lock.reset(new base::AutoLock(*lock_));
- OnDestroyed(gpu::error::kGpuChannelLost, gpu::error::kLostContext);
+
+ gpu::error::ContextLostReason context_lost_reason =
+ gpu::error::kGpuChannelLost;
+ if (shared_state_shm_ && shared_state_shm_->memory()) {
+ TryUpdateState();
+ // The GPU process might have intentionally been crashed
+ // (exit_on_context_lost), so try to find out the original reason.
+ if (last_state_.error == gpu::error::kLostContext)
+ context_lost_reason = last_state_.context_lost_reason;
+ }
+ OnDestroyed(context_lost_reason, gpu::error::kLostContext);
}
void CommandBufferProxyImpl::OnDestroyed(gpu::error::ContextLostReason reason,
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index bd57c41..e50de4c 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -40,6 +40,7 @@
#include "ui/gl/gl_switches.h"
#if defined(OS_WIN)
+#include "base/win/win_util.h"
#include "content/public/common/sandbox_init.h"
#endif
@@ -472,14 +473,6 @@ void GpuCommandBufferStub::OnInitialize(
DCHECK(result);
decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get()));
-
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSingleProcess) &&
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kInProcessGPU)) {
- decoder_->SetAllowExit(true);
- }
-
scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(),
decoder_.get(),
decoder_.get()));
@@ -1089,6 +1082,21 @@ bool GpuCommandBufferStub::CheckContextLost() {
DCHECK(command_buffer_);
gpu::CommandBuffer::State state = command_buffer_->GetLastState();
bool was_lost = state.error == gpu::error::kLostContext;
+
+ // Work around issues with recovery by allowing a new GPU process to launch.
+ if (was_lost &&
+ context_group_->feature_info()->workarounds().exit_on_context_lost &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSingleProcess) &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kInProcessGPU)) {
+ LOG(ERROR) << "Exiting GPU process because some drivers cannot recover"
+ << " from problems.";
+#if defined(OS_WIN)
+ base::win::SetShouldCrashOnProcessDetach(false);
+#endif
+ exit(0);
+ }
// Lose all other contexts if the reset was triggered by the robustness
// extension instead of being synthetic.
if (was_lost && decoder_ && decoder_->WasContextLostByRobustnessExtension() &&
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 964fc2f..53e95b4 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -73,10 +73,6 @@
#include <OpenGL/CGLIOSurface.h>
#endif
-#if defined(OS_WIN)
-#include "base/win/win_util.h"
-#endif
-
namespace gpu {
namespace gles2 {
@@ -712,7 +708,6 @@ class GLES2DecoderImpl : public GLES2Decoder,
void SetAsyncPixelTransferManagerForTest(
AsyncPixelTransferManager* manager) override;
void SetIgnoreCachedStateForTest(bool ignore) override;
- void SetAllowExit(bool allow_exit) override;
void ProcessFinishedAsyncTransfers();
bool GetServiceTextureId(uint32 client_texture_id,
@@ -2034,8 +2029,6 @@ class GLES2DecoderImpl : public GLES2Decoder,
GLuint validation_fbo_multisample_;
GLuint validation_fbo_;
- bool allow_exit_;
-
typedef gpu::gles2::GLES2Decoder::Error (GLES2DecoderImpl::*CmdHandler)(
uint32 immediate_data_size,
const void* data);
@@ -2548,8 +2541,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
gpu_debug_commands_(false),
validation_texture_(0),
validation_fbo_multisample_(0),
- validation_fbo_(0),
- allow_exit_(false) {
+ validation_fbo_(0) {
DCHECK(group);
// The shader translator is used for WebGL even when running on EGL
@@ -4537,10 +4529,6 @@ void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) {
state_.SetIgnoreCachedStateForTest(ignore);
}
-void GLES2DecoderImpl::SetAllowExit(bool allow_exit) {
- allow_exit_ = allow_exit;
-}
-
void GLES2DecoderImpl::OnFboChanged() const {
if (workarounds().restore_scissor_on_fbo_change)
state_.fbo_binding_for_scissor_workaround_dirty = true;
@@ -11395,16 +11383,6 @@ void GLES2DecoderImpl::MarkContextLost(error::ContextLostReason reason) {
context_lost_reason_ = reason;
current_decoder_error_ = error::kLostContext;
context_was_lost_ = true;
-
- // Work around issues with recovery by allowing a new GPU process to launch.
- if (workarounds().exit_on_context_lost && allow_exit_) {
- LOG(ERROR) << "Exiting GPU process because some drivers cannot recover"
- << " from problems.";
-#if defined(OS_WIN)
- base::win::SetShouldCrashOnProcessDetach(false);
-#endif
- exit(0);
- }
}
bool GLES2DecoderImpl::CheckResetStatus() {
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index 81ff74a..3ad8a6f 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -173,10 +173,6 @@ class GPU_EXPORT GLES2Decoder : public base::SupportsWeakPtr<GLES2Decoder>,
virtual void SetIgnoreCachedStateForTest(bool ignore) = 0;
- // Allow the decoder to exit the current process.
- // Defaults to |false|.
- virtual void SetAllowExit(bool allow_exit) = 0;
-
// Gets the QueryManager for this context.
virtual QueryManager* GetQueryManager() = 0;