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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 1336623004: content/gpu: Simplify gpu channel message handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index d91a65259efff40f2100f525e8bcab7dd98e8555..4d69958718fe3445be32d9d9ae9c27ac04276f25 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -284,7 +284,6 @@ bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForGetOffsetInRange,
OnWaitForGetOffsetInRange);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
- IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer,
OnRegisterTransferBuffer);
IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer,
@@ -342,8 +341,8 @@ void GpuCommandBufferStub::PollWork() {
return;
if (scheduler_) {
- const uint32_t current_unprocessed_num =
- channel()->gpu_channel_manager()->UnprocessedOrderNumber();
+ uint32_t current_unprocessed_num =
+ channel()->gpu_channel_manager()->GetCurrentUnprocessedOrderNum();
// We're idle when no messages were processed or scheduled.
bool is_idle = (previous_processed_num_ == current_unprocessed_num);
if (!is_idle && !last_idle_time_.is_null()) {
@@ -387,7 +386,7 @@ void GpuCommandBufferStub::ScheduleDelayedWork(int64 delay) {
// Idle when no messages are processed between now and when
// PollWork is called.
previous_processed_num_ =
- channel()->gpu_channel_manager()->ProcessedOrderNumber();
+ channel()->gpu_channel_manager()->GetProcessedOrderNum();
if (last_idle_time_.is_null())
last_idle_time_ = base::TimeTicks::Now();
@@ -781,28 +780,23 @@ void GpuCommandBufferStub::OnAsyncFlush(
const std::vector<ui::LatencyInfo>& latency_info) {
TRACE_EVENT1(
"gpu", "GpuCommandBufferStub::OnAsyncFlush", "put_offset", put_offset);
+ DCHECK(command_buffer_.get());
dcheng 2015/09/10 21:30:38 DCHECK(command_buffer_);
sunnyps 2015/09/10 23:38:37 Done.
+
+ // We received this message out-of-order. This should not happen but is here
+ // to catch regressions. Ignore the message.
+ DCHECK(flush_count - last_flush_count_ < 0x8000000U)
dcheng 2015/09/10 21:30:37 DCHECK_LT
sunnyps 2015/09/10 23:38:37 Done.
+ << "Received a Flush message out-of-order";
- if (ui::LatencyInfo::Verify(latency_info,
+ if (flush_count > last_flush_count_ &&
+ ui::LatencyInfo::Verify(latency_info,
"GpuCommandBufferStub::OnAsyncFlush") &&
!latency_info_callback_.is_null()) {
latency_info_callback_.Run(latency_info);
}
- DCHECK(command_buffer_.get());
- if (flush_count - last_flush_count_ < 0x8000000U) {
- last_flush_count_ = flush_count;
- command_buffer_->Flush(put_offset);
- } else {
- // We received this message out-of-order. This should not happen but is here
- // to catch regressions. Ignore the message.
- NOTREACHED() << "Received a Flush message out-of-order";
- }
-
- ReportState();
-}
-void GpuCommandBufferStub::OnRescheduled() {
+ last_flush_count_ = flush_count;
gpu::CommandBuffer::State pre_state = command_buffer_->GetLastState();
- command_buffer_->Flush(command_buffer_->GetPutOffset());
+ command_buffer_->Flush(put_offset);
gpu::CommandBuffer::State post_state = command_buffer_->GetLastState();
if (pre_state.get_offset != post_state.get_offset)
@@ -886,8 +880,10 @@ void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) {
memory_manager_client_state_->SetVisible(visible);
}
-void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) {
+void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point, bool retire) {
sync_points_.push_back(sync_point);
+ if (retire)
+ OnRetireSyncPoint(sync_point);
}
void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) {

Powered by Google App Engine
This is Rietveld 408576698