public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Anuj Phogat <anuj.phogat@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/5] i965/skl: Set tile width and height for YF/YS tiling
Date: Mon, 30 Mar 2015 14:00:06 -0700	[thread overview]
Message-ID: <1427749208-8961-4-git-send-email-anuj.phogat@gmail.com> (raw)
In-Reply-To: <1427749208-8961-1-git-send-email-anuj.phogat@gmail.com>

I'm still passing tiling=I915_TILING_Y in drm_intel_gem_bo_alloc_internal()
in case of YF/YS tiling. Passing tiling=I915_TILING_{YF,YS} causes bo
allocation failure. Any advice what's the right thing to do here?

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
---
 intel/intel_bufmgr_gem.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index af44ba5..7c50e26 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -803,6 +803,39 @@ drm_intel_gem_bo_alloc(drm_intel_bufmgr *bufmgr,
 					       I915_TILING_NONE, 0);
 }
 
+/* This function does tile height computations valid only for Yf/Ys tiled
+ * surfaces.
+ */
+static unsigned
+drm_intel_gem_tile_height(unsigned bpp, uint32_t tiling)
+{
+	unsigned tile_height;
+	assert(tiling == I915_TILING_YF || tiling == I915_TILING_YS);
+
+	switch (bpp) {
+	case 8:
+		tile_height = 64;
+		break;
+	case 16:
+	case 32:
+		tile_height = 32;
+		break;
+	case 64:
+	case 128:
+		tile_height = 16;
+		break;
+	default:
+		printf("Invalid bits per pixel in %s: bpp = %d\n",
+		       __FUNCTION__, bpp);
+		return 0;
+	}
+
+	if (tiling == I915_TILING_YS)
+		tile_height *= 4;
+
+	return tile_height;
+}
+
 static drm_intel_bo *
 drm_intel_gem_bo_alloc_tiled(drm_intel_bufmgr *bufmgr, const char *name,
 			     int x, int y, int cpp, uint32_t *tiling_mode,
@@ -838,7 +871,15 @@ drm_intel_gem_bo_alloc_tiled(drm_intel_bufmgr *bufmgr, const char *name,
 			    && tiling == I915_TILING_Y)) {
 			height_alignment = 8;
 			tile_width = 512;
-		} else if (tiling == I915_TILING_Y)
+		} else if (tiling == I915_TILING_YF ||
+			   tiling == I915_TILING_YS) {
+			unsigned bpp = cpp * 8;
+			unsigned aspect_ratio =
+				(bpp == 16 || bpp == 64) ? 2 : 1;
+			height_alignment =
+				drm_intel_gem_tile_height(bpp, tiling);
+			tile_width = height_alignment * cpp * aspect_ratio;
+		} else if (tiling == I915_TILING_Y){
 			height_alignment = 32;
 			tile_width = 128;
 		}
@@ -855,6 +896,12 @@ drm_intel_gem_bo_alloc_tiled(drm_intel_bufmgr *bufmgr, const char *name,
 	if (tiling == I915_TILING_NONE)
 		stride = 0;
 
+	/* Use I915_TILING_Y in drm_intel_gem_bo_alloc_internal() in case of
+	 * YF/YS tiling.
+	 */
+	tiling = (tiling == I915_TILING_YF || tiling == I915_TILING_YS) ?
+		  I915_TILING_Y : tiling;
+
 	return drm_intel_gem_bo_alloc_internal(bufmgr, name, size, flags,
 					       tiling, stride);
 }
-- 
2.3.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-03-30 21:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 21:00 [PATCH 0/5] i965/skl: Add YF/YS tiling support Anuj Phogat
2015-03-30 21:00 ` [PATCH 1/5] i965/skl: Add macros for Yf/Ys tiling formats Anuj Phogat
2015-03-31 13:17   ` Daniel Vetter
2015-03-31 22:16     ` Anuj Phogat
2015-03-30 21:00 ` [PATCH 2/5] i965/skl: Move tile_width computations out of drm_intel_gem_bo_tile_pitch Anuj Phogat
2015-03-30 21:00 ` Anuj Phogat [this message]
2015-03-31  8:36   ` [PATCH 3/5] i965/skl: Set tile width and height for YF/YS tiling Tvrtko Ursulin
2015-03-30 21:00 ` [PATCH 4/5] Align YS tile base address to 64KB Anuj Phogat
2015-03-31 14:26   ` Damien Lespiau
2015-03-31 17:49     ` Anuj Phogat
2015-03-31 17:57       ` Damien Lespiau
2015-04-01  6:11         ` Daniel Vetter
2015-04-01 16:31           ` Anuj Phogat
2015-03-30 21:00 ` [PATCH 5/5] build: Bump the version to 2.4.61 Anuj Phogat
2015-03-31 14:28   ` Damien Lespiau
2015-03-31 17:51     ` Anuj Phogat
2015-04-01  6:13       ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427749208-8961-4-git-send-email-anuj.phogat@gmail.com \
    --to=anuj.phogat@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox