summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/FrameTimeline
AgeCommit message (Collapse)Author
2025-03-17Prune logic from buffer stuffing recovery using UIDs Melody Hsu
Buffer stuffing recovery was initially implemented using UIDs and sending events to subscribed clients. A different, simpler approach using callbacks when blocked on dequeueBuffer has since been favored (change-id I24e34591e809aebd7626657c6340faed323227ad) and leaves the initial UID event subscription logic obsolete. Leaving this code causes issues since the logic attempts to update an event that is part of union, causing issues in other events that do not hold onto the current object. This is a partial revert of change-id I38f0eb3d6ef1331e07d6022fa3a0e16c556ba06f Bug: b/294922229 Test: presubmit Flag: EXEMPT, code cleanup Change-Id: I53f653550c58376c8d82a491ecf0aebdeeafbc0d
2025-02-06Remove FrameTimeline module and build FrameTimeline.cpp with SF Matt Buckley
FrameTimeline does not need to be a separate module and it makes linking against it difficult for no obvious benefit Bug: 360908317 Test: atest libsurfaceflinger_unittest Flag: EXEMPT refactor Change-Id: I0d20a2bf9e93dedfb03b44eeb0356f7024e36559
2025-01-31Merge "[SF] Use render rate to classify BufferStuffing state" into main Ram Indani
2025-01-29[SF] Use render rate to classify BufferStuffing state ramindani
Test: make BUG: 390776340 Flag: EXEMPT bug fix Change-Id: I6b282d205cccb3861ea77d57a0dc0d911b7504e0
2025-01-24[SF] increase jank threshold to 4 milliseconds ramindani
Test: Manual jank analysis on the trace BUG: 342265411 Flag: com.android.graphics.surfaceflinger.flags.increase_missed_frame_jank_threshold Change-Id: I6c8dfb522d3006d3c810f4b23f359f31b144c5cb
2024-11-13Merge "Recover from buffer stuffing for canned animations" into main Melody Hsu
2024-11-12Recover from buffer stuffing for canned animations Melody Hsu
Buffer stuffing occurs when SurfaceFlinger misses a frame, but the client continues to produce buffers at the same rate, causing a greater risk for jank to occur. Recovery is achieved for canned animations by adjusting the animation timeline on the client side so that SurfaceFlinger is no longer behind. Use SF backdoor command 1045 to inject jank. Usage: adb shell service call SurfaceFlinger 1045 f 1 Bug: b/294922229 Test: atest EventThreadTest Test: presubmit, manually check perfetto traces Flag: android.view.flags.buffer_stuffing_recovery Change-Id: I38f0eb3d6ef1331e07d6022fa3a0e16c556ba06f
2024-11-05SF: Implement FrameStats directly in FrameTimeline Ben Widawsky
Bug: 241394120 Test: builds, atest CtsUiAutomationTestCases:android.app.uiautomation.cts.UiAutomationTest#testWindowContentFrameStats$ Flag: com.android.graphics.surfaceflinger.flags.deprecate_frame_tracker Change-Id: I3f12d504e821a6ba15a26604eb56f317c9d59a18
2024-09-13SF: Do not trace FrameTimeline before start Ady Abraham
Filter FrameTimeline events for frames started before the trace started. Bug: 364194637 Test: manual Flag: com.android.graphics.surfaceflinger.flags.filter_frames_before_trace_starts Change-Id: I9185f384f306eddab1afc2ea9d7901dd70d2f1a2
2024-09-11[FrameTimeline] Don't add a skipped frame if the surface frame's jank type ↵ Sally Qi
is none. Bug: 316171339 Change-Id: I19b986c91de092c8b36f279f4714e1201c95c717 Test: perfetto checks Flag: EXEMPT bugfix
2024-09-03Add the expected and actual frame duration to the SF jank data. Pascal Mütschard
Adds the expected and actual frame duration, that is the frame durations as shown in the frame timeline in Perfetto, to the jank data exposed by SurfaceFlinger. This reverts commit e79389068c08c3eba422e8f3975b222849f0b326. Bug: b/354763298 Test: libsurfaceflinger_unittest manual Flag: com.android.internal.jank.use_sf_frame_duration Change-Id: Ifa060c02a5619a1e99e44f71a15fc4666a338011
2024-09-02Revert "Add the expected and actual frame duration to the SF jan..." Pechetty Sravani (xWF)
Revert submission 28899062-frame_duration Reason for revert: Droid monitor created revert due to this b/362835127. Reverted changes: /q/submissionid:28899062-frame_duration Change-Id: Ie613f2fbb4efcd73d8ccba0f1fd2bac6bd409f3c
2024-08-28Add the expected and actual frame duration to the SF jank data. Pascal Mütschard
Adds the expected and actual frame duration, that is the frame durations as shown in the frame timeline in Perfetto, to the jank data exposed by SurfaceFlinger. Bug: b/354763298 Test: libsurfaceflinger_unittest manual Flag: com.android.internal.jank.use_sf_frame_duration Change-Id: I43035a15592985c91891c033c667314ec6e15430
2024-07-09Merge "Pass a valid fence time if the acquire fence has not signaled" into main Vishnu Nair
2024-07-08Pass a valid fence time if the acquire fence has not signaled Vishnu Nair
When we try to latch a buffer with an unsignaled fence, we were passing Fence::SIGNAL_TIME_PENDING (MAX_INT) as the acquire fence time, marking all the app frametimeline as missed. This is a short term solution to provide a reasonable value instead. Flag: EXEMPT bugfix Fixes: 344175037 Test: cb test + perfetto Change-Id: Ia226589c177457f28540b040086903e518796436
2024-06-28Create a wrapper for atrace macros Vishnu Nair
Create a SF specific macro to call into atrace. This will make the switch to perfetto for capturing atrace tags easier. Flag: EXEMPT refactor Bug: 349905670 Test: perfetto Change-Id: I4d046d837f52ef78b08e3c97556f2eddb06232dd
2024-06-28Jank callback API refactor. Pascal Mütschard
Removes the old work-arounds for missing jank callbacks. Removes the jank data from the transaction completed callback. Adds new function to ISurfaceComposer to register jank listeners. With the new API, jank data is only sent over binder periodically (every ~50 frames) and on a background thread. It is also only tracked for layers where there is a listener registered. Test: manual, libsurfaceflinger_unittest Bug: http://b/336461947 Flag: EXEMPT refactor Change-Id: I3238ce604571832523525cf098832c7352879826
2024-05-21Merge "Fix the logic of adding skipped frame." into main Sally Qi
2024-05-20Fix the logic of adding skipped frame. Sally Qi
Bug: n/a Test: FrameTimelineTest Change-Id: I21d51d76229701f1fe66982488b5eefedeb02c0c
2024-05-20SF: use a pointer for out param in classifyJankLocked Ady Abraham
Due to a potential HWASAN bug (b/341741835) changing the out parameter semantics from reference to pointer. Bug: 340633280 Change-Id: I230d2073af69e3ec9312d8208d245cb5b743ec35 Test: presubmit
2024-05-16SF: explicitly mark surface frame without a composite as non janky Ady Abraham
otherwise these surface frames waits in the current display frame for the next composite and they are marked as janky, even though they had no affect on the displayed frame. Bug: 340633280 Test: android.platform.test.scenario.sysui.people.PeopleSpaceActivityMicrobenchmark#startPeopleSpaceActivity Change-Id: I2774e88627e39bce18c04af4b20e2f6973121a42
2024-02-21Add default_teams John Reck
Test: n/a Change-Id: I6c2426303194df4b94f6181f4b5c71970bc5f7fd
2023-12-13[FrameTimeline] Refactor the logic of addSkippedFrame Sally Qi
Bug: 273701290 Test: https://screenshot.googleplex.com/3uyqAWi6bXgNbw2 Change-Id: I7dea4f9378e804d60af3ff849793fdc09b97166d
2023-11-30Add jank severity type for actual frame timeline. Ying Wei
Bug: 311760225 Test: capture Perfetto trace locally Change-Id: I591f3730f74dd05f64538caacfe56b8c60404bb6
2023-11-17Add trunk flag for adding SF skipped frames into traces. Sally Qi
Bug: 273701290 Test: FrameTimelineTest#traceDisplayFrameSkipped, play with perfetto Change-Id: Ib5f884a14dc6526e2a2b5a1371be7715a20cd0a9
2023-11-05Trace SF skipped frame. Sally Qi
Bug: 273701290 Test: FrameTimelineTest#traceDisplayFrameSkipped; https://screenshot.googleplex.com/4As43np7DoF6Dxm Change-Id: I0604ab3d15ef94351f9a592920c56ab00ef51b23
2023-10-17Include the frame's expected duration in the jank data. Pascal Muetschard
Bug: b/261839034 Test: atest libsurfaceflinger_unittest Change-Id: I65c85be8825e36671612a47000261c04f0289551
2023-03-15Merge "SF: handle presentTime in the past" into udc-dev am: 612b7822dc am: ↵ Ady Abraham
d3971f9392 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/21995114 Change-Id: I32ee6179770de07e823fd577e70f48c9453ded4f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-14SF: handle presentTime in the past Ady Abraham
presentTime in the past would result in Perfetto showing unterminated slices. Fixing this issue by checking for this case specifically, marking it janky, and fixing the presentTime to be the endTime instead. Test: SF unit tests Bug: 271105399 Change-Id: I7e5d641dfe58717322b7a82b0609fc728e9a69fc
2023-03-10Make frames dropped be a jank type in Frametimeline Edgar Arriaga
This allows the dropped frames to be accounted within frame timeline missed frames metrics, without this, the metric tells there are no missed frames when there are dropped frames. Bug: 271031574 Test: Verified in traces Change-Id: I838e0c10d4a92a4d5f753f020b57ea4e59fd0f8d
2023-01-26SF: don't trace SF timelines when there is no layer update Ady Abraham
Fixes: 239101875 Test: manual Change-Id: I024f6facff5d74a500fb5d917bd97ab5d1c3eba3
2023-01-19Merge "surfaceflinger: fix missing pure virtual declarations." am: ↵ Ady Abraham
f4e70632b9 am: d7a7f9952e am: ffab144ef7 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2392152 Change-Id: I0395269db75c586c5bec4e5b6610654841d478c3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-17surfaceflinger: fix missing pure virtual declarations. Josh Gao
android::frametimeline::FrameTimeline forgot to declare a pair of methods as pure virtual, which results in the following link failure when building at -O0 because the compiler expects to be able to only emit the class's vtable in the translation unit that defines the first non-pure method, which doesn't exist: ld.lld: error: undefined symbol: vtable for android::frametimeline::FrameTimeline >>> referenced by FrameTimeline.h:279 (frameworks/native/services/surfaceflinger/FrameTimeline/FrameTimeline.h:279) >>> lto.tmp:(android::frametimeline::FrameTimeline::FrameTimeline()) >>> referenced by FrameTimeline.h:279 (frameworks/native/services/surfaceflinger/FrameTimeline/FrameTimeline.h:279) >>> lto.tmp:(android::frametimeline::FrameTimeline::FrameTimeline()) Test: `mmma frameworks/native/surfaceflinger` after adding -O0 to surfaceflinger_defaults Change-Id: I2c93986ac5add2c603f385154c07c6238d03c663
2022-12-14Improve handling of hwcomposer with unsupported present fences Theodore Dubois
An implementation such as HWC2OnFbAdapter always returns -1 for the present fence. FrameTimeline should not ignore invalid fences in mPendingPresentFences, since in this case every fence is invalid, resulting in resource leaks. Similarly, PresentLatencyTracker should not be used if HWC doesn't support present fences. Test: no logspam running on starnix (fuchsia), which uses framebuffer Test: booted emulator, no behavior change Test: booted panther, no behavior change Change-Id: I4a11edc443a1cd3a395fc8f97b93a5474d11fe31
2022-10-10SF: make FrameTimeline more robust for fence errors Ady Abraham
- Emit a valid timestamp to Perfetto when fence signal time is invalid - Mark pending fences as invalid if a newer fence has signaled Test: SF unit tests Bug: 243939707 Change-Id: Ieac7eb53fe3e36178d860cc0683bfd8fad7560cd
2022-08-03Change jank for CPU/GPU deadline miss. Rachel Lee
There are cases where there is composition in both cpu and gpu, so it is better to track jank for when deadline miss occurred in HWC or GPU composition instead. Bug: 204463368 Test: atest FrameTimelineTest Test: Perfetto trace Change-Id: Ibfd87d5688e2ef6ff88a3b9f9276954de18beed2
2022-07-01Returns min of minTime or presentTime instead of minTime or endTime. ramindani
Test: atest libsurfaceflinger_unittest BUG: 237113799 Change-Id: I83f270faf2f3872095723854d9bce7b50581cdee
2022-03-18SF: fix frame timeline timestamp Ady Abraham
Fix a bug with setting the timestamp on a packet due to operator precedence where unary plus takes precedence on the ternary operation Fixes: 185346474 Test: Collect perfetto traces and observe timeline slices Change-Id: If1a8f13e7a77dabf0c510181e5aa27aaf7cf0f56
2022-03-10SF: use CLOCK_BOOTTIME for frame timeline Ady Abraham
Using CLOCK_BOOTTIME avoids the need to resync CLOCK_MONOTONIC in perfetto after suspend. Bug: 185346474 Test: Collect perfetto traces and observe timeline slices Change-Id: Ifda1fb43c6ac205ec60cb331c139e950a24a60cb
2022-02-15SF: treat prediction expired as app missed deadline Ady Abraham
We are keeping enough vsyncIds for a reasonable app to send back their vsyncId. If we can't find the vsync id of that app, we can be pretty confident that the app had a huge schedule delay. Bug: 211763914 Test: SF unit tests Change-Id: I046a87e566844bb140df75df3d06f809b7d99155
2021-12-09Add frame timeline method to ASurfaceControl NDK. Rachel Lee
Bug: 198192003 Test: atest ASurfaceControlTest perfetto trace Change-Id: I04310bd9190cfc227ff5ba892c7187d3b8a20463
2021-11-19SF: Remove manual enum stringification Dominik Laskowski
Upgrade to scoped enums where applicable. Pull GameMode from TimeStats into libgui to plumb it as an enum rather than int32_t. Bug: 185536303 Test: libsurfaceflinger_unittest Change-Id: I81fdd24805757ef953484055ee867684eb94fecf
2021-11-18SF: Set up libscheduler headers Dominik Laskowski
Start pulling Scheduler sources into a libscheduler target akin to librenderengine and libcompositionengine. Bug: 185535769 Test: Build Change-Id: I8ee871cce96209c8c53601152501129b09c5e46f
2021-06-25Make deadlineThreshold 0 Adithya Srinivasan
We give 2ms threshold for the deadline and this seems to cause some misclassifications where an app's fault was classified as SF scheduling. We designed the threshold with the idea of tweaking, so try 0 threshold and see if it works better. Bug: 191238086 Test: libsurfaceflinger_unittest Change-Id: I0ac3d9ce3f9ec90f6b3188009d9d09a69afd37b2
2021-06-10Send isBuffer to perfetto trace Adithya Srinivasan
For SurfaceFrames, showing isBuffer in a trace can be helpful in debugging issues within Shared Timeline. Bug: 182214639 Test: libsurfaceflinger_unittest Change-Id: I7509efe8775b27e5e2943a99ad252483ce615e89
2021-06-07SF - plumbing game mode for metrics (part 2) Adithya Srinivasan
Update TimeStats to take in the game mode from layer for all the frames. Bug: 186025682 Test: statsd_testdrive 10063 Test: atest libsurfaceflinger_unittest Change-Id: If95a8c91940228a8925ae9e4e21656d1b492a2ba
2021-05-27Add SurfaceFlingerStuffing case to toString() Adithya Srinivasan
After the recent addition of this jank type, toString() was missed in teh change resulting in a crash. Bug: 189356168 Test: android.view.cts.AttachedSurfaceControlSyncTest#testSync Change-Id: I82496a8bf95cdd1304c0c17a1c9c5d38416a4a88
2021-05-03Limit Predictions size based on count instead of time Adithya Srinivasan
We have an arbitrary time of 120ms for the predictions before they expire. Our assumption was that 120ms is plenty enough for apps & sf that if they finish beyond this, it's basically a jank. However, with some traces, we have noticed SF not running in the main thread at all during setPowerMode() for more than 120ms. This is causing a data loss in jank classification. This change addresses this by limiting the number of predictions stored in TokenManager. Bug: 187091879 Bug: 186874532 Test: libsurfaceflinger_unittest Change-Id: I555bfd974585b7e0632eade776d201f1189c81e0
2021-04-27SF Buffer Stuffing Adithya Srinivasan
When SF presents a frame because it started late (because the previous frame ran too long), this case is similar to App Buffer Stuffing. The frame rate will be smooth but all frames have an increased latency. Currently, we mark this as SFScheduling jank. This change classifies these frames as a separate jank called SFStuffing. This is useful in weeding out issues related to frame rate vs latency. Bug: 181593046 Test: libsurfaceflinger_unittest Change-Id: I59a2931c5e636e9a38fd07e0a328d37873969c44
2021-04-22Fix ts for prediction expired dropped frames Adithya Srinivasan
We have a gap in our logic where dropped frames that have their predictions expired will send out incorrect timestamps. This has caused some instrumentation failures at the perfetto side. Bug: 185978397 Test: libsurfaceflinger_unittest Change-Id: I301816893f425301a5ee1065685b9f7007d8cf1d