Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3013048rwb; Mon, 15 Aug 2022 16:08:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR7w2i2dydicdqrKpaqtj22AAzwLM3dp0e2Ms5OD1JLIKqMCeniKE+FIZEz8cdfoScyOGGYq X-Received: by 2002:a17:907:97cd:b0:731:5d0:4434 with SMTP id js13-20020a17090797cd00b0073105d04434mr10869114ejc.603.1660604925016; Mon, 15 Aug 2022 16:08:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660604925; cv=none; d=google.com; s=arc-20160816; b=yrV1fPq1e4WfSww2Erne5MpCUry8FHMKCw3WmnC6GRdSuKTINzclkqYqq3k7iDUdFK BfHuyJ7OVgCfQZhDUut9tTKiUlJUeXXXv2kfdRfwRSYRriLzCq5QI/gbjNcm+niUq/OI YkqUD6DXzcvT2l/LTNVvOx250LrHgPPXhwB0J7oJwWBwbez6xlLAQDevkPBBB5EaE+AH w4fzRfcWSt/ES5VJdT+rMWEg10N3W1Ex/T4pUH+NG+dbK0XHmMvsRg/vjFsUnzo5cp56 XcCGdSAAdK66R/VPhHeK5VEbuAMjFmQvXU+DpMAsBr/PuOxKqCj6I6SY2RIIJMuHoeUd tC1g== 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=j59ZQOfLasLnhmYoSw5jmLXVg9yf8rZ4/xvOHnA6miA=; b=UyIRm1MWPjYiHZnwRY89UJKX9vTNz/9soBsiw/Bs531jHPUBbgGlEUF8kRCduE+UR8 wkZStiHhmJ6SN3bhAFE0anOCpMUtnJ/P4l0s1ccoZ3zH8l6Jko7UDf5YvOpj3Mx6k1xz sgsxQr/pjmKjoRqB5UC3mBQ6LvyxZvvzj8McfPKA4FHnWHxmAwEYLDinIXQhVQC8WsDk 3WjYy8uffO9CBESZtpHtWpFwCkXgXFMdS4Zw/nTgWspnWapkux+8Dq2ZnNfinS5vQswW XWcXj+y1/jvriWsvS6iXWgGtcBIvDZRV238UgyM27wKsU3IJEC166FXm4pzsMUahw/si 7wMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p7C1EeBv; 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 u12-20020a1709063b8c00b007320345ef3bsi7301330ejf.583.2022.08.15.16.08.19; Mon, 15 Aug 2022 16:08:45 -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=p7C1EeBv; 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 S242853AbiHOVEv (ORCPT + 99 others); Mon, 15 Aug 2022 17:04:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347491AbiHOVCC (ORCPT ); Mon, 15 Aug 2022 17:02:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB3FC992A; Mon, 15 Aug 2022 12:13:55 -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 2892AB8110A; Mon, 15 Aug 2022 19:13:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 467D1C433C1; Mon, 15 Aug 2022 19:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590832; bh=+sfiCdlkPna/YimG9gnGAbfFXU7/uhfnzudGpJJN/94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p7C1EeBvuxjlUFnEWGO5p5oxDfPQ2zTShfWvxSuJM7HxkkuX2iRCeGsz6B2cRtqml ksVihPlvQU2PRDAo7mXv3lA5xERlYI4T2JWWpmLcWoO/8b/lIsjcDYyCxJ0MViSmNF hbYI6tA85WSIkbcfajUsbEHL73Ckx6beHpnfVdfk= 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.18 0385/1095] drm/vc4: plane: Fix margin calculations for the right/bottom edges Date: Mon, 15 Aug 2022 19:56:24 +0200 Message-Id: <20220815180445.610685925@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 c2c33f200416..a82a0b1190eb 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