Mesa (staging/21.3): zink: use static array for detecting VK_TIME_DOMAIN_DEVICE_EXT
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Oct 19 20:59:46 UTC 2021
Module: Mesa
Branch: staging/21.3
Commit: e8217a5a1b7fc0b345f5047188251e82da1123ce
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8217a5a1b7fc0b345f5047188251e82da1123ce
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Oct 14 10:13:25 2021 -0400
zink: use static array for detecting VK_TIME_DOMAIN_DEVICE_EXT
there's only a few possible values for this, so just use a static array
to avoid leaking
Fixes: 039078fe972 ("zink: slight refactor of load_device_extensions()")
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13360>
(cherry picked from commit 11dd9e4ee4a5241ee18cfe68d8bee2ee3da55dc7)
---
.pick_status.json | 2 +-
src/gallium/drivers/zink/zink_screen.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 29398e986f4..1c8a1452baa 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -562,7 +562,7 @@
"description": "zink: use static array for detecting VK_TIME_DOMAIN_DEVICE_EXT",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "039078fe9720797f5eaa109a7e9d27841eb6bc73"
},
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index 5f574010bba..10207633c0a 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1337,10 +1337,11 @@ static bool
check_have_device_time(struct zink_screen *screen)
{
uint32_t num_domains = 0;
+ VkTimeDomainEXT domains[8]; //current max is 4
VKSCR(GetPhysicalDeviceCalibrateableTimeDomainsEXT)(screen->pdev, &num_domains, NULL);
assert(num_domains > 0);
+ assert(num_domains < ARRAY_SIZE(domains));
- VkTimeDomainEXT *domains = malloc(sizeof(VkTimeDomainEXT) * num_domains);
VKSCR(GetPhysicalDeviceCalibrateableTimeDomainsEXT)(screen->pdev, &num_domains, domains);
/* VK_TIME_DOMAIN_DEVICE_EXT is used for the ctx->get_timestamp hook and is the only one we really need */
@@ -1350,7 +1351,6 @@ check_have_device_time(struct zink_screen *screen)
}
}
- free(domains);
return false;
}
More information about the mesa-commit
mailing list