Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2492257lqp; Sun, 24 Mar 2024 23:25:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJbFyYUepRtzFeGrDHKbS+HIWgRB1/MfUcWl6kycb5y97C4q1tbjW+vW4xFIO6ifU1cyeenV8P3/C1qRqA0GwIyGwXu7xD6S5u8aV/yA== X-Google-Smtp-Source: AGHT+IFKrnHLZ5neMSn7Fewn92ObMwbGqqDIvQH4ImZMX3ccs5uzH9Xn2NqvZ6gerzXy/n8AkMaK X-Received: by 2002:a17:906:6b0b:b0:a47:14e0:50d2 with SMTP id q11-20020a1709066b0b00b00a4714e050d2mr3732976ejr.3.1711347933270; Sun, 24 Mar 2024 23:25:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711347933; cv=pass; d=google.com; s=arc-20160816; b=CiZWQLWbLZshst71MgZXtdyKXU0Ntdq7aV+F0b/Mt5BiKpjWNYLyX6yFyfZE86M9L9 XFKYqvNjU+/hDnAvD6/T39cPb/hLdj2yWmDasW1E/y7Ao/QlZYSpA0Uuynq0FtzbnsYB mS/aLTWJu8bFq8tZaEJ4dk1ZwcQVe/G1AbIvHijTGmzlJ7kDFG9VfBcAKiuFd+3jvIj2 IS+7NblB6n6ky5xcOteMVqkQ59hhPN8Y3xIm8PTb4fJJQfH+A2Mrq0VGZA5R3laOks2+ 0iNzFJBs5NsvCvYfWMxTqFItR0+BkpJFmI2YGoymvBkeADJFvj/ScBmYCW78cfrgOrhj WzDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7SolSTrXbC6N4agF8tb+MzzUR2qXp8ElHxkM7aFxWW0=; fh=q6YbYtC9/1KuzNrEh0gatJboiqQVLEPHY0nGa0Id6IM=; b=p1qFBaJnMTxu8NH5zo4IcczpBheLIcGtu1K3QGRP72zJ5Wt1Xlk9J9w33NtM6ogCBN S/hQWV1HcMqo6Vo7kvbMnSmBUZV6d+7abxdpUab+53Baz+uQ7u15FphxqMyTWnpZueN1 bq+tQZ/t+Im0RqqgV2xDhgW3ktN7N8KVy0dfaFnROmZymnSE8pQx2OKqgti2bRwDe7yd Jyb8qq+Pbq55XjlggKYgL/xPKBRtXzClvf+OpHVxqc6fhHfZA1/CJigfn1dm+o8Aoavn XyBwSxf80wlfDsxAmwyUrdaLK/84wQs/cW/80OdrI9O8LuQ6iaOTYN4p6zIT9J6M+1Gi EiUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AaaRzLnz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114688-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114688-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h26-20020a1709066d9a00b00a46bdefb639si2219003ejt.382.2024.03.24.23.25.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 23:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-114688-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AaaRzLnz; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114688-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114688-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 05DDB1F2AC50 for ; Mon, 25 Mar 2024 06:25:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACCE918C78B; Sun, 24 Mar 2024 23:59:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AaaRzLnz" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DDF32398B2; Sun, 24 Mar 2024 23:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322337; cv=none; b=UFa4nsr5hoV/nyLvZTqX61bOKqk9fkf6I6pwO7BTe7XNqzP1FXamUq6Ln/embCHfP6WtrzO3GpgUPGjyQozcAqinZ244VhX12n1R3jJZnVBRMyg+xlhgoCPG/rDJ3S4UcnmqqUEJDllF6ZTb2RLqEqYV3G9Z2LS8jLlEgfKjV9k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322337; c=relaxed/simple; bh=qm8TX9xSC2TJi9KWAjxttvDXX1Sa2xyg/GY5N8v5aMs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P6gZPCnD8opB0ODZVznjv+/BcpHKPKu8tNHbtB33paWSPzMf/67Y8aj9lVOn2s2JPL9H7IYMa5zoRijyIlpE25uPvcBo+QqffgvhCv4OIQ5w/Keq8Y2FpKiwJZwQmwfmJHwDHwH2O2k630nP+PyqzqZwoecfJeJpysvIJLYxNkI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AaaRzLnz; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 257A1C433B1; Sun, 24 Mar 2024 23:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322336; bh=qm8TX9xSC2TJi9KWAjxttvDXX1Sa2xyg/GY5N8v5aMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaaRzLnzk3S+1pA/UUEtD/ytWoi2gowOdZUQYqknSV4YxYWSuuUF1wjOcu5ai3e1L PSI/n6yXcmhAN6Ca2Rky0u1j6JYYxG+jL/QqYHIJVwIghf1D418FnXqigP3SHj3L3b AEujHjqc1jaQmfRjPLkW3pCsstMDQQJIMlIwK0CtV82r6AFPrrwV2lQDKH7HjpXbw/ eZ344PtpD1+2QebXPjD36fUGSDlRPDvcg33cXNLH1d7b8lvrlFJ3isP49La3jRv5Fr 6CcYgCI5jTxPYwZyEG40ImIZrQw6K80eJbsTYTQ7o7Ycpn7f3LJCBNExFdMoLV8M5w qZLEtdqnxeFZg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arthur Grillo , Pekka Paalanen , Harry Wentland , Melissa Wen , Melissa Wen , Sasha Levin Subject: [PATCH 6.1 418/451] drm: Fix drm_fixp2int_round() making it add 0.5 Date: Sun, 24 Mar 2024 19:11:34 -0400 Message-ID: <20240324231207.1351418-419-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Arthur Grillo [ Upstream commit 807f96abdf14c80f534c78f2d854c2590963345c ] As well noted by Pekka[1], the rounding of drm_fixp2int_round is wrong. To round a number, you need to add 0.5 to the number and floor that, drm_fixp2int_round() is adding 0.0000076. Make it add 0.5. [1]: https://lore.kernel.org/all/20240301135327.22efe0dd.pekka.paalanen@collabora.com/ Fixes: 8b25320887d7 ("drm: Add fixed-point helper to get rounded integer values") Suggested-by: Pekka Paalanen Reviewed-by: Harry Wentland Reviewed-by: Melissa Wen Signed-off-by: Arthur Grillo Signed-off-by: Melissa Wen Link: https://patchwork.freedesktop.org/patch/msgid/20240316-drm_fixed-v2-1-c1bc2665b5ed@riseup.net Signed-off-by: Sasha Levin --- include/drm/drm_fixed.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h index 6230088428cdb..a476a406e5997 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h @@ -70,7 +70,6 @@ static inline u32 dfixed_div(fixed20_12 A, fixed20_12 B) } #define DRM_FIXED_POINT 32 -#define DRM_FIXED_POINT_HALF 16 #define DRM_FIXED_ONE (1ULL << DRM_FIXED_POINT) #define DRM_FIXED_DECIMAL_MASK (DRM_FIXED_ONE - 1) #define DRM_FIXED_DIGITS_MASK (~DRM_FIXED_DECIMAL_MASK) @@ -89,7 +88,7 @@ static inline int drm_fixp2int(s64 a) static inline int drm_fixp2int_round(s64 a) { - return drm_fixp2int(a + (1 << (DRM_FIXED_POINT_HALF - 1))); + return drm_fixp2int(a + DRM_FIXED_ONE / 2); } static inline int drm_fixp2int_ceil(s64 a) -- 2.43.0