summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/intel_memory_region.h
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2019-10-18 12:07:50 +0300
committerChris Wilson <chris@chris-wilson.co.uk>2019-10-18 14:41:03 +0300
commitda1184cd41d4c6b316a937ac1da5825807e8f6fb (patch)
tree0f77bf41ed8dda6ff4e48a92c9c158d6e5302c5f /drivers/gpu/drm/i915/intel_memory_region.h
parent3aae9d08532c8e542ad2787b3f1c6b4ee14db32b (diff)
downloadlinux-da1184cd41d4c6b316a937ac1da5825807e8f6fb.tar.xz
drm/i915: treat shmem as a region
Convert shmem to an intel_memory_region. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20191018090751.28295-2-matthew.auld@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/intel_memory_region.h')
-rw-r--r--drivers/gpu/drm/i915/intel_memory_region.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_memory_region.h b/drivers/gpu/drm/i915/intel_memory_region.h
index 2c165a7a5ab4..49b059a2be70 100644
--- a/drivers/gpu/drm/i915/intel_memory_region.h
+++ b/drivers/gpu/drm/i915/intel_memory_region.h
@@ -18,13 +18,39 @@ struct drm_i915_gem_object;
struct intel_memory_region;
struct sg_table;
+/**
+ * Base memory type
+ */
+enum intel_memory_type {
+ INTEL_MEMORY_SYSTEM = 0,
+ INTEL_MEMORY_LOCAL,
+ INTEL_MEMORY_STOLEN,
+};
+
enum intel_region_id {
- INTEL_REGION_UNKNOWN = 0, /* Should be last */
+ INTEL_REGION_SMEM = 0,
+ INTEL_REGION_LMEM,
+ INTEL_REGION_STOLEN,
+ INTEL_REGION_UNKNOWN, /* Should be last */
};
+#define REGION_SMEM BIT(INTEL_REGION_SMEM)
+#define REGION_LMEM BIT(INTEL_REGION_LMEM)
+#define REGION_STOLEN BIT(INTEL_REGION_STOLEN)
+
+#define INTEL_MEMORY_TYPE_SHIFT 16
+
+#define MEMORY_TYPE_FROM_REGION(r) (ilog2((r) >> INTEL_MEMORY_TYPE_SHIFT))
+#define MEMORY_INSTANCE_FROM_REGION(r) (ilog2((r) & 0xffff))
+
#define I915_ALLOC_MIN_PAGE_SIZE BIT(0)
#define I915_ALLOC_CONTIGUOUS BIT(1)
+/**
+ * Memory regions encoded as type | instance
+ */
+extern const u32 intel_region_map[];
+
struct intel_memory_region_ops {
unsigned int flags;