From patchwork Fri Apr 28 14:37:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Praveen Paneri X-Patchwork-Id: 9704837 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 4D11A60225 for ; Fri, 28 Apr 2017 14:29:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D3BB285E7 for ; Fri, 28 Apr 2017 14:29:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 307C82865A; Fri, 28 Apr 2017 14:29:42 +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 C5525283BA for ; Fri, 28 Apr 2017 14:29:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62FF76E7CC; Fri, 28 Apr 2017 14:29:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 01ECC6E7CD for ; Fri, 28 Apr 2017 14:29:39 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2017 07:29:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,388,1488873600"; d="scan'208";a="95374094" Received: from intel-desktop.iind.intel.com ([10.223.25.10]) by fmsmga006.fm.intel.com with ESMTP; 28 Apr 2017 07:29:37 -0700 From: Praveen Paneri To: intel-gfx@lists.freedesktop.org Date: Fri, 28 Apr 2017 20:07:28 +0530 Message-Id: <1493390254-5232-2-git-send-email-praveen.paneri@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1493390254-5232-1-git-send-email-praveen.paneri@intel.com> References: <1493390254-5232-1-git-send-email-praveen.paneri@intel.com> Cc: paulo.r.zanoni@intel.com, Praveen Paneri Subject: [Intel-gfx] [PATCH v2 1/7] 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 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) Signed-off-by: Praveen Paneri --- lib/igt_fb.c | 16 +++++++++++++--- lib/igt_fb.h | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index d2b7e9e..9ba1e3b 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -73,9 +73,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: Bytes per pixel of the framebuffer + * @width_ret: Width of the tile in pixels + * @height_ret: Height of the tile in pixels + * + * 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..414cb3d 100644 --- a/lib/igt_fb.h +++ b/lib/igt_fb.h @@ -94,7 +94,8 @@ enum igt_text_align { align_vcenter = 0x04, 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