зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 4 changesets (bug 1226826) for widespread bustage
Backed out changeset 95d373bec568 (bug 1226826) Backed out changeset bb9970d440a4 (bug 1226826) Backed out changeset 6c1fa0dc6bd7 (bug 1226826) Backed out changeset 400ebf504171 (bug 1226826) --HG-- extra : commitid : D1zZSeIHTOA
This commit is contained in:
Родитель
6efc9783c7
Коммит
ecae6cd9a5
|
@ -2112,7 +2112,6 @@ GK_ATOM(baseURIProperty, "baseURIProperty")
|
|||
GK_ATOM(lockedStyleStates, "lockedStyleStates")
|
||||
GK_ATOM(apzCallbackTransform, "apzCallbackTransform")
|
||||
GK_ATOM(restylableAnonymousNode, "restylableAnonymousNode")
|
||||
GK_ATOM(paintRequestTime, "PaintRequestTime")
|
||||
|
||||
// Languages for lang-specific transforms
|
||||
GK_ATOM(Japanese, "ja")
|
||||
|
|
|
@ -700,7 +700,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
|||
WriteParam(aMsg, aParam.mPageScrollAmount);
|
||||
WriteParam(aMsg, aParam.mClipRect);
|
||||
WriteParam(aMsg, aParam.mMaskLayerIndex);
|
||||
WriteParam(aMsg, aParam.mPaintRequestTime);
|
||||
WriteParam(aMsg, aParam.mIsRootContent);
|
||||
WriteParam(aMsg, aParam.mHasScrollgrab);
|
||||
WriteParam(aMsg, aParam.mUpdateScrollOffset);
|
||||
|
@ -762,7 +761,6 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
|
|||
ReadParam(aMsg, aIter, &aResult->mPageScrollAmount) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mClipRect) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMaskLayerIndex) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPaintRequestTime) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetIsRootContent) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetHasScrollgrab) &&
|
||||
ReadBoolForBitfield(aMsg, aIter, aResult, ¶mType::SetUpdateScrollOffset) &&
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "mozilla/gfx/Rect.h" // for RoundedIn
|
||||
#include "mozilla/gfx/ScaleFactor.h" // for ScaleFactor
|
||||
#include "mozilla/gfx/Logging.h" // for Log
|
||||
#include "mozilla/TimeStamp.h" // for TimeStamp
|
||||
#include "nsString.h"
|
||||
|
||||
namespace IPC {
|
||||
|
@ -64,7 +63,6 @@ public:
|
|||
, mPageScrollAmount(0, 0)
|
||||
, mClipRect()
|
||||
, mMaskLayerIndex()
|
||||
, mPaintRequestTime()
|
||||
, mIsRootContent(false)
|
||||
, mHasScrollgrab(false)
|
||||
, mUpdateScrollOffset(false)
|
||||
|
@ -106,7 +104,6 @@ public:
|
|||
mPageScrollAmount == aOther.mPageScrollAmount &&
|
||||
mClipRect == aOther.mClipRect &&
|
||||
mMaskLayerIndex == aOther.mMaskLayerIndex &&
|
||||
mPaintRequestTime == aOther.mPaintRequestTime &&
|
||||
mIsRootContent == aOther.mIsRootContent &&
|
||||
mHasScrollgrab == aOther.mHasScrollgrab &&
|
||||
mUpdateScrollOffset == aOther.mUpdateScrollOffset &&
|
||||
|
@ -543,13 +540,6 @@ public:
|
|||
return mMaskLayerIndex;
|
||||
}
|
||||
|
||||
void SetPaintRequestTime(const TimeStamp& aTime) {
|
||||
mPaintRequestTime = aTime;
|
||||
}
|
||||
const TimeStamp& GetPaintRequestTime() const {
|
||||
return mPaintRequestTime;
|
||||
}
|
||||
|
||||
void SetIsLayersIdRoot(bool aValue) {
|
||||
mIsLayersIdRoot = aValue;
|
||||
}
|
||||
|
@ -732,9 +722,6 @@ private:
|
|||
// the Layer.
|
||||
Maybe<size_t> mMaskLayerIndex;
|
||||
|
||||
// The time at which the APZC last requested a repaint for this scrollframe.
|
||||
TimeStamp mPaintRequestTime;
|
||||
|
||||
// Whether or not this is the root scroll frame for the root content document.
|
||||
bool mIsRootContent:1;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <algorithm> // for max, min
|
||||
#include "AsyncPanZoomController.h" // for AsyncPanZoomController, etc
|
||||
#include "Axis.h" // for AxisX, AxisY, Axis, etc
|
||||
#include "CheckerboardEvent.h" // for CheckerboardEvent
|
||||
#include "Compositor.h" // for Compositor
|
||||
#include "FrameMetrics.h" // for FrameMetrics, etc
|
||||
#include "GestureEventListener.h" // for GestureEventListener
|
||||
|
@ -26,7 +25,6 @@
|
|||
#include "base/tracked.h" // for FROM_HERE
|
||||
#include "gfxPrefs.h" // for gfxPrefs
|
||||
#include "gfxTypes.h" // for gfxFloat
|
||||
#include "LayersLogging.h" // for print_stderr
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
||||
#include "mozilla/BasicEvents.h" // for Modifiers, MODIFIER_*
|
||||
#include "mozilla/ClearOnShutdown.h" // for ClearOnShutdown
|
||||
|
@ -69,10 +67,13 @@
|
|||
#include "SharedMemoryBasic.h" // for SharedMemoryBasic
|
||||
#include "WheelScrollAnimation.h"
|
||||
|
||||
// #define APZC_ENABLE_RENDERTRACE
|
||||
|
||||
#define ENABLE_APZC_LOGGING 0
|
||||
// #define ENABLE_APZC_LOGGING 1
|
||||
|
||||
#if ENABLE_APZC_LOGGING
|
||||
# include "LayersLogging.h"
|
||||
# define APZC_LOG(...) printf_stderr("APZC: " __VA_ARGS__)
|
||||
# define APZC_LOG_FM(fm, prefix, ...) \
|
||||
{ std::stringstream ss; \
|
||||
|
@ -275,9 +276,6 @@ using mozilla::gfx::PointTyped;
|
|||
* Maximum amount of time while panning before sending a viewport change. This
|
||||
* will asynchronously repaint the page. It is also forced when panning stops.
|
||||
*
|
||||
* \li\b apz.record_checkerboarding
|
||||
* Whether or not to record detailed info on checkerboarding events.
|
||||
*
|
||||
* \li\b apz.smooth_scroll_repaint_interval
|
||||
* Maximum amount of time doing a smooth scroll before sending a viewport
|
||||
* change. This will asynchronously repaint the page.\n
|
||||
|
@ -390,6 +388,18 @@ static bool IsCloseToVertical(float aAngle, float aThreshold)
|
|||
return (fabs(aAngle - (M_PI / 2)) < aThreshold);
|
||||
}
|
||||
|
||||
static inline void LogRendertraceRect(const ScrollableLayerGuid& aGuid, const char* aDesc, const char* aColor, const CSSRect& aRect)
|
||||
{
|
||||
#ifdef APZC_ENABLE_RENDERTRACE
|
||||
static const TimeStamp sRenderStart = TimeStamp::Now();
|
||||
TimeDuration delta = TimeStamp::Now() - sRenderStart;
|
||||
printf_stderr("(%llu,%lu,%llu)%s RENDERTRACE %f rect %s %f %f %f %f\n",
|
||||
aGuid.mLayersId, aGuid.mPresShellId, aGuid.mScrollId,
|
||||
aDesc, delta.ToMilliseconds(), aColor,
|
||||
aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Counter used to give each APZC a unique id
|
||||
static uint32_t sAsyncPanZoomControllerCount = 0;
|
||||
|
||||
|
@ -2802,10 +2812,8 @@ void AsyncPanZoomController::RequestContentRepaint() {
|
|||
RequestContentRepaint(mFrameMetrics);
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics)
|
||||
{
|
||||
ParentLayerPoint velocity = GetVelocityVector();
|
||||
aFrameMetrics.SetDisplayPortMargins(CalculatePendingDisplayPort(aFrameMetrics, velocity));
|
||||
void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics) {
|
||||
aFrameMetrics.SetDisplayPortMargins(CalculatePendingDisplayPort(aFrameMetrics, GetVelocityVector()));
|
||||
aFrameMetrics.SetUseDisplayPortMargins(true);
|
||||
|
||||
// If we're trying to paint what we already think is painted, discard this
|
||||
|
@ -2829,8 +2837,7 @@ void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics)
|
|||
return;
|
||||
}
|
||||
|
||||
aFrameMetrics.SetPaintRequestTime(TimeStamp::Now());
|
||||
DispatchRepaintRequest(aFrameMetrics, velocity);
|
||||
DispatchRepaintRequest(aFrameMetrics);
|
||||
aFrameMetrics.SetPresShellId(mLastContentPaintMetrics.GetPresShellId());
|
||||
}
|
||||
|
||||
|
@ -2846,23 +2853,14 @@ GetDisplayPortRect(const FrameMetrics& aFrameMetrics)
|
|||
}
|
||||
|
||||
void
|
||||
AsyncPanZoomController::DispatchRepaintRequest(const FrameMetrics& aFrameMetrics,
|
||||
const ParentLayerPoint& aVelocity)
|
||||
{
|
||||
AsyncPanZoomController::DispatchRepaintRequest(const FrameMetrics& aFrameMetrics) {
|
||||
RefPtr<GeckoContentController> controller = GetGeckoContentController();
|
||||
if (!controller) {
|
||||
return;
|
||||
}
|
||||
|
||||
APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this);
|
||||
if (mCheckerboardEvent) {
|
||||
std::stringstream info;
|
||||
info << " velocity " << aVelocity;
|
||||
std::string str = info.str();
|
||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||
CheckerboardEvent::RequestedDisplayPort, GetDisplayPortRect(aFrameMetrics),
|
||||
str);
|
||||
}
|
||||
LogRendertraceRect(GetGuid(), "requested displayport", "yellow", GetDisplayPortRect(aFrameMetrics));
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
controller->RequestContentRepaint(aFrameMetrics);
|
||||
|
@ -2970,12 +2968,9 @@ bool AsyncPanZoomController::AdvanceAnimations(const TimeStamp& aSampleTime)
|
|||
|
||||
requestAnimationFrame = UpdateAnimation(aSampleTime, &deferredTasks);
|
||||
|
||||
if (mCheckerboardEvent) {
|
||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||
CheckerboardEvent::UserVisible,
|
||||
CSSRect(mFrameMetrics.GetScrollOffset(),
|
||||
mFrameMetrics.CalculateCompositedSizeInCssPixels()));
|
||||
}
|
||||
LogRendertraceRect(GetGuid(), "viewport", "red",
|
||||
CSSRect(mFrameMetrics.GetScrollOffset(),
|
||||
mFrameMetrics.CalculateCompositedSizeInCssPixels()));
|
||||
}
|
||||
|
||||
// Execute any deferred tasks queued up by mAnimation's Sample() (called by
|
||||
|
@ -3097,19 +3092,6 @@ AsyncPanZoomController::ReportCheckerboard(const TimeStamp& aSampleTime)
|
|||
mozilla::Telemetry::Accumulate(
|
||||
mozilla::Telemetry::CHECKERBOARDED_CSSPIXELS_MS, magnitude * time);
|
||||
mLastCheckerboardReport = aSampleTime;
|
||||
|
||||
if (!mCheckerboardEvent && gfxPrefs::APZRecordCheckerboarding()) {
|
||||
mCheckerboardEvent = MakeUnique<CheckerboardEvent>();
|
||||
}
|
||||
if (mCheckerboardEvent) {
|
||||
if (mCheckerboardEvent->RecordFrameInfo(aSampleTime, magnitude)) {
|
||||
// This checkerboard event is done. TODO: save the info somewhere or
|
||||
// dispatch it to telemetry or something. For now we just print it.
|
||||
std::stringstream log(mCheckerboardEvent->GetLog());
|
||||
print_stderr(log);
|
||||
mCheckerboardEvent = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AsyncPanZoomController::IsCurrentlyCheckerboarding() const {
|
||||
|
@ -3131,10 +3113,7 @@ bool AsyncPanZoomController::IsCurrentlyCheckerboarding() const {
|
|||
return true;
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetrics,
|
||||
bool aIsFirstPaint,
|
||||
bool aThisLayerTreeUpdated)
|
||||
{
|
||||
void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint) {
|
||||
APZThreadUtils::AssertOnCompositorThread();
|
||||
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
@ -3143,40 +3122,14 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
mLastContentPaintMetrics = aLayerMetrics;
|
||||
|
||||
mFrameMetrics.SetScrollParentId(aLayerMetrics.GetScrollParentId());
|
||||
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d, aThisLayerTreeUpdated=%d",
|
||||
this, aIsFirstPaint, aThisLayerTreeUpdated);
|
||||
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d", this, aIsFirstPaint);
|
||||
|
||||
if (mCheckerboardEvent) {
|
||||
std::string 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());
|
||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||
CheckerboardEvent::PaintedDisplayPort,
|
||||
aLayerMetrics.GetDisplayPort() + aLayerMetrics.GetScrollOffset(),
|
||||
str);
|
||||
if (!aLayerMetrics.GetCriticalDisplayPort().IsEmpty()) {
|
||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||
CheckerboardEvent::PaintedCriticalDisplayPort,
|
||||
aLayerMetrics.GetCriticalDisplayPort() + aLayerMetrics.GetScrollOffset());
|
||||
}
|
||||
LogRendertraceRect(GetGuid(), "page", "brown", aLayerMetrics.GetScrollableRect());
|
||||
LogRendertraceRect(GetGuid(), "painted displayport", "lightgreen",
|
||||
aLayerMetrics.GetDisplayPort() + aLayerMetrics.GetScrollOffset());
|
||||
if (!aLayerMetrics.GetCriticalDisplayPort().IsEmpty()) {
|
||||
LogRendertraceRect(GetGuid(), "painted critical displayport", "darkgreen",
|
||||
aLayerMetrics.GetCriticalDisplayPort() + aLayerMetrics.GetScrollOffset());
|
||||
}
|
||||
|
||||
bool needContentRepaint = false;
|
||||
|
@ -3206,7 +3159,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 && aThisLayerTreeUpdated) || isDefault) {
|
||||
if (aIsFirstPaint || isDefault) {
|
||||
// Initialize our internal state to something sane when the content
|
||||
// that was just painted is something we knew nothing about previously
|
||||
CancelAnimation();
|
||||
|
|
|
@ -52,7 +52,6 @@ class TouchBlockState;
|
|||
class PanGestureBlockState;
|
||||
class OverscrollHandoffChain;
|
||||
class StateChangeNotificationBlocker;
|
||||
class CheckerboardEvent;
|
||||
|
||||
/**
|
||||
* Controller for all panning and zooming logic. Any time a user input is
|
||||
|
@ -183,8 +182,7 @@ 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,
|
||||
bool aThisLayerTreeUpdated);
|
||||
void NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint);
|
||||
|
||||
/**
|
||||
* The platform implementation must set the compositor parent so that we can
|
||||
|
@ -596,8 +594,7 @@ protected:
|
|||
/**
|
||||
* Actually send the next pending paint request to gecko.
|
||||
*/
|
||||
void DispatchRepaintRequest(const FrameMetrics& aFrameMetrics,
|
||||
const ParentLayerPoint& aVelocity);
|
||||
void DispatchRepaintRequest(const FrameMetrics& aFrameMetrics);
|
||||
|
||||
/**
|
||||
* Gets the current frame metrics. This is *not* the Gecko copy stored in the
|
||||
|
@ -1102,17 +1099,6 @@ private:
|
|||
// Flag to track whether or not the APZ transform is not used. This
|
||||
// flag is recomputed for every composition frame.
|
||||
bool mAsyncTransformAppliedToContent;
|
||||
|
||||
|
||||
/* ===================================================================
|
||||
* The functions and members in this section are used for checkerboard
|
||||
* recording.
|
||||
*/
|
||||
private:
|
||||
// This is created when this APZC instance is first included as part of a
|
||||
// composite. If a checkerboard event takes place, this is destroyed at the
|
||||
// end of the event, and a new one is created on the next composite.
|
||||
UniquePtr<CheckerboardEvent> mCheckerboardEvent;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -1,200 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "CheckerboardEvent.h"
|
||||
|
||||
#include <algorithm> // for std::sort
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
// Relatively arbitrary limit to prevent a perma-checkerboard event from
|
||||
// eating up gobs of memory. Ideally we shouldn't have perma-checkerboarding
|
||||
// but better to guard against it.
|
||||
#define LOG_LENGTH_LIMIT (50 * 1024)
|
||||
|
||||
const char* CheckerboardEvent::sDescriptions[] = {
|
||||
"page",
|
||||
"painted critical displayport",
|
||||
"painted displayport",
|
||||
"requested displayport",
|
||||
"viewport",
|
||||
};
|
||||
|
||||
const char* CheckerboardEvent::sColors[] = {
|
||||
"brown",
|
||||
"darkgreen",
|
||||
"lightgreen",
|
||||
"yellow",
|
||||
"red",
|
||||
};
|
||||
|
||||
CheckerboardEvent::CheckerboardEvent()
|
||||
: mOriginTime(TimeStamp::Now())
|
||||
, mCheckerboardingActive(false)
|
||||
, mLastSampleTime(mOriginTime)
|
||||
, mFrameCount(0)
|
||||
, mTotalPixelMs(0)
|
||||
, mPeakPixels(0)
|
||||
, mRendertraceLock("Rendertrace")
|
||||
{
|
||||
}
|
||||
|
||||
uint64_t
|
||||
CheckerboardEvent::GetSeverity()
|
||||
{
|
||||
return mTotalPixelMs;
|
||||
}
|
||||
|
||||
std::string
|
||||
CheckerboardEvent::GetLog()
|
||||
{
|
||||
MonitorAutoLock lock(mRendertraceLock);
|
||||
return mRendertraceInfo.str();
|
||||
}
|
||||
|
||||
void
|
||||
CheckerboardEvent::UpdateRendertraceProperty(RendertraceProperty aProperty,
|
||||
const CSSRect& aRect,
|
||||
const std::string& aExtraInfo)
|
||||
{
|
||||
MonitorAutoLock lock(mRendertraceLock);
|
||||
if (!mCheckerboardingActive) {
|
||||
mBufferedProperties[aProperty].Update(aProperty, aRect, aExtraInfo, lock);
|
||||
} else {
|
||||
LogInfo(aProperty, TimeStamp::Now(), aRect, aExtraInfo, lock);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CheckerboardEvent::LogInfo(RendertraceProperty aProperty,
|
||||
const TimeStamp& aTimestamp,
|
||||
const CSSRect& aRect,
|
||||
const std::string& aExtraInfo,
|
||||
const MonitorAutoLock& aProofOfLock)
|
||||
{
|
||||
if (mRendertraceInfo.tellp() >= LOG_LENGTH_LIMIT) {
|
||||
// The log is already long enough, don't put more things into it. We'll
|
||||
// append a truncation message when this event ends.
|
||||
return;
|
||||
}
|
||||
// The log is consumed by the page at http://people.mozilla.org/~kgupta/rendertrace.html
|
||||
// and will move to about:checkerboard in bug 1238042. The format is not
|
||||
// formally specced, but an informal description can be found at
|
||||
// https://github.com/staktrace/rendertrace/blob/master/index.html#L30
|
||||
mRendertraceInfo << "RENDERTRACE "
|
||||
<< (aTimestamp - mOriginTime).ToMilliseconds() << " rect "
|
||||
<< sColors[aProperty] << " "
|
||||
<< aRect.x << " "
|
||||
<< aRect.y << " "
|
||||
<< aRect.width << " "
|
||||
<< aRect.height << " "
|
||||
<< "// " << sDescriptions[aProperty]
|
||||
<< aExtraInfo << std::endl;
|
||||
}
|
||||
|
||||
bool
|
||||
CheckerboardEvent::RecordFrameInfo(const TimeStamp& aSampleTime,
|
||||
uint32_t aCssPixelsCheckerboarded)
|
||||
{
|
||||
bool eventEnding = false;
|
||||
if (aCssPixelsCheckerboarded > 0) {
|
||||
if (!mCheckerboardingActive) {
|
||||
StartEvent();
|
||||
}
|
||||
MOZ_ASSERT(mCheckerboardingActive);
|
||||
MOZ_ASSERT(aSampleTime >= mLastSampleTime);
|
||||
mTotalPixelMs += (uint64_t)((aSampleTime - mLastSampleTime).ToMilliseconds() * aCssPixelsCheckerboarded);
|
||||
if (aCssPixelsCheckerboarded > mPeakPixels) {
|
||||
mPeakPixels = aCssPixelsCheckerboarded;
|
||||
}
|
||||
mFrameCount++;
|
||||
} else {
|
||||
if (mCheckerboardingActive) {
|
||||
StopEvent();
|
||||
eventEnding = true;
|
||||
}
|
||||
MOZ_ASSERT(!mCheckerboardingActive);
|
||||
}
|
||||
mLastSampleTime = aSampleTime;
|
||||
return eventEnding;
|
||||
}
|
||||
|
||||
void
|
||||
CheckerboardEvent::StartEvent()
|
||||
{
|
||||
MOZ_ASSERT(!mCheckerboardingActive);
|
||||
mCheckerboardingActive = true;
|
||||
mStartTime = TimeStamp::Now();
|
||||
|
||||
MonitorAutoLock lock(mRendertraceLock);
|
||||
std::vector<PropertyValue> history;
|
||||
for (int i = 0; i < MAX_RendertraceProperty; i++) {
|
||||
mBufferedProperties[i].Flush(history, lock);
|
||||
}
|
||||
std::sort(history.begin(), history.end());
|
||||
for (const PropertyValue& p : history) {
|
||||
LogInfo(p.mProperty, p.mTimeStamp, p.mRect, p.mExtraInfo, lock);
|
||||
}
|
||||
mRendertraceInfo << " -- checkerboarding starts below --" << std::endl;
|
||||
}
|
||||
|
||||
void
|
||||
CheckerboardEvent::StopEvent()
|
||||
{
|
||||
mCheckerboardingActive = false;
|
||||
mEndTime = TimeStamp::Now();
|
||||
|
||||
MonitorAutoLock lock(mRendertraceLock);
|
||||
if (mRendertraceInfo.tellp() >= LOG_LENGTH_LIMIT) {
|
||||
mRendertraceInfo << "[logging aborted due to length limitations]\n";
|
||||
}
|
||||
mRendertraceInfo << "Checkerboarded for " << mFrameCount << " frames ("
|
||||
<< (mEndTime - mStartTime).ToMilliseconds() << " ms), "
|
||||
<< mPeakPixels << " peak, " << GetSeverity() << " severity." << std::endl;
|
||||
}
|
||||
|
||||
bool
|
||||
CheckerboardEvent::PropertyValue::operator<(const PropertyValue& aOther) const
|
||||
{
|
||||
if (mTimeStamp < aOther.mTimeStamp) {
|
||||
return true;
|
||||
} else if (mTimeStamp > aOther.mTimeStamp) {
|
||||
return false;
|
||||
}
|
||||
return mProperty < aOther.mProperty;
|
||||
}
|
||||
|
||||
CheckerboardEvent::PropertyBuffer::PropertyBuffer()
|
||||
: mIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CheckerboardEvent::PropertyBuffer::Update(RendertraceProperty aProperty,
|
||||
const CSSRect& aRect,
|
||||
const std::string& aExtraInfo,
|
||||
const MonitorAutoLock& aProofOfLock)
|
||||
{
|
||||
mValues[mIndex] = { aProperty, TimeStamp::Now(), aRect, aExtraInfo };
|
||||
mIndex = (mIndex + 1) % BUFFER_SIZE;
|
||||
}
|
||||
|
||||
void
|
||||
CheckerboardEvent::PropertyBuffer::Flush(std::vector<PropertyValue>& aOut,
|
||||
const MonitorAutoLock& aProofOfLock)
|
||||
{
|
||||
for (uint32_t i = 0; i < BUFFER_SIZE; i++) {
|
||||
uint32_t ix = (mIndex + i) % BUFFER_SIZE;
|
||||
if (!mValues[ix].mTimeStamp.IsNull()) {
|
||||
aOut.push_back(mValues[ix]);
|
||||
mValues[ix].mTimeStamp = TimeStamp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
|
@ -1,199 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_layers_CheckerboardEvent_h
|
||||
#define mozilla_layers_CheckerboardEvent_h
|
||||
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include <sstream>
|
||||
#include "Units.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
/**
|
||||
* This class records information relevant to one "checkerboard event", which is
|
||||
* a contiguous set of frames where a given APZC was checkerboarding. The intent
|
||||
* of this class is to record enough information that it can provide actionable
|
||||
* steps to reduce the occurrence of checkerboarding. Furthermore, it records
|
||||
* information about the severity of the checkerboarding so as to allow
|
||||
* prioritizing the debugging of some checkerboarding events over others.
|
||||
*/
|
||||
class CheckerboardEvent {
|
||||
public:
|
||||
enum RendertraceProperty {
|
||||
Page,
|
||||
PaintedCriticalDisplayPort,
|
||||
PaintedDisplayPort,
|
||||
RequestedDisplayPort,
|
||||
UserVisible,
|
||||
|
||||
// sentinel final value
|
||||
MAX_RendertraceProperty
|
||||
};
|
||||
|
||||
static const char* sDescriptions[MAX_RendertraceProperty];
|
||||
static const char* sColors[MAX_RendertraceProperty];
|
||||
|
||||
public:
|
||||
CheckerboardEvent();
|
||||
|
||||
/**
|
||||
* Gets the "severity" of the checkerboard event. This doesn't have units,
|
||||
* it's just useful for comparing two checkerboard events to see which one
|
||||
* is worse, for some implementation-specific definition of "worse".
|
||||
*/
|
||||
uint64_t GetSeverity();
|
||||
|
||||
/**
|
||||
* Gets the raw log of the checkerboard event. This can be called any time,
|
||||
* although it really only makes sense to pull once the event is done, after
|
||||
* RecordFrameInfo returns true.
|
||||
*/
|
||||
std::string GetLog();
|
||||
|
||||
/**
|
||||
* Provide a new value for one of the rects that is tracked for
|
||||
* checkerboard events.
|
||||
*/
|
||||
void UpdateRendertraceProperty(RendertraceProperty aProperty,
|
||||
const CSSRect& aRect,
|
||||
const std::string& aExtraInfo = std::string());
|
||||
|
||||
/**
|
||||
* Provide the number of CSS pixels that are checkerboarded in a composite
|
||||
* at the given sample time. The sample times must be non-decreasing, and
|
||||
* should generally be one vsync apart.
|
||||
* @return true if the checkerboard event has completed. The caller should
|
||||
* stop updating this object once this happens.
|
||||
*/
|
||||
bool RecordFrameInfo(const TimeStamp& aSampleTime,
|
||||
uint32_t aCssPixelsCheckerboarded);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Helper method to do stuff when checkeboarding starts.
|
||||
*/
|
||||
void StartEvent();
|
||||
/**
|
||||
* Helper method to do stuff when checkerboarding stops.
|
||||
*/
|
||||
void StopEvent();
|
||||
|
||||
/**
|
||||
* Helper method to log a rendertrace property and its value to the
|
||||
* rendertrace info buffer (mRendertraceInfo).
|
||||
*/
|
||||
void LogInfo(RendertraceProperty aProperty,
|
||||
const TimeStamp& aTimestamp,
|
||||
const CSSRect& aRect,
|
||||
const std::string& aExtraInfo,
|
||||
const MonitorAutoLock& aProofOfLock);
|
||||
|
||||
/**
|
||||
* Helper struct that holds a single rendertrace property value.
|
||||
*/
|
||||
struct PropertyValue
|
||||
{
|
||||
RendertraceProperty mProperty;
|
||||
TimeStamp mTimeStamp;
|
||||
CSSRect mRect;
|
||||
std::string mExtraInfo;
|
||||
|
||||
bool operator<(const PropertyValue& aOther) const;
|
||||
};
|
||||
|
||||
/**
|
||||
* A circular buffer that stores the most recent BUFFER_SIZE values of a
|
||||
* given property.
|
||||
*/
|
||||
class PropertyBuffer
|
||||
{
|
||||
public:
|
||||
PropertyBuffer();
|
||||
/**
|
||||
* Add a new value to the buffer, overwriting the oldest one if needed.
|
||||
*/
|
||||
void Update(RendertraceProperty aProperty, const CSSRect& aRect,
|
||||
const std::string& aExtraInfo,
|
||||
const MonitorAutoLock& aProofOfLock);
|
||||
/**
|
||||
* Dump the recorded values, oldest to newest, to the given vector, and
|
||||
* remove them from this buffer.
|
||||
*/
|
||||
void Flush(std::vector<PropertyValue>& aOut,
|
||||
const MonitorAutoLock& aProofOfLock);
|
||||
|
||||
private:
|
||||
static const uint32_t BUFFER_SIZE = 5;
|
||||
|
||||
/**
|
||||
* The index of the oldest value in the buffer. This is the next index
|
||||
* that will be written to.
|
||||
*/
|
||||
uint32_t mIndex;
|
||||
PropertyValue mValues[BUFFER_SIZE];
|
||||
};
|
||||
|
||||
private:
|
||||
/**
|
||||
* A base time so that the other timestamps can be turned into durations.
|
||||
*/
|
||||
const TimeStamp mOriginTime;
|
||||
/**
|
||||
* Whether or not a checkerboard event is currently occurring.
|
||||
*/
|
||||
bool mCheckerboardingActive;
|
||||
|
||||
/**
|
||||
* The start time of the checkerboard event.
|
||||
*/
|
||||
TimeStamp mStartTime;
|
||||
/**
|
||||
* The end time of the checkerboard event.
|
||||
*/
|
||||
TimeStamp mEndTime;
|
||||
/**
|
||||
* The sample time of the last frame recorded.
|
||||
*/
|
||||
TimeStamp mLastSampleTime;
|
||||
/**
|
||||
* The number of contiguous frames with checkerboard.
|
||||
*/
|
||||
uint32_t mFrameCount;
|
||||
/**
|
||||
* The total number of pixel-milliseconds of checkerboarding visible to
|
||||
* the user during the checkerboarding event.
|
||||
*/
|
||||
uint64_t mTotalPixelMs;
|
||||
/**
|
||||
* The largest number of pixels of checkerboarding visible to the user
|
||||
* during any one frame, during this checkerboarding event.
|
||||
*/
|
||||
uint32_t mPeakPixels;
|
||||
|
||||
/**
|
||||
* Monitor that needs to be acquired before touching mBufferedProperties
|
||||
* or mRendertraceInfo.
|
||||
*/
|
||||
mutable Monitor mRendertraceLock;
|
||||
/**
|
||||
* A circular buffer to store some properties. This is used before the
|
||||
* checkerboarding actually starts, so that we have some data on what
|
||||
* was happening before the checkerboarding started.
|
||||
*/
|
||||
PropertyBuffer mBufferedProperties[MAX_RendertraceProperty];
|
||||
/**
|
||||
* The rendertrace info buffer that gives us info on what was happening
|
||||
* during the checkerboard event.
|
||||
*/
|
||||
std::ostringstream mRendertraceInfo;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_layers_CheckerboardEvent_h
|
|
@ -1181,13 +1181,13 @@ TEST_F(APZCBasicTester, ComplexTransform) {
|
|||
|
||||
// initial transform
|
||||
apzc->SetFrameMetrics(metrics);
|
||||
apzc->NotifyLayersUpdated(metrics, true, true);
|
||||
apzc->NotifyLayersUpdated(metrics, 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, true);
|
||||
childApzc->NotifyLayersUpdated(childMetrics, true);
|
||||
childApzc->SampleContentTransformForFrame(&viewTransformOut, pointOut);
|
||||
EXPECT_EQ(AsyncTransform(LayerToParentLayerScale(1), ParentLayerPoint()), viewTransformOut);
|
||||
EXPECT_EQ(ParentLayerPoint(60, 60), pointOut);
|
||||
|
|
|
@ -200,14 +200,6 @@ GetPresShell(const nsIContent* aContent)
|
|||
return result.forget();
|
||||
}
|
||||
|
||||
static void
|
||||
SetPaintRequestTime(nsIContent* aContent, const TimeStamp& aPaintRequestTime)
|
||||
{
|
||||
aContent->SetProperty(nsGkAtoms::paintRequestTime,
|
||||
new TimeStamp(aPaintRequestTime),
|
||||
nsINode::DeleteProperty<TimeStamp>);
|
||||
}
|
||||
|
||||
void
|
||||
APZCCallbackHelper::UpdateRootFrame(FrameMetrics& aMetrics)
|
||||
{
|
||||
|
@ -255,7 +247,6 @@ APZCCallbackHelper::UpdateRootFrame(FrameMetrics& aMetrics)
|
|||
|
||||
MOZ_ASSERT(nsLayoutUtils::HasDisplayPort(content));
|
||||
SetDisplayPortMargins(shell, content, aMetrics);
|
||||
SetPaintRequestTime(content, aMetrics.GetPaintRequestTime());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -277,7 +268,6 @@ APZCCallbackHelper::UpdateSubFrame(FrameMetrics& aMetrics)
|
|||
if (nsCOMPtr<nsIPresShell> shell = GetPresShell(content)) {
|
||||
SetDisplayPortMargins(shell, content, aMetrics);
|
||||
}
|
||||
SetPaintRequestTime(content, aMetrics.GetPaintRequestTime());
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -920,6 +910,7 @@ APZCCallbackHelper::IsDisplayportSuppressed()
|
|||
return sActiveSuppressDisplayport > 0;
|
||||
}
|
||||
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -248,7 +248,6 @@ UNIFIED_SOURCES += [
|
|||
'apz/src/APZCTreeManager.cpp',
|
||||
'apz/src/AsyncPanZoomController.cpp',
|
||||
'apz/src/Axis.cpp',
|
||||
'apz/src/CheckerboardEvent.cpp',
|
||||
'apz/src/GestureEventListener.cpp',
|
||||
'apz/src/HitTestingTreeNode.cpp',
|
||||
'apz/src/InputBlockState.cpp',
|
||||
|
|
|
@ -176,7 +176,6 @@ private:
|
|||
DECL_GFX_PREF(Live, "apz.overscroll.stretch_factor", APZOverscrollStretchFactor, float, 0.5f);
|
||||
DECL_GFX_PREF(Live, "apz.pan_repaint_interval", APZPanRepaintInterval, int32_t, 250);
|
||||
DECL_GFX_PREF(Live, "apz.printtree", APZPrintTree, bool, false);
|
||||
DECL_GFX_PREF(Live, "apz.record_checkerboarding", APZRecordCheckerboarding, bool, false);
|
||||
DECL_GFX_PREF(Live, "apz.smooth_scroll_repaint_interval", APZSmoothScrollRepaintInterval, int32_t, 75);
|
||||
DECL_GFX_PREF(Live, "apz.test.logging_enabled", APZTestLoggingEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "apz.touch_move_tolerance", APZTouchMoveTolerance, float, 0.0);
|
||||
|
|
|
@ -8520,10 +8520,6 @@ nsLayoutUtils::ComputeFrameMetrics(nsIFrame* aForFrame,
|
|||
|
||||
ViewID scrollId = FrameMetrics::NULL_SCROLL_ID;
|
||||
if (aContent) {
|
||||
if (void* paintRequestTime = aContent->GetProperty(nsGkAtoms::paintRequestTime)) {
|
||||
metrics.SetPaintRequestTime(*static_cast<TimeStamp*>(paintRequestTime));
|
||||
aContent->DeleteProperty(nsGkAtoms::paintRequestTime);
|
||||
}
|
||||
scrollId = nsLayoutUtils::FindOrCreateIDFor(aContent);
|
||||
nsRect dp;
|
||||
if (nsLayoutUtils::GetDisplayPort(aContent, &dp)) {
|
||||
|
|
|
@ -575,11 +575,6 @@ pref("apz.pan_repaint_interval", 16);
|
|||
// Whether to print the APZC tree for debugging
|
||||
pref("apz.printtree", false);
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
pref("apz.record_checkerboarding", true);
|
||||
#else
|
||||
pref("apz.record_checkerboarding", false);
|
||||
#endif
|
||||
pref("apz.smooth_scroll_repaint_interval", 16);
|
||||
pref("apz.test.logging_enabled", false);
|
||||
pref("apz.touch_start_tolerance", "0.1");
|
||||
|
|
Загрузка…
Ссылка в новой задаче