vkr: advertise external memory extensions

Advertise VK_KHR_external_memory_fd and VK_EXT_external_memory_dma_buf.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
macos/master
Chia-I Wu 4 years ago
parent 827b32ec1d
commit b596ca1420
  1. 2
      src/venus-protocol/vn_protocol_renderer.h
  2. 21
      src/venus-protocol/vn_protocol_renderer_defines.h
  3. 3
      src/venus-protocol/vn_protocol_renderer_device_memory.h
  4. 6
      src/venus-protocol/vn_protocol_renderer_dispatches.h
  5. 10
      src/venus-protocol/vn_protocol_renderer_info.h
  6. 7
      src/venus-protocol/vn_protocol_renderer_transport.h
  7. 2
      src/vkr_renderer.c

@ -1,4 +1,4 @@
/* This file is generated by venus-protocol git-0f26f4b9. */ /* This file is generated by venus-protocol git-3f14eafb. */
/* /*
* Copyright 2020 Google LLC * Copyright 2020 Google LLC

@ -249,6 +249,8 @@ typedef enum VkCommandTypeEXT {
VK_COMMAND_TYPE_vkCmdBeginQueryIndexedEXT_EXT = 184, VK_COMMAND_TYPE_vkCmdBeginQueryIndexedEXT_EXT = 184,
VK_COMMAND_TYPE_vkCmdEndQueryIndexedEXT_EXT = 185, VK_COMMAND_TYPE_vkCmdEndQueryIndexedEXT_EXT = 185,
VK_COMMAND_TYPE_vkCmdDrawIndirectByteCountEXT_EXT = 186, VK_COMMAND_TYPE_vkCmdDrawIndirectByteCountEXT_EXT = 186,
VK_COMMAND_TYPE_vkGetMemoryFdKHR_EXT = 193,
VK_COMMAND_TYPE_vkGetMemoryFdPropertiesKHR_EXT = 194,
VK_COMMAND_TYPE_vkGetImageDrmFormatModifierPropertiesEXT_EXT = 187, VK_COMMAND_TYPE_vkGetImageDrmFormatModifierPropertiesEXT_EXT = 187,
VK_COMMAND_TYPE_vkSetReplyCommandStreamMESA_EXT = 178, VK_COMMAND_TYPE_vkSetReplyCommandStreamMESA_EXT = 178,
VK_COMMAND_TYPE_vkSeekReplyCommandStreamMESA_EXT = 179, VK_COMMAND_TYPE_vkSeekReplyCommandStreamMESA_EXT = 179,
@ -1425,6 +1427,23 @@ struct vn_command_vkGetPhysicalDeviceExternalBufferProperties {
VkExternalBufferProperties* pExternalBufferProperties; VkExternalBufferProperties* pExternalBufferProperties;
}; };
struct vn_command_vkGetMemoryFdKHR {
VkDevice device;
const VkMemoryGetFdInfoKHR* pGetFdInfo;
int* pFd;
VkResult ret;
};
struct vn_command_vkGetMemoryFdPropertiesKHR {
VkDevice device;
VkExternalMemoryHandleTypeFlagBits handleType;
int fd;
VkMemoryFdPropertiesKHR* pMemoryFdProperties;
VkResult ret;
};
struct vn_command_vkGetPhysicalDeviceExternalSemaphoreProperties { struct vn_command_vkGetPhysicalDeviceExternalSemaphoreProperties {
VkPhysicalDevice physicalDevice; VkPhysicalDevice physicalDevice;
const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo; const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo;
@ -1901,6 +1920,8 @@ struct vn_dispatch_context {
void (*dispatch_vkGetPhysicalDeviceSparseImageFormatProperties2)(struct vn_dispatch_context *ctx, struct vn_command_vkGetPhysicalDeviceSparseImageFormatProperties2 *args); void (*dispatch_vkGetPhysicalDeviceSparseImageFormatProperties2)(struct vn_dispatch_context *ctx, struct vn_command_vkGetPhysicalDeviceSparseImageFormatProperties2 *args);
void (*dispatch_vkTrimCommandPool)(struct vn_dispatch_context *ctx, struct vn_command_vkTrimCommandPool *args); void (*dispatch_vkTrimCommandPool)(struct vn_dispatch_context *ctx, struct vn_command_vkTrimCommandPool *args);
void (*dispatch_vkGetPhysicalDeviceExternalBufferProperties)(struct vn_dispatch_context *ctx, struct vn_command_vkGetPhysicalDeviceExternalBufferProperties *args); void (*dispatch_vkGetPhysicalDeviceExternalBufferProperties)(struct vn_dispatch_context *ctx, struct vn_command_vkGetPhysicalDeviceExternalBufferProperties *args);
void (*dispatch_vkGetMemoryFdKHR)(struct vn_dispatch_context *ctx, struct vn_command_vkGetMemoryFdKHR *args);
void (*dispatch_vkGetMemoryFdPropertiesKHR)(struct vn_dispatch_context *ctx, struct vn_command_vkGetMemoryFdPropertiesKHR *args);
void (*dispatch_vkGetPhysicalDeviceExternalSemaphoreProperties)(struct vn_dispatch_context *ctx, struct vn_command_vkGetPhysicalDeviceExternalSemaphoreProperties *args); void (*dispatch_vkGetPhysicalDeviceExternalSemaphoreProperties)(struct vn_dispatch_context *ctx, struct vn_command_vkGetPhysicalDeviceExternalSemaphoreProperties *args);
void (*dispatch_vkGetPhysicalDeviceExternalFenceProperties)(struct vn_dispatch_context *ctx, struct vn_command_vkGetPhysicalDeviceExternalFenceProperties *args); void (*dispatch_vkGetPhysicalDeviceExternalFenceProperties)(struct vn_dispatch_context *ctx, struct vn_command_vkGetPhysicalDeviceExternalFenceProperties *args);
void (*dispatch_vkEnumeratePhysicalDeviceGroups)(struct vn_dispatch_context *ctx, struct vn_command_vkEnumeratePhysicalDeviceGroups *args); void (*dispatch_vkEnumeratePhysicalDeviceGroups)(struct vn_dispatch_context *ctx, struct vn_command_vkEnumeratePhysicalDeviceGroups *args);

@ -13,6 +13,7 @@
/* /*
* These structs/unions/commands are not included * These structs/unions/commands are not included
* *
* VkImportMemoryFdInfoKHR
* vkMapMemory * vkMapMemory
*/ */
@ -353,6 +354,7 @@ vn_decode_VkMemoryAllocateInfo_pnext_temp(struct vn_cs_decoder *dec)
vn_decode_VkImportMemoryResourceInfoMESA_self_temp(dec, (VkImportMemoryResourceInfoMESA *)pnext); vn_decode_VkImportMemoryResourceInfoMESA_self_temp(dec, (VkImportMemoryResourceInfoMESA *)pnext);
} }
break; break;
case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR:
default: default:
/* unexpected struct */ /* unexpected struct */
pnext = NULL; pnext = NULL;
@ -417,6 +419,7 @@ vn_replace_VkMemoryAllocateInfo_handle(VkMemoryAllocateInfo *val)
case VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA: case VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA:
vn_replace_VkImportMemoryResourceInfoMESA_handle_self((VkImportMemoryResourceInfoMESA *)pnext); vn_replace_VkImportMemoryResourceInfoMESA_handle_self((VkImportMemoryResourceInfoMESA *)pnext);
break; break;
case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR:
default: default:
/* ignore unknown/unsupported struct */ /* ignore unknown/unsupported struct */
break; break;

