Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp828905lqc; Fri, 8 Mar 2024 12:57:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUd0jazJQFY3cHwow1kS4L8Kd4DFnooUlrzGWKc3EVu2o6KFAMeUMCvDjR4bKtphSRJ+aRc0daCURVmK1CUGH/5dweDK5OYQQhysvkNDA== X-Google-Smtp-Source: AGHT+IGEVYAyy6/+BDrmFgoiAj8SGwR27FR2lEK83PEjDN/LmfwViqUTmrX4jGXWI7F+SyhadpRH X-Received: by 2002:a50:c04c:0:b0:568:ae7:bc0 with SMTP id u12-20020a50c04c000000b005680ae70bc0mr248636edd.34.1709931448927; Fri, 08 Mar 2024 12:57:28 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dc26-20020a056402311a00b0056698116842si119760edb.460.2024.03.08.12.57.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 12:57:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97577-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=@amd.com header.s=selector1 header.b=5j5YHkbm; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-97577-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97577-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 739661F21916 for ; Fri, 8 Mar 2024 20:57:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 306C75FB8B; Fri, 8 Mar 2024 20:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="5j5YHkbm" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2087.outbound.protection.outlook.com [40.107.220.87]) (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 7F9435F852 for ; Fri, 8 Mar 2024 20:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.87 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709931432; cv=fail; b=WyxUjYD/osChFLZAAMsiCNTO8RAhmihZgIsxiegr4tbZLHyBPHz/il0OEzr2+mlVDqxDmUi9Tpj/aet/GKMXwPfWnm9Ggzk/8WD7FjcR+KDmnP4VIS0OeTafvMu2xm0jc6rtsbMvDZmINLW6k0L5eAxQqXI+iurkqHC61mfzQbE= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709931432; c=relaxed/simple; bh=8m+Jwd8z93Ng+dajSfnwDpu36ZqI41gbo+FjfwgR8EQ=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=LY4Exs+/+YLZCcXVgrT1k5+awJGa38zcuwX54ot8x//xWO6s3zEj8aPGCn4xG2nJo2S3XnjMal39t7rmIraQrcUCiNar5cpsEsR5U6W+F+r69yEDHhPHEXi7ln9IkEr88MgVzliOA821htmZl/A5nJZjrCgqDX2Sia1b4IxrHPc= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=5j5YHkbm; arc=fail smtp.client-ip=40.107.220.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jj1nlXePJbXu+Tl4lXmpFnYEGkiusxtBVMjwr8mNmSkwTaVAMEipe3EkRabwWZoVva75hVPw6UQ+S0lANUqd7BLCNYvn8HrtnyyuEWQczlbH/F6gMMRqRz0WnvN+n60tBe11aHajic2HGNKnsoVJnvb6L/kSVh5AqlGg9qA/wGwJLAsVaeqcPH/p/C7H+AK6J8JTWR09OqMrlqkVvBhQ0zs2U7qjr9KLmt1FOtnkr22eeojS4/2t9G3SSE0fCHd8XquM8Vpn28Hu25NQ8hZ7EaGFTUP9hwMiG2iMkCyRRzkxcNQmi+MYzI/cG3gNLOpDMznXgOQPm0MjCQ6dy8wGXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oM+pHZuC9K8LNQSZO+qrilvDBWB/5aukgyGmJ6ZIBNs=; b=apoteti6hF4Q+ArTcgP9z+QvpMR3AcodkLLK0ETnMiMybtBu//V/RR4og8hMiP+V1cX1WR/azwoJPp0bHRzvcaQXIW1eSthEOm9pUNAjS+kwT9hdGrvVRh/nyI646RpduptGXzQzs3iEUoEwslgGW+p47hs4ox4445WZ1mofJqII8fjT0zcusWH3Y+LOVOr6O7lBuPVROIHU9B3NLRiDVJrx52czpzLDxMgbc/+Rr+8B1B0JK4jEeK9XzM68mFUpqqD5zlDDl+Vo/cFY/UwoHdyDWJuM6yGsKCtwNtpwEy3KEMCK5scgZQWyFmU1AgSaStz/BGW6zg0Ip42D5Ya+8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oM+pHZuC9K8LNQSZO+qrilvDBWB/5aukgyGmJ6ZIBNs=; b=5j5YHkbmbft1VLeceEYDBm0gpltok2v6KPFTrxYL05vC8ppaPRpyjQOhywKiCDaxqeND79MsB0B9uQni4y0eiRbw5L4liF50kUBqFHSBEElK8OHdvZ/3L7AkwESvdmY6/z7PhKiErXx01tstwy8BsT2MolQ+luIM+0bBKh3UFLI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CO6PR12MB5427.namprd12.prod.outlook.com (2603:10b6:5:358::13) by MN2PR12MB4373.namprd12.prod.outlook.com (2603:10b6:208:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.27; Fri, 8 Mar 2024 20:57:07 +0000 Received: from CO6PR12MB5427.namprd12.prod.outlook.com ([fe80::6c3b:75a3:6af2:8bf4]) by CO6PR12MB5427.namprd12.prod.outlook.com ([fe80::6c3b:75a3:6af2:8bf4%6]) with mapi id 15.20.7362.024; Fri, 8 Mar 2024 20:57:06 +0000 Message-ID: <0255d007-6929-4366-b47e-0826e13b86e8@amd.com> Date: Fri, 8 Mar 2024 15:57:00 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/7] drm: Fix drm_fixp2int_round() making it add 0.5 Content-Language: en-US To: Arthur Grillo , Rodrigo Siqueira , Melissa Wen , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , 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 References: <20240306-louis-vkms-conv-v1-0-5bfe7d129fdd@riseup.net> <20240306-louis-vkms-conv-v1-1-5bfe7d129fdd@riseup.net> From: Harry Wentland In-Reply-To: <20240306-louis-vkms-conv-v1-1-5bfe7d129fdd@riseup.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: YQXPR0101CA0042.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:14::19) To CO6PR12MB5427.namprd12.prod.outlook.com (2603:10b6:5:358::13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO6PR12MB5427:EE_|MN2PR12MB4373:EE_ X-MS-Office365-Filtering-Correlation-Id: ad1ec340-bd88-44a2-699c-08dc3fb25012 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N2sTxWAOh4sCcD26CI6earh7NxgmGhGwOlGXBcCCC1HhvAmWaxzKGrl8d5Vvt+14JPDIuAxE41upSg5J53fZ1krLwtIfJeeaMfu7umc+ucDwigIwMmymAdX4OCNeBX2eNZfnQN+4BvLFZ23XkU/G9oOIngMOuvFcf1qxOFpSiYOjrQWU2irciICDns5zddws4uEbaIR9WI9tRkdApMNuUIA5ty6vzYtoeb+2zVXQUvsBeXOCwRu7WbHLLDodwI0XzxjFpzqCT9/8N/vZuuf1m+o1j3rmXuJc3vPXKSTXZxL6PmpRikHaahPpibGMDJblrNjpgsMaBjiUVDWMn44qjLzN9nPQ/vdId4x4uu++EHhQ7e2USZB7Od/87QYDln2KC33pxuYwqtZucnxYJBhjdDPxDEECvOwlxMdJ10tLr0SszZaB1eKGPRppLoPtCE7SmVUk2andXOg8LiqJwsj4CvjrCK0ckY2OLMJ28L8hFDb/iTZ1Nmy4yE3vSv823BSGjFeidjrXa6kGksxSXGa8yy3I6rrXBVS7jOq5SGOwF+fU/dOy2UwiR6JB7UeswGKk7+Y+b04+A0rsul5mTeFsGJQBbNDRybsIhw6eL6gB8YJLWnVo3aUfa89PudRPIdNVmn0AnLxbiOjyYj1qSBG1YciO8ud/WVvgXknN9l3Gd3E= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR12MB5427.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(7416005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SEVsWTdZbjdUaG1ZanpNNEUyZjdlTU9NUGNISjJzS3FjNVVITDdDa1FvemRy?= =?utf-8?B?T1ZBTjZDY2dQR0pGczhzU3FZMHM4bFpWd0VxQUVlUUV3MWdITTF4K0VYK1Fw?= =?utf-8?B?RWZKWC92RFNpMUZkM3ZOdS9hT2ZNaGdVMkgvUERTRkFzdWxML2plczVDdkNu?= =?utf-8?B?bHZRclVXN2JuWWVESFNhbC90VTVlTlZYeTlaZlVoMkVLT0x6S1hyNHFxTURK?= =?utf-8?B?cDI2NnljZG5JeVl0dGhOUmMxL3dpV3RaVGVLbFdCUVVhMERJRTJ6MVpXdUtz?= =?utf-8?B?S3JCWGxsOUZ2VGg4enh2TkdHVllKVzlXYUxNcUgzblQ4RkNWMU11ZjNnVldS?= =?utf-8?B?OHBMUXhuVklrV1hQcFFKcy91VGJ3V0IrZ2xnc01Ud1JTMUwwRWZZMW1Wejl6?= =?utf-8?B?NjhhW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Exchange-CrossTenant-AuthSource: CO6PR12MB5427.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2024 20:57:06.1575 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QemGvLDKP8dmvgQibB2AmL1+AJsFIH2SufWVz6gHY/0zCGL/05nPQTxCrwSKBHqdbbsXTJwJUERtdBdQcwGJEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4373 On 2024-03-06 15:03, 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/ > > Suggested-by: Pekka Paalanen > Signed-off-by: Arthur Grillo Reviewed-by: Harry Wentland I had a different jab at this [1], but your patch is cleaner. https://patchwork.freedesktop.org/patch/579978/?series=123446&rev=4 Harry > --- > 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) >