swapchain: support RGBX backed opaque swapchain for offscreen
When a swapchain is connected to SurfaceFlinger, it makes sense to only
advertise INHERIT bit on Android. However, for offscreen scenarios, e.g.
a video encoder surface, that currently shuts the door for preferring
RGBX over RGBA for the requested VK_FORMAT_R8G8B8A8_* format, ending up
with suboptimal performance when using Vulkan swapchain.
This change advertises the OPAQUE bit for offscreen scenarios, and adds
the code path to prefer RGBX as the backing storage when OPAQUE is used.
This bridges a gap against EGL where GL_RGB8 is used for such encoder
surface, which internally picks RGBX. This casts no regressions for
anything currently going to the display via KHR_swapchain.
Bug: b/328125698, b/328122401
Test: below tests pass with ANGLE on Zork device (AMD chromebook)
1. android.media.encoder.cts.SurfaceEncodeTimestampTest
2. android.media.codec.cts.EncodeDecodeTest
- testEncodeDecodeVideoFromSurfaceToPersistentSurface
- testEncodeDecodeVideoFromSurfaceToPersistentSurfaceNdk
Change-Id: I82a7ac741dc70a3e3b5fdd4f7499c937c4dce6d8
1 file changed