Bug 1226826 - Record if painted displayport updates were due to repaints from the relevant layer tree or not. r=botond

--HG--
extra : commitid : JtQqmhK6am
This commit is contained in:
Kartikaya Gupta 2016-01-13 15:46:08 -05:00
parent a7478cbca5
commit eef30edf04
4 changed files with 30 additions and 13 deletions

View File

@ -455,8 +455,8 @@ APZCTreeManager::PrepareNodeForLayer(const LayerMetricsWrapper& aLayer,
APZCTM_LOG("Using APZC %p for layer %p with identifiers %" PRId64 " %" PRId64 "\n", apzc, aLayer.GetLayer(), aLayersId, aMetrics.GetScrollId());
apzc->NotifyLayersUpdated(aMetrics,
aState.mIsFirstPaint && (aLayersId == aState.mOriginatingLayersId));
apzc->NotifyLayersUpdated(aMetrics, aState.mIsFirstPaint,
aLayersId == aState.mOriginatingLayersId);
// Since this is the first time we are encountering an APZC with this guid,
// the node holding it must be the primary holder. It may be newly-created

View File

@ -3131,7 +3131,10 @@ bool AsyncPanZoomController::IsCurrentlyCheckerboarding() const {
return true;
}
void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint) {
void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetrics,
bool aIsFirstPaint,
bool aThisLayerTreeUpdated)
{
APZThreadUtils::AssertOnCompositorThread();
ReentrantMonitorAutoEnter lock(mMonitor);
@ -3140,15 +3143,28 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
mLastContentPaintMetrics = aLayerMetrics;
mFrameMetrics.SetScrollParentId(aLayerMetrics.GetScrollParentId());
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d", this, aIsFirstPaint);
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d, aThisLayerTreeUpdated=%d",
this, aIsFirstPaint, aThisLayerTreeUpdated);
if (mCheckerboardEvent) {
std::string str;
if (!aLayerMetrics.GetPaintRequestTime().IsNull()) {
TimeDuration paintTime = TimeStamp::Now() - aLayerMetrics.GetPaintRequestTime();
std::stringstream info;
info << " painttime " << paintTime.ToMilliseconds();
str = info.str();
if (aThisLayerTreeUpdated) {
if (!aLayerMetrics.GetPaintRequestTime().IsNull()) {
// Note that we might get the paint request time as non-null, but with
// aThisLayerTreeUpdated false. That can happen if we get a layer transaction
// from a different process right after we get the layer transaction with
// aThisLayerTreeUpdated == true. In this case we want to ignore the
// paint request time because it was already dumped in the previous layer
// transaction.
TimeDuration paintTime = TimeStamp::Now() - aLayerMetrics.GetPaintRequestTime();
std::stringstream info;
info << " painttime " << paintTime.ToMilliseconds();
str = info.str();
} else {
// This might be indicative of a wasted paint particularly if it happens
// during a checkerboard event.
str = " (this layertree updated)";
}
}
mCheckerboardEvent->UpdateRendertraceProperty(
CheckerboardEvent::Page, aLayerMetrics.GetScrollableRect());
@ -3190,7 +3206,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
// TODO if we're in a drag and scrollOffsetUpdated is set then we want to
// ignore it
if (aIsFirstPaint || isDefault) {
if ((aIsFirstPaint && aThisLayerTreeUpdated) || isDefault) {
// Initialize our internal state to something sane when the content
// that was just painted is something we knew nothing about previously
CancelAnimation();

View File

@ -183,7 +183,8 @@ public:
* layers code indicating that the frame metrics being sent with this call are
* the initial metrics and the initial paint of the frame has just happened.
*/
void NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint);
void NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint,
bool aThisLayerTreeUpdated);
/**
* The platform implementation must set the compositor parent so that we can

View File

@ -1181,13 +1181,13 @@ TEST_F(APZCBasicTester, ComplexTransform) {
// initial transform
apzc->SetFrameMetrics(metrics);
apzc->NotifyLayersUpdated(metrics, true);
apzc->NotifyLayersUpdated(metrics, true, true);
apzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1), ParentLayerPoint()), viewTransformOut);
EXPECT_EQ(ParentLayerPoint(60, 60), pointOut);
childApzc->SetFrameMetrics(childMetrics);
childApzc->NotifyLayersUpdated(childMetrics, true);
childApzc->NotifyLayersUpdated(childMetrics, true, true);
childApzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1), ParentLayerPoint()), viewTransformOut);
EXPECT_EQ(ParentLayerPoint(60, 60), pointOut);