mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 00:10:20 +01:00
vk_common_QueueWaitIdle() creates a syncobj, does a submit with no batch buffers what translates to execute trivial_batch_bo and then waits for syncobj to be signaled when trivial_batch_bo finishes. On Xe KMD on other hand we can avoid the trivial_batch_bo submission and instead use the special DRM_IOCTL_XE_EXEC with num_batch_buffer == 0 to get a syncobj to be signaled when the last exec finish execution. This should free a bit GPU to execute more important workloads. This will also optimize vkDeviceWaitIdle() that calls QueueWaitIdle(). It have to fallback to vk_common_QueueWaitIdle() when queue is in VK_QUEUE_SUBMIT_MODE_THREADED mode because vkQueueWaitIdle() could return but there still stuff in VK/CPU submission queue. Also it could cause use after free when resources attached to submission are freed before it is processed, example: vkCreateFence() or vkCreateSemaphore() vkQueueSubmit() // with Fence or Semaphore created above vkQueueWaitIdle() // with the race it returns vkDestroyFence() or vkDestroySemaphore() // vk_queue_submit_thread_func() start to process submission above... Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30958>
38 lines
1.5 KiB
C
38 lines
1.5 KiB
C
/*
|
|
* 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_xe_create_engine(struct anv_device *device,
|
|
struct anv_queue *queue,
|
|
const VkDeviceQueueCreateInfo *pCreateInfo);
|
|
void
|
|
anv_xe_destroy_engine(struct anv_device *device, struct anv_queue *queue);
|
|
|
|
int
|
|
anv_xe_wait_exec_queue_idle(struct anv_device *device, uint32_t exec_queue_id);
|