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/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 212d142..f2cd8e6 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -817,9 +817,6 @@
loader_extensions.push_back({
VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME,
VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION});
- loader_extensions.push_back({
- VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME,
- VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION});
if (kEnableUnratifiedExtensions) {
// conditionally add shared_presentable_image if supportable
@@ -832,6 +829,16 @@
}
}
+ // conditionally add VK_GOOGLE_display_timing if present timestamps are
+ // supported by the driver:
+ char timestamp_property[PROPERTY_VALUE_MAX];
+ property_get("service.sf.present_timestamp", timestamp_property, "1");
+ if (strcmp(timestamp_property, "1") == 0) {
+ loader_extensions.push_back({
+ VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME,
+ VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION});
+ }
+
// enumerate our extensions first
if (!pLayerName && pProperties) {
uint32_t count = std::min(