From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=159.226.251.81 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794900856; b=5LCN93m6Aa8BjCGwIzrSjTLhQlL19wZNilxzoNY7r58eeQrHUiNwDtPEOgRcnjPFrfrm SAM/jEfSs/Gcd+OEqAtOqZyysNogQWiVHhPM8KSyLmGMpLxVfYMeB0KJeiqVkRCCK+sO3 LuvD/upUeskKpDHNJXf2PRGQizCpKjL93ejGRSd5oxBtUveSMzQfE4fAjM5sJDFZP7ii+ B8gOs+KuSTxdUZVSsoss0z+pHeFDNFMMmUJeB4pkKQTQq7+2WylqJJgdGtW49R1YUlDq6 PzdrDIRxoDIbqKCnqb2fGjgnf487PbM+jZjGFdnFvyGt9oLzHF3mDKtloi6nMwTVKPQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794900856; h=DMARC-Filter:Received:Message-ID:Subject:From:To:Cc:Date:In-Reply-To: References:Content-Type:Content-Transfer-Encoding:User-Agent: MIME-Version:X-CM-TRANSID:X-Coremail-Antispam:X-Originating-IP: X-CM-SenderInfo; bh=7xGplfEcnYgsOIKy3UGuEiz5z0nEPCZzej+DTzRp/YI=; b=VAMuo7Q+QnlB1gHa/XkR5SfBGtmFckfeu98ZY4n99x4VLWMzWkjwhMf0dw9hXrHytqqO FDI4by77y0/QqOCgjM3T0FBU0fC353aYOsgSPyQD6wm8PXda1Vjej1EvME9zSRZ+A229B v2qTKKMmJx6W0VO5GSlEqC7eojGv8cwo7F2CPgkg3yLV6deWJ6BDvc3RpgOIGhN8SDXbr CyuR13gAbLm9fSX6U2KnJSbRA9kcVTvdGt0kNZ9TP/Ra2ilaW7EJchUbGpAUiC2NiS1gm Sb3dJhhe870zA9xPYMg+Iirq7rATboP549n8G8dV6FioIcOIAJikNAaNnAqP7kqblOA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.remote-ip=159.226.251.81 Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 163EB606A31C for ; Tue, 17 Nov 2026 07:34:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 163EB606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from edelgard.fodlan.icenowy.me (unknown [112.94.102.23]) by APP-03 (Coremail) with SMTP id rQCowAAXJpdqA_xqqn83AQ--.27001S2; Tue, 17 Nov 2026 15:34:04 +0800 (CST) Message-ID: <73f4e371c37c36581240ff355fef3de2afaaa033.camel@iscas.ac.cn> Subject: Re: [PATCH v2 2/4] drm/verisilicon: nuke planes' atomic_enable hooks From: Icenowy Zheng To: Thomas Zimmermann , Maarten Lankhorst , Maxime Ripard Cc: David Airlie , Simona Vetter , Dmitry Baryshkov , Joey Lu , Han Gao , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Date: Tue, 17 Nov 2026 15:34:02 +0800 In-Reply-To: References: <20261102075710.1286456-1-zhengxingda@iscas.ac.cn> <20261102075710.1286456-3-zhengxingda@iscas.ac.cn> <8e3b36c6-e2d8-4746-aefe-462bba1a4b05@suse.de> <5830251f1420c152b2efc2ee37248057bdfc901d.camel@iscas.ac.cn> <55991183-ab5f-4445-afce-37a79310ef27@suse.de> <83aa9fb5be26fb407c7f1393bc01099d374cf51f.camel@iscas.ac.cn> <7e4b4fd185f47404bb5f18e7c2c8086d24e673f4.camel@iscas.ac.cn> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-CM-TRANSID:rQCowAAXJpdqA_xqqn83AQ--.27001S2 X-Coremail-Antispam: 1UD129KBjvJXoW3XFWDuF1kCF4DGr4UKF15urg_yoWxGr1kpr WktFy8Kr4rXrykJr9rtw4qqayagr47t347Xr1UJF1UXrn8trnrW3W0qrnruF4kXr48G3Wx Jw12yF9rZr18AF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvqb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4 A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IE w4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMc vjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwACI402YVCY1x02628vn2kIc2xKxwCY 1x0262kKe7AKxVWUtVW8ZwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8Jw C20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAF wI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjx v20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2 jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0x ZFpf9x07betCcUUUUU= X-CM-SenderInfo: x2kh0wp0lqwv3d6l2u1dvotugofq/ =E5=9C=A8 2026-11-17=E4=BA=8C=E7=9A=84 08:25 +0100=EF=BC=8CThomas Zimmerman= n=E5=86=99=E9=81=93=EF=BC=9A > Hi >=20 > Am 17.11.26 um 06:19 schrieb Icenowy Zheng: > [...] > > > > Sure, but is that a problem for this hardware? > > > For the cursor plane, the unchecked coordinate might be improper > > > for > > > the registers. > > >=20 > > > For the primary plane, if the plane is found to be totally off by > > > drm_atomic_helper_check_plane_state(), the check for > > > can_position, > > > which is below the code snippet I referenced, would be bypassed, > > > and > > > such plane would be programmed to be visible by the atomic_update > > > hook > > > even if it shouldn't be visible. > > Well I am now thinking that bound-but-invisible situation is > > commonly > > ignored by drivers. > >=20 > > For drm/verisilicon, maybe I'd remove both atomic_disable and > > atomic_enable; however I think the atomic helpers may need some > > flag to > > consider bound-but-invisible planes when calling > > atomic_{dis,en}able. >=20 > I don't think I really understand what you're up to, but it seems > you're=20 > overthinking the whole thing. Other drivers only care about plane > on/off=20 Well I don't know whether I am overthinking... Enabled but invisible planes are explicitly allowed in drm_atomic_helper_check_plane_state(), and even the can_position check is bypassed in such case (so such a configuration can even appear on primary planes). In addition, in most implementations for atomic_check, the invisible situations have the validity check explicitly skipped, so just disallow enabled-but-invisible planes in atomic_check would make the behavior quite different with most drivers. Maybe I should craft some "evil" programs to check for this situation. Thanks, Icenowy > and the contained image. That's also what the 3 callbacks are for. It > usually works nicely. Hence me asking. But maybe verisilicon is=20 > different, IDK. >=20 > My suggestion is therefore to remove _enable and _disable and keep > all=20 > logic in _update. >=20 > atomic_update() > { > =C2=A0=C2=A0 =C2=A0 if (plane_state->visible) { > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 // do update > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 // enable hw plane > =C2=A0=C2=A0 =C2=A0 } else { > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 // disable hw plane > =C2=A0=C2=A0 =C2=A0 } > } >=20 > If you have any special cases where you want visible to be false (or=20 > true), detect them in atomic_check and set the flags accordingly. >=20 > atomic_check() > { > drm_atomic_helper_check_plane_state() =C2=A0 =C2=A0 if (awkward coords) > =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0plane_state->visible =3D false; > } >=20 > Best regards > Thomas >=20 > >=20 > > Thanks, > > Icenowy > >=20 > > > Thanks, > > > Icenowy > > >=20 > > > > Best regards > > > > Thomas > > > >=20 > > > > > The end of drm_atomic_helper_check_plane_state() says: > > > > >=20 > > > > > ``` > > > > > if (!plane_state->visible) > > > > > /* > > > > > * Plane isn't visible; some drivers can > > > > > handle > > > > > this > > > > > * so we just return success here.=C2=A0 Drivers > > > > > that > > > > > can't > > > > > * (including those that use the primary > > > > > plane > > > > > helper's > > > > > * update function) will return an error > > > > > from > > > > > their > > > > > * update_plane handler. > > > > > */ > > > > > return 0; > > > > > ``` > > > > >=20 > > > > > Thanks, > > > > > Icenowy > > > > >=20 > > > > > > [1] > > > > > > https://elixir.bootlin.com/linux/v7.3.1/source/drivers/gpu/drm/= drm_atomic_helper.c#L3030 > > > > > >=20 > > > > > > Best regards > > > > > > Thomas > > > > > >=20 > > > > > > > =C2=A0=C2=A0=C2=A0 }; > > > > > > > =C2=A0=C2=A0=C2=A0=20 > > > > > > > diff --git > > > > > > > a/drivers/gpu/drm/verisilicon/vs_primary_plane.c > > > > > > > b/drivers/gpu/drm/verisilicon/vs_primary_plane.c > > > > > > > index 8e94491693019..fca692f4f7d5c 100644 > > > > > > > --- a/drivers/gpu/drm/verisilicon/vs_primary_plane.c > > > > > > > +++ b/drivers/gpu/drm/verisilicon/vs_primary_plane.c > > > > > > > @@ -59,25 +59,6 @@ static void > > > > > > > vs_primary_plane_commit(struct > > > > > > > vs_dc > > > > > > > *dc, unsigned int output) > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0 VSDC_FB_CONFIG_EX_COMMIT); > > > > > > > =C2=A0=C2=A0=C2=A0 } > > > > > > > =C2=A0=C2=A0=C2=A0=20 > > > > > > > -static void vs_primary_plane_atomic_enable(struct > > > > > > > drm_plane > > > > > > > *plane, > > > > > > > - =C2=A0=C2=A0 struct > > > > > > > drm_atomic_commit *atomic_state) > > > > > > > -{ > > > > > > > - struct drm_plane_state *state =3D > > > > > > > drm_atomic_get_new_plane_state(atomic_state, > > > > > > > - > > > > > > > =09 > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 plane); > > > > > > > - struct drm_crtc *crtc =3D state->crtc; > > > > > > > - struct vs_crtc *vcrtc =3D > > > > > > > drm_crtc_to_vs_crtc(crtc); > > > > > > > - unsigned int output =3D vcrtc->id; > > > > > > > - struct vs_dc *dc =3D vcrtc->dc; > > > > > > > - > > > > > > > - regmap_set_bits(dc->regs, > > > > > > > VSDC_FB_CONFIG_EX(output), > > > > > > > - VSDC_FB_CONFIG_EX_FB_EN); > > > > > > > - regmap_update_bits(dc->regs, > > > > > > > VSDC_FB_CONFIG_EX(output), > > > > > > > - =09 > > > > > > > VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK, > > > > > > > - =09 > > > > > > > VSDC_FB_CONFIG_EX_DISPLAY_ID(output)); > > > > > > > - > > > > > > > - vs_primary_plane_commit(dc, output); > > > > > > > -} > > > > > > > - > > > > > > > =C2=A0=C2=A0=C2=A0 static void vs_primary_plane_atomic_disabl= e(struct > > > > > > > drm_plane > > > > > > > *plane, > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 struct > > > > > > > drm_atomic_commit *atomic_state) > > > > > > > =C2=A0=C2=A0=C2=A0 { > > > > > > > @@ -144,13 +125,18 @@ static void > > > > > > > vs_primary_plane_atomic_update(struct drm_plane *plane, > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0 regmap_write(dc->regs, > > > > > > > VSDC_FB_BLEND_CONFIG(output), > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 > > > > > > > VSDC_FB_BLEND_CONFIG_BLEND_DISABLE); > > > > > > > =C2=A0=C2=A0=C2=A0=20 > > > > > > > + regmap_set_bits(dc->regs, > > > > > > > VSDC_FB_CONFIG_EX(output), > > > > > > > + VSDC_FB_CONFIG_EX_FB_EN); > > > > > > > + regmap_update_bits(dc->regs, > > > > > > > VSDC_FB_CONFIG_EX(output), > > > > > > > + =09 > > > > > > > VSDC_FB_CONFIG_EX_DISPLAY_ID_MASK, > > > > > > > + =09 > > > > > > > VSDC_FB_CONFIG_EX_DISPLAY_ID(output)); > > > > > > > + > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0 vs_primary_plane_commit(dc, output); > > > > > > > =C2=A0=C2=A0=C2=A0 } > > > > > > > =C2=A0=C2=A0=C2=A0=20 > > > > > > > =C2=A0=C2=A0=C2=A0 static const struct drm_plane_helper_funcs > > > > > > > vs_primary_plane_helper_funcs =3D { > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0 .atomic_check =3D vs_primary_plane_a= tomic_check, > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0 .atomic_update =3D > > > > > > > vs_primary_plane_atomic_update, > > > > > > > - .atomic_enable =3D > > > > > > > vs_primary_plane_atomic_enable, > > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0 .atomic_disable =3D > > > > > > > vs_primary_plane_atomic_disable, > > > > > > > =C2=A0=C2=A0=C2=A0 }; > > > > > > > =C2=A0=C2=A0=C2=A0=20