From patchwork Tue Jul 18 17:22:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Praveen Paneri X-Patchwork-Id: 9849161 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3ECA9600CC for ; Tue, 18 Jul 2017 17:13:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20368285D3 for ; Tue, 18 Jul 2017 17:13:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14FA4285D1; Tue, 18 Jul 2017 17:13:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B93A285CE for ; Tue, 18 Jul 2017 17:13:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E5AE6E385; Tue, 18 Jul 2017 17:13:29 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 951C26E385 for ; Tue, 18 Jul 2017 17:13:27 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP; 18 Jul 2017 10:13:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,378,1496127600"; d="scan'208";a="880154406" Received: from intel-desktop.iind.intel.com ([10.223.26.163]) by FMSMGA003.fm.intel.com with ESMTP; 18 Jul 2017 10:13:26 -0700 From: Praveen Paneri To: intel-gfx@lists.freedesktop.org Date: Tue, 18 Jul 2017 22:52:56 +0530 Message-Id: <1500398580-15846-2-git-send-email-praveen.paneri@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500398580-15846-1-git-send-email-praveen.paneri@intel.com> References: <1500398580-15846-1-git-send-email-praveen.paneri@intel.com> Cc: paulo.r.zanoni@intel.com, Praveen Paneri Subject: [Intel-gfx] [PATCH i-g-t v3 1/5] lib/igt_fb: Let others use igt_get_fb_tile_size X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Praveen Paneri This function can be used by igt_draw to get accurate tile dimensions for all tile formats. v2: Added comments to function igt_get_fb_tile_size (Daniel) v3: Fixed errors in comments and coding style (Paulo) Signed-off-by: Praveen Paneri --- lib/igt_fb.c | 15 +++++++++++++-- lib/igt_fb.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index d2b7e9e..c94f95e 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -74,8 +74,19 @@ static struct format_desc_struct { #define for_each_format(f) \ for (f = format_desc; f - format_desc < ARRAY_SIZE(format_desc); f++) -static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp, - unsigned *width_ret, unsigned *height_ret) +/** + * igt_get_fb_tile_size: + * @fd: the DRM file descriptor + * @tiling: tiling layout of the framebuffer (as framebuffer modifier) + * @fb_bpp: bits per pixel of the framebuffer + * @width_ret: width of the tile in bytes + * @height_ret: height of the tile in lines + * + * This function returns width and height of a tile based on the given tiling + * format. + */ +void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp, + unsigned *width_ret, unsigned *height_ret) { switch (tiling) { case LOCAL_DRM_FORMAT_MOD_NONE: diff --git a/lib/igt_fb.h b/lib/igt_fb.h index 4a680ce..010ed3a 100644 --- a/lib/igt_fb.h +++ b/lib/igt_fb.h @@ -95,6 +95,8 @@ enum igt_text_align { align_hcenter = 0x08, }; +void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp, + unsigned *width_ret, unsigned *height_ret); void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling, unsigned *size_ret, unsigned *stride_ret); unsigned int