Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 1282973004: gpu: Crash GPU process when context was lost through robustness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/hash.h" 8 #include "base/hash.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 // to be made current before calling methods on the surface. 1107 // to be made current before calling methods on the surface.
1108 if (surface_.get() && MakeCurrent()) 1108 if (surface_.get() && MakeCurrent())
1109 surface_->SetFrontbufferAllocation(suggest_have_frontbuffer); 1109 surface_->SetFrontbufferAllocation(suggest_have_frontbuffer);
1110 } 1110 }
1111 1111
1112 bool GpuCommandBufferStub::CheckContextLost() { 1112 bool GpuCommandBufferStub::CheckContextLost() {
1113 DCHECK(command_buffer_); 1113 DCHECK(command_buffer_);
1114 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); 1114 gpu::CommandBuffer::State state = command_buffer_->GetLastState();
1115 bool was_lost = state.error == gpu::error::kLostContext; 1115 bool was_lost = state.error == gpu::error::kLostContext;
1116 1116
1117 // Work around issues with recovery by allowing a new GPU process to launch. 1117 if (was_lost) {
1118 if (was_lost && 1118 bool was_lost_by_robustness =
1119 context_group_->feature_info()->workarounds().exit_on_context_lost && 1119 decoder_ && decoder_->WasContextLostByRobustnessExtension();
1120 !base::CommandLine::ForCurrentProcess()->HasSwitch( 1120
1121 switches::kSingleProcess) && 1121 // Work around issues with recovery by allowing a new GPU process to launch.
1122 !base::CommandLine::ForCurrentProcess()->HasSwitch( 1122 if ((was_lost_by_robustness ||
1123 switches::kInProcessGPU)) { 1123 context_group_->feature_info()->workarounds().exit_on_context_lost) &&
1124 LOG(ERROR) << "Exiting GPU process because some drivers cannot recover" 1124 !base::CommandLine::ForCurrentProcess()->HasSwitch(
1125 << " from problems."; 1125 switches::kSingleProcess) &&
1126 !base::CommandLine::ForCurrentProcess()->HasSwitch(
1127 switches::kInProcessGPU)) {
1128 LOG(ERROR) << "Exiting GPU process because some drivers cannot recover"
1129 << " from problems.";
1126 #if defined(OS_WIN) 1130 #if defined(OS_WIN)
1127 base::win::SetShouldCrashOnProcessDetach(false); 1131 base::win::SetShouldCrashOnProcessDetach(false);
1128 #endif 1132 #endif
1129 exit(0); 1133 exit(0);
1134 }
1135
1136 // Lose all other contexts if the reset was triggered by the robustness
1137 // extension instead of being synthetic.
1138 if (was_lost_by_robustness &&
1139 (gfx::GLContext::LosesAllContextsOnContextLost() ||
1140 use_virtualized_gl_context_)) {
1141 channel_->LoseAllContexts();
1142 }
1130 } 1143 }
1131 // Lose all other contexts if the reset was triggered by the robustness 1144
1132 // extension instead of being synthetic.
1133 if (was_lost && decoder_ && decoder_->WasContextLostByRobustnessExtension() &&
1134 (gfx::GLContext::LosesAllContextsOnContextLost() ||
1135 use_virtualized_gl_context_))
1136 channel_->LoseAllContexts();
1137 CheckCompleteWaits(); 1145 CheckCompleteWaits();
1138 return was_lost; 1146 return was_lost;
1139 } 1147 }
1140 1148
1141 void GpuCommandBufferStub::MarkContextLost() { 1149 void GpuCommandBufferStub::MarkContextLost() {
1142 if (!command_buffer_ || 1150 if (!command_buffer_ ||
1143 command_buffer_->GetLastState().error == gpu::error::kLostContext) 1151 command_buffer_->GetLastState().error == gpu::error::kLostContext)
1144 return; 1152 return;
1145 1153
1146 command_buffer_->SetContextLostReason(gpu::error::kUnknown); 1154 command_buffer_->SetContextLostReason(gpu::error::kUnknown);
1147 if (decoder_) 1155 if (decoder_)
1148 decoder_->MarkContextLost(gpu::error::kUnknown); 1156 decoder_->MarkContextLost(gpu::error::kUnknown);
1149 command_buffer_->SetParseError(gpu::error::kLostContext); 1157 command_buffer_->SetParseError(gpu::error::kLostContext);
1150 } 1158 }
1151 1159
1152 void GpuCommandBufferStub::SendSwapBuffersCompleted( 1160 void GpuCommandBufferStub::SendSwapBuffersCompleted(
1153 const std::vector<ui::LatencyInfo>& latency_info, 1161 const std::vector<ui::LatencyInfo>& latency_info,
1154 gfx::SwapResult result) { 1162 gfx::SwapResult result) {
1155 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info, 1163 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info,
1156 result)); 1164 result));
1157 } 1165 }
1158 1166
1159 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1167 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1160 base::TimeDelta interval) { 1168 base::TimeDelta interval) {
1161 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1169 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1162 interval)); 1170 interval));
1163 } 1171 }
1164 1172
1165 } // namespace content 1173 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698