From patchwork Wed Jul 31 19:10:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 13749066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 40EEDC3DA7F for ; Wed, 31 Jul 2024 19:10:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA6C610E6B9; Wed, 31 Jul 2024 19:10:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=emersion.fr header.i=@emersion.fr header.b="lXDMqR8K"; dkim-atps=neutral Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3CEE510E6B9 for ; Wed, 31 Jul 2024 19:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1722453027; x=1722712227; bh=eCpNChI+KuE5oDd2sSaMRGXR9eveNhpe5ODTDylH2Ec=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=lXDMqR8KoorB9D0tGrCNsHu662sLUzq85FvRIKvcYsc5aaiWzEMu3ol2f7gU7Ue1n qWkp6CFO75miz4qUyfX499YKZizhpUWGFNuT2fYHLPq+ydrUuVff9t1bFJNOsP4Jnp cGuWvphDJ55IsnnbMf0va13+8a4zvfV+u2+pvOGy/fwFYkrQMtzgwYLu2xrzL1nsav 89WrEs2xZqB2Aywnw7hYna9IfdDLZibQp0xRXjdsmSVx5Fa2qSgMBxcp/J2JlwQ1Yu qB4G3+6K0yLmi19ROGLNopSiE/yu6OUpzhN8A1LccbjK8ZGNk4CXDe4OzbP2BiCESP L9sPBxZvg9I3g== Date: Wed, 31 Jul 2024 19:10:20 +0000 To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Xaver Hugl , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , =?utf-8?q?Mich?= =?utf-8?q?el_D=C3=A4nzer?= , =?utf-8?b?VmlsbGUg?= =?utf-8?b?U3lyasOkbMOk?= Subject: [PATCH v2] drm/atomic: allow no-op FB_ID updates for async flips Message-ID: <20240731191014.878320-1-contact@emersion.fr> Feedback-ID: 1358184:user:proton X-Pm-Message-ID: 69b5f55c97e03c9f3202fa35f871f58410e63ef5 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: André Almeida Tested-by: Xaver Hugl Cc: Alex Deucher Cc: Christian König Cc: Michel Dänzer Cc: Ville Syrjälä --- 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(-) 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);