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

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: Fix bad merge 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 namespace {
31
32 uint64_t CommandBufferProxyID(int channel_id, int32 route_id) {
33 return (static_cast<uint64_t>(channel_id) << 32) | route_id;
34 }
35
36 } // namespace
37
30 CommandBufferProxyImpl::CommandBufferProxyImpl(GpuChannelHost* channel, 38 CommandBufferProxyImpl::CommandBufferProxyImpl(GpuChannelHost* channel,
31 int32 route_id, 39 int32 route_id,
32 int32 stream_id) 40 int32 stream_id)
33 : lock_(nullptr), 41 : lock_(nullptr),
34 channel_(channel), 42 channel_(channel),
43 command_buffer_id_(CommandBufferProxyID(channel->channel_id(), route_id)),
35 route_id_(route_id), 44 route_id_(route_id),
36 stream_id_(stream_id), 45 stream_id_(stream_id),
37 flush_count_(0), 46 flush_count_(0),
38 last_put_offset_(-1), 47 last_put_offset_(-1),
39 last_barrier_put_offset_(-1), 48 last_barrier_put_offset_(-1),
40 next_signal_id_(0) { 49 next_signal_id_(0) {
41 DCHECK(channel); 50 DCHECK(channel);
42 } 51 }
43 52
44 CommandBufferProxyImpl::~CommandBufferProxyImpl() { 53 CommandBufferProxyImpl::~CommandBufferProxyImpl() {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } 477 }
469 478
470 void CommandBufferProxyImpl::SetLock(base::Lock* lock) { 479 void CommandBufferProxyImpl::SetLock(base::Lock* lock) {
471 lock_ = lock; 480 lock_ = lock;
472 } 481 }
473 482
474 bool CommandBufferProxyImpl::IsGpuChannelLost() { 483 bool CommandBufferProxyImpl::IsGpuChannelLost() {
475 return !channel_ || channel_->IsLost(); 484 return !channel_ || channel_->IsLost();
476 } 485 }
477 486
487 gpu::CommandBufferNamespace CommandBufferProxyImpl::GetNamespaceID() const {
488 return gpu::CommandBufferNamespace::GPU_IO;
489 }
490
491 uint64_t CommandBufferProxyImpl::GetCommandBufferID() const {
492 return command_buffer_id_;
493 }
494
478 uint32 CommandBufferProxyImpl::InsertSyncPoint() { 495 uint32 CommandBufferProxyImpl::InsertSyncPoint() {
479 CheckLock(); 496 CheckLock();
480 if (last_state_.error != gpu::error::kNoError) 497 if (last_state_.error != gpu::error::kNoError)
481 return 0; 498 return 0;
482 499
483 uint32 sync_point = 0; 500 uint32 sync_point = 0;
484 Send(new GpuCommandBufferMsg_InsertSyncPoint(route_id_, true, &sync_point)); 501 Send(new GpuCommandBufferMsg_InsertSyncPoint(route_id_, true, &sync_point));
485 return sync_point; 502 return sync_point;
486 } 503 }
487 504
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 657 }
641 } 658 }
642 659
643 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, 660 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase,
644 base::TimeDelta interval) { 661 base::TimeDelta interval) {
645 if (!update_vsync_parameters_completion_callback_.is_null()) 662 if (!update_vsync_parameters_completion_callback_.is_null())
646 update_vsync_parameters_completion_callback_.Run(timebase, interval); 663 update_vsync_parameters_completion_callback_.Run(timebase, interval);
647 } 664 }
648 665
649 } // namespace content 666 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.h ('k') | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698