| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "cc/output/output_surface.h" | 5 #include "cc/output/output_surface.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 404 } |
| 405 | 405 |
| 406 base::TimeDelta OutputSurface::GpuLatencyEstimate() { | 406 base::TimeDelta OutputSurface::GpuLatencyEstimate() { |
| 407 if (context_provider_ && !capabilities_.adjust_deadline_for_parent) | 407 if (context_provider_ && !capabilities_.adjust_deadline_for_parent) |
| 408 return gpu_latency_history_.Percentile(kGpuLatencyEstimationPercentile); | 408 return gpu_latency_history_.Percentile(kGpuLatencyEstimationPercentile); |
| 409 else | 409 else |
| 410 return base::TimeDelta(); | 410 return base::TimeDelta(); |
| 411 } | 411 } |
| 412 | 412 |
| 413 void OutputSurface::UpdateAndMeasureGpuLatency() { | 413 void OutputSurface::UpdateAndMeasureGpuLatency() { |
| 414 return; // http://crbug.com/306690 tracks re-enabling latency queries. | 414 // http://crbug.com/306690 tracks re-enabling latency queries. |
| 415 | 415 #if 0 |
| 416 // We only care about GPU latency for surfaces that do not have a parent | 416 // We only care about GPU latency for surfaces that do not have a parent |
| 417 // compositor, since surfaces that do have a parent compositor can use | 417 // compositor, since surfaces that do have a parent compositor can use |
| 418 // mailboxes or delegated rendering to send frames to their parent without | 418 // mailboxes or delegated rendering to send frames to their parent without |
| 419 // incurring GPU latency. | 419 // incurring GPU latency. |
| 420 if (capabilities_.adjust_deadline_for_parent) | 420 if (capabilities_.adjust_deadline_for_parent) |
| 421 return; | 421 return; |
| 422 | 422 |
| 423 while (pending_gpu_latency_query_ids_.size()) { | 423 while (pending_gpu_latency_query_ids_.size()) { |
| 424 unsigned query_id = pending_gpu_latency_query_ids_.front(); | 424 unsigned query_id = pending_gpu_latency_query_ids_.front(); |
| 425 unsigned query_complete = 1; | 425 unsigned query_complete = 1; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 gpu_latency_query_id = available_gpu_latency_query_ids_.front(); | 466 gpu_latency_query_id = available_gpu_latency_query_ids_.front(); |
| 467 available_gpu_latency_query_ids_.pop_front(); | 467 available_gpu_latency_query_ids_.pop_front(); |
| 468 } else { | 468 } else { |
| 469 context_provider_->ContextGL()->GenQueriesEXT(1, &gpu_latency_query_id); | 469 context_provider_->ContextGL()->GenQueriesEXT(1, &gpu_latency_query_id); |
| 470 } | 470 } |
| 471 | 471 |
| 472 context_provider_->ContextGL()->BeginQueryEXT(GL_LATENCY_QUERY_CHROMIUM, | 472 context_provider_->ContextGL()->BeginQueryEXT(GL_LATENCY_QUERY_CHROMIUM, |
| 473 gpu_latency_query_id); | 473 gpu_latency_query_id); |
| 474 context_provider_->ContextGL()->EndQueryEXT(GL_LATENCY_QUERY_CHROMIUM); | 474 context_provider_->ContextGL()->EndQueryEXT(GL_LATENCY_QUERY_CHROMIUM); |
| 475 pending_gpu_latency_query_ids_.push_back(gpu_latency_query_id); | 475 pending_gpu_latency_query_ids_.push_back(gpu_latency_query_id); |
| 476 #endif |
| 476 } | 477 } |
| 477 | 478 |
| 478 void OutputSurface::PostSwapBuffersComplete() { | 479 void OutputSurface::PostSwapBuffersComplete() { |
| 479 base::MessageLoop::current()->PostTask( | 480 base::MessageLoop::current()->PostTask( |
| 480 FROM_HERE, | 481 FROM_HERE, |
| 481 base::Bind(&OutputSurface::OnSwapBuffersComplete, | 482 base::Bind(&OutputSurface::OnSwapBuffersComplete, |
| 482 weak_ptr_factory_.GetWeakPtr())); | 483 weak_ptr_factory_.GetWeakPtr())); |
| 483 } | 484 } |
| 484 | 485 |
| 485 void OutputSurface::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 486 void OutputSurface::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
| 486 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy", | 487 TRACE_EVENT1("cc", "OutputSurface::SetMemoryPolicy", |
| 487 "bytes_limit_when_visible", policy.bytes_limit_when_visible); | 488 "bytes_limit_when_visible", policy.bytes_limit_when_visible); |
| 488 // Just ignore the memory manager when it says to set the limit to zero | 489 // Just ignore the memory manager when it says to set the limit to zero |
| 489 // bytes. This will happen when the memory manager thinks that the renderer | 490 // bytes. This will happen when the memory manager thinks that the renderer |
| 490 // is not visible (which the renderer knows better). | 491 // is not visible (which the renderer knows better). |
| 491 if (policy.bytes_limit_when_visible) | 492 if (policy.bytes_limit_when_visible) |
| 492 client_->SetMemoryPolicy(policy); | 493 client_->SetMemoryPolicy(policy); |
| 493 } | 494 } |
| 494 | 495 |
| 495 } // namespace cc | 496 } // namespace cc |
| OLD | NEW |