[Intel-xe] [PATCH v3 28/43] drm/xe/uapi: Differentiate WAIT_OP from WAIT_MASK
Francois Dugast
francois.dugast at intel.com
Thu Nov 9 15:44:42 UTC 2023
From: Rodrigo Vivi <rodrigo.vivi at intel.com>
On one hand the WAIT_OP represents the operation use for waiting such
as ==, !=, > and so on. On the other hand, the mask is applied to the
value used for comparision. Split those two to bring clarity to the uapi.
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
Signed-off-by: Francois Dugast <francois.dugast at intel.com>
---
drivers/gpu/drm/xe/xe_wait_user_fence.c | 14 ++++-----
include/uapi/drm/xe_drm.h | 41 +++++++++++++------------
2 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_wait_user_fence.c b/drivers/gpu/drm/xe/xe_wait_user_fence.c
index 13562db6c07f..4d5c2555ce41 100644
--- a/drivers/gpu/drm/xe/xe_wait_user_fence.c
+++ b/drivers/gpu/drm/xe/xe_wait_user_fence.c
@@ -25,22 +25,22 @@ static int do_compare(u64 addr, u64 value, u64 mask, u16 op)
return -EFAULT;
switch (op) {
- case DRM_XE_UFENCE_WAIT_EQ:
+ case DRM_XE_UFENCE_WAIT_OP_EQ:
passed = (rvalue & mask) == (value & mask);
break;
- case DRM_XE_UFENCE_WAIT_NEQ:
+ case DRM_XE_UFENCE_WAIT_OP_NEQ:
passed = (rvalue & mask) != (value & mask);
break;
- case DRM_XE_UFENCE_WAIT_GT:
+ case DRM_XE_UFENCE_WAIT_OP_GT:
passed = (rvalue & mask) > (value & mask);
break;
- case DRM_XE_UFENCE_WAIT_GTE:
+ case DRM_XE_UFENCE_WAIT_OP_GTE:
passed = (rvalue & mask) >= (value & mask);
break;
- case DRM_XE_UFENCE_WAIT_LT:
+ case DRM_XE_UFENCE_WAIT_OP_LT:
passed = (rvalue & mask) < (value & mask);
break;
- case DRM_XE_UFENCE_WAIT_LTE:
+ case DRM_XE_UFENCE_WAIT_OP_LTE:
passed = (rvalue & mask) <= (value & mask);
break;
default:
@@ -81,7 +81,7 @@ static int check_hw_engines(struct xe_device *xe,
#define VALID_FLAGS (DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP | \
DRM_XE_UFENCE_WAIT_FLAG_ABSTIME)
-#define MAX_OP DRM_XE_UFENCE_WAIT_LTE
+#define MAX_OP DRM_XE_UFENCE_WAIT_OP_LTE
static long to_jiffies_timeout(struct xe_device *xe,
struct drm_xe_wait_user_fence *args)
diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
index 5217558a32d0..c30f7ea3fae3 100644
--- a/include/uapi/drm/xe_drm.h
+++ b/include/uapi/drm/xe_drm.h
@@ -1140,22 +1140,22 @@ struct drm_xe_exec_queue_get_property {
* Returns to user on user fence completion or timeout.
*
* The wait @op can be:
- * - %DRM_XE_UFENCE_WAIT_EQ
- * - %DRM_XE_UFENCE_WAIT_NEQ
- * - %DRM_XE_UFENCE_WAIT_GT
- * - %DRM_XE_UFENCE_WAIT_GTE
- * - %DRM_XE_UFENCE_WAIT_LT
- * - %DRM_XE_UFENCE_WAIT_LTE
+ * - %DRM_XE_UFENCE_WAIT_OP_EQ
+ * - %DRM_XE_UFENCE_WAIT_OP_NEQ
+ * - %DRM_XE_UFENCE_WAIT_OP_GT
+ * - %DRM_XE_UFENCE_WAIT_OP_GTE
+ * - %DRM_XE_UFENCE_WAIT_OP_LT
+ * - %DRM_XE_UFENCE_WAIT_OP_LTE
*
* The wait @flags can be:
* - %DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP
* - %DRM_XE_UFENCE_WAIT_FLAG_ABSTIME
*
* The wait @mask can be:
- * - %DRM_XE_UFENCE_WAIT_U8
- * - %DRM_XE_UFENCE_WAIT_U16
- * - %DRM_XE_UFENCE_WAIT_U32
- * - %DRM_XE_UFENCE_WAIT_U64
+ * - %DRM_XE_UFENCE_WAIT_MASK_U8
+ * - %DRM_XE_UFENCE_WAIT_MASK_U16
+ * - %DRM_XE_UFENCE_WAIT_MASK_U32
+ * - %DRM_XE_UFENCE_WAIT_MASK_U64
*
*/
struct drm_xe_wait_user_fence {
@@ -1167,12 +1167,12 @@ struct drm_xe_wait_user_fence {
*/
__u64 addr;
-#define DRM_XE_UFENCE_WAIT_EQ 0
-#define DRM_XE_UFENCE_WAIT_NEQ 1
-#define DRM_XE_UFENCE_WAIT_GT 2
-#define DRM_XE_UFENCE_WAIT_GTE 3
-#define DRM_XE_UFENCE_WAIT_LT 4
-#define DRM_XE_UFENCE_WAIT_LTE 5
+#define DRM_XE_UFENCE_WAIT_OP_EQ 0x0
+#define DRM_XE_UFENCE_WAIT_OP_NEQ 0x1
+#define DRM_XE_UFENCE_WAIT_OP_GT 0x2
+#define DRM_XE_UFENCE_WAIT_OP_GTE 0x3
+#define DRM_XE_UFENCE_WAIT_OP_LT 0x4
+#define DRM_XE_UFENCE_WAIT_OP_LTE 0x5
/** @op: wait operation (type of comparison) */
__u16 op;
@@ -1187,12 +1187,13 @@ struct drm_xe_wait_user_fence {
/** @value: compare value */
__u64 value;
-#define DRM_XE_UFENCE_WAIT_U8 0xffu
-#define DRM_XE_UFENCE_WAIT_U16 0xffffu
-#define DRM_XE_UFENCE_WAIT_U32 0xffffffffu
-#define DRM_XE_UFENCE_WAIT_U64 0xffffffffffffffffu
+#define DRM_XE_UFENCE_WAIT_MASK_U8 0xffu
+#define DRM_XE_UFENCE_WAIT_MASK_U16 0xffffu
+#define DRM_XE_UFENCE_WAIT_MASK_U32 0xffffffffu
+#define DRM_XE_UFENCE_WAIT_MASK_U64 0xffffffffffffffffu
/** @mask: comparison mask */
__u64 mask;
+
/**
* @timeout: how long to wait before bailing, value in nanoseconds.
* Without DRM_XE_UFENCE_WAIT_FLAG_ABSTIME flag set (relative timeout)
--
2.34.1
More information about the Intel-xe
mailing list