Fix getDisplayInfo() for SurfaceFlinger in HWC2 mode.
When HWC2 mode is enabled in SurfaceFlinger, the getDisplayInfo() function would fail to return the correct active mode in some cases. This bug was only noticable if you had more than one mode registered by the HWC2 backend. The SurfaceComposerClient::getDisplayInfo() function works by calling getDisplayConfigs(), and de-referencing the config at the index returned by getActiveConfig(). The active config returned was correct, but the getDisplayConfigs() array was not properly sorted. Tracing this back, this problem occurs because the configId is stored alongside the config in an unordered_map, so when this is converted to a vector and the configId is discarded, the conversion must be sorted correctly; it can't just be the hash order returned from the unordered_map. There are a few ways to fix this problem, but the easiest was to nip the problem in the bud by not allowing an unsorted list of configs to exist on the base HWC2 class. It may be better still to just get rid of the map and go back to a vector, as this data is more often used as an array than it is indexed by configId, so the use of an unordered_map was probably overkill. Change-Id: Ibfb015a6d9b49c870f37a1c892f15f90abbd1e2c Bug: 62617569 Test: ./cts-tradefed run cts -m CtsViewTestCases -t android.view.cts.DisplayRefreshRateTest#testRefreshRate
Loading
Please register or sign in to comment