WSI_FN_GetPhysicalDeviceProcAddr proc_addr,
const VkAllocationCallbacks *alloc,
int display_fd,
- const struct driOptionCache *dri_options)
+ const struct driOptionCache *dri_options,
+ bool sw_device)
{
const char *present_mode;
UNUSED VkResult result;
wsi->instance_alloc = *alloc;
wsi->pdevice = pdevice;
-
+ wsi->sw = sw_device;
#define WSI_GET_CB(func) \
PFN_vk##func func = (PFN_vk##func)proc_addr(pdevice, "vk" #func)
WSI_GET_CB(GetPhysicalDeviceProperties2);
WSI_GET_CB(GetImageDrmFormatModifierPropertiesEXT);
WSI_GET_CB(GetImageMemoryRequirements);
WSI_GET_CB(GetImageSubresourceLayout);
- WSI_GET_CB(GetMemoryFdKHR);
+ if (!wsi->sw)
+ WSI_GET_CB(GetMemoryFdKHR);
WSI_GET_CB(GetPhysicalDeviceFormatProperties);
WSI_GET_CB(GetPhysicalDeviceFormatProperties2KHR);
WSI_GET_CB(GetPhysicalDeviceImageFormatProperties2);
WSI_GET_CB(ResetFences);
WSI_GET_CB(QueueSubmit);
WSI_GET_CB(WaitForFences);
+ WSI_GET_CB(MapMemory);
+ WSI_GET_CB(UnmapMemory);
#undef WSI_GET_CB
#ifdef VK_USE_PLATFORM_XCB_KHR
if (result != VK_SUCCESS)
goto fail;
- const VkMemoryGetFdInfoKHR memory_get_fd_info = {
- .sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR,
- .pNext = NULL,
- .memory = image->memory,
- .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
- };
- int fd;
- result = wsi->GetMemoryFdKHR(chain->device, &memory_get_fd_info, &fd);
- if (result != VK_SUCCESS)
- goto fail;
+ int fd = -1;
+ if (!wsi->sw) {
+ const VkMemoryGetFdInfoKHR memory_get_fd_info = {
+ .sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR,
+ .pNext = NULL,
+ .memory = image->memory,
+ .handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
+ };
+
+ result = wsi->GetMemoryFdKHR(chain->device, &memory_get_fd_info, &fd);
+ if (result != VK_SUCCESS)
+ goto fail;
+ }
- if (num_modifier_lists > 0) {
+ if (!wsi->sw && num_modifier_lists > 0) {
VkImageDrmFormatModifierPropertiesEXT image_mod_props = {
.sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT,
};