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

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

Issue 2814843002: gpu: GPU service scheduler. (Closed)
Patch Set: fix test dcheck failures Created 3 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
« no previous file with comments | « gpu/ipc/client/command_buffer_proxy_impl.h ('k') | gpu/ipc/client/gpu_channel_host.h » ('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/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 CommandBufferProxyImpl::CommandBufferProxyImpl(int channel_id, 53 CommandBufferProxyImpl::CommandBufferProxyImpl(int channel_id,
54 int32_t route_id, 54 int32_t route_id,
55 int32_t stream_id) 55 int32_t stream_id)
56 : lock_(nullptr), 56 : lock_(nullptr),
57 gpu_control_client_(nullptr), 57 gpu_control_client_(nullptr),
58 command_buffer_id_(CommandBufferProxyID(channel_id, route_id)), 58 command_buffer_id_(CommandBufferProxyID(channel_id, route_id)),
59 route_id_(route_id), 59 route_id_(route_id),
60 stream_id_(stream_id), 60 stream_id_(stream_id),
61 weak_this_(AsWeakPtr()) { 61 weak_this_(AsWeakPtr()) {
62 DCHECK(route_id); 62 DCHECK(route_id);
63 DCHECK_NE(stream_id, GPU_STREAM_INVALID);
64 } 63 }
65 64
66 // static 65 // static
67 std::unique_ptr<CommandBufferProxyImpl> CommandBufferProxyImpl::Create( 66 std::unique_ptr<CommandBufferProxyImpl> CommandBufferProxyImpl::Create(
68 scoped_refptr<GpuChannelHost> host, 67 scoped_refptr<GpuChannelHost> host,
69 gpu::SurfaceHandle surface_handle, 68 gpu::SurfaceHandle surface_handle,
70 CommandBufferProxyImpl* share_group, 69 CommandBufferProxyImpl* share_group,
71 int32_t stream_id, 70 int32_t stream_id,
72 gpu::GpuStreamPriority stream_priority, 71 gpu::SchedulingPriority stream_priority,
73 const gpu::gles2::ContextCreationAttribHelper& attribs, 72 const gpu::gles2::ContextCreationAttribHelper& attribs,
74 const GURL& active_url, 73 const GURL& active_url,
75 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { 74 scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
76 DCHECK(!share_group || (stream_id == share_group->stream_id_)); 75 DCHECK(!share_group || (stream_id == share_group->stream_id_));
77 TRACE_EVENT1("gpu", "GpuChannelHost::CreateViewCommandBuffer", 76 TRACE_EVENT1("gpu", "GpuChannelHost::CreateViewCommandBuffer",
78 "surface_handle", surface_handle); 77 "surface_handle", surface_handle);
79 78
80 GPUCreateCommandBufferConfig init_params; 79 GPUCreateCommandBufferConfig init_params;
81 init_params.surface_handle = surface_handle; 80 init_params.surface_handle = surface_handle;
82 init_params.share_group_id = 81 init_params.share_group_id =
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 // Can only wait on an unverified sync token if it is from the same channel. 664 // Can only wait on an unverified sync token if it is from the same channel.
666 int sync_token_channel_id = GetChannelID(sync_token.command_buffer_id()); 665 int sync_token_channel_id = GetChannelID(sync_token.command_buffer_id());
667 int channel_id = GetChannelID(command_buffer_id_); 666 int channel_id = GetChannelID(command_buffer_id_);
668 if (sync_token.namespace_id() != gpu::CommandBufferNamespace::GPU_IO || 667 if (sync_token.namespace_id() != gpu::CommandBufferNamespace::GPU_IO ||
669 sync_token_channel_id != channel_id) { 668 sync_token_channel_id != channel_id) {
670 return false; 669 return false;
671 } 670 }
672 671
673 // If waiting on a different stream, flush pending commands on that stream. 672 // If waiting on a different stream, flush pending commands on that stream.
674 int32_t release_stream_id = sync_token.extra_data_field(); 673 int32_t release_stream_id = sync_token.extra_data_field();
675 if (release_stream_id == gpu::GPU_STREAM_INVALID)
676 return false;
677
678 if (release_stream_id != stream_id_) 674 if (release_stream_id != stream_id_)
679 channel_->FlushPendingStream(release_stream_id); 675 channel_->FlushPendingStream(release_stream_id);
680 676
681 return true; 677 return true;
682 } 678 }
683 679
684 void CommandBufferProxyImpl::AddLatencyInfo( 680 void CommandBufferProxyImpl::AddLatencyInfo(
685 const std::vector<ui::LatencyInfo>& latency_info) { 681 const std::vector<ui::LatencyInfo>& latency_info) {
686 CheckLock(); 682 CheckLock();
687 for (size_t i = 0; i < latency_info.size(); i++) 683 for (size_t i = 0; i < latency_info.size(); i++)
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 return; 944 return;
949 channel_->FlushPendingStream(stream_id_); 945 channel_->FlushPendingStream(stream_id_);
950 channel_->Send(new GpuChannelMsg_DestroyCommandBuffer(route_id_)); 946 channel_->Send(new GpuChannelMsg_DestroyCommandBuffer(route_id_));
951 channel_->RemoveRoute(route_id_); 947 channel_->RemoveRoute(route_id_);
952 channel_ = nullptr; 948 channel_ = nullptr;
953 if (gpu_control_client_) 949 if (gpu_control_client_)
954 gpu_control_client_->OnGpuControlLostContext(); 950 gpu_control_client_->OnGpuControlLostContext();
955 } 951 }
956 952
957 } // namespace gpu 953 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/command_buffer_proxy_impl.h ('k') | gpu/ipc/client/gpu_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698