From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32A85C432BE for ; Wed, 1 Sep 2021 18:15:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F33E4610D1 for ; Wed, 1 Sep 2021 18:15:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F33E4610D1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mQiWEvy7kT9NQRRIRdUGs/GucNbriEr+D4dXO1xo/rA=; b=BrUaXl/Ax1Dvjv EaKw7cktuOr6n+3AGLbC/J8DKAA4MiD+8ddFrsMsLDxm6woTFFM//ybm+7SXAQKkOi6mw99x79DnA 1uqfsPo26076c2/NTv3MngXJ9TMQePAwFrKu1IPkWpxR65zt3R+oRCFLPPce1E4FGRGWn8pju8LQ2 ejV1qDmvHaGrt5gJj5XPHlUY9vHwvzzD7BUpm02eGWAa4byLTgplyhK6g0YOyo3D7pEW3BNo0KyHm nytIhoYQxIrmSSXJmhxXbp9mk2fjyCawJhjWtLKDkKKDgskAyPPfyqT5dswKog5tuV355e58ZqyLP UxPmhBaJmPt4NYOtJs8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLUjv-006w56-BN; Wed, 01 Sep 2021 18:13:35 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLUjo-006w35-Nj for linux-arm-kernel@lists.infradead.org; Wed, 01 Sep 2021 18:13:32 +0000 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-Disposition: inline In-Reply-To: <20210901175431.14060-1-alyssa@rosenzweig.io> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210901_111328_983446_CDACDE32 X-CRM114-Status: GOOD ( 19.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel