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

Side by Side Diff: gpu/ipc/service/gpu_command_buffer_stub.cc

Issue 2497503004: Revert of Refactor context creation parameters into a struct. (Closed)
Patch Set: Created 4 years, 1 month 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 | « gpu/gles2_conform_support/egl/context.cc ('k') | gpu/perftests/texture_upload_perftest.cc » ('j') | 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 "gpu/ipc/service/gpu_command_buffer_stub.h" 5 #include "gpu/ipc/service/gpu_command_buffer_stub.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/hash.h" 11 #include "base/hash.h"
12 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "gpu/command_buffer/common/constants.h" 19 #include "gpu/command_buffer/common/constants.h"
20 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" 20 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
21 #include "gpu/command_buffer/common/mailbox.h" 21 #include "gpu/command_buffer/common/mailbox.h"
22 #include "gpu/command_buffer/common/sync_token.h" 22 #include "gpu/command_buffer/common/sync_token.h"
23 #include "gpu/command_buffer/service/gl_context_virtual.h" 23 #include "gpu/command_buffer/service/gl_context_virtual.h"
24 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" 24 #include "gpu/command_buffer/service/gl_state_restorer_impl.h"
25 #include "gpu/command_buffer/service/image_manager.h" 25 #include "gpu/command_buffer/service/image_manager.h"
26 #include "gpu/command_buffer/service/logger.h" 26 #include "gpu/command_buffer/service/logger.h"
27 #include "gpu/command_buffer/service/mailbox_manager.h" 27 #include "gpu/command_buffer/service/mailbox_manager.h"
28 #include "gpu/command_buffer/service/memory_tracking.h" 28 #include "gpu/command_buffer/service/memory_tracking.h"
29 #include "gpu/command_buffer/service/query_manager.h" 29 #include "gpu/command_buffer/service/query_manager.h"
30 #include "gpu/command_buffer/service/service_utils.h"
31 #include "gpu/command_buffer/service/sync_point_manager.h" 30 #include "gpu/command_buffer/service/sync_point_manager.h"
32 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 31 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
33 #include "gpu/ipc/common/gpu_messages.h" 32 #include "gpu/ipc/common/gpu_messages.h"
34 #include "gpu/ipc/service/gpu_channel.h" 33 #include "gpu/ipc/service/gpu_channel.h"
35 #include "gpu/ipc/service/gpu_channel_manager.h" 34 #include "gpu/ipc/service/gpu_channel_manager.h"
36 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" 35 #include "gpu/ipc/service/gpu_channel_manager_delegate.h"
37 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" 36 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
38 #include "gpu/ipc/service/gpu_memory_manager.h" 37 #include "gpu/ipc/service/gpu_memory_manager.h"
39 #include "gpu/ipc/service/gpu_memory_tracking.h" 38 #include "gpu/ipc/service/gpu_memory_tracking.h"
40 #include "gpu/ipc/service/gpu_watchdog_thread.h" 39 #include "gpu/ipc/service/gpu_watchdog_thread.h"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 DLOG(ERROR) << "Failed to create surface."; 530 DLOG(ERROR) << "Failed to create surface.";
532 return false; 531 return false;
533 } 532 }
534 } 533 }
535 534
536 scoped_refptr<gl::GLContext> context; 535 scoped_refptr<gl::GLContext> context;
537 gl::GLShareGroup* gl_share_group = channel_->share_group(); 536 gl::GLShareGroup* gl_share_group = channel_->share_group();
538 if (use_virtualized_gl_context_ && gl_share_group) { 537 if (use_virtualized_gl_context_ && gl_share_group) {
539 context = gl_share_group->GetSharedContext(surface_.get()); 538 context = gl_share_group->GetSharedContext(surface_.get());
540 if (!context.get()) { 539 if (!context.get()) {
541 context = gl::init::CreateGLContext( 540 context = gl::init::CreateGLContext(gl_share_group, surface_.get(),
542 gl_share_group, surface_.get(), 541 init_params.attribs.gpu_preference);
543 GenerateGLContextAttribs(init_params.attribs,
544 context_group_->gpu_preferences()));
545 if (!context.get()) { 542 if (!context.get()) {
546 DLOG(ERROR) << "Failed to create shared context for virtualization."; 543 DLOG(ERROR) << "Failed to create shared context for virtualization.";
547 return false; 544 return false;
548 } 545 }
549 // Ensure that context creation did not lose track of the intended 546 // Ensure that context creation did not lose track of the intended
550 // gl_share_group. 547 // gl_share_group.
551 DCHECK(context->share_group() == gl_share_group); 548 DCHECK(context->share_group() == gl_share_group);
552 gl_share_group->SetSharedContext(surface_.get(), context.get()); 549 gl_share_group->SetSharedContext(surface_.get(), context.get());
553 } 550 }
554 // This should be either: 551 // This should be either:
555 // (1) a non-virtual GL context, or 552 // (1) a non-virtual GL context, or
556 // (2) a mock context. 553 // (2) a mock context.
557 DCHECK(context->GetHandle() || 554 DCHECK(context->GetHandle() ||
558 gl::GetGLImplementation() == gl::kGLImplementationMockGL); 555 gl::GetGLImplementation() == gl::kGLImplementationMockGL);
559 context = new GLContextVirtual( 556 context = new GLContextVirtual(
560 gl_share_group, context.get(), decoder_->AsWeakPtr()); 557 gl_share_group, context.get(), decoder_->AsWeakPtr());
561 if (!context->Initialize( 558 if (!context->Initialize(surface_.get(),
562 surface_.get(), 559 init_params.attribs.gpu_preference)) {
563 GenerateGLContextAttribs(init_params.attribs,
564 context_group_->gpu_preferences()))) {
565 // The real context created above for the default offscreen surface 560 // The real context created above for the default offscreen surface
566 // might not be compatible with this surface. 561 // might not be compatible with this surface.
567 context = NULL; 562 context = NULL;
568 DLOG(ERROR) << "Failed to initialize virtual GL context."; 563 DLOG(ERROR) << "Failed to initialize virtual GL context.";
569 return false; 564 return false;
570 } 565 }
571 } 566 }
572 if (!context.get()) { 567 if (!context.get()) {
573 context = gl::init::CreateGLContext( 568 context = gl::init::CreateGLContext(gl_share_group, surface_.get(),
574 gl_share_group, surface_.get(), 569 init_params.attribs.gpu_preference);
575 GenerateGLContextAttribs(init_params.attribs,
576 context_group_->gpu_preferences()));
577 } 570 }
578 if (!context.get()) { 571 if (!context.get()) {
579 DLOG(ERROR) << "Failed to create context."; 572 DLOG(ERROR) << "Failed to create context.";
580 return false; 573 return false;
581 } 574 }
582 575
583 if (!context->MakeCurrent(surface_.get())) { 576 if (!context->MakeCurrent(surface_.get())) {
584 LOG(ERROR) << "Failed to make context current."; 577 LOG(ERROR) << "Failed to make context current.";
585 return false; 578 return false;
586 } 579 }
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); 1113 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params));
1121 } 1114 }
1122 1115
1123 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1116 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1124 base::TimeDelta interval) { 1117 base::TimeDelta interval) {
1125 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1118 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1126 interval)); 1119 interval));
1127 } 1120 }
1128 1121
1129 } // namespace gpu 1122 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/egl/context.cc ('k') | gpu/perftests/texture_upload_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698