[Intel-gfx] [PATCH 6/6] drm/i915/execlists: Don't allocate scratch
Chris Wilson
chris at chris-wilson.co.uk
Thu Sep 26 10:34:00 UTC 2019
Quoting Michał Winiarski (2019-09-26 11:06:35)
> We're no longer using it on execlists platforms. There's no point in
> allocating it.
>
> Signed-off-by: Michał Winiarski <michal.winiarski at intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 --
> drivers/gpu/drm/i915/gt/intel_gt.c | 6 ++++++
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> index f451d5076bde..a4e5aceff678 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> @@ -669,8 +669,6 @@ static int measure_breadcrumb_dw(struct intel_engine_cs *engine)
> struct measure_breadcrumb *frame;
> int dw = -ENOMEM;
>
> - GEM_BUG_ON(!engine->gt->scratch);
> -
> frame = kzalloc(sizeof(*frame), GFP_KERNEL);
> if (!frame)
> return -ENOMEM;
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index eef9bdae8ebb..e135a66b7242 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -329,6 +329,9 @@ static int intel_gt_init_scratch(struct intel_gt *gt, unsigned int size)
> struct i915_vma *vma;
> int ret;
>
> + if (HAS_EXECLISTS(i915))
> + return 0;
Push the decision to the backends then, and
if (gt->scratch)
return;
> +
> obj = i915_gem_object_create_stolen(i915, size);
> if (!obj)
> obj = i915_gem_object_create_internal(i915, size);
> @@ -358,6 +361,9 @@ static int intel_gt_init_scratch(struct intel_gt *gt, unsigned int size)
>
> static void intel_gt_fini_scratch(struct intel_gt *gt)
> {
> + if (HAS_EXECLISTS(gt->i915))
> + return;
Not required, as release NULL is a no-op. After pushing the init to the
backends, we keep the central free at the end, agnostic to whether or not
we needed the scratch.
> +
> i915_vma_unpin_and_release(>->scratch, 0);
> }
>
> --
> 2.21.0
>
More information about the Intel-gfx
mailing list