From patchwork Sat Jun 29 15:22:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 13716956 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 D61A9C27C4F for ; Sat, 29 Jun 2024 15:22:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3C62210E05D; Sat, 29 Jun 2024 15:22:28 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=emersion.fr header.i=@emersion.fr header.b="FgIKxduR"; dkim-atps=neutral Received: from mail-41104.protonmail.ch (mail-41104.protonmail.ch [185.70.41.104]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F64B10E027 for ; Sat, 29 Jun 2024 15:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail3; t=1719674538; x=1719933738; bh=ZaQhQB+792NPrPd8uwNUfcKNjPfomxO+GXrTpIqDgco=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=FgIKxduRdapOEcFGyMQuJn+ts8oY2DLEx7NJFojsAKmvau4t57huwncLV97+1F50m N0hL+0hvw9vJSUcunRRLvF1H1jWcCSU2SUNbmQgLoCSEzY5mIUOa0Tya1sW2pgZlPK DtCXWiNIvT3tGH0OaT50RZQ97OrwZM2t9sOzPNo4zuU+NOndsAsqjHOjOcCbUETgur xzOCF1s/PVrlc0dk5aKaT+MT+ztQ1P1mPGiBBz2NhyV25BbZ0ZZGC+o+JpJ60yXVNR e2S8r9RIbke8SwTfTfYbNE/JRN2/EwvMhZm4rxScYmyq+nhbKQRnPnxkIOzOvc8wlY PnYp9bbfggBDQ== Date: Sat, 29 Jun 2024 15:22:12 +0000 To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , 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] drm/atomic: allow no-op FB_ID updates for async flips Message-ID: <20240629152204.666748-1-contact@emersion.fr> Feedback-ID: 1358184:user:proton X-Pm-Message-ID: 940e41555372456f3719021107a12b9e71bab594 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 Cc: André Almeida Cc: Alex Deucher Cc: Christian König Cc: Michel Dänzer Cc: Ville Syrjälä Reviewed-by: André Almeida --- drivers/gpu/drm/drm_atomic_uapi.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 22bbb2d83e30..1764bb0dbbdf 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -1070,21 +1070,14 @@ int drm_atomic_set_property(struct drm_atomic_state *state, break; } - if (async_flip && prop != config->prop_fb_id) { + if (async_flip && (prop != config->prop_fb_id || + plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY)) { 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);