Request dma-buf Vulkan extensions
This CL adds a few Vulkan extensions to be used for importing dma-bufs as VkImages. In particular, we need: - VK_EXT_external_memory_dma_buf - VK_EXT_image_drm_format_modifier BUG=chromium:996470 Change-Id: I7a3dfd0184177c756b07613fbfe140506f54584c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13783 Commit-Queue: Brian Ho <hob@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
39695fd41d
commit
d3123137b1
|
@ -355,6 +355,14 @@ namespace dawn_native { namespace vulkan {
|
||||||
extensionsToRequest.push_back(kExtensionNameKhrExternalMemoryFD);
|
extensionsToRequest.push_back(kExtensionNameKhrExternalMemoryFD);
|
||||||
usedKnobs.externalMemoryFD = true;
|
usedKnobs.externalMemoryFD = true;
|
||||||
}
|
}
|
||||||
|
if (mDeviceInfo.externalMemoryDmaBuf) {
|
||||||
|
extensionsToRequest.push_back(kExtensionNameExtExternalMemoryDmaBuf);
|
||||||
|
usedKnobs.externalMemoryDmaBuf = true;
|
||||||
|
}
|
||||||
|
if (mDeviceInfo.imageDrmFormatModifier) {
|
||||||
|
extensionsToRequest.push_back(kExtensionNameExtImageDrmFormatModifier);
|
||||||
|
usedKnobs.imageDrmFormatModifier = true;
|
||||||
|
}
|
||||||
if (mDeviceInfo.externalMemoryZirconHandle) {
|
if (mDeviceInfo.externalMemoryZirconHandle) {
|
||||||
extensionsToRequest.push_back(kExtensionNameFuchsiaExternalMemory);
|
extensionsToRequest.push_back(kExtensionNameFuchsiaExternalMemory);
|
||||||
usedKnobs.externalMemoryZirconHandle = true;
|
usedKnobs.externalMemoryZirconHandle = true;
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
}
|
}
|
||||||
|
|
||||||
MaybeError VulkanFunctions::LoadDeviceProcs(VkDevice device,
|
MaybeError VulkanFunctions::LoadDeviceProcs(VkDevice device,
|
||||||
const VulkanDeviceKnobs& usedKnobs) {
|
const VulkanDeviceInfo& deviceInfo) {
|
||||||
GET_DEVICE_PROC(AllocateCommandBuffers);
|
GET_DEVICE_PROC(AllocateCommandBuffers);
|
||||||
GET_DEVICE_PROC(AllocateDescriptorSets);
|
GET_DEVICE_PROC(AllocateDescriptorSets);
|
||||||
GET_DEVICE_PROC(AllocateMemory);
|
GET_DEVICE_PROC(AllocateMemory);
|
||||||
|
@ -240,35 +240,35 @@ namespace dawn_native { namespace vulkan {
|
||||||
GET_DEVICE_PROC(UpdateDescriptorSets);
|
GET_DEVICE_PROC(UpdateDescriptorSets);
|
||||||
GET_DEVICE_PROC(WaitForFences);
|
GET_DEVICE_PROC(WaitForFences);
|
||||||
|
|
||||||
if (usedKnobs.debugMarker) {
|
if (deviceInfo.debugMarker) {
|
||||||
GET_DEVICE_PROC(CmdDebugMarkerBeginEXT);
|
GET_DEVICE_PROC(CmdDebugMarkerBeginEXT);
|
||||||
GET_DEVICE_PROC(CmdDebugMarkerEndEXT);
|
GET_DEVICE_PROC(CmdDebugMarkerEndEXT);
|
||||||
GET_DEVICE_PROC(CmdDebugMarkerInsertEXT);
|
GET_DEVICE_PROC(CmdDebugMarkerInsertEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usedKnobs.externalMemoryFD) {
|
if (deviceInfo.externalMemoryFD) {
|
||||||
GET_DEVICE_PROC(GetMemoryFdKHR);
|
GET_DEVICE_PROC(GetMemoryFdKHR);
|
||||||
GET_DEVICE_PROC(GetMemoryFdPropertiesKHR);
|
GET_DEVICE_PROC(GetMemoryFdPropertiesKHR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usedKnobs.externalSemaphoreFD) {
|
if (deviceInfo.externalSemaphoreFD) {
|
||||||
GET_DEVICE_PROC(ImportSemaphoreFdKHR);
|
GET_DEVICE_PROC(ImportSemaphoreFdKHR);
|
||||||
GET_DEVICE_PROC(GetSemaphoreFdKHR);
|
GET_DEVICE_PROC(GetSemaphoreFdKHR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VK_USE_PLATFORM_FUCHSIA
|
#if VK_USE_PLATFORM_FUCHSIA
|
||||||
if (usedKnobs.externalMemoryZirconHandle) {
|
if (deviceInfo.externalMemoryZirconHandle) {
|
||||||
GET_DEVICE_PROC(GetMemoryZirconHandleFUCHSIA);
|
GET_DEVICE_PROC(GetMemoryZirconHandleFUCHSIA);
|
||||||
GET_DEVICE_PROC(GetMemoryZirconHandlePropertiesFUCHSIA);
|
GET_DEVICE_PROC(GetMemoryZirconHandlePropertiesFUCHSIA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usedKnobs.externalSemaphoreZirconHandle) {
|
if (deviceInfo.externalSemaphoreZirconHandle) {
|
||||||
GET_DEVICE_PROC(ImportSemaphoreZirconHandleFUCHSIA);
|
GET_DEVICE_PROC(ImportSemaphoreZirconHandleFUCHSIA);
|
||||||
GET_DEVICE_PROC(GetSemaphoreZirconHandleFUCHSIA);
|
GET_DEVICE_PROC(GetSemaphoreZirconHandleFUCHSIA);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (usedKnobs.swapchain) {
|
if (deviceInfo.swapchain) {
|
||||||
GET_DEVICE_PROC(CreateSwapchainKHR);
|
GET_DEVICE_PROC(CreateSwapchainKHR);
|
||||||
GET_DEVICE_PROC(DestroySwapchainKHR);
|
GET_DEVICE_PROC(DestroySwapchainKHR);
|
||||||
GET_DEVICE_PROC(GetSwapchainImagesKHR);
|
GET_DEVICE_PROC(GetSwapchainImagesKHR);
|
||||||
|
|
|
@ -24,14 +24,14 @@ class DynamicLib;
|
||||||
namespace dawn_native { namespace vulkan {
|
namespace dawn_native { namespace vulkan {
|
||||||
|
|
||||||
struct VulkanGlobalInfo;
|
struct VulkanGlobalInfo;
|
||||||
struct VulkanDeviceKnobs;
|
struct VulkanDeviceInfo;
|
||||||
|
|
||||||
// Stores the Vulkan entry points. Also loads them from the dynamic library
|
// Stores the Vulkan entry points. Also loads them from the dynamic library
|
||||||
// and the vkGet*ProcAddress entry points.
|
// and the vkGet*ProcAddress entry points.
|
||||||
struct VulkanFunctions {
|
struct VulkanFunctions {
|
||||||
MaybeError LoadGlobalProcs(const DynamicLib& vulkanLib);
|
MaybeError LoadGlobalProcs(const DynamicLib& vulkanLib);
|
||||||
MaybeError LoadInstanceProcs(VkInstance instance, const VulkanGlobalInfo& globalInfo);
|
MaybeError LoadInstanceProcs(VkInstance instance, const VulkanGlobalInfo& globalInfo);
|
||||||
MaybeError LoadDeviceProcs(VkDevice device, const VulkanDeviceKnobs& usedKnobs);
|
MaybeError LoadDeviceProcs(VkDevice device, const VulkanDeviceInfo& deviceInfo);
|
||||||
|
|
||||||
// ---------- Global procs
|
// ---------- Global procs
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ namespace dawn_native { namespace vulkan {
|
||||||
const char kExtensionNameKhrExternalMemoryCapabilities[] =
|
const char kExtensionNameKhrExternalMemoryCapabilities[] =
|
||||||
"VK_KHR_external_memory_capabilities";
|
"VK_KHR_external_memory_capabilities";
|
||||||
const char kExtensionNameKhrExternalMemoryFD[] = "VK_KHR_external_memory_fd";
|
const char kExtensionNameKhrExternalMemoryFD[] = "VK_KHR_external_memory_fd";
|
||||||
|
const char kExtensionNameExtExternalMemoryDmaBuf[] = "VK_EXT_external_memory_dma_buf";
|
||||||
|
const char kExtensionNameExtImageDrmFormatModifier[] = "VK_EXT_image_drm_format_modifier";
|
||||||
const char kExtensionNameFuchsiaExternalMemory[] = "VK_FUCHSIA_external_memory";
|
const char kExtensionNameFuchsiaExternalMemory[] = "VK_FUCHSIA_external_memory";
|
||||||
const char kExtensionNameKhrExternalSemaphore[] = "VK_KHR_external_semaphore";
|
const char kExtensionNameKhrExternalSemaphore[] = "VK_KHR_external_semaphore";
|
||||||
const char kExtensionNameKhrExternalSemaphoreCapabilities[] =
|
const char kExtensionNameKhrExternalSemaphoreCapabilities[] =
|
||||||
|
@ -287,6 +289,12 @@ namespace dawn_native { namespace vulkan {
|
||||||
if (IsExtensionName(extension, kExtensionNameKhrExternalMemoryFD)) {
|
if (IsExtensionName(extension, kExtensionNameKhrExternalMemoryFD)) {
|
||||||
info.externalMemoryFD = true;
|
info.externalMemoryFD = true;
|
||||||
}
|
}
|
||||||
|
if (IsExtensionName(extension, kExtensionNameExtExternalMemoryDmaBuf)) {
|
||||||
|
info.externalMemoryDmaBuf = true;
|
||||||
|
}
|
||||||
|
if (IsExtensionName(extension, kExtensionNameExtImageDrmFormatModifier)) {
|
||||||
|
info.imageDrmFormatModifier = true;
|
||||||
|
}
|
||||||
if (IsExtensionName(extension, kExtensionNameFuchsiaExternalMemory)) {
|
if (IsExtensionName(extension, kExtensionNameFuchsiaExternalMemory)) {
|
||||||
info.externalMemoryZirconHandle = true;
|
info.externalMemoryZirconHandle = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ namespace dawn_native { namespace vulkan {
|
||||||
extern const char kExtensionNameKhrExternalMemory[];
|
extern const char kExtensionNameKhrExternalMemory[];
|
||||||
extern const char kExtensionNameKhrExternalMemoryCapabilities[];
|
extern const char kExtensionNameKhrExternalMemoryCapabilities[];
|
||||||
extern const char kExtensionNameKhrExternalMemoryFD[];
|
extern const char kExtensionNameKhrExternalMemoryFD[];
|
||||||
|
extern const char kExtensionNameExtExternalMemoryDmaBuf[];
|
||||||
|
extern const char kExtensionNameExtImageDrmFormatModifier[];
|
||||||
extern const char kExtensionNameFuchsiaExternalMemory[];
|
extern const char kExtensionNameFuchsiaExternalMemory[];
|
||||||
extern const char kExtensionNameKhrExternalSemaphore[];
|
extern const char kExtensionNameKhrExternalSemaphore[];
|
||||||
extern const char kExtensionNameKhrExternalSemaphoreCapabilities[];
|
extern const char kExtensionNameKhrExternalSemaphoreCapabilities[];
|
||||||
|
@ -88,6 +90,8 @@ namespace dawn_native { namespace vulkan {
|
||||||
bool debugMarker = false;
|
bool debugMarker = false;
|
||||||
bool externalMemory = false;
|
bool externalMemory = false;
|
||||||
bool externalMemoryFD = false;
|
bool externalMemoryFD = false;
|
||||||
|
bool externalMemoryDmaBuf = false;
|
||||||
|
bool imageDrmFormatModifier = false;
|
||||||
bool externalMemoryZirconHandle = false;
|
bool externalMemoryZirconHandle = false;
|
||||||
bool externalSemaphore = false;
|
bool externalSemaphore = false;
|
||||||
bool externalSemaphoreFD = false;
|
bool externalSemaphoreFD = false;
|
||||||
|
|
Loading…
Reference in New Issue