summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
AgeCommit message (Collapse)Author
2025-03-19Add border API to surface control YCairn Overturf
See go/sf-box-shadows-api for more details Bug: b/367464660 Flag: com.android.window.flags.enable_border_settings Test: atest SurfaceFlinger_test Change-Id: I1190edb97693004d9f46058fd0165451470a65b3
2025-03-03Provide classes that logically make up a transaction with == and !=. Anton Ivanov
Primarily this change is intended to support writing test assertions. As a side effect, make some improvements to encapsulation of members. Flag: EXEMPT refactor Bug: 385156191 Test: presubmit Change-Id: I51352c78ccfcb0fc6bff655593d7d31771516668
2025-02-26Revert^2 "Harden construction sites of android::StrongPointer." Anton Ivanov
This reverts commit f73db7a6242e297ead71df0d0d1fb3a8515245d3. Reason for revert: Scope restricted to sp<>::make which is a safe replacement for assignment from new. Bug: 393217449 Test: ChoreographerTests pass locally. Flag: EXEMPT_refactor Change-Id: I9a38c54c06cc64da099d282c05ccf20f40b70a72
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-01-28Remove client drawn shadow code Cairn Overturf
Shadows will continue to be drawn by surfaceflinger Bug: 391428079, 375624570 Change-Id: Ic527a091e77d69c6e9529782d283379a2651dea8 Test: Shadows work in free form mode Flag: com.android.window.flags.ignore_corner_radius_and_shadows
2025-01-06surfaceflinger: Add clientDrawnCornerRadius and clientDrawnShadowLength ↵ Surbhi Kadam
layer properties Modify RoundedCornerState and ShadowSettings to account for client drawn corners and shadows. When equal to the requested values, SurfaceFlinger will not draw corners and shadows for the layer. Bug: 375624570 Flag: com.android.window.flags.ignore_corner_radius_and_shadows Test: atest SurfaceFlinger_test; manual test - PIP, freeform window, recents, app launch Change-Id: Idde115b51a253a34cfadfbd1ff6c7b15c44518ef
2024-11-11Merge "Allow apps to apply picture profiles with priority to layers" into main Brian Lindahl
2024-11-09[Lut HAL backend] implementation 3rd patch. Sally Qi
- interpret the lut and pass them into shader. Bug: 329472856 Test: builds Flag: EXEMPT no flag needed Change-Id: I005600593f4a369130bf8bcaea69300758b5ae03
2024-11-08Allow apps to apply picture profiles with priority to layers Brian Lindahl
Bug: 337330263 Test: build Test: atest LayerSnapshotTest Flag: com.android.graphics.libgui.flags.apply_picture_profiles Change-Id: I1adb6069d0168084abf0a76d310abb4ffad5ce5f
2024-10-22[Lut HAL backend] implementation 2nd patch Sally Qi
1. add gui/DisplayLuts.h structure. Mimic DisplayLuts.java. 2. add Lut parameter into Layer side. When SurfaceControl#setLuts is called, in native code, the lut information is passed to SurfaceFlinger and RenderEngine side via LayerState::eLutsChanged. 3. in OutputLayer::updateCompositionState, we compare the Lut requested from the app and the Lut from the HWC to decide GPU composition or not. 4. DPU or GPU composition? If the Lut from the app exactly matches the Lut from the hwc, do DPU. Otherwise, GPU composition instead. Bug: 329472856 Test: libcompositionengine_test Flag: NONE HAL backend interface change Change-Id: I8295fe419c6237d90b7ff9f02f62bafd6cd2cecf
2024-10-03Support floating point values for layer crop Vishnu Nair
Flag: EXEMPT bug fix Fixes: 310950423 Test: presubmit Change-Id: I05feb4881a95bc8caad90a3d632b3c7881909bf3
2024-08-15Move CaptureArgs + friends to structured aidl Alec Mouri
No more manual parceling! Bug: 329465218 Flag: EXEMPT mechanical refactor Test: builds Test: courage Change-Id: I9f5eba12db615d6b02de0686193381f7a63bb043
2024-08-06Add BufferReleaseChannel Patrick Williams
BufferReleaseChannel will be used to communicate buffer releases from SurfaceFlinger to BLASTBufferQueue. Bug: 294133380 Flag: com.android.graphics.libgui.flags.buffer_release_channel Test: BufferReleaseChannelTest Change-Id: Ic38e8eefc96abc0b2bbe780115b7628413e8b829
2024-07-25Revert "Optimize BLAST buffer releases via Unix sockets" Patrick Williams
Reverting due to b/355260320 Change-Id: I8a32f73b6805d3f2bceb2948925be6a9baaa3015
2024-07-23Optimize BLAST buffer releases via Unix sockets Patrick Williams
Bug: 294133380 Flag: com.android.graphics.libgui.flags.buffer_release_channel Test: BLASTBufferQueueTest Change-Id: Ia183452198dadc7f8e540f7219bd44d8b5823458
2024-07-04Edge extension effect: shader reimplementation Marzia Favaro
X-axis activity transitions require the translation of the surfaces involved. As this movement would create unwanted see-through, we would have added side windows anchored to the moving activities, and textured them by clamping their parents. We are replacing the additional windows with the extension of the surfaces, and filling the area without buffer with a shader. See go/edge-extension-sksl for more info. Bug: 322036393 Test: LayerSnapshotTest Flag: EXEMPT (calls will be protected by wm shell with com.android.window.flags.edge_extension_shader) Change-Id: I3682efd16a1b311d67a522bb85960f100948b2ea
2024-05-29Pass dequeue timestamp along with buffer data Nergi Rahardi
Avoids performance penalties associated with metadata. Bug: 342174822 Test: atest libsurfaceflinger_unittest Test: Manually verified dequeueTime sent without triggering metadata change Change-Id: Ifed747818ea252b2551780ffcefd3309eb41edbe
2024-05-22Allow child layers to unset trusted overlay state 2/2 Vishnu Nair
Test: presubmit Bug: 339701674 Change-Id: I1a94b5e5dc1fa64a9e1eb3330b5c5b03af8d2b16
2024-03-20Delete border rendering code from SurfaceFlinger. Melody Hsu
Removed code is never used and drawing borders is done instead by Window Manager Service. Changes revert ag/16980603 and ag/17496275. Bug: b/227656283 Test: presubmit Test: SurfaceFlinger_test Change-Id: Ib5c8bf74ad6764d65536dc60cc3c458edde86b3f
2024-02-16Merge "Add support for restricting HDR headroom for video" into main Alec Mouri
2024-02-15Add support for restricting HDR headroom for video Alec Mouri
This is needed for allowing apps to vote for HDR headroom restrictions for SurfaceView and SurfaceControl Bug: 323964760 Test: manually poking at test app Test: SurfaceViewTests Test: SurfaceControlTest Test: ASurfaceControlTest Change-Id: Ie886e67879525462d49fdedc535aea659d69321a
2024-01-29Introduce eCanOccludePresentation layer flag Vishnu Nair
Sets a property on a layer hierarchy indicating that its visible region should be considered when computing TrustedPresentation Thresholds. This property is set on a layer and inherited by all its children. The property is then passed via windowinfos so the TrustedPresentation controller can determine which windows to use when computing the thresholds. Test: presubmit Bug: b/275574214 Change-Id: Ide384c64cb7b5a9b2b3ce293b20e2be64da8ad69
2023-11-28Merge "Remove useIdentityTransform from DisplayCaptureArgs." into main Melody Hsu
2023-11-27Remove useIdentityTransform from DisplayCaptureArgs. Melody Hsu
Screenshots do not set useIdentityTransfrom to true with a rotated display. The default value is false in SurfaceFlinger and is not relevant for captureLayers, which is the API that will be used for screenshots going forward. Rotation flags are no longer relevant in DisplayRenderArea and rotation values can be simplified to 0 rotation by default. Bug: 293445881 Test: atest LayerStateTest Test: presubmit Change-Id: Id0cce05458c3daa4078097057f00fd856df1e092
2023-11-22native: Rename frame rate selection strategies Rachel Lee
SELF -> PROPAGATE (default) DO_NOT_PROPAGATE -> SELF No behavioral changes. Test: atest libsurfaceflinger_unittest Bug: 309687765 Change-Id: I055d827a45ecc7f566375425c42e745a41b751f9
2023-10-11Add smooth switch bool for setFrameRateCategory Rachel Lee
This allows the platform to have a different behavior depending on whether a device is MRR or dVRR. When the bool is `true`, MRR devices (those with DisplayModes that do not have vrr config) will not change frame rates if it would cause jank. The expected usage is to mark the bool true when an animation is running. Bug: 300491171 Test: atest libsurfaceflinger_unittest Change-Id: I5e87d276c11ecc806ede3e943f0a6498a7b910c4
2023-09-20Merge "Plumb new frameRateSelectionStrategy value" into main Rachel Lee
2023-09-18Plumb new frameRateSelectionStrategy value Rachel Lee
This new value will allow a parent layer to override the frame rate specifications of all its descendants. This CL only plumbs the value from Transaction to Layer. Bug: 297418260 Test: atest CtsSurfaceControlTestsStaging Test: atest libsurfaceflinger_unittest Change-Id: Ibbda6ff6c143e931240178d89306822b4cce9669
2023-09-14libgui: plumb setFrameRate thru BufferQueue Ady Abraham
The current implementation just assumes that the Surface and BLASTBufferQueue lives in the same process and rely on inheritance to handle setFrameRate. This doesn't work for any usecase that the Surface is Parceled to a diffrent process. Bug: 281695725 Test: atest CtsGraphicsTestCases --test-filter SetFrameRateTest* Change-Id: I4e08b92b618fa7b863ca3ef4f7b46d9f1c30c775
2023-08-22Add setFrameRateCategory surface API Rachel Lee
Bug: 284911776 Test: atest CtsSurfaceControlTestsStaging Test: atest libsurfaceflinger_unittest Change-Id: Ia804a63198ff096d1e5ffedf6046a0350963b8ed
2023-04-25Support screenshots of HDR content Alec Mouri
Previously screenshots always rendered to either an SDR or a wide gamut colorspace. For screenshotting HDR content, this is only appropriate when the resulting screenshot (a) never leaves the device and (b) the relevant code has workarounds for the display to appropriately handle its luminance range. HDR screenshots will now have two paths: * A standard path for rendering to HLG. HLG was chosen because the OOTF shape is less hand-wavey than PQ's, does not require metadata, and bands less at 8-bits of color. * A special path for "display-native" screenshots. This is for use-cases like screen rotation where there are stricter color accuracy requirements for round-tripping. Skia already encodes the resulting screenshot by supplying an HLG CICP alongside a backwards-compatible transfer function, so it's only sufficient to change how SurfaceFlinger renders. Bug: 242324609 Bug: 276812775 Test: screencap binary Test: rotation animation Test: swiping in Recents Change-Id: Ic9edb92391d3beb38d076fba8f15e3fdcc2b8f50
2023-04-04Merge "Move exclude layer to CaptureArgs." into udc-dev TreeHugger Robot
2023-03-31Move exclude layer to CaptureArgs. Ajinkya Chalke
Test: atest ScreenCaptureTest ScreenCaptureChildOnlyTest Bug: 267324693 Change-Id: I6ab421e2f9e5bc0ab1422d88ddf2628776347a6f
2023-03-23Rename Sdr/Hdr to Hdr/Sdr internally to get avoid of confusion. Sally Qi
Bug: 267350616 Test: builds Change-Id: I75bb485f01ae2358c77133767f01cb63f8eda6f1
2023-02-24SF: Frontend fixes for issues surfaced by SurfaceFlinger_test Vishnu Nair
- separate color and bgcolor in layer state so we don't set a color on a layer without a buffer - avoid using legacy layer state when latching a buffer - fix callback issue where invisible or offscreen layers were not invoking the callbacks - pass in layer snapshot for trusted presentation state - fix a screenshot issue where the root layer was skipped - pass in framerate changes to layer history Test: presubmit Test: atest SurfaceFlinger_test with new fe Bug: 238781169 Change-Id: Id9ff8a036dc283e21a05985c1c01ebd070b1df24
2023-02-17Add CachingHint into SurfaceFlinger Alec Mouri
Some system layers may need to be excluded from surfaceflinger caching for a variety of reasons, including power or image quality considerations. This provides a mechanism for those system layers to never be cached on the GPU. Bug: 259311918 Test: libcompositionengine_test Test: run test app and inspect planner state Change-Id: I35418ad5a41cb2546e3b27b0af290bf3c31a0180
2023-02-09Add producerId so we know when the BBQ producer has been changed. liulijun
If BBQ producer changes but the SC remains the same, the frame numbers for the SC will get reset. This causes issues if there's a barrier layer set because the barrier is waiting for a particular frame number before applying the transaction. Since the frame numbers have been reset, the barrier will be greater than the incoming frame numbers. The change adds a producerId to the buffer being sent so it can check if the producerId is older than what's currently set on the Layer. If there's a barriers set from the old producer, the buffer can be released and not applied and will stop SF from waiting indefinitely. Bug: 251971691 Test: Builds, hard to repro Signed-off-by: Liu Lijun<liulijun@xiaomi.corp-partner.google.com> Change-Id: If37171de4693a73f36f8de43e29c129b352eb55f
2023-02-08Adds a flush jank data layer state update type. Pascal Muetschard
A transaction can be sent to SurfaceFlinger with a layer state change of this type to wake up SurfaceFlinger and have it perform the layer state update logic, without updating anything, but triggering any side-effects, especially jank data processing. Bug: 235178314 Bug: 221393601 Bug: 225105422 Test: atest SurfaceFlinger_test Change-Id: Idf458c96cbe8f54224ebde6f517c08b9a5c48a06
2023-01-25Add extended brightness range impl John Reck
Bug: 241001465 Test: manual currently, flagged off Change-Id: I707281b9acaf6ea218f1d9ce888fc7cdbf1cf7c9
2023-01-23SurfaceFlinger: Add TrustedPresentationListener API Chavi Weingarten
TrustedPresentationListener is intended to allow the producer of a buffer layer to gain a trusted signal on whether and to what extent a layer is presented. A strawman design would be to provide the producer details on it's presentation (alpha, position, scale, final crop, covered region, etc). In the strawman design the client end would then decide itself whether each of these parameters were in an acceptable range. However providing the client feedback on it's per frame position would have a negative system health impact. Furthermore in some of the target use cases we can't even be sure the layer of interest is actively producing buffers and so there may be no existing callback to piggy-back on. Because of this we use a server side thresholding approach, where the client expresses some visibility threshold and a time stability constraint. See SurfaceComposerClient.h comment for details on these thresholds and their computation. Bug: 256993331 Test: LayerTrustedPresentationListener_test.cpp Change-Id: If4bef60dc6b22ce4959c353fa2a19b0994a00f5c
2023-01-17Revert "Migrate ITransactionCompletedListener to AIDL" Huihong Luo
This reverts commit c50b4988e93872bfe023a4e099548f84bdfd998d. Reason for revert: CTS failures, b/262211898 Change-Id: Iaff863f8af98c11dbf852cccad50e55148d87cee
2022-12-08Migrate ITransactionCompletedListener to AIDL Huihong Luo
This migrates the c++ interface to aidl. Bug: 225250470 Test: atest libsurfaceflinger_unittest libgui_test SurfaceFlinger_test Change-Id: I997e302ac8c6a23bedefaa5b8272677f3dce54df
2022-12-07Add security check to getPhysicalDisplayToken binder function. Sally Qi
- There is a possible way to take over the screen display and swap the display content due to a missing permission check. - Add a short-term fix for WCG checking failure because of new permission check added to SF::getPhysicalDisplayToken: change two function signatures (getStaticDisplayInfo and getDynamicDisplayInfo). - To make short-term fix workable, split getDynamicDisplayInfo binder call into two, one is to take display id, one is to take display token as old codes show to avoid huge modification on other callees. Bug: 248031255 Test: test using displaytoken app manually on the phone, test shell screenrecord during using displaytoken; atest android.hardware.camera2.cts.FastBasicsTest Change-Id: Id9d9012d4ede9c8330f0ce1096bcb78e51b7c5df
2022-11-17libgui: add layer_state_t::diff Vishnu Nair
Compares two layer_state_t structs and returns a set of change flags describing all the states that are different. Also introduces change sets describing which set of client states can affect the hierarchy, content or the content size. Bug: 238781169 Test: presubmit Change-Id: I6e5fb255972aff2373be27e62005ee3a8de7ebf6
2022-10-10SurfaceComposerClient: Clean up layer state Vishnu Nair
- align layer alpha/color with SF layer drawing state - remove unused flags and fields Bug: 238781169 Test: presubmit Change-Id: I4be9c56b3006b7d7a0ca19160511ebb9e3551a8c
2022-10-06SF: Add TransactionHandler Vishnu Nair
- migrate transaction queueing and flushing into a new class and remove dependencies from other components. - Add a filter interface for other components to participate in transactionready logic. Test: presubmit Bug: 238781169 Change-Id: Ia4da386cd72058126f6f765adafb9cb4d15b1d2b
2022-08-22SF: Clean up layer state Vishnu Nair
Remove unused layer states. Bug: 238781169 Test: presubmit Change-Id: I84917bed157a93ec9bfd16d168312ce27ff1765e