From 2ccc9a5c407676c9ca7d940dd021c3395c7c6bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Fri, 16 Aug 2024 11:52:07 -0700 Subject: [PATCH] iris: Use xe_queue_get_syncobj_for_idle() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Paulo Zanoni Signed-off-by: José Roberto de Souza Part-of: --- src/gallium/drivers/iris/xe/iris_batch.c | 44 ++++++++++-------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/gallium/drivers/iris/xe/iris_batch.c b/src/gallium/drivers/iris/xe/iris_batch.c index e467e3bb271..6adcddddf98 100644 --- a/src/gallium/drivers/iris/xe/iris_batch.c +++ b/src/gallium/drivers/iris/xe/iris_batch.c @@ -30,6 +30,7 @@ #include "common/intel_engine.h" #include "common/xe/intel_device_query.h" #include "common/xe/intel_engine.h" +#include "common/xe/intel_queue.h" #include "drm-uapi/xe_drm.h" #include "drm-uapi/gpu_scheduler.h" @@ -159,35 +160,28 @@ static void iris_xe_wait_exec_queue_idle(struct iris_batch *batch) { struct iris_bufmgr *bufmgr = batch->screen->bufmgr; - struct iris_syncobj *syncobj = iris_create_syncobj(bufmgr); - struct drm_xe_sync xe_sync = { - .type = DRM_XE_SYNC_TYPE_SYNCOBJ, - .flags = DRM_XE_SYNC_FLAG_SIGNAL, - }; - struct drm_xe_exec exec = { - .exec_queue_id = batch->xe.exec_queue_id, - .num_syncs = 1, - .syncs = (uintptr_t)&xe_sync, - }; - int ret; + int fd = iris_bufmgr_get_fd(bufmgr); + uint32_t syncobj; + int ret = xe_queue_get_syncobj_for_idle(fd, batch->xe.exec_queue_id, + &syncobj); - if (!syncobj) + if (ret) { + assert(iris_batch_is_banned(bufmgr, ret) == true); return; - - xe_sync.handle = syncobj->handle; - /* Using the special exec.num_batch_buffer == 0 handling to get syncobj - * signaled when the last DRM_IOCTL_XE_EXEC is completed. - */ - ret = intel_ioctl(iris_bufmgr_get_fd(bufmgr), DRM_IOCTL_XE_EXEC, &exec); - if (ret == 0) { - ASSERTED bool success; - success = iris_wait_syncobj(bufmgr, syncobj, INT64_MAX); - assert(success); - } else { - assert(iris_batch_is_banned(bufmgr, -errno) == true); } - iris_syncobj_destroy(bufmgr, syncobj); + struct drm_syncobj_wait wait = { + .handles = (uintptr_t)&syncobj, + .count_handles = 1, + .timeout_nsec = INT64_MAX, + }; + ret = intel_ioctl(fd, DRM_IOCTL_SYNCOBJ_WAIT, &wait); + assert(ret == 0); + + struct drm_syncobj_destroy syncobj_destroy = { + .handle = syncobj, + }; + intel_ioctl(fd, DRM_IOCTL_SYNCOBJ_DESTROY, &syncobj_destroy); } static void