Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp96496lqb; Thu, 14 Mar 2024 06:30:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUb3KRE7qYxVRCkRs2c2l4Mj2Ga9ogUGkSY3fSnvnQA5qSj+NiPTSUF1JNq3xtx3mUBLbWbl7hdZjmwHujIjPLupm7C6d6pCdx1LnMVwQ== X-Google-Smtp-Source: AGHT+IG+RcLKthJ3igwJ26PT5MhMv3qs2kvOztXjdA8fOzw2pepmLFI+SVS92KJxOWDLwqi6iMyS X-Received: by 2002:a6b:d90f:0:b0:7c8:d0fd:efd7 with SMTP id r15-20020a6bd90f000000b007c8d0fdefd7mr2477666ioc.10.1710423046779; Thu, 14 Mar 2024 06:30:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710423046; cv=pass; d=google.com; s=arc-20160816; b=QwbGEIN0Rrpb6p88ECf36X1cA1wf+qOPy2BUOTPeMVmDnyO0qYN7coBXr1kj9ETLl0 9jYklTrn6dyrpalP5TWo4GaDkuGwfS5kedQ12rrgpTdn8ZQpEyQfl291lTjedw6ptpjL MN3mgm/7nrCYumtQgKGqwOgEOvFH5HByhlwlRhLwrLaKkMoA4BnOh2fjShWpawMvGeKS Bz6u63427x6SJmA2zXLvKAIJohP+UWJQBywMdkMZOph1M2ZntmJvOxVfOi9fSjilESnJ wcrxRlDPKAhnKVd2MtzvhGurBDFyyJU/v7TBRGmdfXy9rNfMUpTOeOKQsuV2dAzkL8QG 4Jmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=A+U5F6bERWi3eCfUM/Ca+ebxunp7MF/z4TrvOfSc87M=; fh=RqOxPKr7SGBJvoBYRuh9lspDHx0acuZVxweqURImAxg=; b=fykr2diolub6FZnpGjppOg/M8DtJXoBxsr9Ohor0V/Wd7420F7I2pk1f1MsN5do7PR zLb2AOmw8N57pvWvHnGMnX/PgDJggGZvyAPanwfUP49UHtUO7wlNNYBDqX+rWEv7wgRA 2YPkPHtsoEBBbFlm8Tw+3NRQ4La00ZVDerjRxSQ4zZHoukHuPS9g2oYcqxkFwe2ni2ni q2KNETC/GZP+GMcnDDXjQqLakv+nGL7n7GJj+eDEjpmUaelf2x9lX1M/MEsRcZ1ZVFI7 w1VqBFZ3rUg9b0N+uIMpAZGDwrlfUh/OtChQiKIii04QICKJVfhY1jpGFg5mXIhj1erX HwSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=5WPWnxVZ; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-103300-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l9-20020a6b7509000000b007c837ac23b7si553639ioh.94.2024.03.14.06.30.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 06:30:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103300-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=5WPWnxVZ; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-103300-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103300-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 680312824FE for ; Thu, 14 Mar 2024 13:29:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 238D55C5F3; Thu, 14 Mar 2024 13:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="5WPWnxVZ" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 91A4C5A11A for ; Thu, 14 Mar 2024 13:29:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710422968; cv=none; b=kliGvhs9/0CbHYuD1G0uOVAbrUoI9UtwymoeKPJ4dGEIp9hUdjcrLbeZ7OgB/xtBnRqjZsIdTd0OBtchjnwr+YOPAGzbPBXOGmKoCXzMtjNlLdokKRva3kyK6m3tUOeFLDlSXxaGBA0NeJ97H+65qcmqaZPdleL22RBli8vCrW0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710422968; c=relaxed/simple; bh=OPR+be61xu6eBXXnp/++w/CdEI4VsQSdO9wap5rADAM=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GbwM5OORct2pN8jNHzjFDWSxaGNgeKt3qJJapZd0/GgPofyXPTt0UnUYampvGNSOVyHomINChyxdh82bgmfKK2sANHxqfQxNl7670OskG0ScmSJIHF8YvR+Z3P1ERA2R3+2O+HgOuq4hEucJpm9Wjk0Wk+inikW5d38EZB1izk0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=5WPWnxVZ; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1710422964; bh=OPR+be61xu6eBXXnp/++w/CdEI4VsQSdO9wap5rADAM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=5WPWnxVZdkpSnbPDaqckpBPCssY2Hg/K0OrsDXKRkP93nL6O798hS2lVJ8VGpAr9i Gm5yjE/4UDwgUpil+LWnEMsNuDZvt8WdeDY92NIZPLL4fIBXPrcBBnU792WAHRS66U COQdtC9HP3o4aZqf0YsWx1WJ+tk0E8CUUz8l4XjDGld/V/VF7RtzQWd0GPyT+R8S4g sQBp3e3m7nqwyUFOYcMmR1Goy5FqUTjgK4fry7VtgCYe0aqL3/NYNkAgE+K0MVfwCD rGk1WYmQvIHbF5OY8MmCfT9u0dJPvvAA5pwXrfoY2v4Ovj5+WKl069rXGpodICRZ26 9tagenpHUGexw== Received: from eldfell (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pq) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 5B1753781013; Thu, 14 Mar 2024 13:29:23 +0000 (UTC) Date: Thu, 14 Mar 2024 15:29:12 +0200 From: Pekka Paalanen To: Melissa Wen Cc: Arthur Grillo , Rodrigo Siqueira , Melissa Wen , =?UTF-8?B?TWHDrXJh?= Canal , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Jonathan Corbet , Louis Chauvet , 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 Subject: Re: [PATCH 1/7] drm: Fix drm_fixp2int_round() making it add 0.5 Message-ID: <20240314152912.7925242f.pekka.paalanen@collabora.com> In-Reply-To: References: <20240306-louis-vkms-conv-v1-0-5bfe7d129fdd@riseup.net> <20240306-louis-vkms-conv-v1-1-5bfe7d129fdd@riseup.net> <16f8867c-147a-4149-ba96-ae70f8eaf903@riseup.net> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/dOumZZ=j4VZBSK8qbc0+7gS"; protocol="application/pgp-signature"; micalg=pgp-sha256 --Sig_/dOumZZ=j4VZBSK8qbc0+7gS Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 14 Mar 2024 09:59:39 -0300 Melissa Wen wrote: > On 03/13, Arthur Grillo wrote: > >=20 > >=20 > > On 12/03/24 15:27, Melissa Wen wrote: =20 > > > On 03/06, Arthur Grillo wrote: =20 > > >> As well noted by Pekka[1], the rounding of drm_fixp2int_round is wro= ng. > > >> 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.paala= nen@collabora.com/ > > >> =20 > > > Hi Arthur, > > >=20 > > > thanks for addressing this issue. > > >=20 > > > Please, add a fix tag to the commit that you are fixing, so we can > > > easily backport. Might be this commit: > > > https://cgit.freedesktop.org/drm/drm-misc/commit/drivers/gpu/drm/vkms= ?id=3Dab87f558dcfb2562c3497e89600dec798a446665 =20 > > >> 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) > > >> =20 > > >> static inline int drm_fixp2int_round(s64 a) > > >> { > > >> - return drm_fixp2int(a + (1 << (DRM_FIXED_POINT_HALF - 1))); =20 > > > Also, this is the only usage of DRM_FIXED_POINT_HALF. Can you also > > > remove it as it won't be used anymore? > > > =20 > > >> + return drm_fixp2int(a + DRM_FIXED_ONE / 2); =20 > > > Would this division be equivalent to just shifting 1ULL by 31 instead= of > > > 32 as done in DRM_FIXED_ONE? =20 > >=20 > > Yes, but I think the division makes it easier to understand what is > > going on. =20 >=20 > Right. I was thinking about slightly better performance, but I don't > have any data. We can go with this since you consider more readable, > anyway. Those are constants, the compiler should compute it at build time in both styles. I like the DRM_FIXED_ONE / 2 style, it's semantically obvious. Bit shift is less obvious. Thanks, pq --Sig_/dOumZZ=j4VZBSK8qbc0+7gS Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJQjwWQChkWOYOIONI1/ltBGqqqcFAmXy+6gACgkQI1/ltBGq qqdypA/8DP+ZPFALvLB10UlVV9UNUurMWlycc6po5VFxXLt8YZcWvGHTaTTAzLyT cGkOiq+fq1qXx68+trjpYt1M9f/yfu0BO+YLgVvMYXkJQKqkFFbRxGlUDwltM8SQ pGFFKzMX3nPEenfaGJXP53EYRGmZmKND8vSIJgmWXmelgAeHjM0yIB0P5v+FhV4b RJbvNNZzqElFqlpowCCk2uE/Yz+9a8eMWQFPu6AIB8UPtB2BbFnVOquMbujHDYuI O0oxuoIJOoj+OwIwlZ6yokwiuIugJURsU6No9WD10bLB84uqbCowejdUHOPL42wl xBZWVWOCoje18BOKTZFln9NrUW5xxkzGmjCpBrlCKXA9lfzqTcXFWegZEuAms3Ow 8pHRQ6Exd1GAdSmPjbhu0/KQKhR1EL0FmmaPaRLyVcCYh/Wd3xaFR0wg8GgbiRu2 emBXRLmffKh36wa8FqnKl+FWNRc354xZ6TN5pw6r0oQRJChwTlGPA4P2SjGqZXGs bYOTFXkXzTB20rLFH6rDPKWhVu4RuD8wtQoOp8Gx7mJf2hXszKwIcQj0MFXVPyKe 05oF8mMGF73HloECl2mV/gEecHLPyjqBIILV6h91DB6Ph0bZ/uXXi53Q99kvK639 hu/wQTHWNAznEhVFsYtPgd4Uk6q4pPjNM3Nz8fRd+2Hgs+C5Kys= =2qYl -----END PGP SIGNATURE----- --Sig_/dOumZZ=j4VZBSK8qbc0+7gS--