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 2/8] tests/intel: prefer intel_buf_init_in_region()
Date: Tue, 13 Feb 2024 10:01:19 +0000	[thread overview]
Message-ID: <20240213100125.90085-2-matthew.auld@intel.com> (raw)
In-Reply-To: <20240213100125.90085-1-matthew.auld@intel.com>

We want to get rid of intel_buf_init_using_handle(), in favour of
something where bo_size is always passed in. It looks like we can
instead just use intel_buf_init_in_region() here.

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>
---
 tests/intel/gem_gpgpu_fill.c   | 7 ++-----
 tests/intel/gem_media_fill.c   | 7 ++-----
 tests/intel/i915_pipe_stress.c | 8 +++-----
 tests/intel/i915_pm_rpm.c      | 8 +++-----
 4 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/tests/intel/gem_gpgpu_fill.c b/tests/intel/gem_gpgpu_fill.c
index 25f2a96c1..ac283620e 100644
--- a/tests/intel/gem_gpgpu_fill.c
+++ b/tests/intel/gem_gpgpu_fill.c
@@ -78,7 +78,6 @@ create_buf(data_t *data, int width, int height, uint8_t color, uint32_t region)
 {
 	struct intel_buf *buf;
 	uint8_t *ptr;
-	uint32_t handle;
 	int i;
 
 	buf = calloc(1, sizeof(*buf));
@@ -88,10 +87,8 @@ create_buf(data_t *data, int width, int height, uint8_t color, uint32_t region)
 	 * Legacy code uses 32 bpp after buffer creation.
 	 * Let's do the same due to keep shader intact.
 	 */
-	handle = gem_create_in_memory_regions(data->drm_fd, SIZE, region);
-	intel_buf_init_using_handle(data->bops, handle, buf,
-				    width/4, height, 32, 0,
-				    I915_TILING_NONE, 0);
+	intel_buf_init_in_region(data->bops, buf, width/4, height, 32, 0,
+				 I915_TILING_NONE, 0, region);
 
 	ptr = gem_mmap__cpu_coherent(data->drm_fd, buf->handle, 0,
 				     buf->surface[0].size, PROT_WRITE);
diff --git a/tests/intel/gem_media_fill.c b/tests/intel/gem_media_fill.c
index a678d2f99..79a06f7b8 100644
--- a/tests/intel/gem_media_fill.c
+++ b/tests/intel/gem_media_fill.c
@@ -75,21 +75,18 @@ static struct intel_buf *
 create_buf(data_t *data, int width, int height, uint8_t color, uint32_t region)
 {
 	struct intel_buf *buf;
-	uint32_t handle;
 	uint8_t *ptr;
 	int i;
 
 	buf = calloc(1, sizeof(*buf));
 	igt_assert(buf);
 
-	handle = gem_create_in_memory_regions(data->drm_fd, SIZE, region);
-
 	/*
 	 * Legacy code uses 32 bpp after buffer creation.
 	 * Let's do the same due to keep shader intact.
 	 */
-	intel_buf_init_using_handle(data->bops, handle, buf, width/4,
-				    height, 32, 0, I915_TILING_NONE, 0);
+	intel_buf_init_in_region(data->bops, buf, width/4, height, 32, 0,
+				 I915_TILING_NONE, 0, region);
 
 	ptr = gem_mmap__cpu_coherent(data->drm_fd, buf->handle, 0,
 				     buf->surface[0].size, PROT_WRITE);
diff --git a/tests/intel/i915_pipe_stress.c b/tests/intel/i915_pipe_stress.c
index f9da5f023..79f83d266 100644
--- a/tests/intel/i915_pipe_stress.c
+++ b/tests/intel/i915_pipe_stress.c
@@ -192,7 +192,6 @@ static struct intel_buf *
 create_buf(struct data *data, int width, int height, uint32_t region)
 {
 	struct intel_buf *buf;
-	uint32_t handle;
 
 	buf = calloc(1, sizeof(*buf));
 	igt_assert(buf);
@@ -201,10 +200,9 @@ create_buf(struct data *data, int width, int height, uint32_t region)
 	 * Legacy code uses 32 bpp after buffer creation.
 	 * Let's do the same due to keep shader intact.
 	 */
-	handle = gem_create_in_memory_regions(data->drm_fd, width * height, region);
-	intel_buf_init_using_handle(data->bops, handle, buf,
-				    width/4, height, 32, 0,
-				    I915_TILING_NONE, 0);
+	intel_buf_init_in_region(data->bops, buf,
+				 width/4, height, 32, 0,
+				 I915_TILING_NONE, 0, region);
 
 	return buf;
 }
diff --git a/tests/intel/i915_pm_rpm.c b/tests/intel/i915_pm_rpm.c
index 2b0a63bde..7f64d1069 100644
--- a/tests/intel/i915_pm_rpm.c
+++ b/tests/intel/i915_pm_rpm.c
@@ -218,7 +218,6 @@ create_buf(struct data_t *data, uint32_t color)
 {
 	struct intel_buf *buf;
 	uint8_t *ptr;
-	uint32_t handle;
 	struct buf_ops *bops;
 	int i;
 
@@ -226,10 +225,9 @@ create_buf(struct data_t *data, uint32_t color)
 	igt_assert(buf);
 	bops = buf_ops_create(drm_fd);
 
-	handle = gem_create_in_memory_regions(drm_fd, SIZE, data->region);
-	intel_buf_init_using_handle(bops, handle, buf,
-				    data->width / 4, data->height, 32, 0,
-				    I915_TILING_NONE, 0);
+	intel_buf_init_in_region(bops, buf,
+				 data->width / 4, data->height, 32, 0,
+				 I915_TILING_NONE, 0, data->region);
 
 	ptr = gem_mmap__cpu_coherent(drm_fd, buf->handle, 0,
 				     buf->surface[0].size, PROT_WRITE);
-- 
2.43.0


  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 ` Matthew Auld [this message]
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

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-2-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