drm_hwcomposer: Support DisplayCommand.expectedPresentTime
DisplayCommand.expectedPresentTime indicates that the HWC should present
the composition as close to the desired time as possible. It may be that
the desired time is some number of vsync periods in the future.
A drm atomic commit will always present at the next vsync, and there is
no mechanism for userspace to indicate a desired present time.
Lacking a kernel uAPI to support this, an alternative is to sleep in
userspace until the next expected vsync aligns with the expected present
time.
Change-Id: Iad703eed9b0e459194f895339dd604990875f157
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/hwc3/DrmHwcThree.h b/hwc3/DrmHwcThree.h
index 10470ea..89bcf46 100644
--- a/hwc3/DrmHwcThree.h
+++ b/hwc3/DrmHwcThree.h
@@ -26,6 +26,9 @@
class Hwc3Display : public ::android::FrontendDisplayBase {
public:
bool must_validate = false;
+ // Desired present time for a composition that has been validated but not
+ // yet presented. nullopt means it should be presented at the next vsync.
+ std::optional<int64_t> desired_present_time = std::nullopt;
int64_t next_layer_id = 1;
};