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: 039078fe97 ("zink: slight refactor of load_device_extensions()")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13360>
This commit is contained in:
Mike Blumenkrantz 2021-10-14 10:13:25 -04:00 committed by Marge Bot
parent 061610a7dd
commit 11dd9e4ee4

View file

@ -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;
}