Bug 1177335 - Skip resampling if the time difference of touches is less than 2ms.

This commit is contained in:
Samael Wang 2015-08-19 13:02:21 +08:00
parent 1c4e9df863
commit 904f52b265
3 changed files with 11 additions and 0 deletions

View File

@ -245,6 +245,7 @@ private:
// These times should be in milliseconds
DECL_GFX_PREF(Once, "gfx.touch.resample.delay-threshold", TouchResampleVsyncDelayThreshold, int32_t, 20);
DECL_GFX_PREF(Once, "gfx.touch.resample.max-predict", TouchResampleMaxPredict, int32_t, 8);
DECL_GFX_PREF(Once, "gfx.touch.resample.min-delta", TouchResampleMinDelta, int32_t, 2);
DECL_GFX_PREF(Once, "gfx.touch.resample.old-touch-threshold",TouchResampleOldTouchThreshold, int32_t, 17);
DECL_GFX_PREF(Once, "gfx.touch.resample.vsync-adjust", TouchVsyncSampleAdjust, int32_t, 5);

View File

@ -78,6 +78,7 @@ GeckoTouchDispatcher::GeckoTouchDispatcher()
mEnabledUniformityInfo = gfxPrefs::UniformityInfo();
mVsyncAdjust = TimeDuration::FromMilliseconds(gfxPrefs::TouchVsyncSampleAdjust());
mMaxPredict = TimeDuration::FromMilliseconds(gfxPrefs::TouchResampleMaxPredict());
mMinDelta = TimeDuration::FromMilliseconds(gfxPrefs::TouchResampleMinDelta());
mOldTouchThreshold = TimeDuration::FromMilliseconds(gfxPrefs::TouchResampleOldTouchThreshold());
mDelayedVsyncThreshold = TimeDuration::FromMilliseconds(gfxPrefs::TouchResampleVsyncDelayThreshold());
}
@ -275,6 +276,14 @@ GeckoTouchDispatcher::ResampleTouchMoves(MultiTouchInput& aOutTouch, TimeStamp a
TimeStamp sampleTime = aVsyncTime - mVsyncAdjust;
TimeDuration touchDiff = currentTouch.mTimeStamp - baseTouch.mTimeStamp;
if (touchDiff < mMinDelta) {
aOutTouch = currentTouch;
#ifdef LOG_RESAMPLE_DATA
LOG("The touches are too close, skip resampling\n");
#endif
return;
}
if (currentTouch.mTimeStamp < sampleTime) {
TimeDuration maxResampleTime = std::min(touchDiff / int64_t(2), mMaxPredict);
TimeStamp maxTimestamp = currentTouch.mTimeStamp + maxResampleTime;

View File

@ -79,6 +79,7 @@ private:
// All times below are in nanoseconds
TimeDuration mVsyncAdjust; // Time from vsync we create sample times from
TimeDuration mMaxPredict; // How far into the future we're allowed to extrapolate
TimeDuration mMinDelta; // Minimal time difference between touches for resampling
// Amount of time between vsync and the last event that is required before we
// resample