[PATCH 2/2] drm/syncobj: add submit point query capability

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

 



This feature was talked about by David. It allows userspace to query
the last submitted point on a timeline.

Following the previous commit it made sense to add it.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx>
---
 drivers/gpu/drm/drm_syncobj.c | 15 ++++++++++++++-
 include/uapi/drm/drm.h        |  1 +
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index c437fb6aaf7c..ad2f5672d707 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -1291,7 +1291,8 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 		return -EOPNOTSUPP;
 
 	if (args->selector != DRM_SYNCOBJ_TIMELINE_ARRAY_SELECTOR_SIGNALED_POINT &&
-	    args->selector != DRM_SYNCOBJ_TIMELINE_ARRAY_SELECTOR_SIDEBAND_PAYLOAD)
+	    args->selector != DRM_SYNCOBJ_TIMELINE_ARRAY_SELECTOR_SIDEBAND_PAYLOAD &&
+	    args->selector != DRM_SYNCOBJ_TIMELINE_ARRAY_SELECTOR_SUBMIT_POINT)
 		return -EINVAL;
 
 	if (args->count_handles == 0)
@@ -1346,6 +1347,18 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 			if (ret)
 				goto error;
 			break;
+
+		case DRM_SYNCOBJ_TIMELINE_ARRAY_SELECTOR_SUBMIT_POINT:
+			fence = drm_syncobj_fence_get(syncobjs[i]);
+			chain = to_dma_fence_chain(fence);
+			point = chain ? chain->base.seqno : 0;
+			dma_fence_put(fence);
+
+			ret = copy_to_user(&points[i], &point, sizeof(uint64_t));
+			ret = ret ? -EFAULT : 0;
+			if (ret)
+				goto error;
+			break;
 		}
 	}
 
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index dea759a36d37..3b8cdb3ffa94 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -785,6 +785,7 @@ struct drm_syncobj_timeline_array {
 	__u32 selector;
 #define DRM_SYNCOBJ_TIMELINE_ARRAY_SELECTOR_SIGNALED_POINT   (0)
 #define DRM_SYNCOBJ_TIMELINE_ARRAY_SELECTOR_SIDEBAND_PAYLOAD (1)
+#define DRM_SYNCOBJ_TIMELINE_ARRAY_SELECTOR_SUBMIT_POINT     (2)
 };
 
 
-- 
2.23.0.rc1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[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