Only enumerate display_timing when present timestamp supported
Test: CTS and cube demo.
Bug: 36887025
Vulkan should only enumerate the VK_GOOGLE_display_timing extension if
the device supports reliably returning the present timestamp. Vulkan
will determine this by reading a property that SurfaceFlinger will set
(based on the HWC2::Capability::PresentFenceIsNotReliable capability).
Change-Id: I6025be5f9120a8f02f228b8437b64be4ff8cfb17
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index d72b3b5..61ceda4 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -578,6 +578,14 @@
Mutex::Autolock _l(mStateLock);
+ // Inform native graphics APIs whether the present timestamp is supported:
+ if (getHwComposer().hasCapability(
+ HWC2::Capability::PresentFenceIsNotReliable)) {
+ property_set(kTimestampProperty, "0");
+ } else {
+ property_set(kTimestampProperty, "1");
+ }
+
if (useVrFlinger) {
auto vrFlingerRequestDisplayCallback = [this] (bool requestDisplay) {
mVrFlingerRequestsDisplay = requestDisplay;