Re: [PATCH v2 19/37] drm/i915: treat shmem as a region

Chris Wilson
2019-06-27T23:56:00Z

Quoting Matthew Auld (2019-06-27 21:56:15)
> int i915_gem_freeze(struct drm_i915_private *dev_priv)
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index e4f811fdaedc..958c61e88200 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2941,7 +2941,8 @@ int i915_gem_init_memory_regions(struct drm_i915_private *i915)
>
> type = MEMORY_TYPE_FROM_REGION(intel_region_map[i]);
> switch (type) {
> - default:
> + case INTEL_SMEM:
> + mem = i915_gem_shmem_setup(i915);
> break;
> }
>
> @@ -2951,11 +2952,9 @@ int i915_gem_init_memory_regions(struct drm_i915_private *i915)
> goto out_cleanup;
> }
>
> - if (mem) {
> - mem->id = intel_region_map[i];
> - mem->type = type;
> - mem->instance = MEMORY_INSTANCE_FROM_REGION(intel_region_map[i]);
> - }
> + mem->id = intel_region_map[i];
> + mem->type = type;
> + mem->instance = MEMORY_INSTANCE_FROM_REGION(intel_region_map[i]);

Go back and adjust the stub function you just introduced to avoid
self-inflicted churn.

Meanwhile I'm left with this magic that isn't even defined in this patch
to try and figure out if this is equivalent to the code you just
removed.
-Chris