&pCreateInfo->pQueueCreateInfos[i];
for (uint32_t j = 0; j < queueCreateInfo->queueCount; j++) {
- /* When using legacy contexts, we use I915_EXEC_RENDER but, with
- * engine-based contexts, the bottom 6 bits of exec_flags are used
- * for the engine ID.
- */
- uint32_t exec_flags = device->physical->engine_info ?
- device->queue_count : I915_EXEC_RENDER;
-
result = anv_queue_init(device, &device->queues[device->queue_count],
- exec_flags, queueCreateInfo, j);
+ queueCreateInfo, j);
if (result != VK_SUCCESS)
goto fail_queues;
int64_t timeout);
VkResult anv_queue_init(struct anv_device *device, struct anv_queue *queue,
- uint32_t exec_flags,
const VkDeviceQueueCreateInfo *pCreateInfo,
uint32_t index_in_family);
void anv_queue_finish(struct anv_queue *queue);
#include "anv_private.h"
+#include "i915/anv_queue.h"
#include "xe/anv_queue.h"
static VkResult
{
switch (device->info->kmd_type) {
case INTEL_KMD_TYPE_I915:
- return VK_SUCCESS;
+ return anv_i915_create_engine(device, queue, pCreateInfo);
case INTEL_KMD_TYPE_XE:
return anv_xe_create_engine(device, queue, pCreateInfo);
default:
struct anv_device *device = queue->device;
switch (device->info->kmd_type) {
case INTEL_KMD_TYPE_I915:
+ anv_i915_destroy_engine(device, queue);
break;
case INTEL_KMD_TYPE_XE:
anv_xe_destroy_engine(device, queue);
VkResult
anv_queue_init(struct anv_device *device, struct anv_queue *queue,
- uint32_t exec_flags,
const VkDeviceQueueCreateInfo *pCreateInfo,
uint32_t index_in_family)
{
struct anv_physical_device *pdevice = device->physical;
VkResult result;
- result = anv_create_engine(device, queue, pCreateInfo);
+ result = vk_queue_init(&queue->vk, &device->vk, pCreateInfo,
+ index_in_family);
if (result != VK_SUCCESS)
return result;
- result = vk_queue_init(&queue->vk, &device->vk, pCreateInfo,
- index_in_family);
+ result = anv_create_engine(device, queue, pCreateInfo);
if (result != VK_SUCCESS) {
- anv_destroy_engine(queue);
+ vk_queue_finish(&queue->vk);
return result;
}
assert(queue->vk.queue_family_index < pdevice->queue.family_count);
queue->family = &pdevice->queue.families[queue->vk.queue_family_index];
- if (device->info->kmd_type == INTEL_KMD_TYPE_I915)
- queue->exec_flags = exec_flags;
-
queue->decoder = &device->decoder[queue->vk.queue_family_index];
return VK_SUCCESS;
--- /dev/null
+/*
+ * Copyright © 2023 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "i915/anv_queue.h"
+
+#include "anv_private.h"
+
+#include "common/i915/intel_engine.h"
+#include "common/intel_gem.h"
+
+#include "i915/anv_device.h"
+
+#include "drm-uapi/i915_drm.h"
+
+VkResult
+anv_i915_create_engine(struct anv_device *device,
+ struct anv_queue *queue,
+ const VkDeviceQueueCreateInfo *pCreateInfo)
+{
+ struct anv_physical_device *physical = device->physical;
+ struct anv_queue_family *queue_family =
+ &physical->queue.families[pCreateInfo->queueFamilyIndex];
+
+ if (device->physical->engine_info == NULL) {
+ switch (queue_family->engine_class) {
+ case INTEL_ENGINE_CLASS_COPY:
+ queue->exec_flags = I915_EXEC_BLT;
+ break;
+ case INTEL_ENGINE_CLASS_RENDER:
+ queue->exec_flags = I915_EXEC_RENDER;
+ break;
+ case INTEL_ENGINE_CLASS_VIDEO:
+ /* We want VCS0 (with ring1) for HW lacking HEVC on VCS1. */
+ queue->exec_flags = I915_EXEC_BSD | I915_EXEC_BSD_RING1;
+ break;
+ default:
+ unreachable("Unsupported legacy engine");
+ }
+ } else {
+ /* When using the new engine creation uAPI, the exec_flags value is the
+ * index of the engine in the group specified at GEM context creation.
+ */
+ queue->exec_flags = device->queue_count;
+ }
+
+ return VK_SUCCESS;
+}
+
+void
+anv_i915_destroy_engine(struct anv_device *device, struct anv_queue *queue)
+{
+ /* NO-OP */
+}
--- /dev/null
+/*
+ * Copyright © 2023 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+
+#include "vulkan/vulkan_core.h"
+
+struct anv_device;
+struct anv_queue;
+
+VkResult
+anv_i915_create_engine(struct anv_device *device,
+ struct anv_queue *queue,
+ const VkDeviceQueueCreateInfo *pCreateInfo);
+void
+anv_i915_destroy_engine(struct anv_device *device, struct anv_queue *queue);
'i915/anv_device.c',
'i915/anv_device.h',
'i915/anv_kmd_backend.c',
+ 'i915/anv_queue.c',
+ 'i915/anv_queue.h',
'layers/anv_doom64.c',
'layers/anv_hitman3.c',
'layers/anv_android_layer.c',
#include "xe/anv_device.h"
#include "anv_private.h"
+#include "drm-uapi/gpu_scheduler.h"
#include "drm-uapi/xe_drm.h"
bool anv_xe_device_destroy_vm(struct anv_device *device)
return VK_SUCCESS;
}
-enum drm_sched_priority
-anv_vk_priority_to_drm_sched_priority(VkQueueGlobalPriorityKHR vk_priority)
-{
- switch (vk_priority) {
- case VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR:
- return DRM_SCHED_PRIORITY_MIN;
- case VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR:
- return DRM_SCHED_PRIORITY_NORMAL;
- case VK_QUEUE_GLOBAL_PRIORITY_HIGH_KHR:
- return DRM_SCHED_PRIORITY_HIGH;
- default:
- unreachable("Invalid priority");
- return DRM_SCHED_PRIORITY_MIN;
- }
-}
-
static VkQueueGlobalPriorityKHR
drm_sched_priority_to_vk_priority(enum drm_sched_priority drm_sched_priority)
{
#include "vulkan/vulkan_core.h"
#include "vk_device.h"
-#include "drm-uapi/gpu_scheduler.h"
-
struct anv_device;
struct anv_physical_device;
anv_xe_physical_device_get_parameters(struct anv_physical_device *device);
VkResult
anv_xe_physical_device_init_memory_types(struct anv_physical_device *device);
-
-enum drm_sched_priority
-anv_vk_priority_to_drm_sched_priority(VkQueueGlobalPriorityKHR vk_priority);
#include <sys/mman.h>
#include <xf86drm.h>
+#include "common/xe/intel_engine.h"
+
#include "anv_private.h"
#include "xe/anv_batch_chain.h"
+#include "drm-uapi/gpu_scheduler.h"
#include "drm-uapi/xe_drm.h"
static uint32_t
#include "drm-uapi/xe_drm.h"
#include "drm-uapi/gpu_scheduler.h"
+static enum drm_sched_priority
+anv_vk_priority_to_drm_sched_priority(VkQueueGlobalPriorityKHR vk_priority)
+{
+ switch (vk_priority) {
+ case VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR:
+ return DRM_SCHED_PRIORITY_MIN;
+ case VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_KHR:
+ return DRM_SCHED_PRIORITY_NORMAL;
+ case VK_QUEUE_GLOBAL_PRIORITY_HIGH_KHR:
+ return DRM_SCHED_PRIORITY_HIGH;
+ default:
+ unreachable("Invalid priority");
+ return DRM_SCHED_PRIORITY_MIN;
+ }
+}
+
VkResult
anv_xe_create_engine(struct anv_device *device,
struct anv_queue *queue,