Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3711496imu; Mon, 28 Jan 2019 09:27:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN4orVz6IZv7MV95FJcBnKk0jcbOEP/kjhlQdzyric3AjoSoapS+ahdwJnu9i+F+EPRaMBBK X-Received: by 2002:a63:5402:: with SMTP id i2mr20071867pgb.79.1548696420237; Mon, 28 Jan 2019 09:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696420; cv=none; d=google.com; s=arc-20160816; b=X3Y5IMvL40o2RDJbOHGh/h7Jdbc3Rc0eNpDpWrv0kpO5ww+ly3wJWmwIG/oiOMFc/F MfqYDDxGtlCKbiN8PSAvJrfKGma3Di8uFfUB6jRiOynhl86+kxKa/QF1Y9cH9K33uVBd q/5R9k5rjbq7Yt4efCX9pU08jhTv+cbNn2hcLNpPR79Ah1qYxPZDm13DjSIBy2Oxp6MP kf+rqkILQN9L81JrOxYni+A+/T4ijlWECYg9eW80CtBVeUGyalfkcI11LD1R3aXjsf6X C1AD+FUMgBkUDismS11xB7iY1bDH7/PxMeQtAFb8WcfiNwBlFRCCrR4O3NSPknyuPvCR AnHA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ubJ+82+IM2Ev2J9hI1OLCpeJmCJQROZk0axgiEStRqs=; b=J0cEX0ibpSoGBUXVpIiJ81O5Ajst4RmfD/5NUVuWJYgcN4XgH/riDmoVrfCDqwVd+3 yE05loq8Vzco85ZtGExpzO/b0uHyCySF+/LG/S9n8iZLbsAzFq93M5ZUiC6AEMyBFlJJ lYAPgpsGcLaugTRE6JfPAS7xhm2ZHMEjeLe0ff5/ZI99WgSRAgQZNyrMeqAeOoIxKS/v X7uhP1r5l3JbLvStgk9uDfFT/BHknKdpVMbFn8d8EV2Yca+D55sFe1M2On3gR2FQF58k xbA5wTQGIXKYdOLqJdPWVUaT2mPIB4tWHa9g0JpOaq3uf01LU3c15n9b1jM1CJzni6tU wicQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bJqGoBs5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si12274809pgq.36.2019.01.28.09.26.44; Mon, 28 Jan 2019 09:27:00 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=bJqGoBs5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730185AbfA1R0k (ORCPT + 99 others); Mon, 28 Jan 2019 12:26:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:45906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730278AbfA1QAh (ORCPT ); Mon, 28 Jan 2019 11:00:37 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2F0E021848; Mon, 28 Jan 2019 16:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691236; bh=LJaonxEBoYBCFBNcMTMBiSuvl45WcyJpLD7cs+2eFPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bJqGoBs5dEzE1UIUGvbCuizvfBoOriWu8JRSt3r6ZflCvIJBZMYcAMGHH8XWf2j6Q DRVEXNXzWhXpu/fRAXD/5+hsukXx3OVVURYEMcIY/VHK3sEfNla6B4NbM8S1HBAIrR V1lYj9ZFm6oIwuhSF/Eq63JpDJqEcELeFGjGtQOc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Boris Brezillon , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.19 027/258] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE Date: Mon, 28 Jan 2019 10:55:33 -0500 Message-Id: <20190128155924.51521-27-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Boris Brezillon [ Upstream commit 0560054da5673b25d56bea6c57c8d069673af73b ] For the YUV conversion to work properly, ->x_scaling[1] should never be set to VC4_SCALING_NONE, but vc4_get_scaling_mode() might return VC4_SCALING_NONE if the horizontal scaling ratio exactly matches the horizontal subsampling factor. Add a test to turn VC4_SCALING_NONE into VC4_SCALING_PPF when that happens. The old ->x_scaling[0] adjustment is dropped as I couldn't find any mention to this constraint in the spec and it's proven to be unnecessary (I tested various multi-planar YUV formats with scaling disabled, and all of them worked fine without this adjustment). Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.") Signed-off-by: Boris Brezillon Reviewed-by: Eric Anholt Link: https://patchwork.freedesktop.org/patch/msgid/20181109102633.32603-1-boris.brezillon@bootlin.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_plane.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 629f40424bba..ab39315c9078 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -315,12 +315,14 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) vc4_get_scaling_mode(vc4_state->src_h[1], vc4_state->crtc_h); - /* 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. + /* YUV conversion requires that horizontal scaling be enabled + * on the UV plane even if vc4_get_scaling_mode() returned + * VC4_SCALING_NONE (which can happen when the down-scaling + * ratio is 0.5). Let's force it to VC4_SCALING_PPF in this + * case. */ - if (vc4_state->is_unity) - vc4_state->x_scaling[0] = VC4_SCALING_PPF; + if (vc4_state->x_scaling[1] == VC4_SCALING_NONE) + vc4_state->x_scaling[1] = VC4_SCALING_PPF; } else { vc4_state->is_yuv = false; vc4_state->x_scaling[1] = VC4_SCALING_NONE; -- 2.19.1