mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
anv: hide exec_flags selection inside the i915 backend
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Hyunjun Ko <zzoon@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24073>
This commit is contained in:
parent
f6dddcef79
commit
67a8b70c57
10 changed files with 137 additions and 39 deletions
|
|
@ -3128,15 +3128,8 @@ VkResult anv_CreateDevice(
|
|||
&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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1387,7 +1387,6 @@ VkResult anv_device_wait(struct anv_device *device, struct anv_bo *bo,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "anv_private.h"
|
||||
|
||||
#include "i915/anv_queue.h"
|
||||
#include "xe/anv_queue.h"
|
||||
|
||||
static VkResult
|
||||
|
|
@ -36,7 +37,7 @@ anv_create_engine(struct anv_device *device,
|
|||
{
|
||||
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:
|
||||
|
|
@ -51,6 +52,7 @@ anv_destroy_engine(struct anv_queue *queue)
|
|||
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);
|
||||
|
|
@ -62,21 +64,20 @@ anv_destroy_engine(struct anv_queue *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;
|
||||
}
|
||||
|
||||
|
|
@ -97,9 +98,6 @@ anv_queue_init(struct anv_device *device, struct anv_queue *queue,
|
|||
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;
|
||||
|
|
|
|||
72
src/intel/vulkan/i915/anv_queue.c
Normal file
72
src/intel/vulkan/i915/anv_queue.c
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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 */
|
||||
}
|
||||
35
src/intel/vulkan/i915/anv_queue.h
Normal file
35
src/intel/vulkan/i915/anv_queue.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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);
|
||||
|
|
@ -137,6 +137,8 @@ libanv_files = files(
|
|||
'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',
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#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)
|
||||
|
|
@ -46,22 +47,6 @@ VkResult anv_xe_device_setup_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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@
|
|||
#include "vulkan/vulkan_core.h"
|
||||
#include "vk_device.h"
|
||||
|
||||
#include "drm-uapi/gpu_scheduler.h"
|
||||
|
||||
struct anv_device;
|
||||
struct anv_physical_device;
|
||||
|
||||
|
|
@ -40,6 +38,3 @@ VkResult
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -24,10 +24,13 @@
|
|||
#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
|
||||
|
|
|
|||
|
|
@ -32,6 +32,22 @@
|
|||
#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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue