Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3194009pxb; Mon, 9 Nov 2020 05:18:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxlKtJnMqPg+49q7lDx5VmGBcwkfVBaqphCkDUEFLJQV9vC8VXvoQJX9S4VsMY9GRZZ3An X-Received: by 2002:a17:906:4e90:: with SMTP id v16mr11721988eju.477.1604927892341; Mon, 09 Nov 2020 05:18:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604927892; cv=none; d=google.com; s=arc-20160816; b=eKDh89dpovU6Y8aLFYYXWx+J2TPryFIEj+p2MPVxMU2bAGO7fijoqQr7wb8zuQlBvR eSAXi17v+nuI66ZIxnwsb/QbBNdCKgxlzNWdP49EYLVU6OSlwHvPYUx+pXk2e2skhGt2 ymg2cIkUK6QtFwpxlUdRZE3aLlUfRenUudi2er3qGwcjRcLfaQpRl1AmO9C2RGOqWBlR jRZDssP4BQuIniH6OH4q3078jpIyL0GJVxv8GL5MPPCvGZ48E1AvPCHRlBcMz23FIJaC DLsJWPhBGty2h1SCu9qIiKRx9FBenDC2PK8/SF2lGTPRxYvji1g89TiQPg3Pwl5EpE2f NJKA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xioK8uTeKFxZtwYoqoaolz4YGLYBsHow7AiRdDAyo8A=; b=q2o9ATAw+nFSiB2ukdXouFUc4a7C7pZPdmMqMFY5auPX0yeXj3prtK4506aiIOuMAb UzkrAug8LrN1en+rP3zHxheB5xHzWlczVDUVwQYVwY2o7kBQm13UFCBVGX1VIz+KBWrr ltHYvTDEXv1AF886qOEENd6Ooa50RWWSCRnotZizI3MZZiwpIVgtf6nySq7EkKtfw6KS S03OswjP15VeiUqnAMUS1cdLMgrf8SC1xqsNHTlWwQERMSy7pf27U2FvLwp/0/a3JAFA 8RuP3Q46SoEQXX5gBJ1nCegYDCcnX0zQi/PzNbe9FYJgAI7c3VoHG6RSrQ1zzPHfmb6N doAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TMWUh4lf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c91si6651615edf.313.2020.11.09.05.17.49; Mon, 09 Nov 2020 05:18:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TMWUh4lf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732971AbgKINNe (ORCPT + 99 others); Mon, 9 Nov 2020 08:13:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:39446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731621AbgKINNd (ORCPT ); Mon, 9 Nov 2020 08:13:33 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 101262083B; Mon, 9 Nov 2020 13:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927612; bh=VLse2Z6NhS8fDKFaVBcSRIry1Vxk7y3pzIPZuEQfV0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMWUh4lfRk2h7TM3o8YcxrqA9B2kR5EB5SOvqZZgQS1XpkRwvi7MeKI3yXYs5dGqK P4lgQwrIoT+Erm7PKr/ZMmDY8lMK1ed8EN0RGmV6euF/s5FjmZ4wymzqPdho+G2aVf IHQV/79+RXy/C6yr2OWYYBLvYPIMLra+B39euyic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taras Galchenko , Maxime Ripard , Jernej Skrabec , Sasha Levin Subject: [PATCH 5.4 47/85] drm/sun4i: frontend: Reuse the ch0 phase for RGB formats Date: Mon, 9 Nov 2020 13:55:44 +0100 Message-Id: <20201109125024.849356191@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125022.614792961@linuxfoundation.org> References: <20201109125022.614792961@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxime Ripard [ Upstream commit 2db9ef9d9e6ea89a9feb5338f58d1f8f83875577 ] When using the scaler on the A10-like frontend with single-planar formats, the current code will setup the channel 0 filter (used for the R or Y component) with a different phase parameter than the channel 1 filter (used for the G/B or U/V components). This creates a bleed out that keeps repeating on of the last line of the RGB plane across the rest of the display. The Allwinner BSP either applies the same phase parameter over both channels or use a separate one, the condition being whether the input format is YUV420 or not. Since YUV420 is both subsampled and multi-planar, and since YUYV is subsampled but single-planar, we can rule out the subsampling and assume that the condition is actually whether the format is single or multi-planar. And it looks like applying the same phase parameter over both channels for single-planar formats fixes our issue, while we keep the multi-planar formats working properly. Reported-by: Taras Galchenko Signed-off-by: Maxime Ripard Acked-by: Jernej Skrabec Link: https://patchwork.freedesktop.org/patch/msgid/20201015093642.261440-2-maxime@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/sun4i/sun4i_frontend.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c index 7462801b1fa8e..c4959d9e16391 100644 --- a/drivers/gpu/drm/sun4i/sun4i_frontend.c +++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c @@ -407,6 +407,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, struct drm_framebuffer *fb = state->fb; const struct drm_format_info *format = fb->format; uint64_t modifier = fb->modifier; + unsigned int ch1_phase_idx; u32 out_fmt_val; u32 in_fmt_val, in_mod_val, in_ps_val; unsigned int i; @@ -442,18 +443,19 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, * I have no idea what this does exactly, but it seems to be * related to the scaler FIR filter phase parameters. */ + ch1_phase_idx = (format->num_planes > 1) ? 1 : 0; regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_HORZPHASE_REG, frontend->data->ch_phase[0]); regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_HORZPHASE_REG, - frontend->data->ch_phase[1]); + frontend->data->ch_phase[ch1_phase_idx]); regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE0_REG, frontend->data->ch_phase[0]); regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE0_REG, - frontend->data->ch_phase[1]); + frontend->data->ch_phase[ch1_phase_idx]); regmap_write(frontend->regs, SUN4I_FRONTEND_CH0_VERTPHASE1_REG, frontend->data->ch_phase[0]); regmap_write(frontend->regs, SUN4I_FRONTEND_CH1_VERTPHASE1_REG, - frontend->data->ch_phase[1]); + frontend->data->ch_phase[ch1_phase_idx]); /* * Checking the input format is sufficient since we currently only -- 2.27.0