Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3092678rwb; Mon, 15 Aug 2022 17:57:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR6bztX1qKGxtTlQV32nE5Em12oRH9T8EmfM9qWkkUqQun3iztPlEbygT9LzcOUreN0tqNGA X-Received: by 2002:a17:907:2d20:b0:730:8bb6:3f9d with SMTP id gs32-20020a1709072d2000b007308bb63f9dmr11776522ejc.668.1660611308655; Mon, 15 Aug 2022 17:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611308; cv=none; d=google.com; s=arc-20160816; b=SudfiSb3HlG2ZCS/1mRL1XC85Q2b0WFEZHgFL9mGU6QlPgOTMA7Pso6L21X+MaC1QF mzzENsFMgeaH68/E+Qtz42Lyv3o+WBa0s+siZO1mbcYDX9YHmtS1FQgUCLKr2m3pe5lN +BqlODMQso2T9syxOk5VZYv26v3O4fCnsWfqy07gSMLE9swJH5b8hclPSmQRuy/7T//z QN3VOXogzomgF3bCAGE5VlByzzHPh0U9xZ8rZOdWKroARXaDYtRQU6MkmPnRbSuvr7jm u/lSUmj45fy77ZHhWfqdQu41Zdf332orwcbjX7UUqZXgJ+C28d5RjXU2W8zLyTfsVFg6 CrnA== 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=NTrsmJpuW2gvytbv2MnGAAhQIB9rIj4v7/KtmUKui1U=; b=ekG+/MHewRBMrMnE4emrSk5HQsoHP3PcOeij3JddSVkFLU3P2lj/5IVTwePM0/3QeX pQZd/b8NPDxjo9ompZ8Vluo3fJTXEI7O7P+xNTczybdtTmuQZBNqg0q/aZ3/8ks/5AxT yKFiXjiwr6WBjYNvcmoDgzPgf8HZ9Xe37OKKhpcMJV6P4ez4KQ+qZMzPqsLRDvklJwqo eWN+P1uvplpDdu0alaQfxWNXzK2R79ZfcjeoP9ZtCqvyixz9zgxrflJiAtAswXQOlgpf gGJpRm2SDkxlkmiPaWpGz7lxkAsN/NQAfnys5gvLAvnwg1lwDWZ2jOT7HvP7OBR+I0jY FO7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xf6q2te4; 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 v23-20020a1709061dd700b00722e7756f3dsi7926331ejh.462.2022.08.15.17.54.42; Mon, 15 Aug 2022 17:55: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=Xf6q2te4; 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 S232447AbiHOXtV (ORCPT + 99 others); Mon, 15 Aug 2022 19:49:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353897AbiHOXmx (ORCPT ); Mon, 15 Aug 2022 19:42:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 724A885A95; Mon, 15 Aug 2022 13:13:49 -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 DD4E860B9B; Mon, 15 Aug 2022 20:13:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBFE7C433C1; Mon, 15 Aug 2022 20:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594428; bh=gm9GfrC0J6whizYs8N/CPAxYEFys+ekiI6l13kMrfHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xf6q2te4PfRAc8WaWJQ4MwA1DSu1iPdnuaeEBgunW8KuHiTeY+RYOrs2KMZvtbpPz 8zEnDoDmHTsysqCpJb05NytazlNK36siEI1Pukng6KKMd3S1/bKUJvPFYqIo2jj8sB gKrtpR9ENLGvfU7e8K3G3R+SXkJ26oFbRdFRcEu4= 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.19 0408/1157] drm/vc4: plane: Fix margin calculations for the right/bottom edges Date: Mon, 15 Aug 2022 19:56:04 +0200 Message-Id: <20220815180455.975639104@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 67402da89213..568371aa89c5 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -310,16 +310,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