Commit 0f79f41c authored by jbauman's avatar jbauman Committed by Commit bot

Validate all flush IDs if the unvalidated list gets too long.

The browser process normally never needs to validate sync tokens unless
it's returning resources to a renderer, so it's possible the highest
verified flush ID will almost never be updated and the list of
unvalidated flush IDs will grow indefinitely. Force a validation if that
happens to avoid wasting memory.

BUG=635051
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2318933005
Cr-Commit-Position: refs/heads/master@{#417168}
parent 22fda4e8
......@@ -266,7 +266,6 @@ void CommandBufferProxyImpl::Flush(int32_t put_offset) {
const uint32_t flush_id = channel_->OrderingBarrier(
route_id_, stream_id_, put_offset, ++flush_count_, latency_info_,
put_offset_changed, true, &highest_verified_flush_id);
UpdateVerifiedReleases(highest_verified_flush_id);
if (put_offset_changed) {
DCHECK(flush_id);
const uint64_t fence_sync_release = next_fence_sync_release_ - 1;
......@@ -276,6 +275,7 @@ void CommandBufferProxyImpl::Flush(int32_t put_offset) {
std::make_pair(fence_sync_release, flush_id));
}
}
CleanupFlushedReleases(highest_verified_flush_id);
}
if (put_offset_changed)
......@@ -298,7 +298,6 @@ void CommandBufferProxyImpl::OrderingBarrier(int32_t put_offset) {
const uint32_t flush_id = channel_->OrderingBarrier(
route_id_, stream_id_, put_offset, ++flush_count_, latency_info_,
put_offset_changed, false, &highest_verified_flush_id);
UpdateVerifiedReleases(highest_verified_flush_id);
if (put_offset_changed) {
DCHECK(flush_id);
......@@ -309,6 +308,7 @@ void CommandBufferProxyImpl::OrderingBarrier(int32_t put_offset) {
std::make_pair(fence_sync_release, flush_id));
}
}
CleanupFlushedReleases(highest_verified_flush_id);
}
if (put_offset_changed)
......@@ -746,6 +746,18 @@ void CommandBufferProxyImpl::UpdateVerifiedReleases(uint32_t verified_flush) {
}
}
void CommandBufferProxyImpl::CleanupFlushedReleases(
uint32_t highest_verified_flush_id) {
DCHECK(channel_);
static const uint32_t kMaxUnverifiedFlushes = 1000;
if (flushed_release_flush_id_.size() > kMaxUnverifiedFlushes) {
// Prevent list of unverified flushes from growing indefinitely.
highest_verified_flush_id =
channel_->ValidateFlushIDReachedServer(stream_id_, false);
}
UpdateVerifiedReleases(highest_verified_flush_id);
}
gpu::CommandBufferSharedState* CommandBufferProxyImpl::shared_state() const {
return reinterpret_cast<gpu::CommandBufferSharedState*>(
shared_state_shm_->memory());
......
......@@ -209,6 +209,7 @@ class GPU_EXPORT CommandBufferProxyImpl
// Updates the highest verified release fence sync.
void UpdateVerifiedReleases(uint32_t verified_flush);
void CleanupFlushedReleases(uint32_t highest_verified_flush_id);
// Try to read an updated copy of the state from shared memory, and calls
// OnGpuStateError() if the new state has an error.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment