Module: Mesa
Branch: main
Commit: ba6faeb9746c6ffa7d22b3c7a24b0f8990aa2ea6
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba6faeb9746c6ffa7d22b3c7a24b0f8990aa2ea6

Author: José Roberto de Souza <[email protected]>
Date:   Thu Dec 14 12:48:12 2023 -0800

anv: Remove libdrm usage from Xe KMD backend

Signed-off-by: José Roberto de Souza <[email protected]>
Reviewed-by: Paulo Zanoni <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26699>

---

 src/intel/vulkan/xe/anv_batch_chain.c | 17 +++++++++--------
 src/intel/vulkan/xe/anv_kmd_backend.c |  1 -
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/intel/vulkan/xe/anv_batch_chain.c 
b/src/intel/vulkan/xe/anv_batch_chain.c
index 9632a8cc53d..b5076f3a027 100644
--- a/src/intel/vulkan/xe/anv_batch_chain.c
+++ b/src/intel/vulkan/xe/anv_batch_chain.c
@@ -25,8 +25,6 @@
 
 #include "anv_private.h"
 
-#include <xf86drm.h>
-
 #include "drm-uapi/xe_drm.h"
 
 VkResult
@@ -36,18 +34,20 @@ xe_execute_simple_batch(struct anv_queue *queue,
                         bool is_companion_rcs_batch)
 {
    struct anv_device *device = queue->device;
-   VkResult result = VK_SUCCESS;
-   uint32_t syncobj_handle;
    uint32_t exec_queue_id = is_companion_rcs_batch ?
                             queue->companion_rcs_id :
                             queue->exec_queue_id;
-   if (drmSyncobjCreate(device->fd, 0, &syncobj_handle))
+   struct drm_syncobj_create syncobj_create = {};
+   struct drm_syncobj_destroy syncobj_destroy = {};
+   VkResult result = VK_SUCCESS;
+
+   if (intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_CREATE, &syncobj_create))
       return vk_errorf(device, VK_ERROR_UNKNOWN, "Unable to create sync obj");
 
    struct drm_xe_sync sync = {
       .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
       .flags = DRM_XE_SYNC_FLAG_SIGNAL,
-      .handle = syncobj_handle,
+      .handle = syncobj_create.handle,
    };
    struct drm_xe_exec exec = {
       .exec_queue_id = exec_queue_id,
@@ -63,7 +63,7 @@ xe_execute_simple_batch(struct anv_queue *queue,
    }
 
    struct drm_syncobj_wait wait = {
-      .handles = (uintptr_t)&syncobj_handle,
+      .handles = (uintptr_t)&syncobj_create.handle,
       .timeout_nsec = INT64_MAX,
       .count_handles = 1,
    };
@@ -71,7 +71,8 @@ xe_execute_simple_batch(struct anv_queue *queue,
       result = vk_device_set_lost(&device->vk, "DRM_IOCTL_SYNCOBJ_WAIT failed: 
%m");
 
 exec_error:
-   drmSyncobjDestroy(device->fd, syncobj_handle);
+   syncobj_destroy.handle = syncobj_create.handle;
+   intel_ioctl(device->fd, DRM_IOCTL_SYNCOBJ_DESTROY, &syncobj_destroy);
 
    return result;
 }
diff --git a/src/intel/vulkan/xe/anv_kmd_backend.c 
b/src/intel/vulkan/xe/anv_kmd_backend.c
index 9124c04f82a..4a92d672bfa 100644
--- a/src/intel/vulkan/xe/anv_kmd_backend.c
+++ b/src/intel/vulkan/xe/anv_kmd_backend.c
@@ -22,7 +22,6 @@
  */
 
 #include <sys/mman.h>
-#include <xf86drm.h>
 
 #include "common/xe/intel_engine.h"
 

Reply via email to