[PATCH 7/8] drm/panthor: Add sync_update eventfd handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Expose the SYNC_UPDATE event to userspace so it can respond to changes
in syncobj state.

Signed-off-by: Mihail Atanassov <mihail.atanassov@xxxxxxx>
---
 drivers/gpu/drm/panthor/panthor_sched.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
index 92172b2c6253..67c27fcc3345 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -643,6 +643,9 @@ struct panthor_group {
 	 * panthor_group::groups::waiting list.
 	 */
 	struct list_head wait_node;
+
+	/** @eventfd_sync_update_ctx: eventfd context to signal on GPU_SYNC_UPDATE */
+	struct eventfd_ctx *eventfd_sync_update_ctx;
 };
 
 /**
@@ -797,6 +800,10 @@ static void group_release_work(struct work_struct *work)
 	panthor_kernel_bo_destroy(group->syncobjs);
 
 	panthor_vm_put(group->vm);
+
+	if (group->eventfd_sync_update_ctx)
+		eventfd_ctx_put(group->eventfd_sync_update_ctx);
+
 	kfree(group);
 }
 
@@ -1501,6 +1508,9 @@ static void csg_slot_sync_update_locked(struct panthor_device *ptdev,
 		/* Rerun XGS jobs immediately, as this can potentially unblock the group */
 		panthor_xgs_queue_pool_recheck(group->pfile);
 
+		if (group->eventfd_sync_update_ctx)
+			eventfd_signal(group->eventfd_sync_update_ctx);
+
 		if (!group->user_submit)
 			group_queue_work(group, sync_upd);
 	}
@@ -3204,9 +3214,18 @@ int panthor_group_create(struct panthor_file *pfile,
 	INIT_WORK(&group->tiler_oom_work, group_tiler_oom_work);
 	INIT_WORK(&group->release_work, group_release_work);
 
-	if (group_args->flags & DRM_PANTHOR_GROUP_CREATE_USER_SUBMIT)
+	if (group_args->flags & DRM_PANTHOR_GROUP_CREATE_USER_SUBMIT) {
 		group->user_submit = true;
 
+		if (group_args->eventfd_sync_update >= 0) {
+			group->eventfd_sync_update_ctx = eventfd_ctx_fdget(
+				group_args->eventfd_sync_update);
+			ret = PTR_ERR_OR_ZERO(group->eventfd_sync_update_ctx);
+			if (ret)
+				goto err_put_group;
+		}
+	}
+
 	group->vm = panthor_vm_pool_get_vm(pfile->vms, group_args->vm_id);
 	if (!group->vm) {
 		ret = -EINVAL;
-- 
2.45.0




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux