summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/tests/unittests/SetFrameRateTest.cpp
AgeCommit message (Collapse)Author
2021-08-06Merge "SF: fix frame rate for layer tree" into sc-dev am: 3871daf53aAdy Abraham
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15463251 Change-Id: I1e0ba658e2230d666dd8eaa7497a4986fece264b
2021-08-05SF: fix frame rate for layer treeAdy Abraham
With the current implementation we might mark layers as NoVote incorrectly when a sibling has a frame rate. Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest Bug: 195205467 Change-Id: I62641f855a027e1192f9a85a4bc50692b1744764
2021-07-01SF: move RefreshRateConfigs to DisplayDeviceAdy Abraham
Move RefreshRateConfigs to DisplayDevice to be able to maintain a per-display refresh rate switching policy. Test: SF unit tests Test: refresh rate switching is working on device with more than one display Bug: 187539899 Change-Id: Ica6a955e8ad0e563a0740f6579b61fc592eb982c
2021-06-18Start removing Current stateRobert Carr
Now that we only write to current state from the main thread we can actually just write directly in to drawing state and avoid copying current to drawing state on each frame. simpleperf on bouncing ball indicates this was saving around 8% CPU or so per frame. As a next target we will eliminate the remaining work in doTransaction and eliminate the doTransaction pass. Test: Existing tests pass. simpleperf Bug: 186200583 Change-Id: I59b75747d7371b3ffe870129c8be100c7daa6c4e
2021-06-04SF: Extract virtual display allocation from CEDominik Laskowski
Allocate HAL virtual display and generate HAL/GPU virtual display ID in SF rather than CE. This centralizes the HAL vs. GPU decision as a first step in isolating display configuration (e.g. hotplug, modeset) to be a distinct stage from invalidate/refresh. Rework SF backend hooks for screen capture. Plumb the PhysicalDisplayId to be mirrored by the virtual display to Composer::createVirtualDisplay. This enables the ARC backend to know which display to mirror (instead of making assumptions about the layer stack) or error out if not mirroring (previously done through maybeAllocateDisplayIdForVirtualDisplay), such that SF falls back to creating a GPU virtual display. Bug: 182939859 Bug: 129481165 Test: Enable overlay display and toggle HAL/GPU Test: libsurfaceflinger_unittest Test: libcompositionengine_test Change-Id: I209b245966e544d5ff55d5d118140cfcfa85db15 Merged-In: I209b245966e544d5ff55d5d118140cfcfa85db15
2021-04-12SurfaceFlinger: Remove deferTransactionUntilRobert Carr
There are no users left Bug: 168505645 Change-Id: I81725bf3c0ef4704e9da25da9a75854b4f172885
2021-04-08SurfaceFlinger: Remove reparentChildrenRobert Carr
No callers left outside of tests. Bug: 161937501 Test: Existing tests pass Change-Id: Id5c2b68d1be05fce9f698813d83044b02bb2764d
2021-04-06SF: remove wp<Layer> from LayerHistoryAdy Abraham
wp::promote has a significant performace impact. Instead we maintain a copy of the relevant layer information in LayerInfo. This shows reduction in simpleperf for the main thread 3.07% -> 0.81% Test: simpleperf for PIP + Notification shade expansion Test: atest SetFrameRateTest Bug: 169873384 Change-Id: Ib1414a2db73a4c30a26379a0ba8ba9e639f920ce
2021-03-24setFrameRate: Make shouldBeSeamless an enumMarin Shalamanov
Change the shouldBeSeamless parameter to an enum in order to make the API easier to understand. This changes - SurfaceControl.setFrameRate - Surface.setFrameRate - ANativeWindow_setFrameRateWithChangeStrategy - ASurfaceTransaction_setFrameRateWithChangeStrategy Bug: 179116474 Test: atest SetFrameRateTest Change-Id: I28a8863ea77101f90b878fbda5f00d98e075b7cc
2021-02-23SF: fix layer activation with schedulerAdy Abraham
When a layer frame rate vote changes (via setFrameRate call), the layers needs to be activated in scheduler. This change fixes a bug that was activating all layers instead of just the layers that has a vote change Bug: 163079696 Bug: 180014293 Test: run a test app that calls setFrameRate Change-Id: Iaa538d04c535b185161a24a4bbadeff2ac99bcd8
2021-02-02SF: Don't cache display modes in HWComposerMarin Shalamanov
The display modes should be stored only in DisplayDevice. Having the state also in HWComposer is unnesesary and hard to keep in sync with SF, e.g. during hotplug processing of displays which can change their supported modes. Any HWC calls which need to validate their parameters need to go through display device. This additinally makes the code more undestandable. Bug: 159590486 Test: presubmit Change-Id: I40b03c09a5fd6092fca0682d602deb70db022fa5
2021-01-27SurfaceFlinger: handle high refresh rate deny listAdy Abraham
Add visibility to SurfaceFlinger into the high refresh rate deny list and let SurfaceFlinger handle it. Previously WM was setting the preferredDisplayModeId on the denied app's window. The old way prevented SurfaceFlinger to use the frame rate override feature as it didn't know that a specific app is causing the refresh rate spec to be limited. With this change, SurfaceFlinger will limit the display refresh rate based on the high refresh rate deny list, and if possible, will use the frame rate override feature to change the display rate to a multiple, allowing other animations to be smooth while the denied app remains in the low refresh rate. Bug: 170502573 Test: SF unit tests Change-Id: Idc8a5fe6bc12dbd949ad5e09ff50e339ffaeac36 Merged-In: Idc8a5fe6bc12dbd949ad5e09ff50e339ffaeac36
2021-01-27SF: use parent layer frame rateAdy Abraham
If an ancestor of a layer set a frame rate, and that layer doesn't have a frame rate configured, use the one of the ancestor. The reason for this is to support the high refresh rate deny list where WM will set the frame rate on a container layer which is not visible. With this change we will treat all child layers of that container as if they voted themselves. Test: test app that sets preferredDisplayModeId Bug: 163079696 Change-Id: I3c55d393af72e19cd7b4f107d8cc0b2e85289d96 Merged-In: I3c55d393af72e19cd7b4f107d8cc0b2e85289d96 (cherry picked from commit 20dcde8e35b003a82e4c14d39c76f93a16ec6e9d)
2020-12-24SF: fix typoMarin Shalamanov
Test: presubmit Change-Id: I7e7ec1eab615b183a0d2074d96c0a444e5b97e79
2020-12-08Add Fps classMarin Shalamanov
Add a class to wrap a fps value. This is useful because across the code we - convert between vsyncPeriod and fps - compare with tolerance (this ensures we use consistent tolerance) - consistent toString method Bug: 159590486 Test: presubmit Change-Id: Iebb77a33a2f822056642aa61bd6fac6514aa656d
2020-11-18SurfaceFlinger: Add DISPLAY_EVENT_FRAME_RATE_OVERRIDEAdy Abraham
Add a new event to DisplayEventReceiver that conveys a list of apps whose frame rates have been overriden. This event is processed by the DisplayManager to advertise the new frame rate to the overridden app. Change-Id: I89fce8b5b4d9db65ec5db7dd2393c384c0fcfd82 Bug: 169271059 Bug: 169271062 Bug: 170503758 Test: manual test using SF backdoor
2020-11-03SurfaceFlinger: throttle applications based on uidAdy Abraham
Add the ability for SurfaceFlinger to be able to throttle down to a divider of the refresh rate (i.e. for 30/45 for 90Hz) Change-Id: I6bfd6f43ee1f30e771a136c558d8ae9a6d7fbe0f Test: Manually via 1039 SF backdoor Bug: 170502573 Bug: 169270763 Bug: 169271059
2020-09-30SurfaceFlinger: add transactions to FrameTimelineAdy Abraham
Allow transaction clients to specify the vsyncId that started the transaction and plumb this data to FrameTimeline to be able to track jank associated with transactions Bug: 166302754 Test: manually see transactions in frame timeline Change-Id: Id05e0d0a73039204943d93b666cb67e3e7515a69
2020-08-28SurfaceFlinger: DispSync -> VsyncControllerAdy Abraham
Refactor the old DispSync to separate between Vsync math (VsyncTracker) and fence / vsync callback management (VsyncController) Bug: 162888874 Test: examine systraces Test: SF unit tests Change-Id: Id275620380a21aeb0017e966910cbf24860cecef
2020-08-03SF: Remove EventControlThreadDominik Laskowski
EventControlThread was a HWC workaround dating back to K for toggling VSYNC off the main thread, but as of R it defers back to main only to incur context switches. Clean up TestableScheduler construction to skip creating DispSync and timer threads, which fixes several gMock warnings of unexpected calls. Remove virtual destructors for non-polymorphic interfaces. Bug: 160012986 Test: systrace Test: libsurfaceflinger_unittest Change-Id: I01360016a7dba79dc905f250753e6fce34af0a90
2020-04-16SurfaceFlinger: use intended wake up time when calculating next present timeAdy Abraham
If SurfaceFlinger wakes up too late (due to the main thread being busy) it may calculate a wrong presentation time as it is based on the wake up time. Instead, cache the intended wake up time and use it as the base time. Change-Id: I84c37bd5f164fbdef3151c0898d3cea624cea515 Bug: 154199567 Test: collect systrace for launcher scrolling
2020-03-16SurfaceFlinger: Layer::getFrameRate() with relativesAdy Abraham
If an app set a framerate on a layer, then getFrameRate() on ancestors/successors of this layer should return NoVote to allow the refresh rate heuristic to be based on the the actual layers that voted. Bug: 151274728 Test: Swappy with ANativeWindow_setFrateRate Change-Id: Icfdf8e8fd4d92ba520bbc894bb9971b980691518