Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Subject: [PATCH i-g-t v2 5/8] tests/intel: replace intel_buf_init_using_handle()
Date: Tue, 13 Feb 2024 10:01:22 +0000	[thread overview]
Message-ID: <20240213100125.90085-5-matthew.auld@intel.com> (raw)
In-Reply-To: <20240213100125.90085-1-matthew.auld@intel.com>

Require the original object size, if the caller created the object and
convert all existing users over.

v2:(Zbigniew)
 - Remove old intel_buf_init_using_handle() prototype and assert size.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 lib/intel_bufops.c                  | 18 +++++++++++-------
 lib/intel_bufops.h                  | 19 ++++++++-----------
 tests/intel/gem_set_tiling_vs_blt.c |  7 ++++---
 3 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index fa7dc4de6..10e2d3dac 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -1011,7 +1011,7 @@ void intel_buf_close(struct buf_ops *bops, struct intel_buf *buf)
 }
 
 /**
- * intel_buf_init_using_handle
+ * intel_buf_init_using_handle_and_size
  * @bops: pointer to buf_ops
  * @handle: BO handle created by the caller
  * @buf: pointer to intel_buf structure to be filled
@@ -1021,6 +1021,7 @@ void intel_buf_close(struct buf_ops *bops, struct intel_buf *buf)
  * @alignment: alignment of the stride for linear surfaces
  * @tiling: surface tiling
  * @compression: surface compression type
+ * @size: real bo size
  *
  * Function configures BO handle within intel_buf structure passed by the caller
  * (with all its metadata - width, height, ...). Useful if BO was created
@@ -1029,14 +1030,17 @@ void intel_buf_close(struct buf_ops *bops, struct intel_buf *buf)
  * Note: intel_buf_close() can be used because intel_buf is aware it is not
  * buffer owner so it won't close it underneath.
  */
-void intel_buf_init_using_handle(struct buf_ops *bops,
-				 uint32_t handle,
-				 struct intel_buf *buf,
-				 int width, int height, int bpp, int alignment,
-				 uint32_t req_tiling, uint32_t compression)
+void intel_buf_init_using_handle_and_size(struct buf_ops *bops,
+					  uint32_t handle,
+					  struct intel_buf *buf,
+					  int width, int height, int bpp, int alignment,
+					  uint32_t req_tiling, uint32_t compression,
+					  uint64_t size)
 {
+	igt_assert(handle);
+	igt_assert(size);
 	__intel_buf_init(bops, handle, buf, width, height, bpp, alignment,
-			 req_tiling, compression, 0, 0, -1, DEFAULT_PAT_INDEX);
+			 req_tiling, compression, size, 0, -1, DEFAULT_PAT_INDEX);
 }
 
 /**
diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
index 54a143c5b..0b68482b2 100644
--- a/lib/intel_bufops.h
+++ b/lib/intel_bufops.h
@@ -150,11 +150,6 @@ void intel_buf_init_in_region(struct buf_ops *bops,
 			      uint64_t region);
 void intel_buf_close(struct buf_ops *bops, struct intel_buf *buf);
 
-void intel_buf_init_using_handle(struct buf_ops *bops,
-				 uint32_t handle,
-				 struct intel_buf *buf,
-				 int width, int height, int bpp, int alignment,
-				 uint32_t req_tiling, uint32_t compression);
 void intel_buf_init_full(struct buf_ops *bops,
 			 uint32_t handle,
 			 struct intel_buf *buf,
@@ -172,12 +167,14 @@ struct intel_buf *intel_buf_create(struct buf_ops *bops,
 				   int bpp, int alignment,
 				   uint32_t req_tiling, uint32_t compression);
 
-struct intel_buf *intel_buf_create_using_handle(struct buf_ops *bops,
-						uint32_t handle,
-						int width, int height,
-						int bpp, int alignment,
-						uint32_t req_tiling,
-						uint32_t compression);
+void intel_buf_init_using_handle_and_size(struct buf_ops *bops,
+					  uint32_t handle,
+					  struct intel_buf *buf,
+					  int width, int height,
+					  int bpp, int alignment,
+					  uint32_t req_tiling,
+					  uint32_t compression,
+					  uint64_t size);
 
 struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,
 							 uint32_t handle,
diff --git a/tests/intel/gem_set_tiling_vs_blt.c b/tests/intel/gem_set_tiling_vs_blt.c
index e9d5e3c63..9077e0f3f 100644
--- a/tests/intel/gem_set_tiling_vs_blt.c
+++ b/tests/intel/gem_set_tiling_vs_blt.c
@@ -138,9 +138,10 @@ static void do_test(struct buf_ops *bops, uint32_t tiling, unsigned stride,
 	gem_munmap(ptr, TEST_SIZE);
 
 	/* Reuse previously aligned in the gtt object */
-	intel_buf_init_using_handle(bops, test_buf->handle, test_buf,
-				    TEST_WIDTH(stride), TEST_HEIGHT(stride), 32,
-				    0, tiling, I915_COMPRESSION_NONE);
+	intel_buf_init_using_handle_and_size(bops, test_buf->handle, test_buf,
+					     TEST_WIDTH(stride), TEST_HEIGHT(stride), 32,
+					     0, tiling, I915_COMPRESSION_NONE,
+					     test_buf->bo_size);
 	igt_assert_eq_u32(intel_buf_size(test_buf), TEST_SIZE);
 	intel_buf_set_ownership(test_buf, true);
 	intel_bb_add_intel_buf(ibb, test_buf, false);
-- 
2.43.0


  parent reply	other threads:[~2024-02-13 10:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 10:01 [PATCH i-g-t v2 1/8] tests/prime_nv_test: switch over to intel_buf_init() Matthew Auld
2024-02-13 10:01 ` [PATCH i-g-t v2 2/8] tests/intel: prefer intel_buf_init_in_region() Matthew Auld
2024-02-13 10:01 ` [PATCH i-g-t v2 3/8] lib/intel_bufops: repurpose intel_buf_create_using_handle_and_size() Matthew Auld
2024-02-13 10:01 ` [PATCH i-g-t v2 4/8] tests/intel: replace intel_buf_create_using_handle() Matthew Auld
2024-02-13 10:01 ` Matthew Auld [this message]
2024-02-13 10:01 ` [PATCH i-g-t v2 6/8] tests/intel/kms_dirtyfb: pass the bo_size Matthew Auld
2024-02-13 10:01 ` [PATCH i-g-t v2 7/8] lib/intel_bufops: keep bo_size separate Matthew Auld
2024-02-13 10:01 ` [PATCH i-g-t v2 8/8] lib/igt_fb: assert fb->size blt_fb_init() Matthew Auld
2024-02-13 11:37 ` ✓ Fi.CI.BAT: success for series starting with [i-g-t,v2,1/8] tests/prime_nv_test: switch over to intel_buf_init() Patchwork
2024-02-13 12:26 ` ✓ CI.xeBAT: " Patchwork
2024-02-13 13:21 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-02-16 11:12   ` Kamil Konieczny

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=20240213100125.90085-5-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@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