Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp79706lqb; Thu, 14 Mar 2024 06:07:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWUGWXfTSY+tvXQOCqekoh3uuAHDN4zbbzFYGWkR+0Uu/P7sTgY+Yh8r9O651wRMpJsDEePvkdODppigq5VnbFuoxWcZriEwo1oBjVuvg== X-Google-Smtp-Source: AGHT+IEA6SyTMCbUzvnWfKbIInUYHMG0q7jLXDxwYqfSNH9CXSBMKRx6TKCFrGDm9uh+kFS0114v X-Received: by 2002:a50:eacb:0:b0:567:737f:e91f with SMTP id u11-20020a50eacb000000b00567737fe91fmr422785edp.27.1710421655736; Thu, 14 Mar 2024 06:07:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710421655; cv=pass; d=google.com; s=arc-20160816; b=A2FT9i6Q61aTMG1OM2XQYH/1X3oNNaJIf/YCBip6nSbtlgzIhowfHTsZSU7XUlgJ+I O7ERAcyD/KnmRTO+h+tdhSmgUQ6QOrtDsyOvFb90BKIWrSX6C4MrFXgnlglcljiISoTP gxWxT+MU0P5YL2pk5SvnrBLBXQtQ09GLhZqEikQ428CrvpXLVL8eUhLeueU+9QoZjhL4 qQlt+02lMhNXo2IAhPOdcs5511epexnhbToHUE978qeT74LvCr5NvQ6K0N7TGVtPFWEw WDDkK++pTDpEu8alPLdt8QXcmTGENkzC/uFuRaT0xK4qnw5OJfQmvPvq4vLYekqc4twz F5Ag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=trQ4EKn83QrD2+z7XaJSvsGGxWEhjeEliwwk733RxmM=; fh=Mp4cB9Qa8fGXYIV3oJCgdjO9rrfYT7+KKdM0339CMFo=; b=cgXmfVpcgQoPVMnDF+Blp/3IZ5ul5LZOZlTmOpcpBB0G+8KH+IFYvBPwxY5HCqFQFY +3cv/Yq+6d3iUuQtLzyEharurMeMJIWPv4d6oeATS1n+Nkb8iDH536O77qUtActSsPoH Ll5E99jqNwL8zXEPc08yjL2MKBmGAyV/6Fad5qxoOmaQ2s7ctburvSnpwSCspnYd/HCW JF0ZnEfB+2leXyFGwvW9hEJKH21E2C1vUoDTRPf4peAn9GqFjoZwSQE2KM1YHPeo3J+e WRwEJA2q4w1EGU77V/AumvZPH4bldMj7xHRKReHV/peyZjL1OghPzOKdwoLlA/Finbiw nTVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=JHfqubGT; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-103264-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103264-linux.lists.archive=gmail.com@vger.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 l10-20020a056402254a00b005688ec0d2a0si733183edb.657.2024.03.14.06.07.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 06:07:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103264-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=fail header.i=@igalia.com header.s=20170329 header.b=JHfqubGT; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-103264-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103264-linux.lists.archive=gmail.com@vger.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 013061F25158 for ; Thu, 14 Mar 2024 13:00:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E29BC5BACF; Thu, 14 Mar 2024 13:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="JHfqubGT" Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 B8FB75A4C0 for ; Thu, 14 Mar 2024 13:00:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710421233; cv=none; b=HIrDf11uzSrpu0J8AKMV1XUyybQJ/Qmg8aPOdF5qJfT5blIJVblup0RMtaChLtcMRpAUQzMmypaeGNs7QeLTFeH70UezJxDcF1kWO+tAJ6T84ukv+VZJeonHyuoE6rICUf3fBnLfD1nohxh8act8MU3ItMX7W7vDvePt3Sd8y6E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710421233; c=relaxed/simple; bh=8bUrUdU+6VJquHzgZu9WbDIaPZODPSId16QPDpUYmLo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gUneLzQKuqLfRei5C4gTR5cj17iYzsYtApqTlp4lgTUEHCO/Zmf93LmXhSX/0DuSU/ZXt2tnHTz4YYpYCFx9WLA+JJtMmCdEhF5N3GdfW66JTCeKMORpIg7a4cUCgA+TIHT7PJzgHwN5IeESUNWUTklrbaShrm8bGHzYhrHRgbo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=JHfqubGT; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=trQ4EKn83QrD2+z7XaJSvsGGxWEhjeEliwwk733RxmM=; b=JHfqubGT3QGojn5WMy7E/xCknx 8DdNt7nPSctVPl2NMDs1EHFzJOPc0XZ/ddPIWDdNCbuwZxCvLOnMomTR99I7fWLAIn6ONlNKRjcOh QdtzazEFUPFt7b5JCCcVAJBDGzI0L07uYOPKvE8eXmYGsiGrVT355IQpxdBaCepBsZPUC4ST1rb+k kUCk5kJ49ungwqSX79qUpiRM3KCPyO3ip7aPEOxb6iO40V1zkvY5vaykdvmKxeE7Q7HdkXoHSoWZV 014bt8Ef7offCY73w2/F/OyP3zamekv1pFNItFIknQGlEu90N424rssBCzJW39kOo6O/sf+7VqUg5 BU3H6jQg==; Received: from [189.6.17.125] (helo=mail.igalia.com) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1rkkga-00ALk2-TP; Thu, 14 Mar 2024 13:59:53 +0100 Date: Thu, 14 Mar 2024 09:59:39 -0300 From: Melissa Wen To: Arthur Grillo Cc: Rodrigo Siqueira , Melissa Wen , =?utf-8?B?TWHDrXJh?= Canal , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Jonathan Corbet , pekka.paalanen@haloniitty.fi, 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, Pekka Paalanen Subject: Re: [PATCH 1/7] drm: Fix drm_fixp2int_round() making it add 0.5 Message-ID: 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> 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=us-ascii Content-Disposition: inline In-Reply-To: <16f8867c-147a-4149-ba96-ae70f8eaf903@riseup.net> On 03/13, Arthur Grillo wrote: > > > On 12/03/24 15:27, Melissa Wen wrote: > > On 03/06, Arthur Grillo wrote: > >> 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/ > >> > > Hi Arthur, > > > > thanks for addressing this issue. > > > > 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=ab87f558dcfb2562c3497e89600dec798a446665 > >> 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))); > > Also, this is the only usage of DRM_FIXED_POINT_HALF. Can you also > > remove it as it won't be used anymore? > > > >> + return drm_fixp2int(a + DRM_FIXED_ONE / 2); > > Would this division be equivalent to just shifting 1ULL by 31 instead of > > 32 as done in DRM_FIXED_ONE? > > Yes, but I think the division makes it easier to understand what is > going on. 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. Can you send another version addressing the other comments? Then I can cherry-pick and already apply the fix. Thanks, Melissa > > Best Regards, > ~Arthur Grillo > > > > > Melissa > > > >> } > >> > >> static inline int drm_fixp2int_ceil(s64 a) > >> > >> -- > >> 2.43.0 > >>