[PATCH 10/15] drm: add user fence support for atomic out fences

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

 



Add a new driver flag indicating support for user fences.

This flag is then used when creating out fences for atomic mode setting,
indicating that the mode set might depend on an user fence.

Signed-off-by: Christian König <christian.koenig@xxxxxxx>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 8 ++++++++
 include/drm/drm_drv.h             | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 434f3d4cb8a2..e2112c10569b 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1111,6 +1111,7 @@ static int prepare_signaling(struct drm_device *dev,
 				  struct drm_out_fence_state **fence_state,
 				  unsigned int *num_fences)
 {
+	bool use_user_fence = drm_core_check_feature(dev, DRIVER_USER_FENCE);
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *crtc_state;
 	struct drm_connector *conn;
@@ -1120,6 +1121,7 @@ static int prepare_signaling(struct drm_device *dev,
 	if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)
 		return 0;
 
+
 	for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
 		s32 __user *fence_ptr;
 
@@ -1168,6 +1170,9 @@ static int prepare_signaling(struct drm_device *dev,
 			if (!fence)
 				return -ENOMEM;
 
+			if (use_user_fence)
+				set_bit(DMA_FENCE_FLAG_USER, &fence->flags);
+
 			ret = setup_out_fence(&f[(*num_fences)++], fence);
 			if (ret) {
 				dma_fence_put(fence);
@@ -1208,6 +1213,9 @@ static int prepare_signaling(struct drm_device *dev,
 		if (!fence)
 			return -ENOMEM;
 
+		if (use_user_fence)
+			set_bit(DMA_FENCE_FLAG_USER, &fence->flags);
+
 		ret = setup_out_fence(&f[(*num_fences)++], fence);
 		if (ret) {
 			dma_fence_put(fence);
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index f6159acb8856..b2b8ea8d4a9e 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -94,6 +94,13 @@ enum drm_driver_feature {
 	 * synchronization of command submission.
 	 */
 	DRIVER_SYNCOBJ_TIMELINE         = BIT(6),
+	/**
+	 * @DRIVER_USER_FENCE:
+	 *
+	 * Drivers supports user fences and waiting for the before command
+	 * submission.
+	 */
+	DRIVER_USER_FENCE		= BIT(7),
 
 	/* IMPORTANT: Below are all the legacy flags, add new ones above. */
 
-- 
2.25.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux