From 356042291c7ee26341726518f7fb5d312947d725 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Fri, 12 Nov 2021 19:40:51 +0000 Subject: [PATCH] vkr: let vkr_device to track device entry point get_memory_fd Signed-off-by: Yiwei Zhang Reviewed-by: Chia-I Wu --- src/venus/vkr_context.c | 16 ++++++++-------- src/venus/vkr_device.c | 2 ++ src/venus/vkr_device.h | 1 + src/venus/vkr_instance.c | 2 -- src/venus/vkr_instance.h | 1 - 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/venus/vkr_context.c b/src/venus/vkr_context.c index 82ebe4b..fe41a2d 100644 --- a/src/venus/vkr_context.c +++ b/src/venus/vkr_context.c @@ -322,14 +322,14 @@ vkr_context_get_blob_locked(struct virgl_context *base, return -EINVAL; } - VkResult result = ctx->instance->get_memory_fd( - mem->device->base.handle.device, - &(VkMemoryGetFdInfoKHR){ - .sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR, - .memory = mem->base.handle.device_memory, - .handleType = handle_type, - }, - &fd); + VkResult result = + mem->device->get_memory_fd(mem->device->base.handle.device, + &(VkMemoryGetFdInfoKHR){ + .sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR, + .memory = mem->base.handle.device_memory, + .handleType = handle_type, + }, + &fd); if (result != VK_SUCCESS) return -EINVAL; } diff --git a/src/venus/vkr_device.c b/src/venus/vkr_device.c index 018318f..41ccb95 100644 --- a/src/venus/vkr_device.c +++ b/src/venus/vkr_device.c @@ -139,6 +139,8 @@ vkr_device_init_entry_points(struct vkr_device *dev, uint32_t api_version) (PFN_vkGetImageDrmFormatModifierPropertiesEXT)vkGetDeviceProcAddr( handle, "vkGetImageDrmFormatModifierPropertiesEXT"); + dev->get_memory_fd = + (PFN_vkGetMemoryFdKHR)vkGetDeviceProcAddr(handle, "vkGetMemoryFdKHR"); dev->get_memory_fd_properties = (PFN_vkGetMemoryFdPropertiesKHR)vkGetDeviceProcAddr( handle, "vkGetMemoryFdPropertiesKHR"); } diff --git a/src/venus/vkr_device.h b/src/venus/vkr_device.h index 0b4eb3f..db466b6 100644 --- a/src/venus/vkr_device.h +++ b/src/venus/vkr_device.h @@ -39,6 +39,7 @@ struct vkr_device { PFN_vkGetImageDrmFormatModifierPropertiesEXT get_image_drm_format_modifier_properties; + PFN_vkGetMemoryFdKHR get_memory_fd; PFN_vkGetMemoryFdPropertiesKHR get_memory_fd_properties; struct list_head queues; diff --git a/src/venus/vkr_instance.c b/src/venus/vkr_instance.c index 363ef9a..c55299f 100644 --- a/src/venus/vkr_instance.c +++ b/src/venus/vkr_instance.c @@ -196,8 +196,6 @@ vkr_dispatch_vkCreateInstance(struct vn_dispatch_context *dispatch, return; } - instance->get_memory_fd = (PFN_vkGetMemoryFdKHR)vkGetInstanceProcAddr( - instance->base.handle.instance, "vkGetMemoryFdKHR"); instance->get_fence_fd = (PFN_vkGetFenceFdKHR)vkGetInstanceProcAddr( instance->base.handle.instance, "vkGetFenceFdKHR"); diff --git a/src/venus/vkr_instance.h b/src/venus/vkr_instance.h index 38e3034..2552ae9 100644 --- a/src/venus/vkr_instance.h +++ b/src/venus/vkr_instance.h @@ -14,7 +14,6 @@ struct vkr_instance { uint32_t api_version; PFN_vkCreateDebugUtilsMessengerEXT create_debug_utils_messenger; PFN_vkDestroyDebugUtilsMessengerEXT destroy_debug_utils_messenger; - PFN_vkGetMemoryFdKHR get_memory_fd; PFN_vkGetFenceFdKHR get_fence_fd; VkDebugUtilsMessengerEXT validation_messenger;