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

Side by Side Diff: gpu/ipc/client/command_buffer_proxy_impl.cc

Issue 1962493002: Make Mac swap code like other platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 4 years, 7 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/ipc/client/command_buffer_proxy_impl.h" 5 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 10 matching lines...) Expand all
21 #include "gpu/command_buffer/common/command_buffer_shared.h" 21 #include "gpu/command_buffer/common/command_buffer_shared.h"
22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
23 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h" 23 #include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
24 #include "gpu/command_buffer/common/sync_token.h" 24 #include "gpu/command_buffer/common/sync_token.h"
25 #include "gpu/ipc/client/gpu_channel_host.h" 25 #include "gpu/ipc/client/gpu_channel_host.h"
26 #include "gpu/ipc/common/gpu_messages.h" 26 #include "gpu/ipc/common/gpu_messages.h"
27 #include "gpu/ipc/common/gpu_param_traits.h" 27 #include "gpu/ipc/common/gpu_param_traits.h"
28 #include "ui/gfx/geometry/size.h" 28 #include "ui/gfx/geometry/size.h"
29 #include "ui/gl/gl_bindings.h" 29 #include "ui/gl/gl_bindings.h"
30 30
31 #if defined(OS_MACOSX)
32 #include "gpu/ipc/client/gpu_process_hosted_ca_layer_tree_params.h"
33 #endif
34
31 namespace gpu { 35 namespace gpu {
32 36
33 namespace { 37 namespace {
34 38
35 gpu::CommandBufferId CommandBufferProxyID(int channel_id, int32_t route_id) { 39 gpu::CommandBufferId CommandBufferProxyID(int channel_id, int32_t route_id) {
36 return gpu::CommandBufferId::FromUnsafeValue( 40 return gpu::CommandBufferId::FromUnsafeValue(
37 (static_cast<uint64_t>(channel_id) << 32) | route_id); 41 (static_cast<uint64_t>(channel_id) << 32) | route_id);
38 } 42 }
39 43
40 } // namespace 44 } // namespace
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 flushed_release_flush_id_.pop(); 692 flushed_release_flush_id_.pop();
689 } 693 }
690 } 694 }
691 695
692 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const { 696 gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const {
693 return reinterpret_cast<gpu::CommandBufferSharedState*>( 697 return reinterpret_cast<gpu::CommandBufferSharedState*>(
694 shared_state_shm_->memory()); 698 shared_state_shm_->memory());
695 } 699 }
696 700
697 void CommandBufferProxyImpl::OnSwapBuffersCompleted( 701 void CommandBufferProxyImpl::OnSwapBuffersCompleted(
698 const std::vector<ui::LatencyInfo>& latency_info, 702 const GpuCommandBufferMsg_SwapBuffersCompleted_Params& params) {
699 gfx::SwapResult result) { 703 #if defined(OS_MACOSX)
704 gpu::GpuProcessHostedCALayerTreeParamsMac params_mac;
705 params_mac.surface_handle = params.surface_handle;
706 params_mac.ca_context_id = params.ca_context_id;
707 params_mac.fullscreen_low_power_ca_context_valid =
708 params.fullscreen_low_power_ca_context_valid;
709 params_mac.fullscreen_low_power_ca_context_id =
710 params.fullscreen_low_power_ca_context_id;
711 params_mac.io_surface.reset(IOSurfaceLookupFromMachPort(params.io_surface));
712 params_mac.pixel_size = params.pixel_size;
713 params_mac.scale_factor = params.scale_factor;
714 gpu::GpuProcessHostedCALayerTreeParamsMac* mac_frame_ptr = &params_mac;
715 #else
716 gpu::GpuProcessHostedCALayerTreeParamsMac* mac_frame_ptr = nullptr;
717 #endif
718
700 if (!swap_buffers_completion_callback_.is_null()) { 719 if (!swap_buffers_completion_callback_.is_null()) {
701 if (!ui::LatencyInfo::Verify( 720 if (!ui::LatencyInfo::Verify(
702 latency_info, "CommandBufferProxyImpl::OnSwapBuffersCompleted")) { 721 params.latency_info,
722 "CommandBufferProxyImpl::OnSwapBuffersCompleted")) {
703 swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>(), 723 swap_buffers_completion_callback_.Run(std::vector<ui::LatencyInfo>(),
704 result); 724 params.result, mac_frame_ptr);
705 return; 725 } else {
726 swap_buffers_completion_callback_.Run(params.latency_info, params.result,
727 mac_frame_ptr);
706 } 728 }
707 swap_buffers_completion_callback_.Run(latency_info, result);
708 } 729 }
709 } 730 }
710 731
711 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, 732 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase,
712 base::TimeDelta interval) { 733 base::TimeDelta interval) {
713 if (!update_vsync_parameters_completion_callback_.is_null()) 734 if (!update_vsync_parameters_completion_callback_.is_null())
714 update_vsync_parameters_completion_callback_.Run(timebase, interval); 735 update_vsync_parameters_completion_callback_.Run(timebase, interval);
715 } 736 }
716 737
717 void CommandBufferProxyImpl::OnGpuSyncReplyError() { 738 void CommandBufferProxyImpl::OnGpuSyncReplyError() {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 // the client for lost context a single time. 800 // the client for lost context a single time.
780 if (!channel_) 801 if (!channel_)
781 return; 802 return;
782 channel_->DestroyCommandBuffer(this); 803 channel_->DestroyCommandBuffer(this);
783 channel_ = nullptr; 804 channel_ = nullptr;
784 if (gpu_control_client_) 805 if (gpu_control_client_)
785 gpu_control_client_->OnGpuControlLostContext(); 806 gpu_control_client_->OnGpuControlLostContext();
786 } 807 }
787 808
788 } // namespace gpu 809 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/command_buffer_proxy_impl.h ('k') | gpu/ipc/client/gpu_process_hosted_ca_layer_tree_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698