Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Karolina Drobnik <karolina.drobnik@intel.com>
Subject: [PATCH i-g-t v2 2/4] lib/intel_blt: Change surface size calculation
Date: Wed, 31 Jan 2024 14:25:56 +0100	[thread overview]
Message-ID: <20240131132558.208971-3-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20240131132558.208971-1-zbigniew.kempczynski@intel.com>

For tiled surfaces we need to ensure stride and height are valid
from the blit operation perspective. Calculate required surface
size according to tiling constraints.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Karolina Drobnik <karolina.drobnik@intel.com>
---
 lib/intel_blt.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/intel_blt.c b/lib/intel_blt.c
index 6d1aa0608f..2076cb56c4 100644
--- a/lib/intel_blt.c
+++ b/lib/intel_blt.c
@@ -1857,13 +1857,21 @@ blt_create_object(const struct blt_copy_data *blt, uint32_t region,
 		  bool create_mapping)
 {
 	struct blt_copy_object *obj;
-	uint64_t size = width * height * bpp / 8;
-	uint32_t stride = tiling == T_LINEAR ? width * 4 : width;
+	uint32_t stride, aligned_height;
+	uint64_t size;
 	uint32_t handle;
 	uint8_t pat_index = DEFAULT_PAT_INDEX;
 
 	igt_assert_f(blt->driver, "Driver isn't set, have you called blt_copy_init()?\n");
 
+	stride = blt_get_min_stride(width, bpp, tiling);
+	aligned_height = blt_get_aligned_height(height, bpp, tiling);
+	size = stride * aligned_height;
+
+	/* blitter command expects stride in dwords on tiled surfaces */
+	if (tiling)
+		stride /= 4;
+
 	obj = calloc(1, sizeof(*obj));
 
 	obj->size = size;
-- 
2.34.1


  parent reply	other threads:[~2024-01-31 13:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 13:25 [PATCH i-g-t v2 0/4] Fill block-copy test gap for unaligned sizes Zbigniew Kempczyński
2024-01-31 13:25 ` [PATCH i-g-t v2 1/4] lib/intel_blt: Add helpers for calculating stride and aligned height Zbigniew Kempczyński
2024-01-31 13:25 ` Zbigniew Kempczyński [this message]
2024-01-31 13:25 ` [PATCH i-g-t v2 3/4] lib/intel_blt: Use object pitch and aligned height on png write Zbigniew Kempczyński
2024-01-31 13:25 ` [PATCH i-g-t v2 4/4] tests/xe-ccs: Add tests which exercise small to large blit sizes Zbigniew Kempczyński
2024-01-31 15:01 ` ✓ Fi.CI.BAT: success for Fill block-copy test gap for unaligned sizes (rev2) Patchwork
2024-01-31 15:24 ` ✗ CI.xeBAT: failure " Patchwork
2024-01-31 17:10 ` ✗ Fi.CI.IGT: " Patchwork

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=20240131132558.208971-3-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karolina.drobnik@intel.com \
    /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