Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1777179imm; Thu, 27 Sep 2018 02:17:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV62eLTiwXBGDL9YEbrKpo6SOiJCT/+5K2PFcKRqxIXWIG9GFeGtZemAICUbOGj/kci7XNFfv X-Received: by 2002:a62:13cb:: with SMTP id 72-v6mr5593280pft.34.1538039847497; Thu, 27 Sep 2018 02:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039847; cv=none; d=google.com; s=arc-20160816; b=Xtrh/y0utyhi3ZyiJbMbamVffb1vb0qMDMJIcoVfriY//IQPhozLF09SuQeP6HO0Yl OHhLfkAIX7hMZyDw5C5BULQCqwPnLNCMh/a38Sz17gTyX1K0w3UAG9xsWSKiULOGqFVv gSRlGcmoESK7qbA41yqDsweCz3fOMCdXZ9UN9u/paL4nNvVwFBukeoR3bgxP0TloJAD8 7lisbr7OKotXAQRu2L2NAlGsrrhBxCBhHGiUxBSFBqQQJHhl5CA2Xgyt835jTC9C5JuT FEXVcvWepxhNnVFstgqiHsqzhp7GuOH8X+VfVf6IySAMxZ1XfEY4o/hKbZLxiS3Cu6lC wUPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=2p4OarxwwgRy0PT9EMBIDxQ2lMG9LrKpmyJC5s9KIJk=; b=LM31k9l0mnAmZtz9uey8ie/1559Oj9d3a8H6uMjZYao7zsWmUr2Hoho/GU3xZVm8Y1 YcP3g1ApQvVYqu+6HojuKEar54rPZph4EqjL10abjcJSzlG+Bjxw0qHNyhNbatG4UhaU dmutO0zTayLj5mV2sMwzkCrwYOPnpBaguWb4ZMd1kaXVBjVNx3U8/rdBMa7rpcAdXBC+ Yc4rbJty2wKc/3jyOJ9OBULlKza97aRP6nDx6SJ20ehSQYqVPQEzxYZyDopEjRGW8v0S xdhbsvdwMeIwaAN9O3o8LhW4JneejsSY3YLMtfSOsgB1pKz4BOt7brDhh/kyIRR/d377 8mHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j125-v6si1560839pfc.243.2018.09.27.02.17.12; Thu, 27 Sep 2018 02:17:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728106AbeI0Pdf (ORCPT + 99 others); Thu, 27 Sep 2018 11:33:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55864 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727995AbeI0Pde (ORCPT ); Thu, 27 Sep 2018 11:33:34 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2FC5E1117; Thu, 27 Sep 2018 09:16:15 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Brezillon , Eric Anholt , Sean Paul Subject: [PATCH 4.18 71/88] drm/vc4: Fix the "no scaling" case on multi-planar YUV formats Date: Thu, 27 Sep 2018 11:03:52 +0200 Message-Id: <20180927090309.292115934@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Boris Brezillon commit 658d8cbd07dae22ccecf49399e18c609c4e85c53 upstream. When there's no scaling requested ->is_unity should be true no matter the format. Also, when no scaling is requested and we have a multi-planar YUV format, we should leave ->y_scaling[0] to VC4_SCALING_NONE and only set ->x_scaling[0] to VC4_SCALING_PPF. Doing this fixes an hardly visible artifact (seen when using modetest and a rather big overlay plane in YUV420). Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.") Cc: Signed-off-by: Boris Brezillon Reviewed-by: Eric Anholt Link: https://patchwork.freedesktop.org/patch/msgid/20180725122907.13702-1-boris.brezillon@bootlin.com Signed-off-by: Sean Paul Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vc4/vc4_plane.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -297,6 +297,9 @@ static int vc4_plane_setup_clipping_and_ vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0], vc4_state->crtc_h); + vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE && + vc4_state->y_scaling[0] == VC4_SCALING_NONE); + if (num_planes > 1) { vc4_state->is_yuv = true; @@ -312,24 +315,17 @@ static int vc4_plane_setup_clipping_and_ vc4_get_scaling_mode(vc4_state->src_h[1], vc4_state->crtc_h); - /* YUV conversion requires that scaling be enabled, - * even on a plane that's otherwise 1:1. Choose TPZ - * for simplicity. + /* YUV conversion requires that horizontal scaling be enabled, + * even on a plane that's otherwise 1:1. Looks like only PPF + * works in that case, so let's pick that one. */ - if (vc4_state->x_scaling[0] == VC4_SCALING_NONE) - vc4_state->x_scaling[0] = VC4_SCALING_TPZ; - if (vc4_state->y_scaling[0] == VC4_SCALING_NONE) - vc4_state->y_scaling[0] = VC4_SCALING_TPZ; + if (vc4_state->is_unity) + vc4_state->x_scaling[0] = VC4_SCALING_PPF; } else { vc4_state->x_scaling[1] = VC4_SCALING_NONE; vc4_state->y_scaling[1] = VC4_SCALING_NONE; } - vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE && - vc4_state->y_scaling[0] == VC4_SCALING_NONE && - vc4_state->x_scaling[1] == VC4_SCALING_NONE && - vc4_state->y_scaling[1] == VC4_SCALING_NONE); - /* No configuring scaling on the cursor plane, since it gets non-vblank-synced updates, and scaling requires requires LBM changes which have to be vblank-synced. @@ -621,7 +617,10 @@ static int vc4_plane_mode_set(struct drm vc4_dlist_write(vc4_state, SCALER_CSC2_ITR_R_601_5); } - if (!vc4_state->is_unity) { + if (vc4_state->x_scaling[0] != VC4_SCALING_NONE || + vc4_state->x_scaling[1] != VC4_SCALING_NONE || + vc4_state->y_scaling[0] != VC4_SCALING_NONE || + vc4_state->y_scaling[1] != VC4_SCALING_NONE) { /* LBM Base Address. */ if (vc4_state->y_scaling[0] != VC4_SCALING_NONE || vc4_state->y_scaling[1] != VC4_SCALING_NONE) {