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

Side by Side Diff: gpu/command_buffer/tests/gl_manager.cc

Issue 1892483004: Revert of Compute GpuDriverBugWorkarounds only one time in the GPU process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 "gpu/command_buffer/tests/gl_manager.h" 5 #include "gpu/command_buffer/tests/gl_manager.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/at_exit.h" 15 #include "base/at_exit.h"
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h"
18 #include "base/memory/ref_counted_memory.h" 17 #include "base/memory/ref_counted_memory.h"
19 #include "build/build_config.h" 18 #include "build/build_config.h"
20 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 19 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
21 #include "gpu/command_buffer/client/gles2_implementation.h" 20 #include "gpu/command_buffer/client/gles2_implementation.h"
22 #include "gpu/command_buffer/client/gles2_lib.h" 21 #include "gpu/command_buffer/client/gles2_lib.h"
23 #include "gpu/command_buffer/client/transfer_buffer.h" 22 #include "gpu/command_buffer/client/transfer_buffer.h"
24 #include "gpu/command_buffer/common/constants.h" 23 #include "gpu/command_buffer/common/constants.h"
25 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 24 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
26 #include "gpu/command_buffer/common/sync_token.h" 25 #include "gpu/command_buffer/common/sync_token.h"
27 #include "gpu/command_buffer/common/value_state.h" 26 #include "gpu/command_buffer/common/value_state.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 new IOSurfaceGpuMemoryBuffer(size, format)); 223 new IOSurfaceGpuMemoryBuffer(size, format));
225 } 224 }
226 #endif // defined(OS_MACOSX) 225 #endif // defined(OS_MACOSX)
227 std::vector<uint8_t> data(gfx::BufferSizeForBufferFormat(size, format), 0); 226 std::vector<uint8_t> data(gfx::BufferSizeForBufferFormat(size, format), 0);
228 scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data)); 227 scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes(data));
229 return make_scoped_ptr<gfx::GpuMemoryBuffer>( 228 return make_scoped_ptr<gfx::GpuMemoryBuffer>(
230 new GpuMemoryBufferImpl(bytes.get(), size, format)); 229 new GpuMemoryBufferImpl(bytes.get(), size, format));
231 } 230 }
232 231
233 void GLManager::Initialize(const GLManager::Options& options) { 232 void GLManager::Initialize(const GLManager::Options& options) {
234 InitializeWithCommandLine(options, *base::CommandLine::ForCurrentProcess()); 233 InitializeWithCommandLine(options, nullptr);
235 } 234 }
236 235
237 void GLManager::InitializeWithCommandLine( 236 void GLManager::InitializeWithCommandLine(const GLManager::Options& options,
238 const GLManager::Options& options, 237 base::CommandLine* command_line) {
239 const base::CommandLine& command_line) {
240 const int32_t kCommandBufferSize = 1024 * 1024; 238 const int32_t kCommandBufferSize = 1024 * 1024;
241 const size_t kStartTransferBufferSize = 4 * 1024 * 1024; 239 const size_t kStartTransferBufferSize = 4 * 1024 * 1024;
242 const size_t kMinTransferBufferSize = 1 * 256 * 1024; 240 const size_t kMinTransferBufferSize = 1 * 256 * 1024;
243 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024; 241 const size_t kMaxTransferBufferSize = 16 * 1024 * 1024;
244 242
245 context_lost_allowed_ = options.context_lost_allowed; 243 context_lost_allowed_ = options.context_lost_allowed;
246 244
247 gles2::MailboxManager* mailbox_manager = NULL; 245 gles2::MailboxManager* mailbox_manager = NULL;
248 if (options.share_mailbox_manager) { 246 if (options.share_mailbox_manager) {
249 mailbox_manager = options.share_mailbox_manager->mailbox_manager(); 247 mailbox_manager = options.share_mailbox_manager->mailbox_manager();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 attrib_helper.red_size = 8; 280 attrib_helper.red_size = 8;
283 attrib_helper.green_size = 8; 281 attrib_helper.green_size = 8;
284 attrib_helper.blue_size = 8; 282 attrib_helper.blue_size = 8;
285 attrib_helper.alpha_size = 8; 283 attrib_helper.alpha_size = 8;
286 attrib_helper.depth_size = 16; 284 attrib_helper.depth_size = 16;
287 attrib_helper.stencil_size = 8; 285 attrib_helper.stencil_size = 8;
288 attrib_helper.context_type = options.context_type; 286 attrib_helper.context_type = options.context_type;
289 287
290 attrib_helper.Serialize(&attribs); 288 attrib_helper.Serialize(&attribs);
291 289
290 DCHECK(!command_line || !context_group);
292 if (!context_group) { 291 if (!context_group) {
293 GpuDriverBugWorkarounds gpu_driver_bug_workaround(&command_line); 292 scoped_refptr<gles2::FeatureInfo> feature_info;
294 scoped_refptr<gles2::FeatureInfo> feature_info = 293 if (command_line)
295 new gles2::FeatureInfo(command_line, gpu_driver_bug_workaround); 294 feature_info = new gles2::FeatureInfo(*command_line);
296 context_group = new gles2::ContextGroup( 295 context_group = new gles2::ContextGroup(
297 gpu_preferences_, mailbox_manager_.get(), NULL, 296 gpu_preferences_, mailbox_manager_.get(), NULL,
298 new gpu::gles2::ShaderTranslatorCache(gpu_preferences_), 297 new gpu::gles2::ShaderTranslatorCache(gpu_preferences_),
299 new gpu::gles2::FramebufferCompletenessCache, feature_info, NULL, NULL, 298 new gpu::gles2::FramebufferCompletenessCache, feature_info, NULL, NULL,
300 options.bind_generates_resource); 299 options.bind_generates_resource);
301 } 300 }
302 301
303 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group)); 302 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group));
304 if (options.force_shader_name_hashing) { 303 if (options.force_shader_name_hashing) {
305 decoder_->SetForceShaderNameHashingForTest(true); 304 decoder_->SetForceShaderNameHashingForTest(true);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 sync_point_order_data_ = nullptr; 456 sync_point_order_data_ = nullptr;
458 } 457 }
459 if (decoder_.get()) { 458 if (decoder_.get()) {
460 bool have_context = decoder_->GetGLContext() && 459 bool have_context = decoder_->GetGLContext() &&
461 decoder_->GetGLContext()->MakeCurrent(surface_.get()); 460 decoder_->GetGLContext()->MakeCurrent(surface_.get());
462 decoder_->Destroy(have_context); 461 decoder_->Destroy(have_context);
463 decoder_.reset(); 462 decoder_.reset();
464 } 463 }
465 } 464 }
466 465
467 const GpuDriverBugWorkarounds& GLManager::workarounds() const { 466 const gpu::gles2::FeatureInfo::Workarounds& GLManager::workarounds() const {
468 return decoder_->GetContextGroup()->feature_info()->workarounds(); 467 return decoder_->GetContextGroup()->feature_info()->workarounds();
469 } 468 }
470 469
471 void GLManager::PumpCommands() { 470 void GLManager::PumpCommands() {
472 if (!decoder_->MakeCurrent()) { 471 if (!decoder_->MakeCurrent()) {
473 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); 472 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
474 command_buffer_->SetParseError(::gpu::error::kLostContext); 473 command_buffer_->SetParseError(::gpu::error::kLostContext);
475 return; 474 return;
476 } 475 }
477 uint32_t order_num = 0; 476 uint32_t order_num = 0;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 638
640 // Something went wrong, just run the callback now. 639 // Something went wrong, just run the callback now.
641 callback.Run(); 640 callback.Run();
642 } 641 }
643 642
644 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { 643 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) {
645 return false; 644 return false;
646 } 645 }
647 646
648 } // namespace gpu 647 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_manager.h ('k') | gpu/command_buffer/tests/gl_request_extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698