Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp903406rdb; Fri, 1 Dec 2023 01:25:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcQTJSqHl2pZIgzLOn2iJdVW0iEMGBYLm5nwi2FXHLBvYfrRcaRMeqwbfSJTwa5JaOo8Yh X-Received: by 2002:a05:6870:7a09:b0:1ea:d76b:1457 with SMTP id hf9-20020a0568707a0900b001ead76b1457mr26866746oab.7.1701422732149; Fri, 01 Dec 2023 01:25:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701422732; cv=none; d=google.com; s=arc-20160816; b=mTJgjDRsDlon/+tjJGu0avDPea1107ZaUbvVZfPvv7Z5Y/VzVZODDAjd4FRQatxacZ PryWJiOSZ6NSJGN93/Sgtk2GlE6pw1o3Ho6NpB+6XjpsH5ZRW84gYluHO843R8+FGAVj COPwV7QWAFnCWJIkaF/6+5uPXvd+i8YOBjYMiCQO+U5zngzDHU6Bz0fyAEa5RAwDWQCf kkaDOJKctS0z5fTKQoFmhBggdLeixbnMU7l43ZO9UCYLOBcoya+LxbCfnPEO3dq94V0z yUQlKJXboVg53MnAzmI2tP6SvK6gNNtwyXIc7btSCIyA/vkHdKVxr/jLFZY/KijVakJw gl7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tQmpCYIru0cR7B3CbVpovpjRV1kCQjiK2Jx/1HBmGps=; fh=xmY4hNEAjrovkENpxKGiXSjJywm6L3rJlUNtSLpGkPg=; b=Nmhzfs1AeJUMuw9HCh9CFD0VHgFJcjhQr1NrMn86austvk/+OmuwDoUpruAr1IeD0g DbqbxHaqC2WA1UrT4MofUy+MhBaaFbGdfgBGIkC92wkuAneDZRErfcobbnU92gbMhyiB DgbkdOmCSG+ke+P1yf+sE9JXK95UCbiDH+/fCtJGtceM2uNYiLQG8CWSgsgVu/eWrctg on3dNMJNSPQAuDjctKwcBMgDxsVjlhaXTiU14ZB4GxFCNnf0MJr9xGjeMlO9BrHY7Oow rIAn720bEYVy2Lp5pmXcz5MpvLivsCAmHO49cD7+sBYv91Zg5YS2Q72Huw/ZaaSUMfww Eeiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jo++edaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id q33-20020a635061000000b005c615702198si3113307pgl.703.2023.12.01.01.25.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:25:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jo++edaP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8F18A8074515; Fri, 1 Dec 2023 01:25:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378004AbjLAJZI (ORCPT + 99 others); Fri, 1 Dec 2023 04:25:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378013AbjLAJZG (ORCPT ); Fri, 1 Dec 2023 04:25:06 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1379410F9 for ; Fri, 1 Dec 2023 01:25:12 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31B11C433C7; Fri, 1 Dec 2023 09:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701422711; bh=pap0dJ7Aexs0KGqqAq0I3SAp6oVPIn/53vGN/L16G3g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jo++edaPYGu5OZ3NsMc3O5H4BNhyyZ9oJWhGoph0k8VwwbGjUrW9s+S3aWmGKv3TK tfmjJOXp+s2tOMRp0+i5zNc2qKUo6nR/8WlTHdIY9GQgD8Xo0x8K7hDcrhV7XNJyIF VhdoK7wcxtifKlWhm7zF6cOYvqC+Sg1lMZZ/ymyaksY8fWl4p06Ec5cKcJSgmbhZuH bDpwONi70lo4fRUn615W0ON2hrV2ANvFhJ6gRYfPEWWXl7tixuBiqWVmZgbV6skciq vM+D+rrq4EFPxbs4WePG6eXoPiSshuvlniyhdU7aAufwkBAD+tZgS+3D2QeMp4MEn/ 28RjKeylLLpeg== Date: Fri, 1 Dec 2023 10:25:09 +0100 From: Maxime Ripard To: Pekka Paalanen Cc: =?utf-8?B?QW5kcsOp?= Almeida , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, Simon Ser , Rob Clark , Pekka Paalanen , daniel@ffwll.ch, Daniel Stone , 'Marek =?utf-8?B?T2zFocOhayc=?= , Dave Airlie , Michel =?utf-8?Q?D=C3=A4nzer?= , Randy Dunlap , Jonathan Corbet , linux-doc@vger.kernel.org, Thomas Zimmermann , Maarten Lankhorst Subject: Re: [PATCH] drm/doc: Define KMS atomic state set Message-ID: References: <20231130200740.53454-1-andrealmeid@igalia.com> <20231201110616.30ad1468.pekka.paalanen@collabora.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3qxpsltzimgkb2dd" Content-Disposition: inline In-Reply-To: <20231201110616.30ad1468.pekka.paalanen@collabora.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 01 Dec 2023 01:25:23 -0800 (PST) --3qxpsltzimgkb2dd Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 01, 2023 at 11:06:16AM +0200, Pekka Paalanen wrote: > On Fri, 1 Dec 2023 09:29:05 +0100 > Maxime Ripard wrote: >=20 > > Hi, > >=20 > > On Thu, Nov 30, 2023 at 05:07:40PM -0300, Andr=E9 Almeida wrote: > > > From: Pekka Paalanen > > >=20 > > > Specify how the atomic state is maintained between userspace and > > > kernel, plus the special case for async flips. > > >=20 > > > Signed-off-by: Pekka Paalanen > > > Signed-off-by: Andr=E9 Almeida > > > --- > > >=20 > > > This is a standalone patch from the following serie, the other patche= s are > > > already merged: > > > https://lore.kernel.org/lkml/20231122161941.320564-1-andrealmeid@igal= ia.com/ > > >=20 > > > Documentation/gpu/drm-uapi.rst | 47 ++++++++++++++++++++++++++++++++= ++ > > > 1 file changed, 47 insertions(+) > > >=20 > > > diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-u= api.rst > > > index 370d820be248..d0693f902a5c 100644 > > > --- a/Documentation/gpu/drm-uapi.rst > > > +++ b/Documentation/gpu/drm-uapi.rst > > > @@ -570,3 +570,50 @@ dma-buf interoperability > > > =20 > > > Please see Documentation/userspace-api/dma-buf-alloc-exchange.rst for > > > information on how dma-buf is integrated and exposed within DRM. > > > + > > > +KMS atomic state > > > +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > + > > > +An atomic commit can change multiple KMS properties in an atomic fas= hion, > > > +without ever applying intermediate or partial state changes. Either= the whole > > > +commit succeeds or fails, and it will never be applied partially. Th= is is the > > > +fundamental improvement of the atomic API over the older non-atomic = API which is > > > +referred to as the "legacy API". Applying intermediate state could = unexpectedly > > > +fail, cause visible glitches, or delay reaching the final state. > > > + > > > +An atomic commit can be flagged with DRM_MODE_ATOMIC_TEST_ONLY, whic= h means the > > > +complete state change is validated but not applied. Userspace shoul= d use this > > > +flag to validate any state change before asking to apply it. If vali= dation fails > > > +for any reason, userspace should attempt to fall back to another, pe= rhaps > > > +simpler, final state. This allows userspace to probe for various co= nfigurations > > > +without causing visible glitches on screen and without the need to u= ndo a > > > +probing change. > > > + > > > +The changes recorded in an atomic commit apply on top the current KM= S state in > > > +the kernel. Hence, the complete new KMS state is the complete old KM= S state with > > > +the committed property settings done on top. The kernel will try to = avoid =20 > >=20 > > That part is pretty confusing to me. > >=20 > > What are you calling the current and old KMS state? >=20 > Current =3D old, if you read that "current" is the KMS state before > considering the atomic commit at hand. >=20 > > What's confusing to me is that, yes, what you're saying is true for a > > given object: if it was part of the commit, the new state is the old > > state + whatever the new state changed. > >=20 > > However, if that object wasn't part of the commit at all, then it's > > completely out of the old or new global KMS state. >=20 > This is not talking about kernel data structures at all. This is > talking about how KMS looks from the userspace point of view. I mean, that's also true from the userspace point of view. You can very well commit only a single property on a single object, and only that object will be part of the "global KMS state". > All objects are always part of the device KMS state as referred to > in this doc, whether they were mentioned in the atomic commit state set > or not. That's the whole point: all state that was not explicitly > modified remains as it was, and is actively used state by the driver > and hardware. The practical end result state is the same as if all > objects were (redundantly) mentioned. >=20 > For example, if you change properties of CRTC 31, it has no effect on > the behaviour of CRTC 54. If CRTC 54 was active, it remains active. If > CRTC 54 had certain property values, it continues to have those > property values. I'm not quite sure I followed your previous paragraph, sorry, but we agree here and it's kind of my point really: CRTC-54 would not be part of the new KMS state, so claiming that it is complete is confusing. It's not complete to me precisely because it doesn't contain the state of all objects. > This is opposed to something else; the UAPI could have > been designed to e.g. reset all unmentioned objects to defaults/off by > the atomic commit. Obviously that's not how it works today, so we need > to mention how things do work. Sure, I'm not claiming we should change anything but the wording of that doc. > >=20 > > So yeah, individual object KMS state are indeed complete, but > > drm_atomic_state definitely isn't. And it's the whole point of functions > > like drm_atomic_get_crtc_state() vs drm_atomic_get_old/new_crtc_state: > > the old/new variants only return a state if it was part of > > drm_atomic_state to begin with. drm_atomic_get_crtc_state() brings the > > crtc state into drm_atomic_state if it wasn't part of it. >=20 > At no point the text is referring to drm_atomic_state or any other > kernel data structure. Then it's even more confusing, because the sentence I was quoting was "The changes recorded in an atomic commit apply on top the current KMS state *in the kernel*", which is ambiguous then. Maxime --3qxpsltzimgkb2dd Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZWmmdAAKCRDj7w1vZxhR xb0MAQChGpVdOkDehNkhy/zPifFcMHagclQcoMKLY4C8FwZgeQEAgnPy7SCG7WNB JIf40ACZLG5Jj13QUwGmz10Ul888HQQ= =0SXM -----END PGP SIGNATURE----- --3qxpsltzimgkb2dd--