Mesa (staging/20.1): vulkan: make VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT conditional
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 2 13:58:49 UTC 2020
Module: Mesa
Branch: staging/20.1
Commit: 3ac208e222a0d681c944a463e2768f6e9530c687
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ac208e222a0d681c944a463e2768f6e9530c687
Author: Jonathan Gray <jsg at jsg.id.au>
Date: Tue Sep 1 12:13:43 2020 +1000
vulkan: make VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT conditional
Only advertise VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT if CLOCK_MONOTONIC_RAW
is defined. Fixes the build on OpenBSD which has CLOCK_MONOTONIC but not
CLOCK_MONOTONIC_RAW.
Fixes: 67a2c1493c0 ("vulkan: Add VK_EXT_calibrated_timestamps extension (radv and anv) [v5]")
Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6517>
(cherry picked from commit 4500e6e460dca068157862b95c7534d7d163c42c)
---
.pick_status.json | 2 +-
src/amd/vulkan/radv_device.c | 14 ++++++++++++++
src/intel/vulkan/anv_device.c | 14 ++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/.pick_status.json b/.pick_status.json
index d0e0d759ec6..c44c803c138 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -85,7 +85,7 @@
"description": "vulkan: make VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT conditional",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "67a2c1493c068281936fecba9fa6784becf08f8e"
},
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 90f810d40f0..3fd6c86ef19 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -7700,7 +7700,9 @@ radv_GetDeviceGroupPeerMemoryFeatures(
static const VkTimeDomainEXT radv_time_domains[] = {
VK_TIME_DOMAIN_DEVICE_EXT,
VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT,
+#ifdef CLOCK_MONOTONIC_RAW
VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT,
+#endif
};
VkResult radv_GetPhysicalDeviceCalibrateableTimeDomainsEXT(
@@ -7727,8 +7729,10 @@ radv_clock_gettime(clockid_t clock_id)
int ret;
ret = clock_gettime(clock_id, ¤t);
+#ifdef CLOCK_MONOTONIC_RAW
if (ret < 0 && clock_id == CLOCK_MONOTONIC_RAW)
ret = clock_gettime(CLOCK_MONOTONIC, ¤t);
+#endif
if (ret < 0)
return 0;
@@ -7748,7 +7752,11 @@ VkResult radv_GetCalibratedTimestampsEXT(
uint64_t begin, end;
uint64_t max_clock_period = 0;
+#ifdef CLOCK_MONOTONIC_RAW
begin = radv_clock_gettime(CLOCK_MONOTONIC_RAW);
+#else
+ begin = radv_clock_gettime(CLOCK_MONOTONIC);
+#endif
for (d = 0; d < timestampCount; d++) {
switch (pTimestampInfos[d].timeDomain) {
@@ -7763,16 +7771,22 @@ VkResult radv_GetCalibratedTimestampsEXT(
max_clock_period = MAX2(max_clock_period, 1);
break;
+#ifdef CLOCK_MONOTONIC_RAW
case VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT:
pTimestamps[d] = begin;
break;
+#endif
default:
pTimestamps[d] = 0;
break;
}
}
+#ifdef CLOCK_MONOTONIC_RAW
end = radv_clock_gettime(CLOCK_MONOTONIC_RAW);
+#else
+ end = radv_clock_gettime(CLOCK_MONOTONIC);
+#endif
/*
* The maximum deviation is the sum of the interval over which we
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 8965c168aa0..17d2d704712 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -4337,7 +4337,9 @@ void anv_DestroyFramebuffer(
static const VkTimeDomainEXT anv_time_domains[] = {
VK_TIME_DOMAIN_DEVICE_EXT,
VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT,
+#ifdef CLOCK_MONOTONIC_RAW
VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT,
+#endif
};
VkResult anv_GetPhysicalDeviceCalibrateableTimeDomainsEXT(
@@ -4364,8 +4366,10 @@ anv_clock_gettime(clockid_t clock_id)
int ret;
ret = clock_gettime(clock_id, ¤t);
+#ifdef CLOCK_MONOTONIC_RAW
if (ret < 0 && clock_id == CLOCK_MONOTONIC_RAW)
ret = clock_gettime(CLOCK_MONOTONIC, ¤t);
+#endif
if (ret < 0)
return 0;
@@ -4388,7 +4392,11 @@ VkResult anv_GetCalibratedTimestampsEXT(
uint64_t begin, end;
uint64_t max_clock_period = 0;
+#ifdef CLOCK_MONOTONIC_RAW
begin = anv_clock_gettime(CLOCK_MONOTONIC_RAW);
+#else
+ begin = anv_clock_gettime(CLOCK_MONOTONIC);
+#endif
for (d = 0; d < timestampCount; d++) {
switch (pTimestampInfos[d].timeDomain) {
@@ -4408,16 +4416,22 @@ VkResult anv_GetCalibratedTimestampsEXT(
max_clock_period = MAX2(max_clock_period, 1);
break;
+#ifdef CLOCK_MONOTONIC_RAW
case VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT:
pTimestamps[d] = begin;
break;
+#endif
default:
pTimestamps[d] = 0;
break;
}
}
+#ifdef CLOCK_MONOTONIC_RAW
end = anv_clock_gettime(CLOCK_MONOTONIC_RAW);
+#else
+ end = anv_clock_gettime(CLOCK_MONOTONIC);
+#endif
/*
* The maximum deviation is the sum of the interval over which we
More information about the mesa-commit
mailing list