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

Side by Side Diff: content/common/gpu/client/command_buffer_proxy_impl.cc

Issue 1345813002: Added a unique command buffer ID for command buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests Created 5 years, 3 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 "content/common/gpu/client/command_buffer_proxy_impl.h" 5 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/shared_memory.h" 11 #include "base/memory/shared_memory.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
14 #include "content/common/child_process_messages.h" 14 #include "content/common/child_process_messages.h"
15 #include "content/common/gpu/client/gpu_channel_host.h" 15 #include "content/common/gpu/client/gpu_channel_host.h"
16 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h" 16 #include "content/common/gpu/client/gpu_video_decode_accelerator_host.h"
17 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h" 17 #include "content/common/gpu/client/gpu_video_encode_accelerator_host.h"
18 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
19 #include "content/common/view_messages.h" 19 #include "content/common/view_messages.h"
20 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 20 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
21 #include "gpu/command_buffer/common/cmd_buffer_common.h" 21 #include "gpu/command_buffer/common/cmd_buffer_common.h"
22 #include "gpu/command_buffer/common/command_buffer_shared.h" 22 #include "gpu/command_buffer/common/command_buffer_shared.h"
23 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 23 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
24 #include "gpu/command_buffer/service/image_factory.h" 24 #include "gpu/command_buffer/service/image_factory.h"
25 #include "ui/gfx/geometry/size.h" 25 #include "ui/gfx/geometry/size.h"
26 #include "ui/gl/gl_bindings.h" 26 #include "ui/gl/gl_bindings.h"
27 27
28 namespace content { 28 namespace content {
29 29
30 uint64_t CommandBufferProxyID(int channel_id, int32 route_id) {
31 return (static_cast<uint64_t>(channel_id) << 32) | route_id;
32 }
33
30 CommandBufferProxyImpl::CommandBufferProxyImpl(GpuChannelHost* channel, 34 CommandBufferProxyImpl::CommandBufferProxyImpl(GpuChannelHost* channel,
31 int32 route_id, 35 int32 route_id,
32 int32 stream_id) 36 int32 stream_id)
33 : lock_(nullptr), 37 : lock_(nullptr),
34 channel_(channel), 38 channel_(channel),
39 command_buffer_id_(CommandBufferProxyID(channel->channel_id(), route_id)),
35 route_id_(route_id), 40 route_id_(route_id),
36 stream_id_(stream_id), 41 stream_id_(stream_id),
37 flush_count_(0), 42 flush_count_(0),
38 last_put_offset_(-1), 43 last_put_offset_(-1),
39 last_barrier_put_offset_(-1), 44 last_barrier_put_offset_(-1),
40 next_signal_id_(0) { 45 next_signal_id_(0) {
41 DCHECK(channel); 46 DCHECK(channel);
42 } 47 }
43 48
44 CommandBufferProxyImpl::~CommandBufferProxyImpl() { 49 CommandBufferProxyImpl::~CommandBufferProxyImpl() {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } 473 }
469 474
470 void CommandBufferProxyImpl::SetLock(base::Lock* lock) { 475 void CommandBufferProxyImpl::SetLock(base::Lock* lock) {
471 lock_ = lock; 476 lock_ = lock;
472 } 477 }
473 478
474 bool CommandBufferProxyImpl::IsGpuChannelLost() { 479 bool CommandBufferProxyImpl::IsGpuChannelLost() {
475 return !channel_ || channel_->IsLost(); 480 return !channel_ || channel_->IsLost();
476 } 481 }
477 482
483 gpu::CommandBufferNamespace CommandBufferProxyImpl::GetNamespaceID() const {
484 return gpu::kCommandBufferNamespace_GpuIO;
485 }
486
487 uint64_t CommandBufferProxyImpl::GetCommandBufferID() const {
488 return command_buffer_id_;
489 }
490
478 uint32 CommandBufferProxyImpl::InsertSyncPoint() { 491 uint32 CommandBufferProxyImpl::InsertSyncPoint() {
479 CheckLock(); 492 CheckLock();
480 if (last_state_.error != gpu::error::kNoError) 493 if (last_state_.error != gpu::error::kNoError)
481 return 0; 494 return 0;
482 495
483 uint32 sync_point = 0; 496 uint32 sync_point = 0;
484 Send(new GpuCommandBufferMsg_InsertSyncPoint(route_id_, true, &sync_point)); 497 Send(new GpuCommandBufferMsg_InsertSyncPoint(route_id_, true, &sync_point));
485 return sync_point; 498 return sync_point;
486 } 499 }
487 500
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 653 }
641 } 654 }
642 655
643 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, 656 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase,
644 base::TimeDelta interval) { 657 base::TimeDelta interval) {
645 if (!update_vsync_parameters_completion_callback_.is_null()) 658 if (!update_vsync_parameters_completion_callback_.is_null())
646 update_vsync_parameters_completion_callback_.Run(timebase, interval); 659 update_vsync_parameters_completion_callback_.Run(timebase, interval);
647 } 660 }
648 661
649 } // namespace content 662 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698