| OLD | NEW |
| 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" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 31 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
| 32 #include "gpu/ipc/common/gpu_messages.h" | 32 #include "gpu/ipc/common/gpu_messages.h" |
| 33 #include "gpu/ipc/service/gpu_channel.h" | 33 #include "gpu/ipc/service/gpu_channel.h" |
| 34 #include "gpu/ipc/service/gpu_channel_manager.h" | 34 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 35 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 35 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
| 36 #include "gpu/ipc/service/gpu_memory_manager.h" | 36 #include "gpu/ipc/service/gpu_memory_manager.h" |
| 37 #include "gpu/ipc/service/gpu_memory_tracking.h" | 37 #include "gpu/ipc/service/gpu_memory_tracking.h" |
| 38 #include "gpu/ipc/service/gpu_watchdog.h" | 38 #include "gpu/ipc/service/gpu_watchdog.h" |
| 39 #include "gpu/ipc/service/image_transport_surface.h" | 39 #include "gpu/ipc/service/image_transport_surface.h" |
| 40 #include "ui/gl/gl_bindings.h" | 40 #include "ui/gl/gl_bindings.h" |
| 41 #include "ui/gl/gl_context.h" |
| 41 #include "ui/gl/gl_image.h" | 42 #include "ui/gl/gl_image.h" |
| 42 #include "ui/gl/gl_implementation.h" | 43 #include "ui/gl/gl_implementation.h" |
| 43 #include "ui/gl/gl_switches.h" | 44 #include "ui/gl/gl_switches.h" |
| 45 #include "ui/gl/init/gl_factory.h" |
| 44 | 46 |
| 45 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
| 46 #include "base/win/win_util.h" | 48 #include "base/win/win_util.h" |
| 47 #endif | 49 #endif |
| 48 | 50 |
| 49 #if defined(OS_ANDROID) | 51 #if defined(OS_ANDROID) |
| 50 #include "gpu/ipc/service/stream_texture_android.h" | 52 #include "gpu/ipc/service/stream_texture_android.h" |
| 51 #endif | 53 #endif |
| 52 | 54 |
| 53 namespace gpu { | 55 namespace gpu { |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 DLOG(ERROR) << "Failed to create surface."; | 558 DLOG(ERROR) << "Failed to create surface."; |
| 557 OnInitializeFailed(reply_message); | 559 OnInitializeFailed(reply_message); |
| 558 return; | 560 return; |
| 559 } | 561 } |
| 560 | 562 |
| 561 scoped_refptr<gfx::GLContext> context; | 563 scoped_refptr<gfx::GLContext> context; |
| 562 gfx::GLShareGroup* share_group = channel_->share_group(); | 564 gfx::GLShareGroup* share_group = channel_->share_group(); |
| 563 if (use_virtualized_gl_context_ && share_group) { | 565 if (use_virtualized_gl_context_ && share_group) { |
| 564 context = share_group->GetSharedContext(); | 566 context = share_group->GetSharedContext(); |
| 565 if (!context.get()) { | 567 if (!context.get()) { |
| 566 context = gfx::GLContext::CreateGLContext( | 568 context = gl::init::CreateGLContext( |
| 567 share_group, | 569 channel_->share_group(), |
| 568 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), | 570 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), |
| 569 gpu_preference_); | 571 gpu_preference_); |
| 570 if (!context.get()) { | 572 if (!context.get()) { |
| 571 DLOG(ERROR) << "Failed to create shared context for virtualization."; | 573 DLOG(ERROR) << "Failed to create shared context for virtualization."; |
| 572 OnInitializeFailed(reply_message); | 574 OnInitializeFailed(reply_message); |
| 573 return; | 575 return; |
| 574 } | 576 } |
| 575 // Ensure that context creation did not lose track of the intended | 577 // Ensure that context creation did not lose track of the intended |
| 576 // share_group. | 578 // share_group. |
| 577 DCHECK(context->share_group() == share_group); | 579 DCHECK(context->share_group() == share_group); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 588 // The real context created above for the default offscreen surface | 590 // The real context created above for the default offscreen surface |
| 589 // might not be compatible with this surface. | 591 // might not be compatible with this surface. |
| 590 context = NULL; | 592 context = NULL; |
| 591 | 593 |
| 592 DLOG(ERROR) << "Failed to initialize virtual GL context."; | 594 DLOG(ERROR) << "Failed to initialize virtual GL context."; |
| 593 OnInitializeFailed(reply_message); | 595 OnInitializeFailed(reply_message); |
| 594 return; | 596 return; |
| 595 } | 597 } |
| 596 } | 598 } |
| 597 if (!context.get()) { | 599 if (!context.get()) { |
| 598 context = gfx::GLContext::CreateGLContext( | 600 context = |
| 599 share_group, surface_.get(), gpu_preference_); | 601 gl::init::CreateGLContext(share_group, surface_.get(), gpu_preference_); |
| 600 } | 602 } |
| 601 if (!context.get()) { | 603 if (!context.get()) { |
| 602 DLOG(ERROR) << "Failed to create context."; | 604 DLOG(ERROR) << "Failed to create context."; |
| 603 OnInitializeFailed(reply_message); | 605 OnInitializeFailed(reply_message); |
| 604 return; | 606 return; |
| 605 } | 607 } |
| 606 | 608 |
| 607 if (!context->MakeCurrent(surface_.get())) { | 609 if (!context->MakeCurrent(surface_.get())) { |
| 608 LOG(ERROR) << "Failed to make context current."; | 610 LOG(ERROR) << "Failed to make context current."; |
| 609 OnInitializeFailed(reply_message); | 611 OnInitializeFailed(reply_message); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); | 1145 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); |
| 1144 } | 1146 } |
| 1145 | 1147 |
| 1146 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1148 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1147 base::TimeDelta interval) { | 1149 base::TimeDelta interval) { |
| 1148 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1150 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1149 interval)); | 1151 interval)); |
| 1150 } | 1152 } |
| 1151 | 1153 |
| 1152 } // namespace gpu | 1154 } // namespace gpu |
| OLD | NEW |