Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2666076imj; Mon, 11 Feb 2019 06:43:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IY9j+BQD+kAw7AGtz7YypTPf480lr/NDDpRz76K2d3xVXmKm3DJKTKTfQux5fyHyFf0/Zf6 X-Received: by 2002:a17:902:33c2:: with SMTP id b60mr37628898plc.211.1549896190801; Mon, 11 Feb 2019 06:43:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549896190; cv=none; d=google.com; s=arc-20160816; b=pv+f86JkmKpa+0P4mg0CuhghVXCauv6OIPGHI4piSqIX/0WR0D/b9lEEEy5L/vAytR yPGBmZhY3Q7ARil/Jhl7BNFYM7SXZDy7CNQYDQRrZkgLuZhm5jxkP5FGbC5GI3x3jkJb msgI+fQMjUV7oWQM0AqKjCde9hrXZvmgkB4wYShBuMpkMhGDVjHZfYYg9a2SoR273S75 hmHi7axWmy7gKbNPU5I39uCXUE981Y24yHIpg+5i/Imgob6521XDdbFrLS1lW5SAKnzz DjGt5B0Auf4X9kEeuqsqiLpPL9pzR6jimhuV3UMCPXJIXgpoYIuZzyBwk9YByQ87izis ARgg== 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:dkim-signature; bh=rA6td8SGdkZ5xxUvYQxCwwt9KzI6loQBrj6pN7Jjwy4=; b=ta91y2f8/csNMRADKBHqHVr9hB11TpEWni4gXrwM1iFx0ygUGZyqtFXp2dul2I1UMK 4F+yABRuSAUSCm/ZEXT5AguNH2pp22+AaIP8TUW78H/Bqndu9DCtFaY3I3QFcgoqhuBF ANIAyU87u+wZ6SC0y0kdh8xoIr98iJMEzJxtPnROZ2/CjORF/1rtMWAyo36rxbK8Ytoo +v+Iqb2ocPh3wISL/ASDrte0Me+Ae0rkNcaNH//lOpD+E9/9riA1ePe8pjTMV/3U4gBJ 4XlRuN8HvKoc2Y8FaXEV+EFQREPRc2rU0Mw+pEbQU1tiWyfSID6wDBmz+E8lnum/HdlJ yrRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fLBSOi8j; 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 v11si10619412plo.377.2019.02.11.06.42.54; Mon, 11 Feb 2019 06:43:10 -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=fLBSOi8j; 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 S1732121AbfBKOkp (ORCPT + 99 others); Mon, 11 Feb 2019 09:40:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:51540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732096AbfBKOkj (ORCPT ); Mon, 11 Feb 2019 09:40:39 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 01BAE2082F; Mon, 11 Feb 2019 14:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896038; bh=xMmHuWclOB1EVkcfhKLEBR781gKcTGC6zk2tiOqrttw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLBSOi8jTb/HdTa2lfjs1YIktFIPIB+DBjrAxDcQJSlSV5I8PkYTX+VtB0fS0BCDP qVplrNmvswcRkv+jvVSxteJJRXxjVkchDxMkKH8gX4SAkkB2LGD69a+RAO++muUftv yZIF02oGqL3qIj6MJ1kbuicj2RGW091b1G0U4wf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boris Brezillon , Eric Anholt , Sasha Levin Subject: [PATCH 4.19 025/313] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE Date: Mon, 11 Feb 2019 15:15:05 +0100 Message-Id: <20190211141855.098481986@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141852.749630980@linuxfoundation.org> References: <20190211141852.749630980@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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