goldfish hwc drm: Use atomic modeset, export sync fd, respect modesetting's refresh rate
Bug: 177241396
We now use atomic modeset instead of setCrtc to post the color buffer.
This is because we can only export a sync fd to userspace using the
atomic modeset api. Sync fds to userspace from hwc are required in some
applications.
We also respect the size of the bo being posted in case the dimensions
of the posted bo do not equal the dimensions of the display.
Finally, we use the refresh rate as derived from the current crtc's
mode.
We also add a flag to support operating with either goldfish or drm
depending on whether the system is running with minigbm.
Test: launch_cvd --gpu_mode=gfxstream with androidboot.hardware.hwcomposer=ranchu. Display works
TODO: Support multiple crtcs/planes and variable refresh rate
TODO: In minigbm mode, the exported sync fd is actually provided by DRM.
This means that we don't actually need to call rcCreateSyncKHR after
rcComposeAsyncWithoutPost. We can instead create the sync object that
rcCreateSyncKHR would have created, on the host instead, as part of
rcComposeAsyncWithoutPost, and do a server side wait (via glWaitSync or
vkQueueSubmit with wait semaphore) on the host when rcFBPost is called.
Thus we can potentially move this synchronization to the host, which is
a cleaner design.
Change-Id: If74ecec7dd636d730638f68f6004c01635862dcc
2 files changed