drm/xe/uapi: Split xe_sync types from flags

Let's continue on the uapi clean-up with more splits
with stuff into their own exclusive fields instead of
reusing stuff.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
This commit is contained in:
Rodrigo Vivi 2023-11-22 14:38:27 +00:00
parent 60a6a849fc
commit 37d078e51b
3 changed files with 16 additions and 24 deletions

View File

@ -17,8 +17,6 @@
#include "xe_macros.h"
#include "xe_sched_job_types.h"
#define SYNC_FLAGS_TYPE_MASK 0x3
struct user_fence {
struct xe_device *xe;
struct kref refcount;
@ -109,15 +107,13 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
if (copy_from_user(&sync_in, sync_user, sizeof(*sync_user)))
return -EFAULT;
if (XE_IOCTL_DBG(xe, sync_in.flags &
~(SYNC_FLAGS_TYPE_MASK | DRM_XE_SYNC_FLAG_SIGNAL)) ||
XE_IOCTL_DBG(xe, sync_in.pad) ||
if (XE_IOCTL_DBG(xe, sync_in.flags & ~DRM_XE_SYNC_FLAG_SIGNAL) ||
XE_IOCTL_DBG(xe, sync_in.reserved[0] || sync_in.reserved[1]))
return -EINVAL;
signal = sync_in.flags & DRM_XE_SYNC_FLAG_SIGNAL;
switch (sync_in.flags & SYNC_FLAGS_TYPE_MASK) {
case DRM_XE_SYNC_FLAG_SYNCOBJ:
switch (sync_in.type) {
case DRM_XE_SYNC_TYPE_SYNCOBJ:
if (XE_IOCTL_DBG(xe, in_lr_mode && signal))
return -EOPNOTSUPP;
@ -135,7 +131,7 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
}
break;
case DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ:
case DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ:
if (XE_IOCTL_DBG(xe, in_lr_mode && signal))
return -EOPNOTSUPP;
@ -165,12 +161,7 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
}
break;
case DRM_XE_SYNC_FLAG_DMA_BUF:
if (XE_IOCTL_DBG(xe, "TODO"))
return -EINVAL;
break;
case DRM_XE_SYNC_FLAG_USER_FENCE:
case DRM_XE_SYNC_TYPE_USER_FENCE:
if (XE_IOCTL_DBG(xe, !signal))
return -EOPNOTSUPP;
@ -192,6 +183,7 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
return -EINVAL;
}
sync->type = sync_in.type;
sync->flags = sync_in.flags;
sync->timeline_value = sync_in.timeline_value;
@ -252,8 +244,7 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct xe_sched_job *job,
user_fence_put(sync->ufence);
dma_fence_put(fence);
}
} else if ((sync->flags & SYNC_FLAGS_TYPE_MASK) ==
DRM_XE_SYNC_FLAG_USER_FENCE) {
} else if (sync->type == DRM_XE_SYNC_TYPE_USER_FENCE) {
job->user_fence.used = true;
job->user_fence.addr = sync->addr;
job->user_fence.value = sync->timeline_value;

View File

@ -21,6 +21,7 @@ struct xe_sync_entry {
struct user_fence *ufence;
u64 addr;
u64 timeline_value;
u32 type;
u32 flags;
};

View File

@ -947,15 +947,15 @@ struct drm_xe_sync {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
#define DRM_XE_SYNC_FLAG_SYNCOBJ 0x0
#define DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ 0x1
#define DRM_XE_SYNC_FLAG_DMA_BUF 0x2
#define DRM_XE_SYNC_FLAG_USER_FENCE 0x3
#define DRM_XE_SYNC_FLAG_SIGNAL 0x10
__u32 flags;
#define DRM_XE_SYNC_TYPE_SYNCOBJ 0x0
#define DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ 0x1
#define DRM_XE_SYNC_TYPE_USER_FENCE 0x2
/** @type: Type of the this sync object */
__u32 type;
/** @pad: MBZ */
__u32 pad;
#define DRM_XE_SYNC_FLAG_SIGNAL (1 << 0)
/** @flags: Sync Flags */
__u32 flags;
union {
__u32 handle;