Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp129929lqi; Wed, 6 Mar 2024 12:03:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4OF5g7xcIV3wB0nsnPSI1Rk0CXcgprMd8tesDD1dji652goxpAGGQPjap3B7s3gCczRBUpNNLBGVw88eh5hzeBA3TN51D5Zx+n5nJBg== X-Google-Smtp-Source: AGHT+IFGuIkiUbI6G7a9kx3EKquPsfZ0DbXcMYpvyBor23qnWNWaW6R0s4IvYK+3G3/Hd/+kSN9l X-Received: by 2002:a17:902:d4d1:b0:1dc:fce2:3084 with SMTP id o17-20020a170902d4d100b001dcfce23084mr7818701plg.7.1709755431937; Wed, 06 Mar 2024 12:03:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709755431; cv=pass; d=google.com; s=arc-20160816; b=GEukZzttZ3x29I+4iz0gTT5G5BDAKvO8m2D8TlfLv3p75JVCDAiwgknSwRy8JM2aHf +UQjQpxDVcBcBufArnGEfwtt4SoAqsnThEWc/u/Tk8dor05CKK+mZwj9EXt04bcR3JH8 rF+axBq5jfbcP8WyCRwdN/mf5dvOb1hWaeXoWv2LQN0wtf7aOCCtddfuk51GSBtlWrD2 fGSbd7GJJlSKnRcCYR/LP5U6nB+y2x8kUAzslJcZDBuTKrQ6r7QvbcHSxKxPVX6h8ujk SxkPAAS1wzalXR53E368jG2PgbzsoyudrL5enAB9D8xui+ntdq7OZo8eQnKqK0uwhjGV ID/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=srV4vxDW3kzueu+hzEqpYyA9ZUYtJvxKxZlXeboj02Y=; fh=7y4bgDhnT/RI4iWxKOVqZxCmXitAdi108gvY+wIYMgA=; b=a1wzPnaKJKKbPOZmRcTuiNik2pNMhgt2qGkE6bwQ7wZOAcrIEyL2gbFZobJ6R5FEOe A0nYcslt8WEQAXUCSJFeHSlFz85eMs2fpQk91oqx44J3QgOEUmbIqdOV/2qWdHm5nZlH 5MUSAjBPW2WBi7xUSbD1FP6dLD3Hh2fNsFLinqghCciUKkRrcav0cOS5MA2uYXJ5OHQj Q4iYc5e2VgI73p8XIDCo9mR9ri4T8mntw0Mo06lT+RH2iMbWAny2UJRV/5bI7PdqXOVg UBtxntaH6RligR/WMxd82eduCk568VheV/TgExBWqJKQAzAkVTQmm2mmoLbSE4B44A5p B2bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@riseup.net header.s=squak header.b=qpY1+0FP; arc=pass (i=1 spf=pass spfdomain=riseup.net dkim=pass dkdomain=riseup.net dmarc=pass fromdomain=riseup.net); spf=pass (google.com: domain of linux-kernel+bounces-94522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=riseup.net Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j16-20020a170903025000b001dca8734f2asi12706353plh.422.2024.03.06.12.03.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 12:03:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-94522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@riseup.net header.s=squak header.b=qpY1+0FP; arc=pass (i=1 spf=pass spfdomain=riseup.net dkim=pass dkdomain=riseup.net dmarc=pass fromdomain=riseup.net); spf=pass (google.com: domain of linux-kernel+bounces-94522-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-94522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=riseup.net 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 58DBCB21C0E for ; Wed, 6 Mar 2024 20:03:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B91E141987; Wed, 6 Mar 2024 20:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=riseup.net header.i=@riseup.net header.b="qpY1+0FP" Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) (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 22AC7140397 for ; Wed, 6 Mar 2024 20:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.252.153.129 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709755416; cv=none; b=ZgsEGU5Uazu3831+IqcGixm4aOWzCxnBbJg1kYPVHC+U2uwdNpkiwx9mGA5NDpJbACpOUAefUB/4OaG+tAynAr4Oa34NxgwMjkBarhYxqN7Q9aYN9DYJI740YsRunDge7aag678oFSrx62fWDvRaJTuQFuy2efeb9qS20skJcxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709755416; c=relaxed/simple; bh=i30Vaa/vWmAWuQ1xuyHQbAwUbCzPkek4gi1m2EvEbUs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pnAOJmUuUs9zpJrvHd5QaStvQJ+oNma1yHHQvNs74gTg/64mKmH5JM+L3yLakb/Q72fp1LgtOZMB/JLsaOtl/29MrZQBoWmUN5b/4rxdqqx2bIVwkIQX/U63QC4KNlETcspQiuPLWlv0yAdHdQigQ6/T33lUbJZcSpntb/0gdJM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riseup.net; spf=pass smtp.mailfrom=riseup.net; dkim=pass (1024-bit key) header.d=riseup.net header.i=@riseup.net header.b=qpY1+0FP; arc=none smtp.client-ip=198.252.153.129 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riseup.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riseup.net Received: from fews02-sea.riseup.net (fews02-sea-pn.riseup.net [10.0.1.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx1.riseup.net (Postfix) with ESMTPS id 4Tqjzp1b6PzDq8y; Wed, 6 Mar 2024 20:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1709755414; bh=i30Vaa/vWmAWuQ1xuyHQbAwUbCzPkek4gi1m2EvEbUs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qpY1+0FP6AdVM3Qg8lZv+hYANPxKP5Uhd+ZQCanHSNm0ZAMiUDZjQmzYMem4Zok9Y R7KxA49tasIbhKDw3h5f6YE/lSen/1CSnbgxgOD3YO2K4dphn5YoKk6XkwN3+5PSqW nsfZGf4QqtPZladu1ohTmr3RYYToDmwgelbwqIp4= X-Riseup-User-ID: 91291689B435C54B67630DDED63C74A69CF5F515D6AE21446F9EFDBED5BFBAF3 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4Tqjzh2DQtzFvsk; Wed, 6 Mar 2024 20:03:28 +0000 (UTC) From: Arthur Grillo Date: Wed, 06 Mar 2024 17:03:08 -0300 Subject: [PATCH 1/7] drm: Fix drm_fixp2int_round() making it add 0.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240306-louis-vkms-conv-v1-1-5bfe7d129fdd@riseup.net> References: <20240306-louis-vkms-conv-v1-0-5bfe7d129fdd@riseup.net> In-Reply-To: <20240306-louis-vkms-conv-v1-0-5bfe7d129fdd@riseup.net> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , arthurgrillo@riseup.net, Jonathan Corbet , pekka.paalanen@haloniitty.fi, Louis Chauvet Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com, Pekka Paalanen 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/ Suggested-by: Pekka Paalanen Signed-off-by: Arthur Grillo --- include/drm/drm_fixed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h index 0c9f917a4d4b..de3a79909ac9 100644 --- a/include/drm/drm_fixed.h +++ b/include/drm/drm_fixed.h @@ -90,7 +90,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