Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 53a296d2 authored by Jason Macnak's avatar Jason Macnak
Browse files

Map SurfaceFlinger display mode ids to Display.Mode ids

Noticed while trying to switch Cuttlefish to HWComposer3
with ag/16624862. By default, Cuttlefish has a single display
with a single config:

`RanchuHwc: config: id: 0 w:720 h:1280 dpi-x:320 dpi-y:320 ...`

In `LocalDeviceDisplay::updateDisplayModesLocked()`, the display
config ids which come from HWComposer via SurfaceFlinger are mapped
to DisplayRecord's Display.Mode's `mModeId` which are globally
unique ids created from the atomic integer
`DisplayAdapter.NEXT_DISPLAY_MODE_ID` (which defaults to 1).

However, the preferred display config id (`mSystemPreferredModeId`)
was not being mapped. This would lead to boot failures such as:

`
AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: android.anim
AndroidRuntime: java.lang.IllegalStateException: Unable to locate mode 0
`

with ag/16774826 because `mDefaultModeId` was being set to
`mSystemPreferredModeId` which was the unmapped `0` from HWComposer.

(Perhaps the need for this change suggests there should be strongly
typed integers to represent the different id spaces,
`SurfaceFlingerModeId` vs `DisplayAdapaterModeId` or something)

Bug: b/193240715
Test: lunch cf_x86_64_phone-userdebug && cherry-pick ag/16624862 &&
      m && cvd start
Change-Id: I8fc0fca6816e037196f51d256430fad480f3b0ff
parent f0d48baf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment