summaryrefslogtreecommitdiff
path: root/libs/gui/DisplayEventDispatcher.cpp
AgeCommit message (Collapse)Author
2025-02-19Merge "Revert "Harden construction sites of android::StrongPointer."" into main Steven Moreland
2025-02-19Revert "Harden construction sites of android::StrongPointer." Priyanka Advani (xWF)
This reverts commit 81793808b9347a52dd979e4b3d5d9d10fc8c4915. Reason for revert: Droidmonitor created revert due to b/397788382. Will be verifying through ABTD before submission. Change-Id: Idd58b82a5a5380053cdff4e7b92eafa66b2c2782
2025-02-19Merge "Harden construction sites of android::StrongPointer." into main Anton Ivanov
2025-02-17Harden construction sites of android::StrongPointer. Anton Ivanov
Bug: 393217449 Test: presubmit Flag: EXEMPT_refactor Change-Id: Icf703aed608531e9b302b299481af00a52074731
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>
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-06-14SF: trace the render rate of an app Ady Abraham
Add a trace point for both SF and apps when the render rate is overridden. Bug: 347314033 Test: manual Change-Id: I87dc9b17a4c1f97fa43b025cfa684f43c20c5a25
2023-12-15Update HDCP for external displays Huihong Luo
So the secure flag of Display object in Display Manager (DM) can be set correctly. HWC calls the onSync method as a workaround, to notify SurfaceFlinger (SF) about hdcp changes, SF in turn sends an event to DM, DM will then fetch and update display info. Bug: 280818362 Test: manual Change-Id: I29ce0337865b51c0fc7bf7c2d7fdd4cd6d66ef46
2023-09-21SF: Propagate display hotplug errors Brian Johnson
Add support for SurfaceFlinger to handle display connection errors and propagate any error code on hotplug event up the stack. Bug: 241286153 Test: manual Change-Id: I88afeb4f61b13714a81138180db0762cf3ae4ab0
2023-02-01Framework code for Attached Choreographer. Rachel Lee
Allows a direct association of a Layer (via LayerHistory) to attached choreographer. The EventThread checks whether the vsync is in phase for a choreographer. Bug: 255838011 Test: atest AttachedChoreographerNativeTest Change-Id: I9cb35bced5e6d4509609ad7698ab2902a31d5b98
2022-04-19Migrate bootFinished of ISurfaceComposer to AIDL Huihong Luo
And createDisplayEventConnection is migrated too. Bug: 221898546 Bug: 211009610 Test: atest libsurfaceflinger_unittest libgui_test SurfaceFlinger_test Change-Id: I2d0968262b86829b4cce13158446f1c85a4e55e4
2022-03-21Add JNI getLatestVsyncEventData. Rachel Lee
Bug: 205721584 Test: atest ChoreographerTest Change-Id: I005fbffdf0db47e6cb636b22a0a316d18f5bbb90
2022-02-14Use VsyncEventData in DisplayEventReceiver::Event. Rachel Lee
Clean-up that re-uses VsyncEventData so it's easier to maintain. The ParcelableVsyncEventData is used in AIDL. It is separated from VsyncEventData because of the union in DisplayEventReceiver::Event and Parcelable has non-trivial constructors. Bug: 218563993 Test: atest ChoreographerNativeTest Test: atest libsurfaceflinger_unittest Test: atest libgui_test Change-Id: I3ebeb1c7826300c27c4a12d4dba6fbd16305e9e1
2022-02-07Split VsyncEventData from DisplayEventDispatcher. Rachel Lee
Bug: 205721584 Test: atest libsurfaceflinger_unittest Change-Id: I51b18ed356ae7a29f8a88634346c0025321dbe08
2021-11-17Merge "Obsoleted VsyncEventData.expectedPresentTime." Rachel Lee
2021-11-16Obsoleted VsyncEventData.expectedPresentTime. Rachel Lee
It was obsoleted after plumbing multiple frame timelines which each have expected present time. Bug: 198192508 Test: atest ChoreographerNativeTest Change-Id: Ib39f8093ff89c9f7831cc40375d7a0a5ae9408dc
2021-11-10Merge "Dispatch vsync when receiving vsync timeout to handle vsync loss." ↵ Alec Mouri
am: 8816376a11 am: c53f121969 am: 15b2ddfad7 am: a7bcfc5306 am: 0a3ce8e715 Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1867826 Change-Id: I8cdee11cfb9907df2deb4727ab80ba2e4a0fcd03
2021-11-04Revert "Revert "Send multiple scheduler frame timelines."" Rachel Lee
This reverts commit caaa47d60b83670206dcd3c34382719b1f247ab5. Reason for revert: Fix the reverted CL in 2nd CL. Bug: 198192508 Bug: 204941507 Test: See 2nd CL. Change-Id: I15c693c2e0a82ef81a490319da11871bd74298b3
2021-11-02Dispatch vsync when receiving vsync timeout to handle vsync loss. Cheng Shi
Currently we do not have a mechanism to guarantee the arrival of the vsync signal. The vsync signal loss may occur when the renderNodeAnimator is running. The render thread took a long time to perform drawing without time to read the pipe, and the pipe was filled with other signals like configChanged, causing surfaceflinger to miss a vsync signal. If a vsync lost, causing DisplayEventDispatcher::mWaitingForVsync to be true, resulting in DisplayEventDispatcher::scheduleVsync can no longer schedule another vsync. So we need to dispatch vsync when receiving vsync timeout. Bug: 204097701 Test: Manual Change-Id: Ibfa7a301ea17ebd58cae6b790a61d66c3d2e43fd Signed-off-by: shicheng <shicheng@xiaomi.com>
2021-10-29Revert "Send multiple scheduler frame timelines." Rachel Lee
This reverts commit 6b1807002ebd198f51cdb70c3fee79645bd25fe8. Reason for revert: b/204492891 Change-Id: I292c11a0c54c57d97d112d9cec16b27acaa7b6a6
2021-10-18Send multiple scheduler frame timelines. Rachel Lee
Fixed array amount for FrameTimelines. Bug: 198192508 Test: atest ChoreographerNativeTest Change-Id: If0e9304fa114b700b861be6d51a4253f097514c3
2021-09-23Plumb expected present time to Choreographer. Rachel Lee
Bug: 198191648 Test: make Change-Id: I46ed20676ffddccc83aec11801adc4c875ac6f00
2021-04-13Change hwui jank detection to use deadline & gpu completion (2/2) Jorim Jaggi
- Use GPU finish time as well as actual deadline to determine jank rate. - Use dynamic interval to adjust for 60/90hz switching - Move frame metrics reporting into JankTracker to adjust the deadline communicated to the app when in stuffing scenario. - Adjust double-stuffing detection to be a bit more readable. Test: GraphicsStatsValidationTest.java Test: adb shell dumpsys gfxinfo Test: FrameMetricsListenerTest Test: Log output of FrameMetricsObserver Bug: 169858044 Change-Id: Ia1cae9f0c5358d1cd3bf043289ea8b4d26154737
2021-02-09Merge "Revert "DisplayEventDispatcher: optimize binder calls"" into sc-dev TreeHugger Robot
2021-02-09Revert "DisplayEventDispatcher: optimize binder calls" Ady Abraham
This reverts commit 981787535c543cf82ef6f92ad17e9d15b6dc032f. Reason for revert: b/179721483 Change-Id: I667bbcdb6cc8c06624d6dbb599aa612b0af24951
2021-02-05Rename DisplayConfig to DisplayMode Marin Shalamanov
This CL continues the raneming of display "configs" to display "modes". The goal of this is to have the same names as in the java code and the public display APIs. Additionally in this CL we move DisplayConfig (from libui) to the namespace android::ui. This is to prevent conflict with the SurfaceFlinger's internal android::DisplayMode. This is consistent with the neighboring classes which are also in the ui namespace. Also the type of the parameter defaultMode of {s,g}etDesiredDisplayModeSpecs is changed to size_t for consistency with the rest of the code. Appropriate error handling is added for this. Bug: 159590486 Bug: 179158858 Test: presubmit Change-Id: I31e5be1f2223a9ec9340789ce3dc5738eceaf40f
2021-02-01DisplayEventDispatcher: optimize binder calls Ady Abraham
Use DisplayEventReciever::setVsyncRate instead of DisplayEventReciever::requestNextVsync to accommodate a one-time registration to vsync events when the app registers back to back callbacks. With this approach we can save all the binder calls during a running animation. Test: run TouchLatency test app and observe systrace Bug: 162096692 Change-Id: Ib415f2aade40a3d23a2b4c77e5746e5e13666d23
2020-11-18SurfaceFlinger: Add DISPLAY_EVENT_FRAME_RATE_OVERRIDE Ady 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-10-09SurfaceFlinger: pass frame deadline to Choreographer Ady Abraham
Pass the frame deadline calculated by SF to AChoreographer so hwui would be able to improve its stats by knowing if a frame is likely to be late. Bug: 169858174 Test: manul Change-Id: I9433d990684b968cbe1cd3ce17717b616d01b9a2
2020-09-16SurfaceFlinger: Shared timeline plumbing Ady Abraham
Add plumbing to get shared timeline data from Surface Flinger to HWUI and back. Bug: 162890382 Bug: 162888881 Test: SF unit tests Change-Id: Ifb76e6bf28d43c051e6c8ff568437ec9a106b865
2020-08-07Fix refresh rate callback fan-out for choreographer Alec Mouri
* AChoreographer receives refresh rates from DisplayManager already, so there's no need to default-enable them - AChoreographer only needs to pump an event with the latest refresh rate to wake up looper. This also ensures that AChoreographer's callbacks are entirely in-sync with DisplayManager since there's no raciness. * Instead of re-requesting a config change from SF, instead inject it in AChoreographer correctly to save on binder. Bug: 154874011 Bug: 158680912 Bug: 161406626 Test: while [ true ]; do adb shell service call SurfaceFlinger 1035 i32 1; adb shell service call SurfaceFlinger 1035 i32 0; and repeatedly rotate the home screen with auto-rotate off. Change-Id: I66abc2e28e60f06987ce3a54be294c94b77524fc
2020-07-31Use type safe display IDs. Marin Shalamanov
Use a type safe wrapper around uint64_t for display ids. We also modify the format of the EDID generated physical display IDs by setting bit 62 to 1, which will indicate that the display id is stable across reboot. Bug: 160679868 Test: m && flash device Test: take screnshot on device Test: atest surfaceflinger_unittest Change-Id: Ie2c7c2b737e0882fa4208c059caa85b7ded922b2
2020-05-07Receive refresh rate callbacks from DMS Alec Mouri
AChoreographer will use DMS as the source of truth for these callbacks instead of SurfaceFlinger. Bug: 154874011 Test: ChoreographerNativeTest Tes: Manually verify that HWUI is processing refresh rate callbacks Change-Id: I961a7d1ab335800d3e260ba7564ddca9c0595cfc
2020-02-05[AChoreographer] Add const qualifiers for getFd(). Alec Mouri
Per API feedback the AChoreographer argument should be const. Bug: 148954590 Test: builds Change-Id: Ie95481992534b3f5f5c664709bff80b1c21f7d50
2019-12-26[AChoreographer] Add private api that decouples from ALooper. Alec Mouri
For ease of use by HWUI, we'll get rid of the reliance of a thread-local ALooper: * Rather than using AChoreographer_getInstance to access a thread-local AChoreographer instance, the caller will be expected to create and destroy its own instnace. * For use by HWUI's own looper instance, _getFd() will expose the underlying file descriptor from which events can be listened. The corresponding choreographer combined callback can be called to flush pending display events. Bug: 136262896 Test: builds Change-Id: I94f102da22974cbad37f21a68d2f04ac0cec5c78
2019-12-26[AChoreographer] Add refresh rate callback. Alec Mouri
This will augment the NDK to respond to display events where the display refresh rate changes. Consumers of this api will include: * HWUI, for implementing a policy for determining whether to use render-ahead, * Swappy, to potentially replace jumping into Java from native code to respond to display evnets there. * Any other native app that would rely on the up-to-date display refresh rate. Currently however this is not yet exposed to NDK as CTS is not yet written. Once CTS is written then this will be formally exposed to NDK. For now we'll leave these as APEX apis to represent incremental progress. Bug: 136262896 Test: builds Change-Id: I66d393f93eb5d681547411e330ef1b8950a35c5d
2019-11-25[DisplayEventDispatcher] Move DisplayEventDispatcher into libgui. Alec Mouri
Original source file was at frameworks/base/libs/androidfw. For now, libgui will be its new home so that the graphics module can depend on libandroidfw without pulling in libgui. Bug: 142760698 Test: builds Change-Id: Iea51e24ffb11a6ad79ad91a9e887f5e326705f1b