All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
	Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Subject: [PATCH v4 1/2] drm/i915: lookup for mem_region of a mem_type
Date: Wed,  6 Nov 2019 21:38:18 +0530	[thread overview]
Message-ID: <20191106160819.25233-1-ramalingam.c@intel.com> (raw)

Lookup function to retrieve the pointer to a memory region of
a mem_type.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
cc: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/intel_memory_region.c | 12 ++++++++++++
 drivers/gpu/drm/i915/intel_memory_region.h |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_memory_region.c b/drivers/gpu/drm/i915/intel_memory_region.c
index baaeaecc64af..ae899df7a1c2 100644
--- a/drivers/gpu/drm/i915/intel_memory_region.c
+++ b/drivers/gpu/drm/i915/intel_memory_region.c
@@ -16,6 +16,18 @@ const u32 intel_region_map[] = {
 	[INTEL_REGION_STOLEN] = REGION_MAP(INTEL_MEMORY_STOLEN, 0),
 };
 
+struct intel_memory_region *
+intel_memory_region_lookup(struct drm_i915_private *i915,
+			   enum intel_memory_type mem_type)
+{
+	enum intel_region_id id;
+
+	for (id = INTEL_REGION_SMEM; id < INTEL_REGION_UNKNOWN; id++)
+		if (i915->mm.regions[id]->type == mem_type)
+			return i915->mm.regions[id];
+	return NULL;
+}
+
 static u64
 intel_memory_region_free_pages(struct intel_memory_region *mem,
 			       struct list_head *blocks)
diff --git a/drivers/gpu/drm/i915/intel_memory_region.h b/drivers/gpu/drm/i915/intel_memory_region.h
index 238722009677..d210936c4d72 100644
--- a/drivers/gpu/drm/i915/intel_memory_region.h
+++ b/drivers/gpu/drm/i915/intel_memory_region.h
@@ -125,5 +125,8 @@ void intel_memory_region_put(struct intel_memory_region *mem);
 
 int intel_memory_regions_hw_probe(struct drm_i915_private *i915);
 void intel_memory_regions_driver_release(struct drm_i915_private *i915);
+struct intel_memory_region *
+intel_memory_region_lookup(struct drm_i915_private *i915,
+			   enum intel_memory_type mem_type);
 
 #endif
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Ramalingam C <ramalingam.c@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>,
	Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Subject: [Intel-gfx] [PATCH v4 1/2] drm/i915: lookup for mem_region of a mem_type
Date: Wed,  6 Nov 2019 21:38:18 +0530	[thread overview]
Message-ID: <20191106160819.25233-1-ramalingam.c@intel.com> (raw)
Message-ID: <20191106160818.KJHywRH2RuQ2_yhOmdsPH1EfKRdPoS90SYxu2fLFtc4@z> (raw)

Lookup function to retrieve the pointer to a memory region of
a mem_type.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
cc: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/intel_memory_region.c | 12 ++++++++++++
 drivers/gpu/drm/i915/intel_memory_region.h |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_memory_region.c b/drivers/gpu/drm/i915/intel_memory_region.c
index baaeaecc64af..ae899df7a1c2 100644
--- a/drivers/gpu/drm/i915/intel_memory_region.c
+++ b/drivers/gpu/drm/i915/intel_memory_region.c
@@ -16,6 +16,18 @@ const u32 intel_region_map[] = {
 	[INTEL_REGION_STOLEN] = REGION_MAP(INTEL_MEMORY_STOLEN, 0),
 };
 
+struct intel_memory_region *
+intel_memory_region_lookup(struct drm_i915_private *i915,
+			   enum intel_memory_type mem_type)
+{
+	enum intel_region_id id;
+
+	for (id = INTEL_REGION_SMEM; id < INTEL_REGION_UNKNOWN; id++)
+		if (i915->mm.regions[id]->type == mem_type)
+			return i915->mm.regions[id];
+	return NULL;
+}
+
 static u64
 intel_memory_region_free_pages(struct intel_memory_region *mem,
 			       struct list_head *blocks)
diff --git a/drivers/gpu/drm/i915/intel_memory_region.h b/drivers/gpu/drm/i915/intel_memory_region.h
index 238722009677..d210936c4d72 100644
--- a/drivers/gpu/drm/i915/intel_memory_region.h
+++ b/drivers/gpu/drm/i915/intel_memory_region.h
@@ -125,5 +125,8 @@ void intel_memory_region_put(struct intel_memory_region *mem);
 
 int intel_memory_regions_hw_probe(struct drm_i915_private *i915);
 void intel_memory_regions_driver_release(struct drm_i915_private *i915);
+struct intel_memory_region *
+intel_memory_region_lookup(struct drm_i915_private *i915,
+			   enum intel_memory_type mem_type);
 
 #endif
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2019-11-06 16:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 16:08 Ramalingam C [this message]
2019-11-06 16:08 ` [Intel-gfx] [PATCH v4 1/2] drm/i915: lookup for mem_region of a mem_type Ramalingam C
2019-11-06 16:08 ` [PATCH v4 2/2] drm/i915: Create dumb buffer from LMEM Ramalingam C
2019-11-06 16:08   ` [Intel-gfx] " Ramalingam C
2019-11-07  9:45   ` Chris Wilson
2019-11-07  9:45     ` [Intel-gfx] " Chris Wilson
2019-11-06 16:15 ` [PATCH v4 1/2] drm/i915: lookup for mem_region of a mem_type Tang, CQ
2019-11-06 16:15   ` [Intel-gfx] " Tang, CQ
2019-11-06 16:25   ` Ramalingam C
2019-11-06 16:25     ` [Intel-gfx] " Ramalingam C
2019-11-06 20:14 ` ✓ Fi.CI.BAT: success for series starting with [v4,1/2] " Patchwork
2019-11-06 20:14   ` [Intel-gfx] " Patchwork
2019-11-07 21:19 ` ✓ Fi.CI.IGT: " Patchwork
2019-11-07 21:19   ` [Intel-gfx] " Patchwork
2019-12-02  6:54 [PATCH v4 1/2] " Ramalingam C

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=20191106160819.25233-1-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@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.