@@ -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);
@@ -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. */
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@amd.com> --- drivers/gpu/drm/drm_atomic_uapi.c | 8 ++++++++ include/drm/drm_drv.h | 7 +++++++ 2 files changed, 15 insertions(+)