From nobody Thu Nov 28 08:01:45 2024 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7B11194ACF for ; Wed, 2 Oct 2024 21:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727903826; cv=none; b=BUKI8LfuVYRquXp3U1D39dPiQMtMoqbv4HhDTkqQDOM2NTc11SCXpt9K+RrvMGxpnZVCOpnFhyRu81WtM2JD5lK3qa4uxrYwrZoQ28+ArqBRci5AlVRsVf13sInIOF0uOCRj17YiCeiJ99A8cncA+0L4PNG4vu/iOpJdC+Um/A4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727903826; c=relaxed/simple; bh=EMvb3jKNVx98jp2fe0mqYyVmBBnx25Ex8zvWqTKftD0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fpzbtYM625fFILpuQKd2GChMUQTrBSWLlYW9CTS8P6CEILAnfA22Y23tGxKnGhNjj2uRSrU/U9Sa/nO5u6RZuwuHBilwnBxTFlNybqdfXUkYihA16NOHmwibvE4vPdTAtakbm120IRWE72rewD8d3ot+KjuNAgXkW+1t/VkTtu4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=knPHSUzF; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="knPHSUzF" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MI6xOCQ7+nhzrvIE6O1Lz/t5IEbq+qfqs1XqHlJ+8qA=; b=knPHSUzFCDfb4ioydXzzyqaboi qQ8dfDNfVuXVHiG8793XlTNIt6c93vExzfe1mpIL0bHPjSQq2Yy4qhQcQRxx0dr9F+sQMlOwZvcSQ Wz4c7DzGYjtGggk4+nS+rwB0SivZ2VZvAEq/SL9wrzLFTEct+bQZViiaA9Qj5Ft2D3g3DKOO8c1R1 j0/voFi823TQOo4xQEJypUS9XJeFVm5TpQe0Hf9E54Jc6UpTW8JvZI3u1uRJOETo6cBKQqOJ4bFND yynNDYFQRyAeisfiC3e5iRjbopbtZEa39p9zwiumwygubDFmsec8GV8hUfZv6s7aK7NyVP8cMksZC L8KMPyKA==; Received: from [187.57.199.212] (helo=[192.168.15.100]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1sw6iF-0042sU-98; Wed, 02 Oct 2024 23:16:47 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Wed, 02 Oct 2024 18:16:05 -0300 Subject: [PATCH v9 1/2] drm/atomic: Let drivers decide which planes to async flip Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-tonyk-async_flip-v9-1-453b1b8977bd@igalia.com> References: <20241002-tonyk-async_flip-v9-0-453b1b8977bd@igalia.com> In-Reply-To: <20241002-tonyk-async_flip-v9-0-453b1b8977bd@igalia.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , dmitry.baryshkov@linaro.org, Simon Ser , joshua@froggi.es, Xaver Hugl , Daniel Stone , ville.syrjala@linux.intel.com Cc: kernel-dev@igalia.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, =?utf-8?q?Andr=C3=A9_Almeida?= X-Mailer: b4 0.14.1 Currently, DRM atomic uAPI allows only primary planes to be flipped asynchronously. However, each driver might be able to perform async flips in other different plane types. To enable drivers to set their own restrictions on which type of plane they can or cannot flip, use the existing atomic_async_check() from struct drm_plane_helper_funcs to enhance this flexibility, thus allowing different plane types to be able to do async flips as well. In order to prevent regressions and such, we keep the current policy: we skip the driver check for the primary plane, because it is always allowed to do async flips on it. Signed-off-by: Andr=C3=A9 Almeida --- Changes from v8: - Rebased on top of 6.12-rc1 --- drivers/gpu/drm/drm_atomic_uapi.c | 39 +++++++++++++++++++++++++++++------= ---- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic= _uapi.c index 7936c2023955..b004fa1d2e2e 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -27,8 +27,9 @@ * Daniel Vetter */ =20 -#include #include +#include +#include #include #include #include @@ -1063,6 +1064,7 @@ int drm_atomic_set_property(struct drm_atomic_state *= state, struct drm_plane *plane =3D obj_to_plane(obj); struct drm_plane_state *plane_state; struct drm_mode_config *config =3D &plane->dev->mode_config; + const struct drm_plane_helper_funcs *plane_funcs =3D plane->helper_priva= te; =20 plane_state =3D drm_atomic_get_plane_state(state, plane); if (IS_ERR(plane_state)) { @@ -1070,15 +1072,32 @@ int drm_atomic_set_property(struct drm_atomic_state= *state, break; } =20 - if (async_flip && - (plane_state->plane->type !=3D DRM_PLANE_TYPE_PRIMARY || - (prop !=3D config->prop_fb_id && - prop !=3D config->prop_in_fence_fd && - prop !=3D config->prop_fb_damage_clips))) { - ret =3D drm_atomic_plane_get_property(plane, plane_state, - prop, &old_val); - ret =3D drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); - break; + if (async_flip) { + /* check if the prop does a nop change */ + if ((plane_state->plane->type !=3D DRM_PLANE_TYPE_PRIMARY) || + (prop !=3D config->prop_fb_id && + prop !=3D config->prop_in_fence_fd && + prop !=3D config->prop_fb_damage_clips)) { + ret =3D drm_atomic_plane_get_property(plane, plane_state, + prop, &old_val); + ret =3D drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); + break; + } + + /* ask the driver if this non-primary plane is supported */ + if (plane->type !=3D DRM_PLANE_TYPE_PRIMARY) { + ret =3D -EINVAL; + + if (plane_funcs && plane_funcs->atomic_async_check) + ret =3D plane_funcs->atomic_async_check(plane, state); + + if (ret) { + drm_dbg_atomic(prop->dev, + "[PLANE:%d] does not support async flips\n", + obj->id); + break; + } + } } =20 ret =3D drm_atomic_plane_set_property(plane, --=20 2.46.0 From nobody Thu Nov 28 08:01:45 2024 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61B7E217338 for ; Wed, 2 Oct 2024 21:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727903828; cv=none; b=N2r6RD2RB60bDDuzE0N5TNmK9jKWHcw5pdqbBNs9DvgZvat+KBeQNRgrA8RUQqtzhcvmximdSQCWzm9c2f35yyml8cvAeEs255V1h3NfvLa+t1h0TPeJBMbmBfaB4ZkgIJgh3bVZcBKXp4iOuhVI3JxSx+fj54KGZGXvIbSLQLY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727903828; c=relaxed/simple; bh=vogNgUbx1sfLEfHQGXYn5GNtb+v1JBZEEWpvO2CNrjo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BrOjvEX73op7xksxnRPSJDwZNtoboUbWUKSsDRX3VFu7gLAcmBf68kYMrr2kMmcgW6LkqgdDK0zNPro5HL58YUixJfNg/LSlt8YgHOuPzQT+xdiDK4B1hMKWRx2g+Twh6ufU3FFheoPIp4VlRLqU8iSPnua7EyHyHnO2cHO/jlI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=kRTx0JGw; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="kRTx0JGw" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=QAyIxhbC81BBqvT0TIePt/27v6ZbBEnRkdmyNQCZFzk=; b=kRTx0JGw082mw71S8K848B/fa3 XEOk/a2WoaReP9rjzQX3/aBXTW6yiE7HaIPbX7Mddacmx9vA36itbhY9VR57UAxuYjyO0wp7zcCuw r4LmkvPpIxmIFZ6zqRoy/kJNkoLeZfExLguVPAFh1LGZpokdUTH6FQ+fT71wS6Dv7/rO/bfbovGZZ QUJKIIWjuCZIo0zUuLgXGoRpqjz0RtvSnC2NcsjHRdGdjASXPLmadeBxyh+YvHmpEQCm4qjgsd0xD CGUDO0El+gJ/44L+1PFuRRvZwKkvJNvtW+RYhTfPGWAd/eqFHJeZwrQblYUrdS7JndbnDWodOfiZE uD3v9XnA==; Received: from [187.57.199.212] (helo=[192.168.15.100]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1sw6iK-0042sU-N3; Wed, 02 Oct 2024 23:16:52 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= Date: Wed, 02 Oct 2024 18:16:06 -0300 Subject: [PATCH v9 2/2] drm/amdgpu: Enable async flip on overlay planes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241002-tonyk-async_flip-v9-2-453b1b8977bd@igalia.com> References: <20241002-tonyk-async_flip-v9-0-453b1b8977bd@igalia.com> In-Reply-To: <20241002-tonyk-async_flip-v9-0-453b1b8977bd@igalia.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , dmitry.baryshkov@linaro.org, Simon Ser , joshua@froggi.es, Xaver Hugl , Daniel Stone , ville.syrjala@linux.intel.com Cc: kernel-dev@igalia.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, =?utf-8?q?Andr=C3=A9_Almeida?= X-Mailer: b4 0.14.1 amdgpu can handle async flips on overlay planes, so allow it for atomic async checks. Signed-off-by: Andr=C3=A9 Almeida --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/driv= ers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c index 495e3cd70426..4c6aed5ca777 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c @@ -1266,8 +1266,7 @@ static int amdgpu_dm_plane_atomic_async_check(struct = drm_plane *plane, struct drm_plane_state *new_plane_state; struct dm_crtc_state *dm_new_crtc_state; =20 - /* Only support async updates on cursor planes. */ - if (plane->type !=3D DRM_PLANE_TYPE_CURSOR) + if (plane->type !=3D DRM_PLANE_TYPE_CURSOR && plane->type !=3D DRM_PLANE_= TYPE_OVERLAY) return -EINVAL; =20 new_plane_state =3D drm_atomic_get_new_plane_state(state, plane); --=20 2.46.0