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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1E702C19F4F for ; Wed, 8 May 2024 12:55:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AEFF01128C9; Wed, 8 May 2024 12:55:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="dIMzbeGG"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 873671128C9 for ; Wed, 8 May 2024 12:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715172905; x=1746708905; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rWvsnYqdwJo8cwA+UuKxAFapslTzFSXsPYc5bx8RZFE=; b=dIMzbeGGVaZ/IDtEbUIvou8ody1YH4i08tR014f7tXyhDam9b0Q2m7qV LY8CRQughTiizHWeBAfZNy53CbA7JlndpWYtzTunRpmIqkN7Z09+0t8kO vw5em80LUZ8Kq6rCXD6Yt9VPKgjOYgOmyCEy9PcaIAULqgQZw7MSxSM38 v2AacMBmSKkyuQekf1OL9ZbQaV0vStN7aEIpIcxwrK94OKNBZ9bhrXRM9 OlY1hfM585AV2fLMC+I4bmTHpRCOUvXDFPZFWMmaMcpRX3LpUxLlr7tDf tFRfupz4G0vOj1eDZ7eMHt87NvKRVwnYKq0n7x3KSeiOlGbcqTjSidONq A==; X-CSE-ConnectionGUID: es4/BLcPS2a/ZbbUjUx8ww== X-CSE-MsgGUID: QpuiX0hbRpmMmoZPoj9H0A== X-IronPort-AV: E=McAfee;i="6600,9927,11066"; a="10865083" X-IronPort-AV: E=Sophos;i="6.08,145,1712646000"; d="scan'208";a="10865083" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2024 05:55:05 -0700 X-CSE-ConnectionGUID: WP0DXsZFSL+evKB3uV4gdw== X-CSE-MsgGUID: EFwHf6CdSgeBwr/LdOB7KA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,145,1712646000"; d="scan'208";a="33716315" Received: from mjarzebo-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.246.90]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2024 05:55:03 -0700 From: =?UTF-8?q?Zbigniew=20Kempczy=C5=84ski?= To: igt-dev@lists.freedesktop.org Cc: =?UTF-8?q?Zbigniew=20Kempczy=C5=84ski?= , Karolina Stolarek Subject: [PATCH i-g-t v4 03/11] lib/intel_blt: Add i915 -> blt tile helper converter Date: Wed, 8 May 2024 14:54:35 +0200 Message-Id: <20240508125443.404402-4-zbigniew.kempczynski@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240508125443.404402-1-zbigniew.kempczynski@intel.com> References: <20240508125443.404402-1-zbigniew.kempczynski@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" We have two kind of buffers in IGT - intel-buf for render and blt-object for blitter. intel-buf uses I915_TILING* whereas blt-object blt_tiling_type (T_*). To construct blt-object from intel-buf we need to convert I915_TILING* to T_*. Add function which does this conversion. Signed-off-by: Zbigniew KempczyƄski Reviewed-by: Karolina Stolarek --- lib/intel_blt.c | 21 +++++++++++++++++++++ lib/intel_blt.h | 1 + 2 files changed, 22 insertions(+) diff --git a/lib/intel_blt.c b/lib/intel_blt.c index 5a281036c4..946adc538b 100644 --- a/lib/intel_blt.c +++ b/lib/intel_blt.c @@ -560,6 +560,27 @@ int blt_tile_to_i915_tile(enum blt_tiling_type tiling) return 0; } +/** + * i915_tile_to_blt_tile: + * @tiling: tiling id + * + * Returns: + * id of blt tiling like T_LINEAR, T_XMAJOR, etc + */ +enum blt_tiling_type i915_tile_to_blt_tile(uint32_t tiling) +{ + switch (tiling) { + case I915_TILING_NONE: return T_LINEAR; + case I915_TILING_X: return T_XMAJOR; + case I915_TILING_Y: return T_YMAJOR; + case I915_TILING_4: return T_TILE4; + case I915_TILING_64: return T_TILE64; + case I915_TILING_Yf: return T_YFMAJOR; + default: + igt_assert_f(0, "Unknown tiling!\n"); + } +} + /** * blt_get_min_stride * @width: width in pixels diff --git a/lib/intel_blt.h b/lib/intel_blt.h index fcfce69bee..6daf46aea4 100644 --- a/lib/intel_blt.h +++ b/lib/intel_blt.h @@ -214,6 +214,7 @@ bool blt_uses_extended_block_copy(int fd); const char *blt_tiling_name(enum blt_tiling_type tiling); int blt_tile_to_i915_tile(enum blt_tiling_type tiling); +enum blt_tiling_type i915_tile_to_blt_tile(uint32_t tiling); uint32_t blt_get_min_stride(uint32_t width, uint32_t bpp, enum blt_tiling_type tiling); -- 2.34.1