All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/2] drm/i915: lookup for mem_region of a mem_type
@ 2019-12-02  6:54 ` Ramalingam C
  0 siblings, 0 replies; 20+ messages in thread
From: Ramalingam C @ 2019-12-02  6:54 UTC (permalink / raw)
  To: intel-gfx, Chris Wilson, Matthew Auld

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [PATCH v4 1/2] drm/i915: lookup for mem_region of a mem_type
@ 2019-11-06 16:08 Ramalingam C
  2019-11-06 16:15 ` Tang, CQ
  0 siblings, 1 reply; 20+ messages in thread
From: Ramalingam C @ 2019-11-06 16:08 UTC (permalink / raw)
  To: intel-gfx, Chris Wilson; +Cc: Matthew Auld

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

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

end of thread, other threads:[~2019-12-09 12:06 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02  6:54 [PATCH v4 1/2] drm/i915: lookup for mem_region of a mem_type Ramalingam C
2019-12-02  6:54 ` [Intel-gfx] " Ramalingam C
2019-12-02  6:54 ` [PATCH v4 2/2] drm/i915: Create dumb buffer from LMEM Ramalingam C
2019-12-02  6:54   ` [Intel-gfx] " Ramalingam C
2019-12-05 12:12   ` Matthew Auld
2019-12-05 12:20     ` Chris Wilson
2019-12-05 13:02       ` Ramalingam C
2019-12-05 13:11         ` Chris Wilson
2019-12-09 11:57           ` Ramalingam C
2019-12-09 12:03             ` Chris Wilson
2019-12-09 12:05               ` Ramalingam C
2019-12-05 12:59     ` Ramalingam C
2019-12-02  7:01 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v4,1/2] drm/i915: lookup for mem_region of a mem_type Patchwork
2019-12-02  7:01   ` [Intel-gfx] " Patchwork
2019-12-02  7:31 ` ✗ Fi.CI.BAT: failure " Patchwork
2019-12-02  7:31   ` [Intel-gfx] " Patchwork
2019-12-05 11:40 ` [Intel-gfx] [PATCH v4 1/2] " Matthew Auld
  -- strict thread matches above, loose matches on Subject: below --
2019-11-06 16:08 Ramalingam C
2019-11-06 16:15 ` Tang, CQ
2019-11-06 16:25   ` Ramalingam C

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.