Re: [PATCH 19/21] drm/i915/gtt: One instance of scratch page table/directory

Michel Thierry
2015-06-03T16:57:28Z

On 5/22/2015 6:05 PM, Mika Kuoppala wrote:
> As we use one scratch page for all ppgtt instances, we can
> use one scratch page table and scratch directory across
> all ppgtt instances, saving 2 pages + structs per ppgtt.
>
> v2: Rebase
>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> ---
> drivers/gpu/drm/i915/i915_gem_gtt.c | 273 +++++++++++++++++++++++-------------
> 1 file changed, 178 insertions(+), 95 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 61f4da0..ab113ce 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -430,6 +430,17 @@ fail_bitmap:
> return ERR_PTR(ret);
> }
>
> +
> +static int setup_scratch(struct i915_address_space *vm)
> +{
> + struct i915_address_space *ggtt_vm = &to_i915(vm->dev)->gtt.base;
> +
> + if (i915_is_ggtt(vm))
> + return setup_scratch_ggtt(vm);
> +
> + vm->scratch_page = ggtt_vm->scratch_page;
> + vm->scratch_pt = ggtt_vm->scratch_pt;
> + vm->scratch_pd = ggtt_vm->scratch_pd;

I'll need to change this a bit for 48b, so it doesn't happen inside
setup_scratch_ggtt (scratch_pdp wouldn't make sense in ggtt); I'll still
keep only 1 instance.

> +
> + return 0;
> +}
> +

Reviewed-by: Michel Thierry <michel.thierry@intel.com>