Changeset 286727 in webkit
- Timestamp:
- Dec 8, 2021, 1:26:12 PM (5 years ago)
- Location:
- branches/safari-612.4.2.1-branch/Source/WebKit
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
WebProcess/WebPage/EventDispatcher.h (modified) (1 diff)
-
WebProcess/WebPage/MomentumEventDispatcher.cpp (modified) (13 diffs)
-
WebProcess/WebPage/MomentumEventDispatcher.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog
r286725 r286727 1 2021-12-03 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r286512. rdar://problem/85928816 4 5 Add more logging for MomentumEventDispatcher 6 https://bugs.webkit.org/show_bug.cgi?id=233811 7 8 Reviewed by Simon Fraser. 9 10 Add a temporary event log to MomentumEventDispatcher, to debug delta/offset/curve issues. 11 12 * WebProcess/WebPage/EventDispatcher.h: 13 (WebKit::EventDispatcher::queue): 14 * WebProcess/WebPage/MomentumEventDispatcher.cpp: 15 (WebKit::MomentumEventDispatcher::handleWheelEvent): 16 Accumulate event deltas. Also accumulate event deltas for the 17 fingers-down phase in the "generated" offset. Store the phase and 18 momentum phase smooshed into a single field. 19 20 (WebKit::MomentumEventDispatcher::dispatchSyntheticMomentumEvent): 21 Accumulate generated deltas. 22 23 (WebKit::MomentumEventDispatcher::didEndMomentumPhase): 24 Attempt to dump the log 1 second after each momentum phase. We'll skip 25 it if another scroll has started since. 26 27 (WebKit::MomentumEventDispatcher::setScrollingAccelerationCurve): 28 (WebKit::MomentumEventDispatcher::startDisplayLink): 29 (WebKit::MomentumEventDispatcher::stopDisplayLink): 30 (WebKit::MomentumEventDispatcher::consumeDeltaForCurrentTime): 31 (WebKit::MomentumEventDispatcher::buildOffsetTableWithInitialDelta): 32 (WebKit::MomentumEventDispatcher::computeNextDelta): 33 Adopt more MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING. Error logging 34 we leave outside of this, because that we'll keep around. 35 36 (WebKit::MomentumEventDispatcher::pushLogEntry): 37 (WebKit::MomentumEventDispatcher::flushLog): 38 Dump the event log in an easy-to-copy-into-a-CSV format. 39 40 * WebProcess/WebPage/MomentumEventDispatcher.h: 41 42 43 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286512 268f45cc-cd09-0410-ab3c-d52691b4dbfc 44 45 2021-12-03 Tim Horton <timothy_horton@apple.com> 46 47 Add more logging for MomentumEventDispatcher 48 https://bugs.webkit.org/show_bug.cgi?id=233811 49 50 Reviewed by Simon Fraser. 51 52 Add a temporary event log to MomentumEventDispatcher, to debug delta/offset/curve issues. 53 54 * WebProcess/WebPage/EventDispatcher.h: 55 (WebKit::EventDispatcher::queue): 56 * WebProcess/WebPage/MomentumEventDispatcher.cpp: 57 (WebKit::MomentumEventDispatcher::handleWheelEvent): 58 Accumulate event deltas. Also accumulate event deltas for the 59 fingers-down phase in the "generated" offset. Store the phase and 60 momentum phase smooshed into a single field. 61 62 (WebKit::MomentumEventDispatcher::dispatchSyntheticMomentumEvent): 63 Accumulate generated deltas. 64 65 (WebKit::MomentumEventDispatcher::didEndMomentumPhase): 66 Attempt to dump the log 1 second after each momentum phase. We'll skip 67 it if another scroll has started since. 68 69 (WebKit::MomentumEventDispatcher::setScrollingAccelerationCurve): 70 (WebKit::MomentumEventDispatcher::startDisplayLink): 71 (WebKit::MomentumEventDispatcher::stopDisplayLink): 72 (WebKit::MomentumEventDispatcher::consumeDeltaForCurrentTime): 73 (WebKit::MomentumEventDispatcher::buildOffsetTableWithInitialDelta): 74 (WebKit::MomentumEventDispatcher::computeNextDelta): 75 Adopt more MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING. Error logging 76 we leave outside of this, because that we'll keep around. 77 78 (WebKit::MomentumEventDispatcher::pushLogEntry): 79 (WebKit::MomentumEventDispatcher::flushLog): 80 Dump the event log in an easy-to-copy-into-a-CSV format. 81 82 * WebProcess/WebPage/MomentumEventDispatcher.h: 83 1 84 2021-12-03 Alan Coon <alancoon@apple.com> 2 85 -
branches/safari-612.4.2.1-branch/Source/WebKit/WebProcess/WebPage/EventDispatcher.h
r286717 r286727 65 65 static Ref<EventDispatcher> create(); 66 66 ~EventDispatcher(); 67 68 WorkQueue& queue() { return m_queue.get(); } 67 69 68 70 #if ENABLE(SCROLLING_THREAD) -
branches/safari-612.4.2.1-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp
r286724 r286727 94 94 didReceiveScrollEvent(event); 95 95 96 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 96 97 if (auto lastActivePhaseDelta = event.rawPlatformDelta()) 97 98 m_lastActivePhaseDelta = *lastActivePhaseDelta; 99 #endif 98 100 } 99 101 … … 106 108 bool isMomentumEventDuringSyntheticGesture = isMomentumEvent && m_currentGesture.active; 107 109 108 #if !RELEASE_LOG_DISABLED110 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 109 111 if (isMomentumEventDuringSyntheticGesture) 110 112 m_currentGesture.accumulatedEventOffset += event.delta(); 113 114 auto combinedPhase = (event.phase() << 8) | (event.momentumPhase()); 115 m_currentLogState.latestEventPhase = combinedPhase; 116 m_currentLogState.totalEventOffset += event.delta().height(); 117 if (!isMomentumEventDuringSyntheticGesture) { 118 // Log events that we don't block to the generated offsets log as well, 119 // even though we didn't technically generate them, just passed them through. 120 m_currentLogState.latestGeneratedPhase = combinedPhase; 121 m_currentLogState.totalGeneratedOffset += event.delta().height(); 122 } 123 pushLogEntry(); 111 124 #endif 112 125 … … 160 173 { }); 161 174 m_dispatcher.internalWheelEvent(m_currentGesture.pageIdentifier, syntheticEvent, m_lastRubberBandableEdges, EventDispatcher::WheelEventOrigin::MomentumEventDispatcher); 175 176 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 177 m_currentLogState.latestGeneratedPhase = phase; 178 m_currentLogState.totalGeneratedOffset += appKitAcceleratedDelta.height(); 179 pushLogEntry(); 180 #endif 162 181 } 163 182 … … 195 214 dispatchSyntheticMomentumEvent(WebWheelEvent::PhaseEnded, { }); 196 215 216 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 197 217 RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher saw momentum end phase with total offset %.1f %.1f, duration %f (event offset would have been %.1f %.1f)", m_currentGesture.currentOffset.width(), m_currentGesture.currentOffset.height(), (MonotonicTime::now() - m_currentGesture.startTime).seconds(), m_currentGesture.accumulatedEventOffset.width(), m_currentGesture.accumulatedEventOffset.height()); 218 m_dispatcher.queue().dispatchAfter(1_s, [this] { 219 flushLog(); 220 }); 221 #endif 198 222 199 223 stopDisplayLink(); … … 206 230 m_accelerationCurves.set(pageIdentifier, curve); 207 231 208 #if USE_MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING232 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 209 233 WTF::TextStream stream(WTF::TextStream::LineMode::SingleLine); 210 234 stream << curve; … … 232 256 // FIXME: Switch down to lower-than-full-speed frame rates for the tail end of the curve. 233 257 WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::StartDisplayLink(m_observerID, displayID, WebCore::FullSpeedFramesPerSecond), 0); 258 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 234 259 RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher starting display link for display %d", displayID); 260 #endif 235 261 } 236 262 … … 244 270 245 271 WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::StopDisplayLink(m_observerID, displayID), 0); 272 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 246 273 RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher stopping display link for display %d", displayID); 274 #endif 247 275 } 248 276 … … 264 292 auto desiredOffset = offsetAtTime(animationTime); 265 293 266 #if ! USE(MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING)294 #if !ENABLE(MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING) 267 295 // Intentional delta rounding (but at the end!). 268 296 WebCore::FloatSize delta = roundedIntSize(desiredOffset - m_currentGesture.currentOffset); … … 327 355 void MomentumEventDispatcher::buildOffsetTableWithInitialDelta(WebCore::FloatSize initialUnacceleratedDelta) 328 356 { 329 #if USE(MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING)357 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING) 330 358 m_currentGesture.carryOffset = { }; 331 359 #endif … … 343 371 } while (std::abs(unacceleratedDelta.width()) > 0.5 || std::abs(unacceleratedDelta.height()) > 0.5); 344 372 373 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 345 374 RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher built table with %ld frames, initial delta %f %f, distance %f %f (initial delta from last changed event %f %f)", m_currentGesture.offsetTable.size(), initialUnacceleratedDelta.width(), initialUnacceleratedDelta.height(), accumulatedOffset.width(), accumulatedOffset.height(), m_lastActivePhaseDelta.width(), m_lastActivePhaseDelta.height()); 375 #endif 346 376 } 347 377 … … 397 427 auto quantizedUnacceleratedDelta = unacceleratedDelta; 398 428 399 #if USE(MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING)429 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING) 400 430 // Round and carry. 401 431 int32_t quantizedX = std::round(quantizedUnacceleratedDelta.width()); … … 442 472 float averageDelta = totalDelta / count; 443 473 444 #if !RELEASE_LOG_DISABLED445 if (!m_currentGesture.didLogInitialQueueState) 474 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 475 if (!m_currentGesture.didLogInitialQueueState) { 446 476 RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher initial historical deltas: average delta %f, average time %fms, event count %d", averageDelta, averageFrameIntervalMS, count); 477 m_currentGesture.didLogInitialQueueState = true; 478 } 447 479 #endif 448 480 … … 465 497 ); 466 498 467 m_currentGesture.didLogInitialQueueState = true;468 469 499 return { unacceleratedDelta, acceleratedDelta }; 470 500 } 471 501 502 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 503 504 void MomentumEventDispatcher::pushLogEntry() 505 { 506 m_currentLogState.time = MonotonicTime::now(); 507 m_log.append(m_currentLogState); 508 } 509 510 void MomentumEventDispatcher::flushLog() 511 { 512 if ((MonotonicTime::now() - m_currentLogState.time) < 500_ms) 513 return; 514 515 if (m_log.isEmpty()) 516 return; 517 518 auto startTime = m_log[0].time; 519 RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher event log: time,generatedOffset,generatedPhase,eventOffset,eventPhase"); 520 for (const auto& entry : m_log) 521 RELEASE_LOG(ScrollAnimations, "MomentumEventDispatcher event log: %f,%f,%d,%f,%d", (entry.time - startTime).seconds(), entry.totalGeneratedOffset, entry.latestGeneratedPhase, entry.totalEventOffset, entry.latestEventPhase); 522 523 m_log.clear(); 524 m_currentLogState = { }; 525 } 526 527 #endif 528 472 529 } // namespace WebKit 473 530 -
branches/safari-612.4.2.1-branch/Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h
r286724 r286727 29 29 30 30 // FIXME: Remove this once we decide which version we want. 31 #define USE_MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING 032 #define USE_MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING 131 #define ENABLE_MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING 0 32 #define ENABLE_MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING 1 33 33 34 34 #include "DisplayLinkObserverID.h" … … 91 91 void didReceiveScrollEvent(const WebWheelEvent&); 92 92 93 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 94 void pushLogEntry(); 95 void flushLog(); 96 97 WebCore::FloatSize m_lastActivePhaseDelta; 98 99 struct LogEntry { 100 MonotonicTime time; 101 102 float totalGeneratedOffset { 0 }; 103 float totalEventOffset { 0 }; 104 105 uint32_t latestGeneratedPhase { 0 }; 106 uint32_t latestEventPhase { 0 }; 107 }; 108 LogEntry m_currentLogState; 109 Vector<LogEntry> m_log; 110 #endif 111 93 112 struct Delta { 94 113 float rawPlatformDelta; … … 104 123 std::optional<WebWheelEvent> m_lastIncomingEvent; 105 124 WebCore::RectEdges<bool> m_lastRubberBandableEdges; 106 #if !RELEASE_LOG_DISABLED107 WebCore::FloatSize m_lastActivePhaseDelta;108 #endif109 125 110 126 struct { … … 120 136 Vector<WebCore::FloatSize> offsetTable; 121 137 122 #if !RELEASE_LOG_DISABLED138 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_TEMPORARY_LOGGING) 123 139 WebCore::FloatSize accumulatedEventOffset; 124 140 bool didLogInitialQueueState { false }; 125 141 #endif 126 142 127 #if USE(MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING)143 #if ENABLE(MOMENTUM_EVENT_DISPATCHER_PREMATURE_ROUNDING) 128 144 WebCore::FloatSize carryOffset; 129 145 #endif
Note:
See TracChangeset
for help on using the changeset viewer.