summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Display
AgeCommit message (Collapse)Author
2025-03-21Detect secure layers and start lazy HDCP activation Huihong Luo
Layer snapshots are traversed to check for secure layers, then trigger HWC to start HDCP activation when a secure layer is detected. Flag: com.android.graphics.surfaceflinger.flags.hdcp_negotiation Bug: 372902990 Bug: 375340594 Test: manual Change-Id: Ie52159043f94d7cdb079d7c48c47764017a979f5
2025-03-17Print display ids of Virtual Displays too Pierre Barbier de Reuille
This impact the output of `dumpsys SurfaceFlinger --display-id`. Note: this will output the ids of the same displays than `dumpsys SurfaceFlinger --displays`. Similar to that command, phyical displays will be enumerated first. Fix: 403588742 Flag: EXEMPT (small change in dumpsys) Test: build and run with an overlay Change-Id: I176b0894c3dd4fc2ecd30809ed117b87464f8d85
2025-02-27SF: Remove connected_display flag Dominik Laskowski
Bug: 380251940 Flag: EXEMPT removing connected_display Test: presubmit Change-Id: I870d8f13fe8012f07a47dace756c5d4b2261ebd3
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
2024-12-06SF: Cache display port in physical DisplaySnapshot Gil Dekel
In order to be able to remove direct dependencies on a DisplayId's int value, we have to find alternatives for the API it provides. One such piece of data is a display port, which is encoded directly in the ID int value. Cache the port as it is retrieved from HWC into DisplaySnapshot when they are updated or created so it can be served later via alternative ISurfaceComposer APIs. Bug: 374163881 Bug: 377307639 Flag: EXEMPT refactor Test: libsurfaceflinger_unittest Change-Id: I7a7e38695ca6065238644457986f12dcce4b59d0
2024-12-02Merge "SF: Store and manage snapshots for virtual displays" into main Treehugger Robot
2024-11-25SF: Return EX_CONFIG_FAILED from setActiveConfigWithConstraints() Manasi Navare
setActiveConfigWithConstraints() currently returns V2_4 Hal::Error But with the new Composer3 IcomposerClient AIDL changes, it should return int32_t corresponding the new EX_CONFIG_FAILED exception. So define a new enum class Error to handle all V2_1 and 2_4 errors and the new IcomposerClient exception. Also define a new class to return the result of initiateModeChange as: Changed, Rejected, Aborted. So change this plumbing through SF. Catch this error and propagate up from DisplayModeController to SF using Scheduler Bug: 374185540 Flag: EXEMPT refactor Test: manual Change-Id: I3548fd6bda806055fb071cc364d07d37b2693374 Signed-off-by: Manasi Navare <navaremanasi@google.com>
2024-11-25SF: Store and manage snapshots for virtual displays Gil Dekel
Create/destroy VirtualDisplaySnapshot that tracks the virtual display's lifetime. For now, VirtualDisplaySnapshots will track a virtual display's DisplayId and whether or not it's backed by Hal/Gpu. This will be helpful when moving the cast system of DisplayIds from within DisplayId.h to SurfaceFlinger. Bug: 374163881 Flag: EXEMPT refactor Test: libsurfaceflinger_unittest Change-Id: Id730e65b24ecd10925282bd72585ac7c5635a4fe
2024-10-02Disable -Wunused-value for surfaceflinger Aditya Kumar
``` frameworks/native/services/surfaceflinger/Display/DisplayModeController.cpp:293:14: error: ignoring temporary created by a constructor declared with 'nodiscard' attribute [-Werror,-Wunused-value] 293 | (std::scoped_lock(displayPtr->desiredModeLock), displayPtr->desiredModeOpt) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Change-Id: I5e84dbd628f5c03f5e325f5ccc5d365d2f40c9dd Flag: EXEMPT b/369277774 Bug: b/369277774
2024-08-14SF: Move toggleKernelIdleTimer to DMC Dominik Laskowski
Remove a special case for the default display by tracking the enabled state per display. Bug: 241285876 Bug: 355424160 Flag: EXEMPT refactor Test: presubmit Change-Id: Ife697e9f31bdf833910132fb0a71918b29c350eb
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-12SF: Isolate modesetting in DisplayModeController Dominik Laskowski
Move the per-display state machine for modesetting from DisplayDevice to DMC. In lieu of mStateLock, protect display lookup from multiple threads using a mutex internal to DMC, which fixes the following deadlock: OneShotTimer::loop SF::requestDisplayModes mStateLock SF::commit mStateLock SF::processDisplayChangesLocked (hotplug or resolution change) Scheduler::demotePacesetterDisplay OneShotTimer::stop A notable change is that {initiate,finalize}DisplayModeChange(s) are no longer called under mStateLock, thanks to DMC's granular, internal lock. finalizeDisplayModeChange still locks mStateLock for resolution changes. Add an ActiveModeListener to DMC and register a callback in SF to update the refresh rate overlay, which still lives in DisplayDevice for now. Fixes: 329450361 Bug: 241285876 Test: DisplayModeControllerTest Test: libsurfaceflinger_unittest Change-Id: I30ec756f134d2d67a70ac8797008dc792eac035e
2024-05-03SF: Introduce DisplayModeController Dominik Laskowski
DisplayModeController will centralize the logic and state for selecting the DisplayMode of each physical display. For now, register a display's DisplaySnapshot with DMC during configure, and move the creation of its RefreshRateSelector to DMC::registerDisplay. Bug: 241285876 Test: presubmit Change-Id: I673914328bea64636b8bcd193e710131926334a5
2024-02-15SF: Add details to setDesiredMode trace and log Dominik Laskowski
Trace/log the display ID, and print the DisplayModeRequest. Remove a superfluous run-time assertion about display ID mismatch, as it cannot happen, which I5a74d58b3feb3a71fc3d85393a509af86f1b0274 will make clearer. Fixes: 318533819 Test: Perfetto and logcat Change-Id: I77defbcf9b1e3c4332838586f60c125a13e2978c
2024-02-09Reland^2 "SF: Set an initial mode [...] for external displays" Dominik Laskowski
Rebased and modified from Iec154c488ef7af9b8e1d6386509e97c9ce85103b, patch set 3. Does not include I688b0c922747a80e881965a1dc243d11ba2c7438, which was reverted. DM currently always picks 1080p@60 for an external display. More work (tracked in b/318534874) needs to be done in SF in order to use that mode initially. In the meantime, have SF pick the same mode on hotplug so that it avoids extra mode switches. Move "force" into DisplayModeRequest. If a request is already pending this allows forcing the final request if a pending request forced it, even if the new request does not. This matches how emitEvent is handled. If a DisplayModeRequest is forced, don't early exit in initiateDisplayModeChanges, which does not honor "force". When loading display modes for an external display, look for 1080p@60 and treat it as the active mode. If the display does not have 1080p@60, pick the mode closest to (but not exceeding) 1080p@60. DM will pick an appropriate mode later. When adding that display, apply that active mode so it will be used by SF. Fixes: 305813445 Test: libsurfaceflinger_unittest Test: YouTube is not frozen or choppy on external display hotplug. Test: Remove the option of 1080p@60 and connect. Change-Id: Ibb15df1c2c0ab162c11895219d8f4bb749c474a1
2024-02-07Revert^2 "SF: Set an initial mode [...] for external displays" Dominik Laskowski
This reverts commit f091fe5a29ee55a1c53f2f09b8cca0306e7cfd91. Reason for revert: b/323907059 Fixes: 323907059 Test: presubmit Change-Id: Ic857349d7c3dbe2cfda8bfd5f6a695eb845c1d93
2024-01-31Reland "SF: Set an initial mode [...] for external displays" Dominik Laskowski
Rebased and modified from Iec154c488ef7af9b8e1d6386509e97c9ce85103b, patch set 3. Does not include I688b0c922747a80e881965a1dc243d11ba2c7438, which was reverted. DM currently always picks 1080p@60 for an external display. More work (tracked in b/318534874) needs to be done in SF in order to use that mode initially. In the meantime, have SF pick the same mode on hotplug so that it avoids extra mode switches. Move "force" into DisplayModeRequest. If a request is already pending this allows forcing the final request if a pending request forced it, even if the new request does not. This matches how emitEvent is handled. If a DisplayModeRequest is forced, don't early exit in initiateDisplayModeChanges, which does not honor "force". When loading display modes for an external display, look for 1080p@60 and treat it as the active mode. If the display does not have 1080p@60, pick the mode closest to (but not exceeding) 1080p@60. DM will pick an appropriate mode later. When adding that display, apply that active mode so it will be used by SF. Fixes: 305813445 Test: libsurfaceflinger_unittest Test: YouTube is not frozen or choppy on external display hotplug. Test: Remove the option of 1080p@60 and connect. Change-Id: I6864d88b327e0f207947b44ce14b97f323170714
2024-01-22Revert "SF: Set an initial mode in response to hotplug for external displays" Petri Gynther
This reverts commit fb078ab329818c116104f61e7c67c3b2ae9a8152. Reason for revert: b/320901698 Bug: 320901698 Change-Id: Ia714380dade4f2eeb5d369713405f33d548b6e40
2024-01-17SF: Set an initial mode in response to hotplug for external displays Dominik Laskowski
Rebased and modified from Iec154c488ef7af9b8e1d6386509e97c9ce85103b, patch set 3. Does not include I688b0c922747a80e881965a1dc243d11ba2c7438, which was reverted. DM currently always picks 1080p@60 for an external display. More work (tracked in b/318534874) needs to be done in SF in order to use that mode initially. In the meantime, have SF pick the same mode on hotplug so that it avoids extra mode switches. Move "force" into DisplayModeRequest. If a request is already pending this allows forcing the final request if a pending request forced it, even if the new request does not. This matches how emitEvent is handled. If a DisplayModeRequest is forced, don't early exit in initiateDisplayModeChanges, which does not honor "force". When loading display modes for an external display, look for 1080p@60 and treat it as the active mode. If the display does not have 1080p@60, pick a 60hz mode (if available) closest to 1080p. DM will pick an appropriate mode later. When adding that display, apply that active mode so it will be used by SF. Fixes: 305813445 Test: libsurfaceflinger_unittest Test: YouTube is not frozen or choppy on external display hotplug. Test: Remove the option of 1080p@60 and connect. Change-Id: Idd48fbb0aab1b500a1a074ce0984c0a253a865c0
2023-05-08ui: Pull DisplayMap.h from SF Dominik Laskowski
...so it can be used in more places, e.g. libscheduler headers. Clean up the verbose type for the frontend::DisplayInfo map by aliasing it as frontend::DisplayInfos. Bug: 241285475 Fixes: 256881188 Test: Build Change-Id: Idf36e20ca304190e43618a6cfd7c67e8f62e9d40
2022-11-28SF: add render frame rate to the scheduler Ady Abraham
Schedule SF at the rate of the render frame rate instead of the display refresh rate. Test: SF unit tests Bug: 257072060 Change-Id: Idaf9be5f25373d38c0ef6440f9f401dc90de7a91
2022-10-24SF: Clean up API for refresh rate selection Dominik Laskowski
Define types for each step: ScoredRefreshRate, RefreshRateRanking, RankedRefreshRates, DisplayModeChoice, and DisplayModeRequest. The last will replace DisplayDevice::ActiveModeInfo in a follow-up CL. Add Scheduler::mLeaderDisplayId (always the primary display for now) and provisionally use its DisplayModeChoice until Scheduler::Policy is tracked per display. Rewrite multi-display tests, which relied on each DisplayMode having the same PhysicalDisplayId, and did not actually verify mode/display association (`expectedDisplays` was unused). Test RefreshRateRanking ordering by descending score. Bug: 241285191 Test: libsurfaceflinger_unittest Change-Id: I1d24d6a1fa9285aa7fc4bf2dd6654fa660d27b08
2022-10-13SF: Simplify per-display refresh rate selection Dominik Laskowski
Remove verbose, single-use helper functions/types to centralize the selection logic and merge two passes. Avoid allocation and hashing. Fix the algorithm to not choose a refresh rate based on total score unless it is common to all displays, and not be thrown off by equal scores. Bug: 241285191 Test: libsurfaceflinger_unittest Change-Id: I355dea767c6b564a04a51476f0cc235a1fceb879
2022-09-30SF: Move color modes to DisplaySnapshot Dominik Laskowski
Bug: 241285876 Test: dumpsys SurfaceFlinger --displays Test: dumpsys SurfaceFlinger --wide-color Change-Id: Ib546cd66950155102dbe021a2a764ad2c47d27fa
2022-09-29SF: Add utility class for dumpsys formatting Dominik Laskowski
The Dumper class automates stringifying (a minimal set of types for now) and indenting. Bug: 241285876 Test: dumpsys SurfaceFlinger --displays Change-Id: I5581cd9cb4235e2c710e303b6ab634847554cc30
2022-09-08SF: Introduce DisplaySnapshot Dominik Laskowski
DisplaySnapshot stores the immutable state of a physical display, captured on hotplug. The SurfaceFlinger class stores a map from PhysicalDisplayId to PhysicalDisplay, a new class that augments this state with the sp<DisplayToken>. Later, DisplayDevice will be removed, and SF::mDisplays will map wp<DisplayToken> to compositionengine::Display. Bug: 241285876 Test: libsurfaceflinger_unittest Test: dumpsys SurfaceFlinger --displays Change-Id: I172df87c4a7a9cf64659ff9cfbd6df195ee4bc8d