cc: Remove disabled LatencyQuery logic in OutputSurface

We can add this back when we figure out why it was causing
flickering on some devices.

BUG=317928

Review URL: https://codereview.chromium.org/323423005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281915 0039d316-1c4b-4281-b951-d872f2087c98
parent 06293aa1
......@@ -21,7 +21,6 @@
#include "cc/output/managed_memory_policy.h"
#include "cc/output/output_surface_client.h"
#include "cc/scheduler/delay_based_time_source.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "third_party/khronos/GLES2/gl2.h"
......@@ -34,13 +33,6 @@ using std::set;
using std::string;
using std::vector;
namespace {
const size_t kGpuLatencyHistorySize = 60;
const double kGpuLatencyEstimationPercentile = 100.0;
}
namespace cc {
OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider)
......@@ -48,8 +40,7 @@ OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider)
context_provider_(context_provider),
device_scale_factor_(-1),
external_stencil_test_enabled_(false),
weak_ptr_factory_(this),
gpu_latency_history_(kGpuLatencyHistorySize) {
weak_ptr_factory_(this) {
}
OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device)
......@@ -57,8 +48,7 @@ OutputSurface::OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device)
software_device_(software_device.Pass()),
device_scale_factor_(-1),
external_stencil_test_enabled_(false),
weak_ptr_factory_(this),
gpu_latency_history_(kGpuLatencyHistorySize) {
weak_ptr_factory_(this) {
}
OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider,
......@@ -68,8 +58,7 @@ OutputSurface::OutputSurface(scoped_refptr<ContextProvider> context_provider,
software_device_(software_device.Pass()),
device_scale_factor_(-1),
external_stencil_test_enabled_(false),
weak_ptr_factory_(this),
gpu_latency_history_(kGpuLatencyHistorySize) {
weak_ptr_factory_(this) {
}
void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase,
......@@ -95,8 +84,6 @@ void OutputSurface::ReclaimResources(const CompositorFrameAck* ack) {
void OutputSurface::DidLoseOutputSurface() {
TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface");
pending_gpu_latency_query_ids_.clear();
available_gpu_latency_query_ids_.clear();
client_->DidLoseOutputSurface();
}
......@@ -189,16 +176,6 @@ void OutputSurface::ReleaseContextProvider() {
void OutputSurface::ResetContext3d() {
if (context_provider_.get()) {
while (!pending_gpu_latency_query_ids_.empty()) {
unsigned query_id = pending_gpu_latency_query_ids_.front();
pending_gpu_latency_query_ids_.pop_front();
context_provider_->ContextGL()->DeleteQueriesEXT(1, &query_id);
}
while (!available_gpu_latency_query_ids_.empty()) {
unsigned query_id = available_gpu_latency_query_ids_.front();
available_gpu_latency_query_ids_.pop_front();
context_provider_->ContextGL()->DeleteQueriesEXT(1, &query_id);
}
context_provider_->SetLostContextCallback(
ContextProvider::LostContextCallback());
context_provider_->SetMemoryPolicyChangedCallback(
......@@ -254,7 +231,6 @@ void OutputSurface::SwapBuffers(CompositorFrame* frame) {
DCHECK(context_provider_);
DCHECK(frame->gl_frame_data);
UpdateAndMeasureGpuLatency();
if (frame->gl_frame_data->sub_buffer_rect ==
gfx::Rect(frame->gl_frame_data->size)) {
context_provider_->ContextSupport()->Swap();
......@@ -266,79 +242,6 @@ void OutputSurface::SwapBuffers(CompositorFrame* frame) {
client_->DidSwapBuffers();
}
base::TimeDelta OutputSurface::GpuLatencyEstimate() {
if (context_provider_ && !capabilities_.adjust_deadline_for_parent)
return gpu_latency_history_.Percentile(kGpuLatencyEstimationPercentile);
else
return base::TimeDelta();
}
void OutputSurface::UpdateAndMeasureGpuLatency() {
// http://crbug.com/306690 tracks re-enabling latency queries.
#if 0
// We only care about GPU latency for surfaces that do not have a parent
// compositor, since surfaces that do have a parent compositor can use
// mailboxes or delegated rendering to send frames to their parent without
// incurring GPU latency.
if (capabilities_.adjust_deadline_for_parent)
return;
while (pending_gpu_latency_query_ids_.size()) {
unsigned query_id = pending_gpu_latency_query_ids_.front();
unsigned query_complete = 1;
context_provider_->ContextGL()->GetQueryObjectuivEXT(
query_id, GL_QUERY_RESULT_AVAILABLE_EXT, &query_complete);
if (!query_complete)
break;
unsigned value = 0;
context_provider_->ContextGL()->GetQueryObjectuivEXT(
query_id, GL_QUERY_RESULT_EXT, &value);
pending_gpu_latency_query_ids_.pop_front();
available_gpu_latency_query_ids_.push_back(query_id);
base::TimeDelta latency = base::TimeDelta::FromMicroseconds(value);
base::TimeDelta latency_estimate = GpuLatencyEstimate();
gpu_latency_history_.InsertSample(latency);
base::TimeDelta latency_overestimate;
base::TimeDelta latency_underestimate;
if (latency > latency_estimate)
latency_underestimate = latency - latency_estimate;
else
latency_overestimate = latency_estimate - latency;
UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.GpuLatency",
latency,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMilliseconds(100),
50);
UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.GpuLatencyUnderestimate",
latency_underestimate,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMilliseconds(100),
50);
UMA_HISTOGRAM_CUSTOM_TIMES("Renderer.GpuLatencyOverestimate",
latency_overestimate,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMilliseconds(100),
50);
}
unsigned gpu_latency_query_id;
if (available_gpu_latency_query_ids_.size()) {
gpu_latency_query_id = available_gpu_latency_query_ids_.front();
available_gpu_latency_query_ids_.pop_front();
} else {
context_provider_->ContextGL()->GenQueriesEXT(1, &gpu_latency_query_id);
}
context_provider_->ContextGL()->BeginQueryEXT(GL_LATENCY_QUERY_CHROMIUM,
gpu_latency_query_id);
context_provider_->ContextGL()->EndQueryEXT(GL_LATENCY_QUERY_CHROMIUM);
pending_gpu_latency_query_ids_.push_back(gpu_latency_query_id);
#endif
}
void OutputSurface::PostSwapBuffersComplete() {
base::MessageLoop::current()->PostTask(
FROM_HERE,
......
......@@ -138,10 +138,6 @@ class CC_EXPORT OutputSurface {
bool HasClient() { return !!client_; }
// Returns an estimate of the current GPU latency. When only a software
// device is present, returns 0.
base::TimeDelta GpuLatencyEstimate();
// Get the class capable of informing cc of hardware overlay capability.
OverlayCandidateValidator* overlay_candidate_validator() const {
return overlay_candidate_validator_.get();
......@@ -181,16 +177,11 @@ class CC_EXPORT OutputSurface {
void SetUpContext3d();
void ResetContext3d();
void SetMemoryPolicy(const ManagedMemoryPolicy& policy);
void UpdateAndMeasureGpuLatency();
bool external_stencil_test_enabled_;
base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
std::deque<unsigned> available_gpu_latency_query_ids_;
std::deque<unsigned> pending_gpu_latency_query_ids_;
RollingTimeDeltaHistory gpu_latency_history_;
DISALLOW_COPY_AND_ASSIGN(OutputSurface);
};
......
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