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 v4 2/5] lib/intel_blt: Change surface size calculation
Date: Thu, 1 Feb 2024 11:07:21 +0100 [thread overview]
Message-ID: <20240201100724.257845-3-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20240201100724.257845-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 13b1dbba4f..00208fc243 100644
--- a/lib/intel_blt.c
+++ b/lib/intel_blt.c
@@ -1858,13 +1858,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
next prev parent reply other threads:[~2024-02-01 10:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 10:07 [PATCH i-g-t v4 0/5] Fill block-copy test gap for unaligned sizes Zbigniew Kempczyński
2024-02-01 10:07 ` [PATCH i-g-t v4 1/5] lib/intel_blt: Add helpers for calculating stride and aligned height Zbigniew Kempczyński
2024-02-01 12:05 ` Karolina Stolarek
2024-02-01 19:07 ` Zbigniew Kempczyński
2024-02-01 10:07 ` Zbigniew Kempczyński [this message]
2024-02-01 13:44 ` [PATCH i-g-t v4 2/5] lib/intel_blt: Change surface size calculation Karolina Stolarek
2024-02-01 19:27 ` Zbigniew Kempczyński
2024-02-01 10:07 ` [PATCH i-g-t v4 3/5] lib/intel_blt: Use object pitch and aligned height on png write Zbigniew Kempczyński
2024-02-01 13:51 ` Karolina Stolarek
2024-02-01 10:07 ` [PATCH i-g-t v4 4/5] tests/xe-ccs: Add tests which exercise small to large blit sizes Zbigniew Kempczyński
2024-02-01 14:09 ` Karolina Stolarek
2024-02-01 19:32 ` Zbigniew Kempczyński
2024-02-01 14:10 ` Karolina Stolarek
2024-02-01 19:54 ` Zbigniew Kempczyński
2024-02-01 10:07 ` [PATCH i-g-t v4 5/5] tests/xe_exercise_blt: Exercise small to large fast-copy blits Zbigniew Kempczyński
2024-02-01 14:18 ` Karolina Stolarek
2024-02-01 19:57 ` Zbigniew Kempczyński
2024-02-01 14:23 ` Karolina Stolarek
2024-02-01 19:58 ` Zbigniew Kempczyński
2024-02-01 11:43 ` ✓ CI.xeBAT: success for Fill block-copy test gap for unaligned sizes (rev4) 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=20240201100724.257845-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