Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp850893pxb; Wed, 1 Sep 2021 11:15:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5dhVGSezu3cW4EsGikmJnQnGKo/yWDVTiRLC0YuyuvQOd7bGaPWyRZ+urQ/TGkThXEfVk X-Received: by 2002:a17:906:a18f:: with SMTP id s15mr816948ejy.269.1630520159268; Wed, 01 Sep 2021 11:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630520159; cv=none; d=google.com; s=arc-20160816; b=OSFK2DRTjry6ibk0nB4QxwrUOuAZZsMBYs/PvSLxXtDRpLFTWKvbVONhZX+uke9cf8 pTX68Rrz+OKrZ+yIcPPalVKOJttW2UPM4ofdamFdInwG+39yG66X0AdVDo0JsRyPUWbz Ph6kQ9AoXj4ldIM9w9alIwlBz47HDDiQNwmlnlAr/2NllMDuMKp/EDIJIG731u/PXDx6 LDGT+P7ISdIR2CnWimzr+bWYMcCUM/jYVo8i73R0/VZ7I+GIfO8R473WMP3Jhoj9m4k8 n6RzQbuyEOOxyDl8C91tSvM3dkg4/eiuPxQVxDih8MjTuwU7YVRQ9uewY2mKP5Jm3nAz 2XCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=i4OnRSO2MhBwEvgJQqfIsGsQV+yMSiXQIYhFATEZ0eg=; b=O66MAoOChdywQpDrpQBMDa9HUVbkLy+3DRS5SCvjEHuSs8k9MWcbnCTqJWXMFfabKv SVQQ0tgFB3FDA5nuOR9QtRx35jjt97j7iDB5wr7YTqo0N48bmz2cb4V14rE8i1ltmRVv S467M4XVcK22vlUOyZ2udYInsfW9fedfEkAaHa+DwuxvkgDt+mlAiQpQhs5oYMcPKCGY hB1WfZKkmGP8fcOSybyvydYzxFlRmKHeYsmW8PKr/sETDogxhxQJZa6BI3IgP21/CCph i4XQZ4M3dQFWrEEIL3iTQsH/9mh2vOgL9feDU3w2V5uVoUm9pmUrkTTbZMKCtMNnaxIW tXcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=ucoRfpQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e24si418805ejl.353.2021.09.01.11.15.19; Wed, 01 Sep 2021 11:15:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=ucoRfpQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344260AbhIASOU (ORCPT + 99 others); Wed, 1 Sep 2021 14:14:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232459AbhIASOU (ORCPT ); Wed, 1 Sep 2021 14:14:20 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDE2AC061575 for ; Wed, 1 Sep 2021 11:13:22 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 98EFA559; Wed, 1 Sep 2021 20:13:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630520000; bh=BDl0EmauITqkvN6b/L6wjyoZWA3yqKvMu0HJWSPXVEU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ucoRfpQEdOL5uWiJHPl4jRLJICaNAL5SCAJcbYTw57fqz6f46uYHeDfj1y/scMT25 wijEhCS5NbSCTmWwQB44Jf1aPl7ADNgmaqlr6CVpNDLt5XVCxwDJo8rkGYgnpChKr8 NxkykMaOVW8YiPowN9atrwmqi+FyI5NJjXJGKXMc= Date: Wed, 1 Sep 2021 21:13:04 +0300 From: Laurent Pinchart To: Alyssa Rosenzweig Cc: dri-devel@lists.freedesktop.org, Neil Armstrong , David Airlie , Daniel Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Rob Clark , Sean Paul , Sandy Huang , Heiko =?utf-8?Q?St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Abhinav Kumar , Dmitry Baryshkov , Lee Jones , Stephen Boyd , Kalyan Thota , Ville =?utf-8?B?U3lyasOkbMOk?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] drm: Add drm_fixed_16_16 helper Message-ID: References: <20210901175431.14060-1-alyssa@rosenzweig.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210901175431.14060-1-alyssa@rosenzweig.io> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alyssa, Thank you for the patch. On Wed, Sep 01, 2021 at 01:54:27PM -0400, Alyssa Rosenzweig wrote: > This constructs a fixed 16.16 rational, useful to specify the minimum > and maximum scaling in drm_atomic_helper_check_plane_state. It is > open-coded as a macro in multiple drivers, so let's share the helper. > > Signed-off-by: Alyssa Rosenzweig > --- > include/drm/drm_fixed.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h > index 553210c02ee0..df1f369b4918 100644 > --- a/include/drm/drm_fixed.h > +++ b/include/drm/drm_fixed.h > @@ -208,4 +208,9 @@ static inline s64 drm_fixp_exp(s64 x) > return sum; > } > Missing documentation :-) > +static inline int drm_fixed_16_16(s32 mult, s32 div) You should return a s32. The function name isn't very explicit, and departs from the naming scheme of other functions in the same file. As fixed-point numbers are stored in a s64 for the drm_fixp_* helpers, we shouldn't rese the drm_fixp_ prefix, maybe drm_fixp_s16_16_ would be a good prefix. The function should probably be named drm_fixp_s16_16 from_fraction() then, but then the same logic should possibly be replicated to ensure optimal precision. I wonder if it wouldn't be best to simply use drm_fixp_from_fraction() and shift the result right by 16 bits. > +{ > + return (mult << 16) / div; > +} > + > #endif -- Regards, Laurent Pinchart