summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-21 13:54:55 -0700
committerJason Ekstrand <[email protected]>2018-03-07 12:13:47 -0800
commit68df93ecbcee6215ac49e0c6f62ae818d2bc9962 (patch)
treee33748a96ab7b3efbe32913cd8855b89fced938d /src
parentdfe18be09e38c6c534474f3b666a1a57755c7731 (diff)
anv: Trivially implement VK_KHR_device_group
Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/compiler/brw_compiler.c1
-rw-r--r--src/intel/vulkan/anv_cmd_buffer.c7
-rw-r--r--src/intel/vulkan/anv_device.c78
-rw-r--r--src/intel/vulkan/anv_extensions.py2
-rw-r--r--src/intel/vulkan/anv_pipeline.c1
-rw-r--r--src/intel/vulkan/anv_wsi.c22
6 files changed, 100 insertions, 11 deletions
diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c
index 93403174922..d5f483798a9 100644
--- a/src/intel/compiler/brw_compiler.c
+++ b/src/intel/compiler/brw_compiler.c
@@ -42,6 +42,7 @@
.lower_fdiv = true, \
.lower_flrp64 = true, \
.lower_ldexp = true, \
+ .lower_device_index_to_zero = true, \
.native_integers = true, \
.use_interpolated_input_intrinsics = true, \
.vertex_id_zero_based = true
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index 5b7928ff189..8f4bf3f0bb9 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -1068,3 +1068,10 @@ void anv_CmdPushDescriptorSetWithTemplateKHR(
anv_cmd_buffer_bind_descriptor_set(cmd_buffer, template->bind_point,
layout, _set, set, NULL, NULL);
}
+
+void anv_CmdSetDeviceMask(
+ VkCommandBuffer commandBuffer,
+ uint32_t deviceMask)
+{
+ /* No-op */
+}
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 7b3ccc01ddc..faf32a00a8e 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -672,6 +672,18 @@ anv_enumerate_devices(struct anv_instance *instance)
return result;
}
+static VkResult
+anv_instance_ensure_physical_device(struct anv_instance *instance)
+{
+ if (instance->physicalDeviceCount < 0) {
+ VkResult result = anv_enumerate_devices(instance);
+ if (result != VK_SUCCESS &&
+ result != VK_ERROR_INCOMPATIBLE_DRIVER)
+ return result;
+ }
+
+ return VK_SUCCESS;
+}
VkResult anv_EnumeratePhysicalDevices(
VkInstance _instance,
@@ -680,20 +692,49 @@ VkResult anv_EnumeratePhysicalDevices(
{
ANV_FROM_HANDLE(anv_instance, instance, _instance);
VK_OUTARRAY_MAKE(out, pPhysicalDevices, pPhysicalDeviceCount);
- VkResult result;
- if (instance->physicalDeviceCount < 0) {
- result = anv_enumerate_devices(instance);
- if (result != VK_SUCCESS &&
- result != VK_ERROR_INCOMPATIBLE_DRIVER)
- return result;
+ VkResult result = anv_instance_ensure_physical_device(instance);
+ if (result != VK_SUCCESS)
+ return result;
+
+ if (instance->physicalDeviceCount == 0)
+ return VK_SUCCESS;
+
+ assert(instance->physicalDeviceCount == 1);
+ vk_outarray_append(&out, i) {
+ *i = anv_physical_device_to_handle(&instance->physicalDevice);
}
- if (instance->physicalDeviceCount > 0) {
- assert(instance->physicalDeviceCount == 1);
- vk_outarray_append(&out, i) {
- *i = anv_physical_device_to_handle(&instance->physicalDevice);
- }
+ return vk_outarray_status(&out);
+}
+
+VkResult anv_EnumeratePhysicalDeviceGroups(
+ VkInstance _instance,
+ uint32_t* pPhysicalDeviceGroupCount,
+ VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties)
+{
+ ANV_FROM_HANDLE(anv_instance, instance, _instance);
+ VK_OUTARRAY_MAKE(out, pPhysicalDeviceGroupProperties,
+ pPhysicalDeviceGroupCount);
+
+ VkResult result = anv_instance_ensure_physical_device(instance);
+ if (result != VK_SUCCESS)
+ return result;
+
+ if (instance->physicalDeviceCount == 0)
+ return VK_SUCCESS;
+
+ assert(instance->physicalDeviceCount == 1);
+
+ vk_outarray_append(&out, p) {
+ p->physicalDeviceCount = 1;
+ memset(p->physicalDevices, 0, sizeof(p->physicalDevices));
+ p->physicalDevices[0] =
+ anv_physical_device_to_handle(&instance->physicalDevice);
+ p->subsetAllocation = VK_FALSE;
+
+ vk_foreach_struct(ext, p->pNext)
+ anv_debug_ignored_stype(ext->sType);
}
return vk_outarray_status(&out);
@@ -1103,6 +1144,21 @@ void anv_GetPhysicalDeviceMemoryProperties2(
}
}
+void
+anv_GetDeviceGroupPeerMemoryFeatures(
+ VkDevice device,
+ uint32_t heapIndex,
+ uint32_t localDeviceIndex,
+ uint32_t remoteDeviceIndex,
+ VkPeerMemoryFeatureFlags* pPeerMemoryFeatures)
+{
+ assert(localDeviceIndex == 0 && remoteDeviceIndex == 0);
+ *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;
+}
+
PFN_vkVoidFunction anv_GetInstanceProcAddr(
VkInstance _instance,
const char* pName)
diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_extensions.py
index df168dc9848..2a16735d3b6 100644
--- a/src/intel/vulkan/anv_extensions.py
+++ b/src/intel/vulkan/anv_extensions.py
@@ -70,6 +70,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->has_syncobj_wait'),
Extension('VK_KHR_external_fence_capabilities', 1, True),
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index f02d54c132d..f25cf37ea25 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -138,6 +138,7 @@ anv_shader_compile_to_nir(struct anv_pipeline *pipeline,
.float64 = device->instance->physicalDevice.info.gen >= 8,
.int64 = device->instance->physicalDevice.info.gen >= 8,
.tessellation = true,
+ .device_group = true,
.draw_parameters = true,
.image_write_without_format = true,
.multiview = true,
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 8913a8022c4..20094f93e1f 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -242,3 +242,25 @@ VkResult anv_QueuePresentKHR(
_queue, 0,
pPresentInfo);
}
+
+VkResult anv_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 anv_GetDeviceGroupSurfacePresentModesKHR(
+ VkDevice device,
+ VkSurfaceKHR surface,
+ VkDeviceGroupPresentModeFlagsKHR* pModes)
+{
+ *pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
+
+ return VK_SUCCESS;
+}