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

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

Issue 1499813003: Reland "Added an extra sync token field for extra command buffer..." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed sync token fuzzer parameters Created 5 years 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"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 route_id_(route_id), 45 route_id_(route_id),
46 stream_id_(stream_id), 46 stream_id_(stream_id),
47 flush_count_(0), 47 flush_count_(0),
48 last_put_offset_(-1), 48 last_put_offset_(-1),
49 last_barrier_put_offset_(-1), 49 last_barrier_put_offset_(-1),
50 next_fence_sync_release_(1), 50 next_fence_sync_release_(1),
51 flushed_fence_sync_release_(0), 51 flushed_fence_sync_release_(0),
52 verified_fence_sync_release_(0), 52 verified_fence_sync_release_(0),
53 next_signal_id_(0) { 53 next_signal_id_(0) {
54 DCHECK(channel); 54 DCHECK(channel);
55 DCHECK(stream_id);
55 } 56 }
56 57
57 CommandBufferProxyImpl::~CommandBufferProxyImpl() { 58 CommandBufferProxyImpl::~CommandBufferProxyImpl() {
58 FOR_EACH_OBSERVER(DeletionObserver, 59 FOR_EACH_OBSERVER(DeletionObserver,
59 deletion_observers_, 60 deletion_observers_,
60 OnWillDeleteImpl()); 61 OnWillDeleteImpl());
61 if (channel_) { 62 if (channel_) {
62 channel_->DestroyCommandBuffer(this); 63 channel_->DestroyCommandBuffer(this);
63 channel_ = nullptr; 64 channel_ = nullptr;
64 } 65 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 params.size = gfx::Size(width, height); 443 params.size = gfx::Size(width, height);
443 params.format = gpu_memory_buffer->GetFormat(); 444 params.format = gpu_memory_buffer->GetFormat();
444 params.internal_format = internal_format; 445 params.internal_format = internal_format;
445 params.image_release_count = image_fence_sync; 446 params.image_release_count = image_fence_sync;
446 447
447 if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, params))) 448 if (!Send(new GpuCommandBufferMsg_CreateImage(route_id_, params)))
448 return -1; 449 return -1;
449 450
450 if (image_fence_sync) { 451 if (image_fence_sync) {
451 gpu::SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(), 452 gpu::SyncToken sync_token(GetNamespaceID(), GetCommandBufferID(),
452 image_fence_sync); 453 GetExtraCommandBufferData(), image_fence_sync);
453 454
454 // Force a synchronous IPC to validate sync token. 455 // Force a synchronous IPC to validate sync token.
455 channel_->ValidateFlushIDReachedServer(stream_id_, true); 456 channel_->ValidateFlushIDReachedServer(stream_id_, true);
456 sync_token.SetVerifyFlush(); 457 sync_token.SetVerifyFlush();
457 458
458 gpu_memory_buffer_manager->SetDestructionSyncToken(gpu_memory_buffer, 459 gpu_memory_buffer_manager->SetDestructionSyncToken(gpu_memory_buffer,
459 sync_token); 460 sync_token);
460 } 461 }
461 462
462 return new_id; 463 return new_id;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 513 }
513 514
514 gpu::CommandBufferNamespace CommandBufferProxyImpl::GetNamespaceID() const { 515 gpu::CommandBufferNamespace CommandBufferProxyImpl::GetNamespaceID() const {
515 return gpu::CommandBufferNamespace::GPU_IO; 516 return gpu::CommandBufferNamespace::GPU_IO;
516 } 517 }
517 518
518 uint64_t CommandBufferProxyImpl::GetCommandBufferID() const { 519 uint64_t CommandBufferProxyImpl::GetCommandBufferID() const {
519 return command_buffer_id_; 520 return command_buffer_id_;
520 } 521 }
521 522
523 int32_t CommandBufferProxyImpl::GetExtraCommandBufferData() const {
524 return stream_id_;
525 }
526
522 uint64_t CommandBufferProxyImpl::GenerateFenceSyncRelease() { 527 uint64_t CommandBufferProxyImpl::GenerateFenceSyncRelease() {
523 return next_fence_sync_release_++; 528 return next_fence_sync_release_++;
524 } 529 }
525 530
526 bool CommandBufferProxyImpl::IsFenceSyncRelease(uint64_t release) { 531 bool CommandBufferProxyImpl::IsFenceSyncRelease(uint64_t release) {
527 return release != 0 && release < next_fence_sync_release_; 532 return release != 0 && release < next_fence_sync_release_;
528 } 533 }
529 534
530 bool CommandBufferProxyImpl::IsFenceSyncFlushed(uint64_t release) { 535 bool CommandBufferProxyImpl::IsFenceSyncFlushed(uint64_t release) {
531 return release != 0 && release <= flushed_fence_sync_release_; 536 return release != 0 && release <= flushed_fence_sync_release_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 575 }
571 576
572 signal_tasks_.insert(std::make_pair(signal_id, callback)); 577 signal_tasks_.insert(std::make_pair(signal_id, callback));
573 } 578 }
574 579
575 bool CommandBufferProxyImpl::CanWaitUnverifiedSyncToken( 580 bool CommandBufferProxyImpl::CanWaitUnverifiedSyncToken(
576 const gpu::SyncToken* sync_token) { 581 const gpu::SyncToken* sync_token) {
577 // Can only wait on an unverified sync token if it is from the same channel. 582 // Can only wait on an unverified sync token if it is from the same channel.
578 const uint64_t token_channel = sync_token->command_buffer_id() >> 32; 583 const uint64_t token_channel = sync_token->command_buffer_id() >> 32;
579 const uint64_t channel = command_buffer_id_ >> 32; 584 const uint64_t channel = command_buffer_id_ >> 32;
580 return (sync_token->namespace_id() == gpu::CommandBufferNamespace::GPU_IO && 585 if (sync_token->namespace_id() != gpu::CommandBufferNamespace::GPU_IO ||
581 token_channel == channel); 586 token_channel != channel) {
587 return false;
588 }
589
590 // If waiting on a different stream, flush pending commands on that stream.
591 const int32_t release_stream_id = sync_token->extra_data_field();
592 if (release_stream_id == 0)
593 return false;
594
595 if (release_stream_id != stream_id_)
596 channel_->FlushPendingStream(release_stream_id);
597
598 return true;
582 } 599 }
583 600
584 uint32 CommandBufferProxyImpl::InsertSyncPoint() { 601 uint32 CommandBufferProxyImpl::InsertSyncPoint() {
585 CheckLock(); 602 CheckLock();
586 if (last_state_.error != gpu::error::kNoError) 603 if (last_state_.error != gpu::error::kNoError)
587 return 0; 604 return 0;
588 605
589 uint32 sync_point = 0; 606 uint32 sync_point = 0;
590 Send(new GpuCommandBufferMsg_InsertSyncPoint(route_id_, true, &sync_point)); 607 Send(new GpuCommandBufferMsg_InsertSyncPoint(route_id_, true, &sync_point));
591 return sync_point; 608 return sync_point;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 } 766 }
750 } 767 }
751 768
752 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase, 769 void CommandBufferProxyImpl::OnUpdateVSyncParameters(base::TimeTicks timebase,
753 base::TimeDelta interval) { 770 base::TimeDelta interval) {
754 if (!update_vsync_parameters_completion_callback_.is_null()) 771 if (!update_vsync_parameters_completion_callback_.is_null())
755 update_vsync_parameters_completion_callback_.Run(timebase, interval); 772 update_vsync_parameters_completion_callback_.Run(timebase, interval);
756 } 773 }
757 774
758 } // namespace content 775 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.h ('k') | content/common/gpu/client/gpu_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698