It's entirely valid and correct for compositors to include disabled
planes in the atomic commit, and doing that should not prevent async
flips from working. To fix that, this commit skips the async checks
if the plane was and still is not visible.

Fixes: fd40a63c drm/atomic: Let drivers decide which planes to async flip
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4263

Signed-off-by: Xaver Hugl <xaver.h...@kde.org>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c 
b/drivers/gpu/drm/drm_atomic_uapi.c
index c2726af6698e..2e62561fd94d 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1066,6 +1066,7 @@ int drm_atomic_set_property(struct drm_atomic_state 
*state,
        }
        case DRM_MODE_OBJECT_PLANE: {
                struct drm_plane *plane = obj_to_plane(obj);
+               struct drm_plane_state *old_plane_state;
                struct drm_plane_state *plane_state;
                struct drm_mode_config *config = &plane->dev->mode_config;
                const struct drm_plane_helper_funcs *plane_funcs = 
plane->helper_private;
@@ -1086,8 +1087,15 @@ int drm_atomic_set_property(struct drm_atomic_state 
*state,
                                ret = drm_atomic_check_prop_changes(ret, 
old_val, prop_value, prop);
                        }
 
+                       old_plane_state = drm_atomic_get_old_plane_state(state, 
plane);
+                       if (IS_ERR(old_plane_state)) {
+                               ret = PTR_ERR(plane_state);
+                               break;
+                       }
+
                        /* ask the driver if this non-primary plane is 
supported */
-                       if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
+                       if (plane->type != DRM_PLANE_TYPE_PRIMARY &&
+                                       (plane_state->visible || 
old_plane_state->visible)) {
                                ret = -EINVAL;
 
                                if (plane_funcs && 
plane_funcs->atomic_async_check)
-- 
2.50.1

Reply via email to