Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp911078rdb; Fri, 1 Dec 2023 01:43:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnKKv67Kmpda/lDOfYrdGXD54XgYcb49mu8PIQoTCvd/GKvm7sslwZQhXd1UuSy+LxfGUV X-Received: by 2002:a17:902:9a85:b0:1cf:b4ac:633e with SMTP id w5-20020a1709029a8500b001cfb4ac633emr17422429plp.51.1701423813809; Fri, 01 Dec 2023 01:43:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701423813; cv=none; d=google.com; s=arc-20160816; b=cx6sMmF5KIcwt9QxkJ2r7JHW4KYCioGACMyT1ITSVw/8P50cpx/fjdn88kvsd6oySL HlVxE7kAobO3ETRcdcw0hWMt1jcT/1isVo8bh4n4AwqMXqqg8IRrF/FJ6jB6sgqMEl2j SI3uTQfDq4ctv6vph26cJ9zxWQwynwu7su+FR8ZtAngqtO5WPP8wgyB+sVct3rY69PaG pA08KbhStAC6+lHifTttVUbQoavZ5PRu+kBPIfbSQZs+RlwFf7GTjAZlTJNWvt9o5b/7 AZpxLghf4JGxCxYqH7EQx/UEQH23NoNS4WpYzld/kEEsc7gJkoW+71TMYBkFEUj9DeY6 EZdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :date:dkim-signature; bh=R40xwJ5ZXVWF75wuJrURSlyJ6mwzxYaMIF9gQCcOzTI=; fh=wET5wB2MXgWAyCzFvAlLSxMVrsQDT8UQiGdzXXV70rI=; b=p2mjjIyucyPprpebc+Vk3Chrcm7PL7tSj/gCYEveWcblUHpVwnZe/4NrhHMQjXihj+ 2G8eBZrskIffJFtkVxdJfSjkiXv9b4qv1L565OvmGLv/UGtAPV8mJt8HgSXnnL3ckYqk klFcu2HvBGYvC1zEfN3C8trM1zYq18A9SbzS2W3TtkgN10Iolq3fJ8Alwfj7iT4EyrXj 97jjAy3fzlAEDqpIhd4+8VHq6pWKpXT1EIGA1p/zC4U+psqkHjXj55vC/6Kg726eemLc pUTFZEWZzMWesTPSVEdsFPCchVzZGk8BCAd0BNiWaj9IUe9Rzxewc5VP7mAxJLT2La/a rqaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail2 header.b=MzFOy8KC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id i9-20020a170902c94900b001cffce39be3si3119056pla.218.2023.12.01.01.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:43:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail2 header.b=MzFOy8KC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 0841C833AB39; Fri, 1 Dec 2023 01:43:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378047AbjLAJnP (ORCPT + 99 others); Fri, 1 Dec 2023 04:43:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378071AbjLAJnK (ORCPT ); Fri, 1 Dec 2023 04:43:10 -0500 Received: from mail-40136.proton.ch (mail-40136.proton.ch [185.70.40.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71CE12D65 for ; Fri, 1 Dec 2023 01:31:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail2; t=1701423100; x=1701682300; bh=R40xwJ5ZXVWF75wuJrURSlyJ6mwzxYaMIF9gQCcOzTI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=MzFOy8KC7MDm3loAEnPVEYW2PETiOOlVVyJU8Kh0ujd4bm99RgBdlxscGMLUE3XJT LJgJ61e6Tj6rg0yyKRfAiFQg68tG+qVidn54rRuVTOU4ZtV317FI0W3q9L9ohBecFp WH/jJV3u/aU2t97/6r0pR9O2Dp+lY+YewIMP5a3W+vd+qdTxMESQkV5MDHmPsqZXu2 Pr3+LaA5lgEzo+v32Z83dThcjI6Kp1H+axJqJ/wtPCpeDCviBxVVzzFNck5TjN8rXc WptADAIdXIMPCkHaKem7VulOrHMrA31kM3ndscdq9iQeEiu5D0XEw4Aeo3oEIctaSV sfljdjJL+JG1A== Date: Fri, 01 Dec 2023 09:31:23 +0000 To: =?utf-8?Q?Andr=C3=A9_Almeida?= From: Simon Ser Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, Rob Clark , Pekka Paalanen , daniel@ffwll.ch, Daniel Stone , =?utf-8?Q?=27Marek_Ol=C5=A1=C3=A1k=27?= , Dave Airlie , =?utf-8?Q?Michel_D=C3=A4nzer?= , Randy Dunlap , Jonathan Corbet , linux-doc@vger.kernel.org, Thomas Zimmermann , Maxime Ripard , Maarten Lankhorst , Pekka Paalanen Subject: Re: [PATCH] drm/doc: Define KMS atomic state set Message-ID: <40gonZRoP7FjDn_ugL_LpXsqwoSCZtypIe7jiWg0t8lkTx94-gESc60Cuu5eWxivJoZCNg3i-cUG9kNpKQZeYdCJPawDpTSIXivJ_t_a87E=@emersion.fr> In-Reply-To: <20231130200740.53454-1-andrealmeid@igalia.com> References: <20231130200740.53454-1-andrealmeid@igalia.com> Feedback-ID: 1358184:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 morse.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 (morse.vger.email [0.0.0.0]); Fri, 01 Dec 2023 01:43:31 -0800 (PST) Thanks for writing these docs! A few comments below. On Thursday, November 30th, 2023 at 21:07, Andr=C3=A9 Almeida wrote: > +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 fashion= , > +without ever applying intermediate or partial state changes. Either the= whole > +commit succeeds or fails, and it will never be applied partially. This i= s 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 unex= pectedly > +fail, cause visible glitches, or delay reaching the final state. > + > +An atomic commit can be flagged with DRM_MODE_ATOMIC_TEST_ONLY, which me= ans the It would be nice to link DRM_MODE_ATOMIC_TEST_ONLY to the actual docs here. This can be done with markup such as: :c:macro:`DRM_MODE_ATOMIC_TEST_ONLY` Same applies to other #defines. > +complete state change is validated but not applied. Userspace should us= e this I'd s/should/can/ here, because there are valid cases where user-space does= n't really need to test before applying. Applying a state first validates it in= the kernel anwyays. > +flag to validate any state change before asking to apply it. If validati= on fails > +for any reason, userspace should attempt to fall back to another, perhap= s > +simpler, final state. This allows userspace to probe for various config= urations > +without causing visible glitches on screen and without the need to undo = a > +probing change. > + > +The changes recorded in an atomic commit apply on top the current KMS st= ate in > +the kernel. Hence, the complete new KMS state is the complete old KMS st= ate with > +the committed property settings done on top. The kernel will try to avoi= d > +no-operation changes, so it is safe for userspace to send redundant prop= erty > +settings. However, not every situation allows for no-op changes, due to= the > +need to acquire locks for some attributes. Userspace needs to be aware t= hat some > +redundant information might result in oversynchronization issues. No-op= eration > +changes do not count towards actually needed changes, e.g. setting MODE= _ID to a > +different blob with identical contents as the current KMS state shall no= t be a > +modeset on its own. As a special exception for VRR needs, explicitly set= ting > +FB_ID to its current value is not a no-op. I'm not sure talking about FB_ID is the right thing to do here. There is nothing special about FB_ID in particular. For instance, setting CRTC_ID to= the same value as before has the same effect. Talking specifically about FB_ID = here can be surprising for user-space: reading these docs, I'd assume setting CRTC_ID to the same value as before is a no-op, but in reality it's not. Instead, I'd suggest explaining how referencing a plane/CRTC/connector in a= n atomic commit adds it to the new state, even if there are no effective prop= erty value changes. > +A "modeset" is a change in KMS state that might enable, disable, or temp= orarily > +disrupt the emitted video signal, possibly causing visible glitches on s= creen. A > +modeset may also take considerably more time to complete than other kind= s of > +changes, and the video sink might also need time to adapt to the new sig= nal > +properties. Therefore a modeset must be explicitly allowed with the flag > +DRM_MODE_ATOMIC_ALLOW_MODESET. This in combination with > +DRM_MODE_ATOMIC_TEST_ONLY allows userspace to determine if a state chang= e is > +likely to cause visible disruption on screen and avoid such changes when= end > +users do not expect them. > + > +An atomic commit with the flag DRM_MODE_PAGE_FLIP_ASYNC is allowed to > +effectively change only the FB_ID property on any planes. No-operation c= hanges > +are ignored as always. Changing any other property will cause the commit= to be > +rejected. Each driver may relax this restriction if they have guarantees= that > +such property change doesn't cause modesets. Userspace can use TEST_ONLY= commits > +to query the driver about this. This doesn't 100% match reality at the moment, because core DRM now rejects= any async commit which changes FB_ID on a non-primary plane. And there is no wa= y for drivers to relax this currently. I'm not sure this is a good place to state such a rule. In the end, it's th= e same as always: the kernel will reject commits it can't perform. DRM_MODE_PAGE_FLIP_ASYNC does not need to be a special case here. Even when changing only FB_ID, the kernel might reject the commit (e.g. i915 does in = some cases).