Reviewed-by: Dave Airlie <airl...@redhat.com>
---
 src/amd/vulkan/radv_cmd_buffer.c  |  7 ++++++
 src/amd/vulkan/radv_device.c      | 45 +++++++++++++++++++++++++++++++++++++++
 src/amd/vulkan/radv_extensions.py |  2 ++
 src/amd/vulkan/radv_shader.c      |  2 ++
 src/amd/vulkan/radv_wsi.c         | 23 ++++++++++++++++++++
 5 files changed, 79 insertions(+)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 1e7d035d34..3e0ed0e9a9 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -3810,3 +3810,10 @@ void radv_CmdWaitEvents(VkCommandBuffer commandBuffer,
                                        RADV_CMD_FLAG_INV_VMEM_L1 |
                                        RADV_CMD_FLAG_INV_SMEM_L1;
 }
+
+
+void radv_CmdSetDeviceMask(VkCommandBuffer commandBuffer,
+                           uint32_t deviceMask)
+{
+   /* No-op */
+}
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 0e7ee8ef9b..67f9cd6b1a 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -592,6 +592,35 @@ VkResult radv_EnumeratePhysicalDevices(
                                                                     : 
VK_SUCCESS;
 }
 
+VkResult radv_EnumeratePhysicalDeviceGroups(
+    VkInstance                                  _instance,
+    uint32_t*                                   pPhysicalDeviceGroupCount,
+    VkPhysicalDeviceGroupProperties*            pPhysicalDeviceGroupProperties)
+{
+       RADV_FROM_HANDLE(radv_instance, instance, _instance);
+       VkResult result;
+
+       if (instance->physicalDeviceCount < 0) {
+               result = radv_enumerate_devices(instance);
+               if (result != VK_SUCCESS &&
+                   result != VK_ERROR_INCOMPATIBLE_DRIVER)
+                       return result;
+       }
+
+       if (!pPhysicalDeviceGroupProperties) {
+               *pPhysicalDeviceGroupCount = instance->physicalDeviceCount;
+       } else {
+               *pPhysicalDeviceGroupCount = MIN2(*pPhysicalDeviceGroupCount, 
instance->physicalDeviceCount);
+               for (unsigned i = 0; i < *pPhysicalDeviceGroupCount; ++i) {
+                       pPhysicalDeviceGroupProperties[i].physicalDeviceCount = 
1;
+                       pPhysicalDeviceGroupProperties[i].physicalDevices[0] = 
radv_physical_device_to_handle(instance->physicalDevices + i);
+                       pPhysicalDeviceGroupProperties[i].subsetAllocation = 
false;
+               }
+       }
+       return *pPhysicalDeviceGroupCount < instance->physicalDeviceCount ? 
VK_INCOMPLETE
+                                                                         : 
VK_SUCCESS;
+}
+
 void radv_GetPhysicalDeviceFeatures(
        VkPhysicalDevice                            physicalDevice,
        VkPhysicalDeviceFeatures*                   pFeatures)
@@ -4270,3 +4299,19 @@ radv_DebugReportMessageEXT(VkInstance _instance,
        vk_debug_report(&instance->debug_report_callbacks, flags, objectType,
                        object, location, messageCode, pLayerPrefix, pMessage);
 }
+
+void
+radv_GetDeviceGroupPeerMemoryFeatures(
+    VkDevice                                    device,
+    uint32_t                                    heapIndex,
+    uint32_t                                    localDeviceIndex,
+    uint32_t                                    remoteDeviceIndex,
+    VkPeerMemoryFeatureFlags*                   pPeerMemoryFeatures)
+{
+       assert(localDeviceIndex == remoteDeviceIndex);
+
+       *pPeerMemoryFeatures = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT |
+                              VK_PEER_MEMORY_FEATURE_COPY_DST_BIT |
+                              VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT |
+                              VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT;
+}
diff --git a/src/amd/vulkan/radv_extensions.py 
b/src/amd/vulkan/radv_extensions.py
index 3b4f75bff6..2ac1aac79e 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -54,6 +54,8 @@ EXTENSIONS = [
     Extension('VK_KHR_bind_memory2',                      1, True),
     Extension('VK_KHR_dedicated_allocation',              1, True),
     Extension('VK_KHR_descriptor_update_template',        1, True),
+    Extension('VK_KHR_device_group',                      1, True),
+    Extension('VK_KHR_device_group_creation',             1, True),
     Extension('VK_KHR_external_fence',                    1, 
'device->rad_info.has_syncobj_wait_for_submit'),
     Extension('VK_KHR_external_fence_capabilities',       1, True),
     Extension('VK_KHR_external_fence_fd',                 1, 
'device->rad_info.has_syncobj_wait_for_submit'),
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 9833ec3d5b..e4b3dec111 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -53,6 +53,7 @@ static const struct nir_shader_compiler_options nir_options = 
{
        .lower_scmp = true,
        .lower_flrp32 = true,
        .lower_flrp64 = true,
+       .lower_device_index_to_zero = true,
        .lower_fsat = true,
        .lower_fdiv = true,
        .lower_sub = true,
@@ -203,6 +204,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
                }
                const struct spirv_to_nir_options spirv_options = {
                        .caps = {
+                               .device_group = true,
                                .draw_parameters = true,
                                .float64 = true,
                                .image_read_without_format = true,
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 3b525fe445..927650480a 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -234,3 +234,26 @@ VkResult radv_QueuePresentKHR(
                                        queue->queue_family_index,
                                        pPresentInfo);
 }
+
+
+VkResult radv_GetDeviceGroupPresentCapabilitiesKHR(
+    VkDevice                                    device,
+    VkDeviceGroupPresentCapabilitiesKHR*        pCapabilities)
+{
+   memset(pCapabilities->presentMask, 0,
+          sizeof(pCapabilities->presentMask));
+   pCapabilities->presentMask[0] = 0x1;
+   pCapabilities->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
+
+   return VK_SUCCESS;
+}
+
+VkResult radv_GetDeviceGroupSurfacePresentModesKHR(
+    VkDevice                                    device,
+    VkSurfaceKHR                                surface,
+    VkDeviceGroupPresentModeFlagsKHR*           pModes)
+{
+   *pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
+
+   return VK_SUCCESS;
+}
-- 
2.16.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to