| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 DLOG(ERROR) << "Failed to create surface."; | 555 DLOG(ERROR) << "Failed to create surface."; |
| 554 OnInitializeFailed(reply_message); | 556 OnInitializeFailed(reply_message); |
| 555 return; | 557 return; |
| 556 } | 558 } |
| 557 | 559 |
| 558 scoped_refptr<gfx::GLContext> context; | 560 scoped_refptr<gfx::GLContext> context; |
| 559 gfx::GLShareGroup* share_group = channel_->share_group(); | 561 gfx::GLShareGroup* share_group = channel_->share_group(); |
| 560 if (use_virtualized_gl_context_ && share_group) { | 562 if (use_virtualized_gl_context_ && share_group) { |
| 561 context = share_group->GetSharedContext(); | 563 context = share_group->GetSharedContext(); |
| 562 if (!context.get()) { | 564 if (!context.get()) { |
| 563 context = gfx::GLContext::CreateGLContext( | 565 context = gl::init::CreateGLContext( |
| 564 share_group, | 566 channel_->share_group(), |
| 565 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), | 567 channel_->gpu_channel_manager()->GetDefaultOffscreenSurface(), |
| 566 gpu_preference_); | 568 gpu_preference_); |
| 567 if (!context.get()) { | 569 if (!context.get()) { |
| 568 DLOG(ERROR) << "Failed to create shared context for virtualization."; | 570 DLOG(ERROR) << "Failed to create shared context for virtualization."; |
| 569 OnInitializeFailed(reply_message); | 571 OnInitializeFailed(reply_message); |
| 570 return; | 572 return; |
| 571 } | 573 } |
| 572 // Ensure that context creation did not lose track of the intended | 574 // Ensure that context creation did not lose track of the intended |
| 573 // share_group. | 575 // share_group. |
| 574 DCHECK(context->share_group() == share_group); | 576 DCHECK(context->share_group() == share_group); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 585 // The real context created above for the default offscreen surface | 587 // The real context created above for the default offscreen surface |
| 586 // might not be compatible with this surface. | 588 // might not be compatible with this surface. |
| 587 context = NULL; | 589 context = NULL; |
| 588 | 590 |
| 589 DLOG(ERROR) << "Failed to initialize virtual GL context."; | 591 DLOG(ERROR) << "Failed to initialize virtual GL context."; |
| 590 OnInitializeFailed(reply_message); | 592 OnInitializeFailed(reply_message); |
| 591 return; | 593 return; |
| 592 } | 594 } |
| 593 } | 595 } |
| 594 if (!context.get()) { | 596 if (!context.get()) { |
| 595 context = gfx::GLContext::CreateGLContext( | 597 context = |
| 596 share_group, surface_.get(), gpu_preference_); | 598 gl::init::CreateGLContext(share_group, surface_.get(), gpu_preference_); |
| 597 } | 599 } |
| 598 if (!context.get()) { | 600 if (!context.get()) { |
| 599 DLOG(ERROR) << "Failed to create context."; | 601 DLOG(ERROR) << "Failed to create context."; |
| 600 OnInitializeFailed(reply_message); | 602 OnInitializeFailed(reply_message); |
| 601 return; | 603 return; |
| 602 } | 604 } |
| 603 | 605 |
| 604 if (!context->MakeCurrent(surface_.get())) { | 606 if (!context->MakeCurrent(surface_.get())) { |
| 605 LOG(ERROR) << "Failed to make context current."; | 607 LOG(ERROR) << "Failed to make context current."; |
| 606 OnInitializeFailed(reply_message); | 608 OnInitializeFailed(reply_message); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); | 1132 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); |
| 1131 } | 1133 } |
| 1132 | 1134 |
| 1133 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1135 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1134 base::TimeDelta interval) { | 1136 base::TimeDelta interval) { |
| 1135 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1137 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1136 interval)); | 1138 interval)); |
| 1137 } | 1139 } |
| 1138 | 1140 |
| 1139 } // namespace gpu | 1141 } // namespace gpu |
| OLD | NEW |