From patchwork Wed Sep 1 17:54:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alyssa Rosenzweig X-Patchwork-Id: 12470047 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 05C23C4320A for ; Wed, 1 Sep 2021 17:54:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 675A861090 for ; Wed, 1 Sep 2021 17:54:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 675A861090 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rosenzweig.io Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A6DF6E226; Wed, 1 Sep 2021 17:54:50 +0000 (UTC) Received: from rosenzweig.io (rosenzweig.io [138.197.143.207]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5BCB56E22F for ; Wed, 1 Sep 2021 17:54:48 +0000 (UTC) From: Alyssa Rosenzweig To: dri-devel@lists.freedesktop.org Cc: Neil Armstrong , David Airlie , Daniel Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Rob Clark , Sean Paul , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Abhinav Kumar , Dmitry Baryshkov , Lee Jones , Stephen Boyd , Kalyan Thota , Laurent Pinchart , =?utf-8?b?VmlsbGUg?= =?utf-8?b?U3lyasOkbMOk?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alyssa Rosenzweig Subject: [PATCH 1/5] drm: Add drm_fixed_16_16 helper Date: Wed, 1 Sep 2021 13:54:27 -0400 Message-Id: <20210901175431.14060-1-alyssa@rosenzweig.io> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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; } +static inline int drm_fixed_16_16(s32 mult, s32 div) +{ + return (mult << 16) / div; +} + #endif