From patchwork Sat May 21 13:34:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Genfu Pan X-Patchwork-Id: 12857887 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 0AC06C433F5 for ; Sat, 21 May 2022 13:36:21 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0sKKJ5lqolbBmB81IKP1PfAWA/IexMb5XWeNJnejeZw=; b=0N3IUorWRKjy2X L91QWBdX28ZkSXGKsmms4OGtK5teuWxZRu4lRwNrW9JIDAnXC3X0i67R0bocA+ArF4XS8IbL9eSbv BV5ec+wA5iIpk1yLbyKQQ3ZF472WSKfsBjrPu+1tymSrPDycvQS5D2wjMTk+tX0SOX0fuLSjWVv5o c/6g5yxLYE0cf4CKDYK/3LjYaiT/QEccUaD/yfREvxbToAC1AeutV/5+Iu7nUzjLbY64YmGdmk5ai mJF7Y8DvE1w2ycxPg/OpmCXBdf4xqp8GYlsxmX3Gp9SlQHaa6SDrpKEFHmjXbLCAjfm6pE3EpbWm9 hjyMCH4hC3IqRNxkEh7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nsPG7-00GeRJ-Qu; Sat, 21 May 2022 13:35:07 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nsPG4-00GeQQ-CR for linux-arm-kernel@lists.infradead.org; Sat, 21 May 2022 13:35:05 +0000 Received: by mail-pj1-x1029.google.com with SMTP id w17-20020a17090a529100b001db302efed6so9912778pjh.4 for ; Sat, 21 May 2022 06:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=X/1JoYU2eaaPdYWTtHptPizgGXOiJfqbRsxQiijvcnU=; b=hJ2wZiz43Q7G5xoR7vAK2HSUyHGSdRL6QM5wOn5ffWmh5k2Q9I5pqiRe4xddjEhY8e IGx3dW2owdGd6n7HP8V94tSJYcKWxXNF0wiB3hZ5KvoEBtuViuVj3SRjC1qO0uau/WCB S30vyXiWvOWLqj/mj66JfAe6myrcD66UJh/gEwv1GpzVDZJ+SsT3VdoObIg7449Qjasc yipS888I4w66zXrKuPCsk6JY9czhevexTSnd7nwSpnYuKonJ5ncBXahUxoxsgLX4Jtnu QYIAmB1QvxnvWoxkCg9VBammHApWcTg8J1eP7nWuRnLEYPtoqB5MFCQkxkBLn2i3M7XI CfYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=X/1JoYU2eaaPdYWTtHptPizgGXOiJfqbRsxQiijvcnU=; b=qp8EMNorS5Ig64OGgkTcbQ74M0fh2QXg5CiAGrqvGGYHsaKra2Bd2rLjiE6rOqUWDP Dbqlsn/wAPp2Rn0VOCktYCTPszuYsy6CBf5RHaGU9bur9qV7bAi/Ez8Cuke2SF47SFry Ed7UcUQ1poqH6C7NKRDc7gQwL9UzMKm0gUbwrd7np0axkXW95pQoB6ZeXMYC/KXq6nPx t5/xjR75dLlGJAxVkARrtCTP1Th3Bs/EvB+Ul9cG2dJQkgH82xuXRxjSkz79K6LXJj/i Kh4e/zD/iFvwMtovoX4+BgvpOouusVsgbWFUVyoPPP844wEQQ+9oxXIlTs/5SjnNWbmv Tglg== X-Gm-Message-State: AOAM5318jVZwOKGd2jwnEs78EZoIUgsJQ6p3Eaio+kV1di8Tjprgxny5 rQGEQtWrj2FmEE71w5wYSfU= X-Google-Smtp-Source: ABdhPJx0zCLwUiyeASotOlJEzSqtjfEA3r1zvU8fue4LcCU1odSzkqoq62UrwvZajtLu0Z/RriA9jA== X-Received: by 2002:a17:90b:3889:b0:1dc:cac6:f03e with SMTP id mu9-20020a17090b388900b001dccac6f03emr16537918pjb.23.1653140102261; Sat, 21 May 2022 06:35:02 -0700 (PDT) Received: from benly-pc.localdomain ([58.100.171.250]) by smtp.gmail.com with ESMTPSA id jb15-20020a170903258f00b0015e8d4eb256sm1597765plb.160.2022.05.21.06.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 06:35:02 -0700 (PDT) From: Genfu Pan 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 Subject: [PATCH] drm/sun4i: mixer: fix scanline for V3s and D1 Date: Sat, 21 May 2022 21:34:43 +0800 Message-Id: <20220521133443.1114749-1-benlypan@gmail.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220521_063504_485776_6B26F1B3 X-CRM114-Status: GOOD ( 14.76 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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");