[Intel-gfx] [PATCH v2 2/3] drm/i915: treat shmem as a region
Chris Wilson
chris at chris-wilson.co.uk
Fri Oct 18 09:55:25 UTC 2019
Quoting Matthew Auld (2019-10-18 10:07:50)
> Convert shmem to an intel_memory_region.
>
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Abdiel Janulgue <abdiel.janulgue at linux.intel.com>
> ---
> 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)
I would have voted for each type and region being added as they are
introduced. Hmm, indeed, I would still do so as mentioning LMEM at this
point is still premature.
> +
> +#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))
Move the empty enum intel_memory_type {} and the defines into the first
patch as part of the infrastructure.
If we can introduce the new enums as we introduce the new regions that
bodes well for the future when our plans inevitably have to change.
Preferably with that split,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris
More information about the Intel-gfx
mailing list