Bug 1208636 - Adjust displayport size based on available system memory. r=kats

This commit is contained in:
Mason Chang 2015-11-18 15:48:19 -08:00
parent 235ff928fc
commit a7c7d26779
4 changed files with 34 additions and 3 deletions

View File

@ -6,11 +6,13 @@
#include "APZCTreeManager.h"
#include "AsyncPanZoomController.h"
#include "Compositor.h" // for Compositor
#include "gfxPrefs.h" // for gfxPrefs
#include "HitTestingTreeNode.h" // for HitTestingTreeNode
#include "InputBlockState.h" // for InputBlockState
#include "InputData.h" // for InputData, etc
#include "Layers.h" // for Layer, etc
#include "mozilla/dom/Touch.h" // for Touch
#include "mozilla/gfx/Logging.h" // for gfx::TreeLog
#include "mozilla/gfx/Point.h" // for Point
#include "mozilla/layers/APZThreadUtils.h" // for AssertOnCompositorThread, etc
#include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform
@ -25,15 +27,13 @@
#include "nsDebug.h" // for NS_WARNING
#include "nsPoint.h" // for nsIntPoint
#include "nsThreadUtils.h" // for NS_IsMainThread
#include "mozilla/gfx/Logging.h" // for gfx::TreeLog
#include "UnitTransforms.h" // for ViewAs
#include "gfxPrefs.h" // for gfxPrefs
#include "OverscrollHandoffState.h" // for OverscrollHandoffState
#include "TaskThrottler.h" // for TaskThrottler
#include "TreeTraversal.h" // for generic tree traveral algorithms
#include "LayersLogging.h" // for Stringify
#include "Units.h" // for ParentlayerPixel
#include "GestureEventListener.h" // for GestureEventListener::setLongTapEnabled
#include "UnitTransforms.h" // for ViewAs
#define ENABLE_APZCTM_LOGGING 0
// #define ENABLE_APZCTM_LOGGING 1

View File

@ -64,6 +64,7 @@
#include "nsStyleStruct.h" // for nsTimingFunction
#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc
#include "nsThreadUtils.h" // for NS_IsMainThread
#include "prsystem.h" // for PR_GetPhysicalMemorySize
#include "SharedMemoryBasic.h" // for SharedMemoryBasic
#include "WheelScrollAnimation.h"
@ -330,6 +331,11 @@ using mozilla::gfx::PointTyped;
* The multiplier we apply to the displayport size if it is not skating (see
* documentation for the skate size multipliers above).
*
* \li\b apz.x_skate_highmem_adjust
* \li\b apz.y_skate_highmem_adjust
* On high memory systems, we adjust the displayport during skating
* to be larger so we can reduce checkerboarding.
*
* \li\b apz.zoom_animation_duration_ms
* This controls how long the zoom-to-rect animation takes.\n
* Units: ms
@ -345,6 +351,16 @@ StaticAutoPtr<ComputedTimingFunction> gZoomAnimationFunction;
*/
StaticAutoPtr<ComputedTimingFunction> gVelocityCurveFunction;
/**
* Returns true if this is a high memory system and we can use
* extra memory for a larger displayport to reduce checkerboarding.
*/
static bool gIsHighMemSystem = false;
static bool IsHighMemSystem()
{
return gIsHighMemSystem;
}
/**
* Maximum zoom amount, always used, even if a page asks for higher.
*/
@ -810,6 +826,10 @@ AsyncPanZoomController::InitializeGlobalState()
gfxPrefs::APZCurveFunctionX2(),
gfxPrefs::APZCurveFunctionY2()));
ClearOnShutdown(&gVelocityCurveFunction);
uint64_t sysmem = PR_GetPhysicalMemorySize();
uint64_t threshold = 1LL << 32; // 4 GB in bytes
gIsHighMemSystem = sysmem >= threshold;
}
AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
@ -2588,6 +2608,11 @@ CalculateDisplayPortSize(const CSSSize& aCompositionSize,
? gfxPrefs::APZYStationarySizeMultiplier()
: gfxPrefs::APZYSkateSizeMultiplier();
if (IsHighMemSystem()) {
xMultiplier += gfxPrefs::APZXSkateHighMemAdjust();
yMultiplier += gfxPrefs::APZYSkateHighMemAdjust();
}
// Ensure that it is at least as large as the visible area inflated by the
// danger zone. If this is not the case then the "AboutToCheckerboard"
// function in TiledContentClient.cpp will return true even in the stable

View File

@ -185,8 +185,10 @@ private:
DECL_GFX_PREF(Live, "apz.velocity_bias", APZVelocityBias, float, 1.0f);
DECL_GFX_PREF(Live, "apz.velocity_relevance_time_ms", APZVelocityRelevanceTime, uint32_t, 150);
DECL_GFX_PREF(Live, "apz.x_skate_size_multiplier", APZXSkateSizeMultiplier, float, 1.5f);
DECL_GFX_PREF(Live, "apz.x_skate_highmem_adjust", APZXSkateHighMemAdjust, float, 0.0f);
DECL_GFX_PREF(Live, "apz.x_stationary_size_multiplier", APZXStationarySizeMultiplier, float, 3.0f);
DECL_GFX_PREF(Live, "apz.y_skate_size_multiplier", APZYSkateSizeMultiplier, float, 2.5f);
DECL_GFX_PREF(Live, "apz.y_skate_highmem_adjust", APZYSkateHighMemAdjust, float, 0.0f);
DECL_GFX_PREF(Live, "apz.y_stationary_size_multiplier", APZYStationarySizeMultiplier, float, 3.5f);
DECL_GFX_PREF(Live, "apz.zoom_animation_duration_ms", APZZoomAnimationDuration, int32_t, 250);

View File

@ -601,6 +601,8 @@ pref("apz.smooth_scroll_repaint_interval", 16);
pref("apz.pan_repaint_interval", 16);
pref("apz.x_skate_size_multiplier", "2.5");
pref("apz.y_skate_size_multiplier", "3.5");
pref("apz.x_skate_highmem_adjust", "1.0");
pref("apz.y_skate_highmem_adjust", "2.5");
#else
// Mobile prefs
pref("apz.fling_repaint_interval", 75);
@ -610,6 +612,8 @@ pref("apz.x_skate_size_multiplier", "1.25");
pref("apz.y_skate_size_multiplier", "1.5");
pref("apz.x_stationary_size_multiplier", "1.5");
pref("apz.y_stationary_size_multiplier", "1.8");
pref("apz.x_skate_highmem_adjust", "0.0");
pref("apz.y_skate_highmem_adjust", "0.0");
#endif
// APZ testing (bug 961289)