From nobody Tue Dec 16 16:37:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 067FEC28B2B for ; Fri, 19 Aug 2022 16:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351444AbiHSQIG (ORCPT ); Fri, 19 Aug 2022 12:08:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351136AbiHSQFB (ORCPT ); Fri, 19 Aug 2022 12:05:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD62C10C802; Fri, 19 Aug 2022 08:55:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 63C27B8281A; Fri, 19 Aug 2022 15:54:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A40BEC43148; Fri, 19 Aug 2022 15:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924497; bh=tSlwNq9Jl2doWBTT6Eflz/2uHezCYOpyZ83yo3nehXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lW1jJozZWwqek9gQRkiTvA2njGH2Ksn7jmvqv4uHMScsb5Y0MlcUEIUBkn1x8t9ao rZs4RgzNPfMVuZP1h4D0GYSdmahi94ghr8zMgEX2bEfcca92PsENLJ621HBPBJQ8Pa kSOHetUW/vDmf06y/ivoqsD8YfzcG8ozTSogX97Q= 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.10 190/545] drm/vc4: plane: Fix margin calculations for the right/bottom edges Date: Fri, 19 Aug 2022 17:39:20 +0200 Message-Id: <20220819153837.863964094@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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_plan= e.c index bdf16554cf68..4df222a83049 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -303,16 +303,16 @@ static int vc4_plane_margins_adj(struct drm_plane_sta= te *pstate) adjhdisplay, crtc_state->mode.hdisplay); vc4_pstate->crtc_x +=3D left; - if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - left) - vc4_pstate->crtc_x =3D crtc_state->mode.hdisplay - left; + if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - right) + vc4_pstate->crtc_x =3D crtc_state->mode.hdisplay - right; =20 adjvdisplay =3D crtc_state->mode.vdisplay - (top + bottom); vc4_pstate->crtc_y =3D DIV_ROUND_CLOSEST(vc4_pstate->crtc_y * adjvdisplay, crtc_state->mode.vdisplay); vc4_pstate->crtc_y +=3D top; - if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - top) - vc4_pstate->crtc_y =3D crtc_state->mode.vdisplay - top; + if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - bottom) + vc4_pstate->crtc_y =3D crtc_state->mode.vdisplay - bottom; =20 vc4_pstate->crtc_w =3D DIV_ROUND_CLOSEST(vc4_pstate->crtc_w * adjhdisplay, --=20 2.35.1