From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A5407C43334 for ; Thu, 2 Jun 2022 21:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Efov0oTAV5K9nJ6N37Sg1eAVUIjugRy4RIbobIFZ8LA=; b=yXIb2vFWL/kuqg qZFySEqDI68tjhPJZUY4k00snJE1hIE2DFpe11jrchmqoyAxkjATHpDTK3t/4xpb9X4MsuSjWt6Qs 1KezN9I85UOZURUwk9EueRim0FcuE2thwGwD7u5tMzvgpv+0bTvrixo/g7+99x6qJU1ZD3PKhXR3L ZOXMdy32pucN41VcjvVV4DxrbsSbLCzBgiDLlMUGC1Uj1535ZUuYsCRU1wtghrPq1qZ0md+gEF6re /MbouZh6uy4sQdBHSzcRmDMcPuDa/csKVAI8cCuLpCnlEOp3im6Te4H4nn//GzajCdnA2zgZRwRjH MaGVglT9Gg/Ue+mXSJyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwsnO-004T4m-E3; Thu, 02 Jun 2022 21:55:58 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwsnK-004T0r-Gu for linux-arm-kernel@lists.infradead.org; Thu, 02 Jun 2022 21:55:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1654206947; bh=Ki/Rl/4q0399EjnSBqmzWU3sLpJik8WX4vFYR3fDXjg=; h=Date:From:To:Cc:Subject:X-My-GPG-KeyId:References:From; b=FLcoU608SZaHaFJVRmHeaoFikgDsv6OxWVxeRAWPKeAQKSmUPNsaF9elJXb9Z6ST9 axoaxO/BP16uhEv0Im0qYE0VTGmt7sBdQe16Q8AWXWtcNdNVrolG1Z7fgg2u/tV3bL 5e34zlYVa/hV/i9VZaDx0KppIU7ukftnHRY6QCLo= Date: Thu, 2 Jun 2022 23:55:47 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Roman Stratiienko Cc: mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, samuel@sholland.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/sun4i: sun8i: Add the ability to keep scaler enabled for VI layer Message-ID: <20220602215547.scsabzbeztgduaj3@core> Mail-Followup-To: =?utf-8?Q?Ond=C5=99ej?= Jirman , Roman Stratiienko , mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com, airlied@linux.ie, daniel@ffwll.ch, samuel@sholland.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED References: <20220602180118.66170-1-r.stratiienko@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220602180118.66170-1-r.stratiienko@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220602_145555_059134_EC6F57D2 X-CRM114-Status: GOOD ( 24.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Roman, On Thu, Jun 02, 2022 at 06:01:18PM +0000, Roman Stratiienko wrote: > According to DE2.0/DE3.0 manual VI scaler enable register is double > buffered, but de facto it doesn't, or the hardware has the shadow > register latching issues which causes single-frame picture corruption > after changing the state of scaler enable register. > > Allow the user to keep the scaler always enabled, preventing the UI > glitches on the transition from scaled to unscaled state. > > NOTE: > UI layer scaler has more registers with double-buffering issue and can't > be workarounded in the same manner. > > You may find a python test and a demo video for this issue at [1] Isn't this an issue with kernel driver not waiting for DE2 FINISH IRQ, but for VBLANK IRQ from TCON instead, before allowing to write new set of register values? https://megous.com/dl/tmp/4fe35b3fc72ee7de.png I haven't checked if FINISH flag is set at time of VBLANK interrupt, so maybe this is not the issue. regards, o. > [1]: https://github.com/GloDroid/glodroid_tests/issues/4 > Signed-off-by: Roman Stratiienko > --- > drivers/gpu/drm/sun4i/sun8i_mixer.c | 12 ++++++++++++ > drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 4 +++- > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c > index 71ab0a00b4de..15cad0330f66 100644 > --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c > +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c > @@ -27,6 +27,18 @@ > #include "sun8i_vi_layer.h" > #include "sunxi_engine.h" > > +/* According to DE2.0/DE3.0 manual VI scaler enable register is double > + * buffered, but de facto it doesn't, or the hardware has the shadow > + * register latching issues which causes single-frame picture corruption > + * after changing the state of scaler enable register. > + * Allow the user to keep the scaler always enabled, preventing the UI > + * glitches on the transition from scaled to unscaled state. > + */ > +int sun8i_vi_keep_scaler_enabled; > +MODULE_PARM_DESC(keep_vi_scaler_enabled, > + "Keep VI scaler enabled (1 = enabled, 0 = disabled (default))"); > +module_param_named(keep_vi_scaler_enabled, sun8i_vi_keep_scaler_enabled, int, 0644); > + > struct de2_fmt_info { > u32 drm_fmt; > u32 de2_fmt; > diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c > index 662ba1018cc4..f005ab883503 100644 > --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c > +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c > @@ -17,6 +17,8 @@ > #include "sun8i_vi_layer.h" > #include "sun8i_vi_scaler.h" > > +extern int sun8i_vi_keep_scaler_enabled; > + > static void sun8i_vi_layer_enable(struct sun8i_mixer *mixer, int channel, > int overlay, bool enable, unsigned int zpos) > { > @@ -149,7 +151,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel, > */ > subsampled = format->hsub > 1 || format->vsub > 1; > > - if (insize != outsize || subsampled || hphase || vphase) { > + if (insize != outsize || subsampled || hphase || vphase || sun8i_vi_keep_scaler_enabled) { > unsigned int scanline, required; > struct drm_display_mode *mode; > u32 hscale, vscale, fps; > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel