All of lore.kernel.org
 help / color / mirror / Atom feed
From: apoorva1.singh@intel.com
To: zbigniew.kempczynski@intel.com, thomas.hellstrom@linux.intel.com,
	igt-dev@lists.freedesktop.org, arjun.melkaveri@intel.com,
	apoorva1.singh@intel.com
Subject: [igt-dev] [PATCH i-g-t 1/2] lib/intel_bufops: Add intel_buf_init_in_region
Date: Wed,  1 Sep 2021 21:18:45 +0530	[thread overview]
Message-ID: <20210901154846.3323879-2-apoorva1.singh@intel.com> (raw)
In-Reply-To: <20210901154846.3323879-1-apoorva1.singh@intel.com>

From: Apoorva Singh <apoorva1.singh@intel.com>

Add intel_buf_init_in_region which allows memory region
to be specified for new BO being created.
Same as intel_buf_init with the additional region argument.

Signed-off-by: Apoorva Singh <apoorva1.singh@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Melkaveri, Arjun <arjun.melkaveri@intel.com>
---
 lib/intel_bufops.c | 28 +++++++++++++++++++++++-----
 lib/intel_bufops.h |  5 +++++
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index faca4406..f5f67edd 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -730,7 +730,8 @@ static void __intel_buf_init(struct buf_ops *bops,
 			     struct intel_buf *buf,
 			     int width, int height, int bpp, int alignment,
 			     uint32_t req_tiling, uint32_t compression,
-			     uint64_t bo_size, int bo_stride)
+			     uint64_t bo_size, int bo_stride,
+			     uint32_t region)
 {
 	uint32_t tiling = req_tiling;
 	uint64_t size;
@@ -818,7 +819,7 @@ static void __intel_buf_init(struct buf_ops *bops,
 	if (handle)
 		buf->handle = handle;
 	else
-		buf->handle = gem_create(bops->fd, size);
+		buf->handle = gem_create_in_memory_regions(bops->fd, size, region);
 
 	set_hw_tiled(bops, buf);
 }
@@ -845,7 +846,24 @@ void intel_buf_init(struct buf_ops *bops,
 		    uint32_t tiling, uint32_t compression)
 {
 	__intel_buf_init(bops, 0, buf, width, height, bpp, alignment,
-			 tiling, compression, 0, 0);
+			 tiling, compression, 0, 0, I915_SYSTEM_MEMORY);
+
+	intel_buf_set_ownership(buf, true);
+}
+
+/**
+ * intel_buf_init_in_region
+ *
+ * Same as intel_buf_init with the additional region argument
+ */
+void intel_buf_init_in_region(struct buf_ops *bops,
+			      struct intel_buf *buf,
+			      int width, int height, int bpp, int alignment,
+			      uint32_t tiling, uint32_t compression,
+			      uint32_t region)
+{
+	__intel_buf_init(bops, 0, buf, width, height, bpp, alignment,
+			 tiling, compression, 0, 0, region);
 
 	intel_buf_set_ownership(buf, true);
 }
@@ -904,7 +922,7 @@ void intel_buf_init_using_handle(struct buf_ops *bops,
 				 uint32_t req_tiling, uint32_t compression)
 {
 	__intel_buf_init(bops, handle, buf, width, height, bpp, alignment,
-			 req_tiling, compression, 0, 0);
+			 req_tiling, compression, 0, 0, -1);
 }
 
 /**
@@ -990,7 +1008,7 @@ struct intel_buf *intel_buf_create_using_handle_and_size(struct buf_ops *bops,
 	igt_assert(buf);
 
 	__intel_buf_init(bops, handle, buf, width, height, bpp, alignment,
-			 req_tiling, compression, size, stride);
+			 req_tiling, compression, size, stride, -1);
 
 	return buf;
 }
diff --git a/lib/intel_bufops.h b/lib/intel_bufops.h
index 9e57d53e..54f2ce45 100644
--- a/lib/intel_bufops.h
+++ b/lib/intel_bufops.h
@@ -125,6 +125,11 @@ static inline void intel_buf_set_ownership(struct intel_buf *buf, bool is_owner)
 void intel_buf_init(struct buf_ops *bops, struct intel_buf *buf,
 		    int width, int height, int bpp, int alignment,
 		    uint32_t tiling, uint32_t compression);
+void intel_buf_init_in_region(struct buf_ops *bops,
+			      struct intel_buf *buf,
+			      int width, int height, int bpp, int alignment,
+			      uint32_t tiling, uint32_t compression,
+			      uint32_t region);
 void intel_buf_close(struct buf_ops *bops, struct intel_buf *buf);
 
 void intel_buf_init_using_handle(struct buf_ops *bops,
-- 
2.25.1

  reply	other threads:[~2021-09-01 15:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 15:48 [igt-dev] [PATCH i-g-t 0/2] i915/gem_render_copy: Add support for local memory apoorva1.singh
2021-09-01 15:48 ` apoorva1.singh [this message]
2021-09-13 17:39   ` [igt-dev] [PATCH i-g-t 1/2] lib/intel_bufops: Add intel_buf_init_in_region Zbigniew Kempczyński
2021-09-01 15:48 ` [igt-dev] [PATCH i-g-t 2/2] i915/gem_render_copy: Add support for local memory apoorva1.singh
2021-09-13 17:43   ` Zbigniew Kempczyński
2021-09-01 16:14 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2021-09-01 18:07 ` [igt-dev] ✓ 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=20210901154846.3323879-2-apoorva1.singh@intel.com \
    --to=apoorva1.singh@intel.com \
    --cc=arjun.melkaveri@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=thomas.hellstrom@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.