diff mbox series

[v2] drm/atomic: allow no-op FB_ID updates for async flips

Message ID 20240731191014.878320-1-contact@emersion.fr (mailing list archive)
State New, archived
Headers show
Series [v2] drm/atomic: allow no-op FB_ID updates for async flips | expand

Commit Message

Simon Ser July 31, 2024, 7:10 p.m. UTC
User-space is allowed to submit any property in an async flip as
long as the value doesn't change. However we missed one case:
as things stand, the kernel rejects no-op FB_ID changes on
non-primary planes. Fix this by changing the conditional and
skipping drm_atomic_check_prop_changes() only for FB_ID on the
primary plane (instead of skipping for FB_ID on any plane).

Fixes: 0e26cc72c71c ("drm: Refuse to async flip with atomic prop changes")
Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Tested-by: Xaver Hugl <xaver.hugl@kde.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Michel Dänzer <michel.daenzer@mailbox.org>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
---

André, can you confirm that the R-b still holds?

 drivers/gpu/drm/drm_atomic_uapi.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Comments

André Almeida Aug. 6, 2024, 12:52 p.m. UTC | #1
Em 31/07/2024 16:10, Simon Ser escreveu:
> User-space is allowed to submit any property in an async flip as
> long as the value doesn't change. However we missed one case:
> as things stand, the kernel rejects no-op FB_ID changes on
> non-primary planes. Fix this by changing the conditional and
> skipping drm_atomic_check_prop_changes() only for FB_ID on the
> primary plane (instead of skipping for FB_ID on any plane).
> 
> Fixes: 0e26cc72c71c ("drm: Refuse to async flip with atomic prop changes")
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Reviewed-by: André Almeida <andrealmeid@igalia.com>
> Tested-by: Xaver Hugl <xaver.hugl@kde.org>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Michel Dänzer <michel.daenzer@mailbox.org>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> 
> André, can you confirm that the R-b still holds?
> 

Yes, it still holds
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 7609c798d73d..7936c2023955 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1071,23 +1071,16 @@  int drm_atomic_set_property(struct drm_atomic_state *state,
 		}
 
 		if (async_flip &&
-		    prop != config->prop_fb_id &&
-		    prop != config->prop_in_fence_fd &&
-		    prop != config->prop_fb_damage_clips) {
+		    (plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY ||
+		     (prop != config->prop_fb_id &&
+		      prop != config->prop_in_fence_fd &&
+		      prop != config->prop_fb_damage_clips))) {
 			ret = drm_atomic_plane_get_property(plane, plane_state,
 							    prop, &old_val);
 			ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop);
 			break;
 		}
 
-		if (async_flip && plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY) {
-			drm_dbg_atomic(prop->dev,
-				       "[OBJECT:%d] Only primary planes can be changed during async flip\n",
-				       obj->id);
-			ret = -EINVAL;
-			break;
-		}
-
 		ret = drm_atomic_plane_set_property(plane,
 				plane_state, file_priv,
 				prop, prop_value);