From patchwork Mon Dec 14 17:49:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 11972601 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.7 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=unavailable 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 B48CCC2BB48 for ; Mon, 14 Dec 2020 17:49:00 +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 5803B21D7F for ; Mon, 14 Dec 2020 17:49:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5803B21D7F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 546076E098; Mon, 14 Dec 2020 17:48:59 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5BE1D6E092; Mon, 14 Dec 2020 17:48:57 +0000 (UTC) IronPort-SDR: VwXBSR8fNTidE+GIndhFxOqSNWwSOUEm0ZKC6S8u2riLHmXghiQhJMG6iUaAJkIyuUxrMEHr/U eTTu3xfk7IRQ== X-IronPort-AV: E=McAfee;i="6000,8403,9834"; a="173977236" X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="173977236" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2020 09:48:56 -0800 IronPort-SDR: PwVfPCT1igT85493wpk3F3InW5vkugLJt0IPdDpfzy/cyPPJ+JMZRuntLh8fMwSkIu48gttyU1 NZHnSD6fj2cA== X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="389088021" Received: from mbenes1-mobl.amr.corp.intel.com (HELO josouza-mobl2.intel.com) ([10.254.42.53]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2020 09:48:55 -0800 From: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= To: intel-gfx@lists.freedesktop.org Subject: [PATCH v6 1/5] drm: Add function to convert rect in 16.16 fixed format to regular format Date: Mon, 14 Dec 2020 09:49:08 -0800 Message-Id: <20201214174912.174065-1-jose.souza@intel.com> X-Mailer: git-send-email 2.29.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: , Cc: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= , dri-devel@lists.freedesktop.org, Gwan-gyeong Mun Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Much more clear to read one function call than four lines doing this conversion. Cc: dri-devel@lists.freedesktop.org Cc: Gwan-gyeong Mun Signed-off-by: José Roberto de Souza --- drivers/gpu/drm/drm_rect.c | 15 +++++++++++++++ include/drm/drm_rect.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c index 0460e874896e..24345704b353 100644 --- a/drivers/gpu/drm/drm_rect.c +++ b/drivers/gpu/drm/drm_rect.c @@ -373,3 +373,18 @@ void drm_rect_rotate_inv(struct drm_rect *r, } } EXPORT_SYMBOL(drm_rect_rotate_inv); + +/** + * drm_rect_convert_16_16_to_regular - Convert a rect in 16.16 fixed point form + * to regular form. + * @in: rect in 16.16 fixed point form + * @out: rect to be stored the converted value + */ +void drm_rect_convert_16_16_to_regular(struct drm_rect *in, struct drm_rect *out) +{ + out->x1 = in->x1 >> 16; + out->y1 = in->y1 >> 16; + out->x2 = in->x2 >> 16; + out->y2 = in->y2 >> 16; +} +EXPORT_SYMBOL(drm_rect_convert_16_16_to_regular); diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h index e7f4d24cdd00..2ef8180416cd 100644 --- a/include/drm/drm_rect.h +++ b/include/drm/drm_rect.h @@ -223,5 +223,7 @@ void drm_rect_rotate(struct drm_rect *r, void drm_rect_rotate_inv(struct drm_rect *r, int width, int height, unsigned int rotation); +void drm_rect_convert_16_16_to_regular(struct drm_rect *in, + struct drm_rect *out); #endif