summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Scheduler
AgeCommit message (Collapse)Author
2025-03-20[SF] Backdoor to update the WorkDuration ramindani
Test: atest libsurfaceflinger_unittest Test: Verified with a trace that work duration updates after backdoor call. BUG: 398872242 Flag: EXEMPT Backdoor implementation. Change-Id: Icea9bebbb3366df09643dbe40fd7c986461262b8
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-03-13Merge changes from topic "make-displayid-opaque" into main Gil Dekel
* changes: SF: Remove PhysicalDisplayId::getPort() SF: Remove *DisplayId::tryCast and DisplayId::isVirtual() SF: Remove *DisplayId::tryCast usage from ScreenCaptureOutput SF: Remove *DisplayId::tryCast usage from VirtualDisplaySurface SF: Remove *DisplayId::tryCast usage from Output
2025-03-13SF: Remove *DisplayId::tryCast and DisplayId::isVirtual() Gil Dekel
Work towards DisplayId opaqueness by eliminating call-sites to APIs that parse the display ID values directly. This CL removes *DisplayId::tryCast from the DislayId interface entirely and replaces it with SF APIs that check for the existence of the displays before casting. This removes direct dependency on ID value bits. It also removes DisplayId::isVirtual(). Flag: com.android.graphics.surfaceflinger.flags.stable_edid_ids Bug: 390690584 Bug: 390689313 Test: libsurfaceflinger_unittest Change-Id: I918a6b361784e41165837234b82eed027dc46673
2025-03-13SF: Remove multithreaded_present flag Dominik Laskowski
Change (and rename) CompositionEnginePresentTest.worksAsExpected to avoid an assumption that would now break the test. Bug: 380251940 Flag: EXEMPT removing multithreaded_present Test: presubmit Change-Id: Ifbcbfc7d82e64d909a6e4d310f34bcb6578d1e1f
2025-03-05Merge changes I6f68b884,I870d8f13 into main Treehugger Robot
* changes: SF: Clean up helpers for thread priority SF: Remove connected_display flag
2025-03-04Merge "[SF] VSync predictor recovery only for the ARR" into main Ram Indani
2025-03-04Move RingBuffer from SF utils into libui Alec Mouri
Stuff in libui or libgui or elsewhere upstack might want to use this. Also remove PowerAdvisor's RingBuffer implementation, since it's basically the same thing. Change-Id: I9d8d94fa0d7b8327b320ceed0d507b83979d033d Bug: 360932099 Flag: EXEMPT refactor Test: builds
2025-02-27[SF] VSync predictor recovery only for the ARR ramindani
Test: atest VSyncPredictorTest BUG: 399209142 BUG: 385059265 Flag: com.android.graphics.surfaceflinger.flags.vsync_predictor_recovery Change-Id: I6090cf90cecdac3ed42c9eeb872e0dbcb0cb68c9
2025-02-27SF: Remove connected_display flag Dominik Laskowski
Bug: 380251940 Flag: EXEMPT removing connected_display Test: presubmit Change-Id: I870d8f13fe8012f07a47dace756c5d4b2261ebd3
2025-02-21Merge "[SF] VSyncPredictor to use idlePeriod for outlier calculation" into main Ram Indani
2025-02-21[SF] VSyncPredictor to use idlePeriod for outlier calculation ramindani
With idealPeriod usage for the slope calculation the model recovers faster from the drifted vsyncs Test: atest VSyncPredictorTest BUG: 385059265 Flag: com.android.graphics.surfaceflinger.flags.vsync_predictor_recovery Change-Id: Idb0cf105c5c52a19773fc10f4898de4741e98816
2025-02-14Add missing `=0` on interface John Reck
Change-Id: Ife0cf573862ba527246a9dbcdda8e03460cf074e Test: builds Flag: EXEMPT build fix
2025-02-12Merge "SF: Let DM resize framebuffer on resolution change" into main Dominik Laskowski
2025-02-10SF: Let DM resize framebuffer on resolution change Dominik Laskowski
The goal of this change is to synchronize resolution switching across SF and DM. The lack of synchronization causes glitches, which are currently papered over in HWC by dropping frames whose size don't match the active resolution. A mode set involving a resolution switch was finalized by destroying the DisplayDevice and thus its HWC layers. Remove this special case in favor of letting DM call SurfaceControl.setDisplaySize right after requesting the mode set via setDesiredDisplayModeSpecs. Emit a mode change event to DM as soon as the DisplayModeRequest becomes the desired mode. In response, DM sends the transaction that resizes the display via setDisplaySize, so wait until that commit before modesetting to the new resolution, and resize the framebuffer in that same frame. Display projection depends on display size, so update the latter first when committing DisplayDeviceState. Fixes: 355427258 Flag: com.android.graphics.surfaceflinger.flags.synced_resolution_switch Test: Internal (caiman) and external displays, with different rotations. Test: Inner display (comet) with install orientation. Change-Id: Ifaf300f3b5f907f7cd10b8db2aa6165ad2106530
2025-02-09Merge "Remove FrameTimeline module and build FrameTimeline.cpp with SF" into ↵ Matt Buckley
main
2025-02-06SF: Fix dispatch of DISPLAY_EVENT_MODE_REJECTION Manasi Navare
The onModeRejected() callback was not getting dispatched correctly from SF to DM because of the missing case for this display event in EventThread.cpp, so add that. While at it, make the Display Event Types enum an enum class so that the compiler will complain for any missing cases. Do the necessary refactor in other files for this. Bug: 393133868 Test: m surfaceflinger, End to End testing forcing Display config failure in DRM HWC and checking that the correct failure and is propagated from DRM HWC to SF and received in DM Flag: com.android.graphics.surfaceflinger.flags.display_config_error_hal Change-Id: I63914a3555466bc6c382ab1bf9ed57eb5eef7cd0 Signed-off-by: Manasi Navare <navaremanasi@google.com>
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-17Add debug sysprops to disable sched fifo in surfaceflinger Vishnu Nair
debug.sf.disable_sched_fifo_sf: false debug.sf.disable_sched_fifo_sf_binder: false debug.sf.disable_sched_fifo_sf_sched: false debug.sf.disable_sched_fifo_re: false debug.sf.disable_sched_fifo_composer: false debug.sf.disable_sched_fifo_composer_callback: false Fixes: 390673988 Test: setprop disable_sched_fifo_sf and check sched policy in perfetto Flag: EXEMPT adding sysprop flags Change-Id: I1973a96591bacd8d7fc6e103f24f4b8e9c7ab926
2024-12-16[Native] FRAME_RATE_COMPATIBILITY_GTE renamed to ↵ ramindani
FRAME_RATE_COMPATIBILITY_AT_LEAST Test: atest LayerHistoryIntegrationTest Test: atest SetFrameRateTest Test: atest SurfaceControlTest Test: atest ViewRootImplTest BUG: 383309509 Flag: com.android.graphics.surfaceflinger.flags.arr_setframerate_gte_enum Change-Id: I52ef062cfc05be9bf7bdfdcaf6b6ef7cb2e236b7
2024-12-13Merge "Revert "Resync on the transaction."" into main Treehugger Robot
2024-12-13Revert "Resync on the transaction." Ram Indani
This reverts commit 5b6bca454fbf60c15b62027b785ccb89b2e14e0e. Reason for revert: b/383209628 Change-Id: I30f766bc8b63c4ee4d421060bb7646a665957b9a
2024-12-09Merge "Resync on the transaction." into main Midas Chien
2024-12-04Merge "Add GTE compatibility logic for NoVote" into main Treehugger Robot
2024-12-03Add GTE compatibility logic for NoVote Rachel Lee
setFrameRate with GTE compatibility and 0 `frameRate` will be counted as NoVote. Test: atest libsurfaceflinger_unittest Test: atest LayerHistoryIntegrationTest Bug: 380949716 Flag: com.android.graphics.surfaceflinger.flags.arr_setframerate_gte_enum Change-Id: I5ffcd4a09b1661c516c11d2f04b80303af215c3a
2024-12-03Merge "Remove the extra parameters in onCommitNotComposited" into main am: ↵ Treehugger Robot
13acbe3eae am: 56cea28743 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3359406 Change-Id: I47b353ea7a53038fc6b467a01ba5df0d6e451347 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-12-03Merge "Remove the extra parameters in onCommitNotComposited" into main am: ↵ Treehugger Robot
13acbe3eae Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3359406 Change-Id: I2a6d9970b213f88664eb9b6ae4735b0bfb62e6d1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-12-03Resync on the transaction. Rachel Lee
Currently only Choreographer requestNextVsync will resync otherwise. Scheduler::resync already checks to make sure resync won't happen too frequently (750 ms currently). Bug: 266128330 Test: see b/380398647 and its child bugs Flag: EXEMPT bugfix Change-Id: Id3c0fc6a62b45262f4338f8154ad2fa8c0c16a05 (cherry picked from commit a5be328a8f3cb420ecdae34e9b25060631616a8f)
2024-12-03Merge "Add GTE compatibility enum to ANativeWindow." into main Rachel Lee
2024-12-02Merge "SF: Propagate Display Mode Rejection from SF to DM" into main Manasi Navare
2024-11-30Add GTE compatibility enum to ANativeWindow. Rachel Lee
This moves and renames the enum into ANativeWindow where it is accessible in the public NDK. Test: atest SetFrameRateTest Test: atest libsurfaceflinger_unittest Test: atest LayerHistoryIntegrationTest Bug: 380949716 Flag: EXEMPT ndk Change-Id: I5216c3ceb223f7b9a0571be14544e83d7f8859ea
2024-11-27[SF] Use the full frame rates range for supportedRefreshRates api ramindani
Test: atest android.display.cts.DisplayTest && atest RefreshRateSelectorTest BUG: 380624084 Flag: EXEMPT bugfix Change-Id: If5d3a23466666c4e6912bcec33cc8af4fcf2ecce
2024-11-27SF: Propagate Display Mode Rejection from SF to DM Manasi Navare
Create a new DisplayEventReceiver callback for onModeRejected to signal mode rejection from SF to DM so that DM can trigger a retry. Add the plumbing through DisplayEventReceiver and EventThread Bug: 374184110 Test: manual Flag: com.android.graphics.surfaceflinger.flags.display_config_error_hal Change-Id: I78515d413bdf2e6e07d6649b7b60df8ced199b19 Signed-off-by: Manasi Navare <navaremanasi@google.com>
2024-11-23Merge "Fix NoVote/NoPreference on LayerHistory" into main Treehugger Robot
2024-11-22Fix NoVote/NoPreference on LayerHistory Rachel Lee
Previous CL ag/30285441 was supposed to allow game default override if the layervote is simply "NoPreference" category. However there was a bug with the CL. This CL fixes this and also removes the early skip of NoVote, in order for explicit NoVote layers to not affect frame rate scoring even if surface has drawing. Bug: 378455432 Test: atest libsurfaceflinger_unittest Test: manual test game with overlay Test: manual test video with overlay Test: manual test on both MRR and ARR Flag: EXEMPT bugfix Change-Id: Iba36cc89597f544bdc3311424f6e5d04439d7dc7
2024-11-21Merge "Adds getSupportedRefreshRates support" into main Ram Indani
2024-11-20Disable -Wunused-value for surfaceflinger Aditya Kumar
``` out/soong/.intermediates/frameworks/native/services/surfaceflinger/Tracing/tools/layertracegenerator/android_x86_64_silvermont/obj/frameworks/native/services/surfaceflinger/Scheduler/Scheduler.o frameworks/native/services/surfaceflinger/Scheduler/Scheduler.cpp frameworks/native/services/surfaceflinger/Scheduler/Scheduler.cpp:432:29: error: ignoring temporary created by a constructor declared with 'nodiscard' attribute [-Werror,-Wunused-value] 432 | (std::scoped_lock(mDisplayLock), displayId == mPacesetterDisplayId)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Flag: EXEMPT b/369277774 Bug: b/369277774 Merged-In: Idd45525cc3fe15c3b5e66332650ce8b7811ae026 Change-Id: Idd45525cc3fe15c3b5e66332650ce8b7811ae026 (cherry picked from commit 91b33f18ea5416bfde82cda7fc1b210d9338a835)
2024-11-20Adds getSupportedRefreshRates support ramindani
Source values for refresh rates from the RefreshRateSelector through SurfaceComposerClient. Test: atest android.display.cts.DisplayTest BUG: 365163968 Flag: com.android.server.display.feature.flags.enable_get_supported_refresh_rates Change-Id: I149e6e51b3b3718ef53e522f1fca5650dbbd8b7b
2024-11-20Remove the extra parameters in onCommitNotComposited Shuangxi Xiang
The PhysicalDisplayId parameter of the onCommitNotComposited function is passed by value. PhysicalDisplayId is a structure, but the parameter value is never used inside the onCommitNotComposited function, which will cause a certain amount of memory waste. You can remove this parameter first, or change it to reference passing. (But reference passing here should not be necessary). Signed-off-by: Shuangxi Xiang <xiangshuangxi@xiaomi.corp-partner.google.com> Change-Id: I996351c8224c286f204975955e5fbbbb52d44e61
2024-11-19SF: add trace points to debug 4ms jank Ady Abraham
Bug: 346503493 Test: manual Flag: EXEMPT logging Change-Id: Ia2afef930b19a0833a43fe1c6cd23edaf58466c3
2024-11-14SF: add a backdoor to introduce a janky frame to HWC Ady Abraham
Bug: 346503493 Test: adb shell service call SurfaceFlinger 1046 i32 3Test: adb root && adb shell service call SurfaceFlinger 1046 i32 3 Flag: EXEMPT bugfix Change-Id: Ic4a837ef06aca40a24db9c1121e19e3e1a1e0d80
2024-11-14Merge "Revert "Skip primaryRangeIsSingleRate check for ARR"" into main Treehugger Robot
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-07Revert "Skip primaryRangeIsSingleRate check for ARR" Rachel Lee
This reverts commit 861e3478823930d9b2496be19eb7afff550e3c41. Reason for revert: The policy is being ignored. Also see doc http://docs/document/d/1Bu4AMHFZ3UMVHM_-jyp2ogu-oEaeBy0EgKcoMbkCM1w?tab=t.0 Test: atest libsurfaceflinger_unittest Change-Id: I7a80540ff4cc398d0764d3af53bfea77731b01a8
2024-11-07Merge "NoPreference does not supercede Game default override" into main Treehugger Robot
2024-11-07SF: do not clear contentRequirement when render rate changes Ady Abraham
There is no need to clear the contentRequirement when only the render rate changes. Bug: 377240935 Flag: EXEMPT bugfix Test: Running TouchLatency and expanding notification shade Change-Id: I0ce9222958358a4eb87b244ed70430b3105e0396
2024-11-06NoPreference does not supercede Game default override Rachel Lee
FrameRateCategory::NoPreference is similar to "no vote". If there is a game default frame rate override, it should not supercede this. For example, a game with 60 default frame rate override should get this override even when Toolkit sends NoPreference on it. Bug: 377169395 Flag: EXEMPT bugfix Test: atest libsurfaceflinger_unittest Test: manual test with game, it uses game default frame rate Change-Id: Id773c03fdd32c3a55b19a6acac788aabf133ebfc
2024-11-06Merge "Toolkit touch boost to per-uid in sf scheduler" into main Treehugger Robot
2024-11-05Toolkit touch boost to per-uid in sf scheduler Rachel Lee
Fix where the toolkit touchboost ("HighHint" category) is ignored by ExplicitDefault frameRate# vote **only** if it has the same UID (app). - App that setFrameRate(#, default compatibility) still disables touch boost - Fixes cases such as game with setFrameRate(#, default) but HighHint touch on other app e.g. notification shade. The HighHint touch on notification shade should boost, while the game has frame rate override. Bug: 372531483 Flag: EXEMPT bugfix Test: Manual with game 30 Default and notification shade Test: atest libsurfaceflinger_unittest Change-Id: I4c85abe1aad053c3692ffad3e571d8a74ee02227