Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2 1/8] tests/prime_nv_test: switch over to intel_buf_init()
@ 2024-02-13 10:01 Matthew Auld
  2024-02-13 10:01 ` [PATCH i-g-t v2 2/8] tests/intel: prefer intel_buf_init_in_region() Matthew Auld
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Matthew Auld @ 2024-02-13 10:01 UTC (permalink / raw)
  To: igt-dev; +Cc: Zbigniew Kempczyński

We want to get rid of intel_buf_init_using_handle(), in favour of always
passing in the real bo size, otherwise it is quite tricky to figure out
what exactly to set for buf->bo_size (which eventually get plugged into
vm_bind) when the caller is the one who created the bo. Trying to guess
the page alignment is unsafe without knowing more about the actual
object.  In this case it seems simplest to switch over to
intel_buf_init. Should be no functional change here.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Acked-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 tests/prime_nv_test.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/tests/prime_nv_test.c b/tests/prime_nv_test.c
index bc2579604..eb5e2d8ea 100644
--- a/tests/prime_nv_test.c
+++ b/tests/prime_nv_test.c
@@ -273,13 +273,11 @@ static void test_i915_import_pread_pwrite(void)
 	gem_close(intel_fd, intel_handle);
 }
 
-static uint32_t create_bo(uint32_t val, int width, int height)
+static void fill_bo(uint32_t intel_handle, uint32_t val, int width, int height)
 {
-	uint32_t intel_handle;
 	int size = width * height;
 	uint32_t *ptr, *currptr;
 
-	intel_handle = gem_create(intel_fd, 4*width*height);
 	igt_assert(intel_handle);
 
         /* gtt map doesn't have a write parameter, so just keep the mapping
@@ -293,15 +291,12 @@ static uint32_t create_bo(uint32_t val, int width, int height)
 		*currptr++ = val;
 
 	gem_munmap(ptr, size);
-
-	return intel_handle;
 }
 
 /* use intel hw to fill the BO with a blit from another BO,
    then readback from the nouveau bo, check value is correct */
 static void test_i915_blt_fill_nv_read(void)
 {
-	uint32_t dst_handle, src_handle;
 	int prime_fd;
 	struct nouveau_bo *nvbo = NULL;
 	uint32_t *ptr;
@@ -312,18 +307,18 @@ static void test_i915_blt_fill_nv_read(void)
 
 	ibb = intel_bb_create(intel_fd, 4096);
 
-	src_handle = create_bo(0xaa55aa55, w, h);
-	dst_handle = gem_create(intel_fd, BO_SIZE);
+	intel_buf_init(bops, &src, w, h, 32, 0,
+		       I915_TILING_NONE, I915_COMPRESSION_NONE);
+	intel_buf_init(bops, &dst, w, 256, 32, 0,
+		       I915_TILING_NONE, I915_COMPRESSION_NONE);
 
-	prime_fd = prime_handle_to_fd(intel_fd, dst_handle);
+	fill_bo(src.handle, 0xaa55aa55, w, h);
+
+	prime_fd = prime_handle_to_fd(intel_fd, dst.handle);
 
 	igt_assert(nouveau_bo_prime_handle_ref(ndev, prime_fd, &nvbo) == 0);
 	close(prime_fd);
 
-	intel_buf_init_using_handle(bops, src_handle, &src, w, h, 32, 0,
-				    I915_TILING_NONE, I915_COMPRESSION_NONE);
-	intel_buf_init_using_handle(bops, dst_handle, &dst, w, 256, 32, 0,
-				    I915_TILING_NONE, I915_COMPRESSION_NONE);
 	intel_bb_copy_intel_buf(ibb, &dst, &src, w * h * 4);
 
 	igt_assert(nouveau_bo_map(nvbo, NOUVEAU_BO_RDWR, nclient) == 0);
@@ -335,8 +330,6 @@ static void test_i915_blt_fill_nv_read(void)
 	intel_buf_destroy(&src);
 	intel_buf_destroy(&dst);
 	intel_bb_destroy(ibb);
-	gem_close(intel_fd, dst_handle);
-	gem_close(intel_fd, src_handle);
 }
 
 /* test 8 use nouveau to do blit */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-02-16 11:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH i-g-t v2 5/8] tests/intel: replace intel_buf_init_using_handle() Matthew Auld
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox