Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3514203rwa; Tue, 23 Aug 2022 06:06:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR7g99ift7/5U80liooPS/wQjW+V06PaTPd/hGs7jJBxZKgoihgCPeuV80KExhos0+YxtNFT X-Received: by 2002:a17:902:788f:b0:170:8b18:8812 with SMTP id q15-20020a170902788f00b001708b188812mr23977355pll.1.1661259968700; Tue, 23 Aug 2022 06:06:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661259968; cv=none; d=google.com; s=arc-20160816; b=QPW0G+zbLYSyaa7iQcttI94YNowL/DRKvjgNEDJ2GDGrXR8OTqAVKqgqg7TAlGPmMa XLfcEPRblK2GypRQ02bVs8jxnI134qs5WkMsbqeO/i9UC2qNr7dksNi/TGS29nTxeYko /b+bSWsnbUjiRIgUX6VSbL3F9WfYHSwtJGyr3inUaa/H8fxQswbZZchjcLv/m+QnFbnt oNd2ur9sbCoD76WdLMR7YKB7yjyIMDajDRtIzMkn95G9TL/MPfWQVmSD2yYlooH1p1cB i0sBTuXPzSVmqeP68dwtRM/yzK5FQqhwa5nyStm0QHwlLXCTwvbR1O98W1lB1xVBofQ9 /VJg== 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=5AqWvuZmg0WtKQomqOUcNzAyua23OfvBktJz4LvY990=; b=qCFkDBYnrkRKDQh3HTVbp13o6H32NYB5y4rNxYHyzqZyH02uT9IGz25TerGO1pERxk 2xluDSEvnNQKMnZFKGgtkFWYZLjwWqkJuE+T7nIqrC6IrWqPPHgnSv/RDR72DoGy7hoS Gzj0AS2jW7MhxG1NTZpffy0U24eaA3lhl3h5uXAAN1eus9bhi8yYowonfeo1kInobNNG yN1dLCk6W2t/I8VvZYaWxFDy+MEhgIjL30XuxLH32l4Kfw+6bk3m/92qBnKpJhcCNiuV 5B2jCDeZ28toKk8xefVmPMTcaHnorL4KSEjUsU848pLtKuse1pDHBh6Q1SByPzS0/J0l hMbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SeQ5xqJg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m12-20020a170902f64c00b00170a468c50dsi8483333plg.275.2022.08.23.06.05.57; Tue, 23 Aug 2022 06:06:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SeQ5xqJg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357704AbiHWLUx (ORCPT + 99 others); Tue, 23 Aug 2022 07:20:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346593AbiHWLRN (ORCPT ); Tue, 23 Aug 2022 07:17:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C9DBD75E; Tue, 23 Aug 2022 02:20:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EB1DB60F85; Tue, 23 Aug 2022 09:20:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBF29C433D7; Tue, 23 Aug 2022 09:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246434; bh=I84a5gVb/NLiQQOrHwz9RdfRGp+3FyR7lZPvKAxpz2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SeQ5xqJgJ8irXhPvFqgk6/N+VKC++eqbIkN8orPCYiIr6E2YleRsmEkOYiC0j74E8 flPoHyniogiN/taCD19+kvh1D1t0zEneiCWt/rsBoPUabwTdD0x/1IsPpu4WYVM53X 7OFsdldGO062//28CLTYEm5I5u4/xsAmPEdbsOJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.4 109/389] drm/vc4: plane: Fix margin calculations for the right/bottom edges Date: Tue, 23 Aug 2022 10:23:07 +0200 Message-Id: <20220823080120.160869237@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080115.331990024@linuxfoundation.org> References: <20220823080115.331990024@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Stevenson [ Upstream commit b7c3d6821627861f4ea3e1f2b595d0ed9e80aac8 ] The current plane margin calculation code clips the right and bottom edges of the range based using the left and top margins. This is obviously wrong, so let's fix it. Fixes: 666e73587f90 ("drm/vc4: Take margin setup into account when updating planes") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-6-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 6e787f684e52..cdcd19698b3c 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -288,16 +288,16 @@ static int vc4_plane_margins_adj(struct drm_plane_state *pstate) adjhdisplay, crtc_state->mode.hdisplay); vc4_pstate->crtc_x += left; - if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - left) - vc4_pstate->crtc_x = crtc_state->mode.hdisplay - left; + if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - right) + vc4_pstate->crtc_x = crtc_state->mode.hdisplay - right; adjvdisplay = crtc_state->mode.vdisplay - (top + bottom); vc4_pstate->crtc_y = DIV_ROUND_CLOSEST(vc4_pstate->crtc_y * adjvdisplay, crtc_state->mode.vdisplay); vc4_pstate->crtc_y += top; - if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - top) - vc4_pstate->crtc_y = crtc_state->mode.vdisplay - top; + if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - bottom) + vc4_pstate->crtc_y = crtc_state->mode.vdisplay - bottom; vc4_pstate->crtc_w = DIV_ROUND_CLOSEST(vc4_pstate->crtc_w * adjhdisplay, -- 2.35.1