linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Genfu Pan <benlypan@gmail.com>
To: mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com
Cc: 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,
	Genfu Pan <benlypan@gmail.com>
Subject: [PATCH] drm/sun4i: mixer: fix scanline for V3s and D1
Date: Sat, 21 May 2022 21:34:43 +0800	[thread overview]
Message-ID: <20220521133443.1114749-1-benlypan@gmail.com> (raw)

Accrording the SDK from Allwinner, the scanline value of yuv and rgb for
V3s are both 1024. The is also the same for mixer 1 of D1. Currently the
scanline value of rgb is hardcoded to 2048 for all SOCs.

Change the scanline_yuv property of V3s to 1024. Add the scanline_rgb
property to the mixer config and replace the hardcoded value with it before
scaling.

Signed-off-by: Genfu Pan <benlypan@gmail.com>
---
 drivers/gpu/drm/sun4i/sun8i_mixer.c    | 13 ++++++++++++-
 drivers/gpu/drm/sun4i/sun8i_mixer.h    |  1 +
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c |  3 +--
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index 875a1156c..e64e08207 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -567,6 +567,7 @@ static const struct sun8i_mixer_cfg sun8i_a83t_mixer0_cfg = {
 	.ccsc		= CCSC_MIXER0_LAYOUT,
 	.scaler_mask	= 0xf,
 	.scanline_yuv	= 2048,
+	.scanline_rgb	= 2048,
 	.ui_num		= 3,
 	.vi_num		= 1,
 };
@@ -575,6 +576,7 @@ static const struct sun8i_mixer_cfg sun8i_a83t_mixer1_cfg = {
 	.ccsc		= CCSC_MIXER1_LAYOUT,
 	.scaler_mask	= 0x3,
 	.scanline_yuv	= 2048,
+	.scanline_rgb	= 2048,
 	.ui_num		= 1,
 	.vi_num		= 1,
 };
@@ -584,6 +586,7 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg = {
 	.mod_rate	= 432000000,
 	.scaler_mask	= 0xf,
 	.scanline_yuv	= 2048,
+	.scanline_rgb	= 2048,
 	.ui_num		= 3,
 	.vi_num		= 1,
 };
@@ -593,6 +596,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
 	.mod_rate	= 297000000,
 	.scaler_mask	= 0xf,
 	.scanline_yuv	= 2048,
+	.scanline_rgb	= 2048,
 	.ui_num		= 3,
 	.vi_num		= 1,
 };
@@ -602,6 +606,7 @@ static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = {
 	.mod_rate	= 297000000,
 	.scaler_mask	= 0x3,
 	.scanline_yuv	= 2048,
+	.scanline_rgb	= 2048,
 	.ui_num		= 1,
 	.vi_num		= 1,
 };
@@ -610,7 +615,8 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
 	.vi_num = 2,
 	.ui_num = 1,
 	.scaler_mask = 0x3,
-	.scanline_yuv = 2048,
+	.scanline_yuv = 1024,
+	.scanline_rgb = 1024,
 	.ccsc = CCSC_MIXER0_LAYOUT,
 	.mod_rate = 150000000,
 };
@@ -620,6 +626,7 @@ static const struct sun8i_mixer_cfg sun20i_d1_mixer0_cfg = {
 	.mod_rate	= 297000000,
 	.scaler_mask	= 0x3,
 	.scanline_yuv	= 2048,
+	.scanline_rgb	= 2048,
 	.ui_num		= 1,
 	.vi_num		= 1,
 };
@@ -629,6 +636,7 @@ static const struct sun8i_mixer_cfg sun20i_d1_mixer1_cfg = {
 	.mod_rate	= 297000000,
 	.scaler_mask	= 0x1,
 	.scanline_yuv	= 1024,
+	.scanline_rgb	= 1024,
 	.ui_num		= 0,
 	.vi_num		= 1,
 };
@@ -638,6 +646,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer0_cfg = {
 	.mod_rate	= 297000000,
 	.scaler_mask	= 0xf,
 	.scanline_yuv	= 4096,
+	.scanline_rgb	= 2048,
 	.ui_num		= 3,
 	.vi_num		= 1,
 };
@@ -647,6 +656,7 @@ static const struct sun8i_mixer_cfg sun50i_a64_mixer1_cfg = {
 	.mod_rate	= 297000000,
 	.scaler_mask	= 0x3,
 	.scanline_yuv	= 2048,
+	.scanline_rgb	= 2048,
 	.ui_num		= 1,
 	.vi_num		= 1,
 };
@@ -657,6 +667,7 @@ static const struct sun8i_mixer_cfg sun50i_h6_mixer0_cfg = {
 	.mod_rate	= 600000000,
 	.scaler_mask	= 0xf,
 	.scanline_yuv	= 4096,
+	.scanline_rgb	= 2048,
 	.ui_num		= 3,
 	.vi_num		= 1,
 };
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index 85c94884f..c01b3e9d6 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -172,6 +172,7 @@ struct sun8i_mixer_cfg {
 	unsigned long	mod_rate;
 	unsigned int	is_de3 : 1;
 	unsigned int	scanline_yuv;
+	unsigned int	scanline_rgb;
 };
 
 struct sun8i_mixer {
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index f7d0b082d..30e6bde92 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -188,8 +188,7 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel,
 			src_h = vn;
 		}
 
-		/* it seems that every RGB scaler has buffer for 2048 pixels */
-		scanline = subsampled ? mixer->cfg->scanline_yuv : 2048;
+		scanline = subsampled ? mixer->cfg->scanline_yuv : mixer->cfg->scanline_rgb;
 
 		if (src_w > scanline) {
 			DRM_DEBUG_DRIVER("Using horizontal coarse scaling\n");
-- 
2.36.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2022-05-21 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-21 13:34 Genfu Pan [this message]
2022-05-22  8:36 ` [PATCH] drm/sun4i: mixer: fix scanline for V3s and D1 Jernej Škrabec
2022-05-22 10:53   ` benlypan
2022-05-23 13:14   ` Icenowy Zheng
2022-05-24 17:07     ` Samuel Holland
2022-05-24 19:01       ` Jernej Škrabec
     [not found]   ` <202205221848264427024@gmail.com>
2022-05-24 19:08     ` Jernej Škrabec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220521133443.1114749-1-benlypan@gmail.com \
    --to=benlypan@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mripard@kernel.org \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).