From c23fcd04886477f1c8026948ed01f81bca082699 Mon Sep 17 00:00:00 2001 From: Tom Murphy Date: Wed, 13 Mar 2024 10:22:06 +0000 Subject: Add engine name to GpuStatsAppInfo The engine name from VkApplicationInfo is useful for collection metrics on Vulkan usage. Add it to the collected metrics in GpuStatsAppInfo. Bug: 330118952 Test: adb shell dumpsys gpu Test: atest GpuStatsTest Change-Id: If4096b8a96ed77ddb1d2fd9f48c2b8825b3d0280 --- vulkan/libvulkan/driver.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vulkan/libvulkan/driver.cpp') diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp index 81fd1185b6..7ea98f5469 100644 --- a/vulkan/libvulkan/driver.cpp +++ b/vulkan/libvulkan/driver.cpp @@ -1372,6 +1372,11 @@ VkResult CreateInstance(const VkInstanceCreateInfo* pCreateInfo, android::GraphicsEnv::getInstance().setTargetStats( android::GpuStatsInfo::Stats::CREATED_VULKAN_API_VERSION, vulkanApiVersion); + + if (pCreateInfo->pApplicationInfo->pEngineName) { + android::GraphicsEnv::getInstance().addVulkanEngineName( + pCreateInfo->pApplicationInfo->pEngineName); + } } // Update stats for the extensions requested -- cgit v1.2.3-59-g8ed1b From 7b48c207960226c57c5be154f7f84be73c4bd4a6 Mon Sep 17 00:00:00 2001 From: Jörg Wagner Date: Mon, 13 May 2024 19:44:08 +0000 Subject: Filter hook entry points by ICD entry point presence For device proc hooks which intercept core functions check whether there exists an exposed core function from the ICD, and skip exposure if none is found. This avoids having to replicate exposure filtering based on requested Vulkan API versions inside the Loader - rely on the ICD to handle it correctly. Bug: 309752984 Change-Id: Ibeb13dae8eccaa859072ee5233013d99d5b26ef0 --- vulkan/libvulkan/driver.cpp | 8 +++++++- vulkan/scripts/driver_generator.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'vulkan/libvulkan/driver.cpp') diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp index 7ea98f5469..3f89960e32 100644 --- a/vulkan/libvulkan/driver.cpp +++ b/vulkan/libvulkan/driver.cpp @@ -964,14 +964,20 @@ PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName) { PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pName) { const ProcHook* hook = GetProcHook(pName); + PFN_vkVoidFunction drv_func = GetData(device).driver.GetDeviceProcAddr(device, pName); + if (!hook) - return GetData(device).driver.GetDeviceProcAddr(device, pName); + return drv_func; if (hook->type != ProcHook::DEVICE) { ALOGE("internal vkGetDeviceProcAddr called for %s", pName); return nullptr; } + // Don't hook if we don't have a device entry function below for the core function. + if (!drv_func && (hook->extension >= ProcHook::EXTENSION_CORE_1_0)) + return nullptr; + return (GetData(device).hook_extensions[hook->extension]) ? hook->proc : nullptr; } diff --git a/vulkan/scripts/driver_generator.py b/vulkan/scripts/driver_generator.py index 78b550c202..48c0ae9304 100644 --- a/vulkan/scripts/driver_generator.py +++ b/vulkan/scripts/driver_generator.py @@ -239,6 +239,8 @@ struct ProcHook { f.write(gencom.indent(2) + gencom.base_ext_name(ext) + ',\n') f.write('\n') + # EXTENSION_CORE_xxx API list must be the last set of enums after the extensions. + # This allows to easily identify "a" core function hook for version in gencom.version_code_list: f.write(gencom.indent(2) + 'EXTENSION_CORE_' + version + ',\n') -- cgit v1.2.3-59-g8ed1b