@ -232,12 +232,14 @@ static inline const char *vn_dispatch_command_name(VkCommandTypeEXT type)
case VK_COMMAND_TYPE_vkGetDeviceProcAddr_EXT: return "vkGetDeviceProcAddr"; case VK_COMMAND_TYPE_vkGetDeviceProcAddr_EXT: return "vkGetDeviceProcAddr";
case VK_COMMAND_TYPE_vkGetInstanceProcAddr_EXT: return "vkGetInstanceProcAddr"; case VK_COMMAND_TYPE_vkGetInstanceProcAddr_EXT: return "vkGetInstanceProcAddr";
case VK_COMMAND_TYPE_vkMapMemory_EXT: return "vkMapMemory"; case VK_COMMAND_TYPE_vkMapMemory_EXT: return "vkMapMemory";
case VK_COMMAND_TYPE_vkGetMemoryFdKHR_EXT: return "vkGetMemoryFdKHR";
case VK_COMMAND_TYPE_vkGetMemoryFdPropertiesKHR_EXT: return "vkGetMemoryFdPropertiesKHR";
case VK_COMMAND_TYPE_vkUpdateDescriptorSetWithTemplate_EXT: return "vkUpdateDescriptorSetWithTemplate"; case VK_COMMAND_TYPE_vkUpdateDescriptorSetWithTemplate_EXT: return "vkUpdateDescriptorSetWithTemplate";
default: return "unknown"; default: return "unknown";
} }
} }
static void (*const vn_dispatch_table[193])(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags) = { static void (*const vn_dispatch_table[195])(struct vn_dispatch_context *ctx, VkCommandFlagsEXT flags) = {
[VK_COMMAND_TYPE_vkCreateInstance_EXT] = vn_dispatch_vkCreateInstance, [VK_COMMAND_TYPE_vkCreateInstance_EXT] = vn_dispatch_vkCreateInstance,
[VK_COMMAND_TYPE_vkDestroyInstance_EXT] = vn_dispatch_vkDestroyInstance, [VK_COMMAND_TYPE_vkDestroyInstance_EXT] = vn_dispatch_vkDestroyInstance,
[VK_COMMAND_TYPE_vkEnumeratePhysicalDevices_EXT] = vn_dispatch_vkEnumeratePhysicalDevices, [VK_COMMAND_TYPE_vkEnumeratePhysicalDevices_EXT] = vn_dispatch_vkEnumeratePhysicalDevices,
@ -437,7 +439,7 @@ static inline void vn_dispatch_command(struct vn_dispatch_context *ctx)
vn_decode_VkCommandTypeEXT(ctx->decoder, &cmd_type); vn_decode_VkCommandTypeEXT(ctx->decoder, &cmd_type);
vn_decode_VkFlags(ctx->decoder, &cmd_flags); vn_decode_VkFlags(ctx->decoder, &cmd_flags);
if (cmd_type < 193 && vn_dispatch_table[cmd_type]) if (cmd_type < 195 && vn_dispatch_table[cmd_type])
vn_dispatch_table[cmd_type](ctx, cmd_flags); vn_dispatch_table[cmd_type](ctx, cmd_flags);
else else
vn_cs_decoder_set_fatal(ctx->decoder); vn_cs_decoder_set_fatal(ctx->decoder);

@ -31,10 +31,11 @@ vn_info_extension_compare(const void *a, const void *b)
static inline uint32_t static inline uint32_t
vn_info_extension_spec_version(const char *name) vn_info_extension_spec_version(const char *name)
{ {
static uint32_t ext_count = 51; static uint32_t ext_count = 53;
static const char *ext_names[51] = { static const char *ext_names[53] = {
"VK_EXT_command_serialization", "VK_EXT_command_serialization",
"VK_EXT_descriptor_indexing", "VK_EXT_descriptor_indexing",
"VK_EXT_external_memory_dma_buf",
"VK_EXT_host_query_reset", "VK_EXT_host_query_reset",
"VK_EXT_image_drm_format_modifier", "VK_EXT_image_drm_format_modifier",
"VK_EXT_sampler_filter_minmax", "VK_EXT_sampler_filter_minmax",
@ -58,6 +59,7 @@ vn_info_extension_spec_version(const char *name)
"VK_KHR_external_fence_capabilities", "VK_KHR_external_fence_capabilities",
"VK_KHR_external_memory", "VK_KHR_external_memory",
"VK_KHR_external_memory_capabilities", "VK_KHR_external_memory_capabilities",
"VK_KHR_external_memory_fd",
"VK_KHR_external_semaphore", "VK_KHR_external_semaphore",
"VK_KHR_external_semaphore_capabilities", "VK_KHR_external_semaphore_capabilities",
"VK_KHR_get_memory_requirements2", "VK_KHR_get_memory_requirements2",
@ -85,11 +87,12 @@ vn_info_extension_spec_version(const char *name)
"VK_KHR_vulkan_memory_model", "VK_KHR_vulkan_memory_model",
"VK_MESA_venus_protocol", "VK_MESA_venus_protocol",
}; };
static const uint32_t ext_versions[51] = { static const uint32_t ext_versions[53] = {
0, 0,
2, 2,
1, 1,
1, 1,
1,
2, 2,
1, 1,
1, 1,
@ -114,6 +117,7 @@ vn_info_extension_spec_version(const char *name)
1, 1,
1, 1,
1, 1,
1,
2, 2,
1, 1,
1, 1,

@ -10,6 +10,13 @@
#include "vn_protocol_renderer_structs.h" #include "vn_protocol_renderer_structs.h"
/*
* These structs/unions/commands are not included
*
* vkGetMemoryFdKHR
* vkGetMemoryFdPropertiesKHR
*/
/* struct VkCommandStreamDescriptionMESA */ /* struct VkCommandStreamDescriptionMESA */
static inline void static inline void

@ -3903,6 +3903,8 @@ vkr_context_init_dispatch(struct vkr_context *ctx)
vkr_dispatch_vkGetPhysicalDeviceSparseImageFormatProperties2; vkr_dispatch_vkGetPhysicalDeviceSparseImageFormatProperties2;
dispatch->dispatch_vkGetPhysicalDeviceExternalBufferProperties = dispatch->dispatch_vkGetPhysicalDeviceExternalBufferProperties =
vkr_dispatch_vkGetPhysicalDeviceExternalBufferProperties; vkr_dispatch_vkGetPhysicalDeviceExternalBufferProperties;
dispatch->dispatch_vkGetMemoryFdKHR = NULL;
dispatch->dispatch_vkGetMemoryFdPropertiesKHR = NULL;
dispatch->dispatch_vkGetPhysicalDeviceExternalSemaphoreProperties = dispatch->dispatch_vkGetPhysicalDeviceExternalSemaphoreProperties =
vkr_dispatch_vkGetPhysicalDeviceExternalSemaphoreProperties; vkr_dispatch_vkGetPhysicalDeviceExternalSemaphoreProperties;
dispatch->dispatch_vkGetPhysicalDeviceExternalFenceProperties = dispatch->dispatch_vkGetPhysicalDeviceExternalFenceProperties =

Loading…
Cancel
Save