From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 22/37] drm/i915: Move common scratch allocation/destroy to intel_engine_cs.c
Date: Fri, 12 Aug 2016 11:40:37 +0300 [thread overview]
Message-ID: <1470991237.3709.18.camel@linux.intel.com> (raw)
In-Reply-To: <1470984867-7132-22-git-send-email-chris@chris-wilson.co.uk>
On pe, 2016-08-12 at 07:54 +0100, Chris Wilson wrote:
> Since the scratch allocation and cleanup is shared by all engine
> submission backends, move it out of the legacy intel_ringbuffer.c and
> into the new home for common routines, intel_engine_cs.c
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Hmm, did not get my e-mail?
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_engine_cs.c | 50 +++++++++++++++++++++++++++++++++
> drivers/gpu/drm/i915/intel_lrc.c | 1 -
> drivers/gpu/drm/i915/intel_ringbuffer.c | 50 ---------------------------------
> drivers/gpu/drm/i915/intel_ringbuffer.h | 4 +--
> 4 files changed, 51 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 186c12d07f99..7104dec5e893 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -195,6 +195,54 @@ void intel_engine_setup_common(struct intel_engine_cs *engine)
> i915_gem_batch_pool_init(engine, &engine->batch_pool);
> }
>
> +int intel_engine_create_scratch(struct intel_engine_cs *engine, int size)
> +{
> + struct drm_i915_gem_object *obj;
> + struct i915_vma *vma;
> + int ret;
> +
> + WARN_ON(engine->scratch);
> +
> + obj = i915_gem_object_create_stolen(&engine->i915->drm, size);
> + if (!obj)
> + obj = i915_gem_object_create(&engine->i915->drm, size);
> + if (IS_ERR(obj)) {
> + DRM_ERROR("Failed to allocate scratch page\n");
> + return PTR_ERR(obj);
> + }
> +
> + vma = i915_vma_create(obj, &engine->i915->ggtt.base, NULL);
> + if (IS_ERR(vma)) {
> + ret = PTR_ERR(vma);
> + goto err_unref;
> + }
> +
> + ret = i915_vma_pin(vma, 0, 4096, PIN_GLOBAL | PIN_HIGH);
> + if (ret)
> + goto err_unref;
> +
> + engine->scratch = vma;
> + DRM_DEBUG_DRIVER("%s pipe control offset: 0x%08llx\n",
> + engine->name, vma->node.start);
> + return 0;
> +
> +err_unref:
> + i915_gem_object_put(obj);
> + return ret;
> +}
> +
> +static void intel_engine_cleanup_scratch(struct intel_engine_cs *engine)
> +{
> + struct i915_vma *vma;
> +
> + vma = fetch_and_zero(&engine->scratch);
> + if (!vma)
> + return;
> +
> + i915_vma_unpin(vma);
> + i915_vma_put(vma);
> +}
> +
> /**
> * intel_engines_init_common - initialize cengine state which might require hw access
> * @engine: Engine to initialize.
> @@ -226,6 +274,8 @@ int intel_engine_init_common(struct intel_engine_cs *engine)
> */
> void intel_engine_cleanup_common(struct intel_engine_cs *engine)
> {
> + intel_engine_cleanup_scratch(engine);
> +
> intel_engine_cleanup_cmd_parser(engine);
> intel_engine_fini_breadcrumbs(engine);
> i915_gem_batch_pool_fini(&engine->batch_pool);
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index cdcdec83d640..88bc5d4ce243 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -1844,7 +1844,6 @@ int logical_render_ring_init(struct intel_engine_cs *engine)
> else
> engine->init_hw = gen8_init_render_ring;
> engine->init_context = gen8_init_rcs_context;
> - engine->cleanup = intel_engine_cleanup_scratch;
> engine->emit_flush = gen8_emit_flush_render;
> engine->emit_request = gen8_emit_request_render;
>
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 939632229320..0ecdd452a7f7 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -613,54 +613,6 @@ out:
> return ret;
> }
>
> -void intel_engine_cleanup_scratch(struct intel_engine_cs *engine)
> -{
> - struct i915_vma *vma;
> -
> - vma = fetch_and_zero(&engine->scratch);
> - if (!vma)
> - return;
> -
> - i915_vma_unpin(vma);
> - i915_vma_put(vma);
> -}
> -
> -int intel_engine_create_scratch(struct intel_engine_cs *engine, int size)
> -{
> - struct drm_i915_gem_object *obj;
> - struct i915_vma *vma;
> - int ret;
> -
> - WARN_ON(engine->scratch);
> -
> - obj = i915_gem_object_create_stolen(&engine->i915->drm, size);
> - if (!obj)
> - obj = i915_gem_object_create(&engine->i915->drm, size);
> - if (IS_ERR(obj)) {
> - DRM_ERROR("Failed to allocate scratch page\n");
> - return PTR_ERR(obj);
> - }
> -
> - vma = i915_vma_create(obj, &engine->i915->ggtt.base, NULL);
> - if (IS_ERR(vma)) {
> - ret = PTR_ERR(vma);
> - goto err_unref;
> - }
> -
> - ret = i915_vma_pin(vma, 0, 4096, PIN_GLOBAL | PIN_HIGH);
> - if (ret)
> - goto err_unref;
> -
> - engine->scratch = vma;
> - DRM_DEBUG_DRIVER("%s pipe control offset: 0x%08llx\n",
> - engine->name, vma->node.start);
> - return 0;
> -
> -err_unref:
> - i915_gem_object_put(obj);
> - return ret;
> -}
> -
> static int intel_ring_workarounds_emit(struct drm_i915_gem_request *req)
> {
> struct intel_ring *ring = req->ring;
> @@ -1311,8 +1263,6 @@ static void render_ring_cleanup(struct intel_engine_cs *engine)
> i915_gem_object_put(dev_priv->semaphore_obj);
> dev_priv->semaphore_obj = NULL;
> }
> -
> - intel_engine_cleanup_scratch(engine);
> }
>
> static int gen8_rcs_signal(struct drm_i915_gem_request *req)
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index c6024db75f93..dca84258be16 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -472,11 +472,9 @@ void intel_ring_update_space(struct intel_ring *ring);
>
> void intel_engine_init_seqno(struct intel_engine_cs *engine, u32 seqno);
>
> -int intel_engine_create_scratch(struct intel_engine_cs *engine, int size);
> -void intel_engine_cleanup_scratch(struct intel_engine_cs *engine);
> -
> void intel_engine_setup_common(struct intel_engine_cs *engine);
> int intel_engine_init_common(struct intel_engine_cs *engine);
> +int intel_engine_create_scratch(struct intel_engine_cs *engine, int size);
> void intel_engine_cleanup_common(struct intel_engine_cs *engine);
>
> static inline int intel_engine_idle(struct intel_engine_cs *engine,
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-08-12 8:40 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 6:53 [PATCH 01/37] drm/i915: Record the position of the start of the request Chris Wilson
2016-08-12 6:53 ` [PATCH 02/37] drm/i915: Reduce amount of duplicate buffer information captured on error Chris Wilson
2016-08-12 6:53 ` [PATCH 03/37] drm/i915: Stop the machine whilst capturing the GPU crash dump Chris Wilson
2016-08-12 6:53 ` [PATCH 04/37] drm/i915: Store the active context object on all engines upon error Chris Wilson
2016-08-12 6:53 ` [PATCH 05/37] drm/i915: Remove inactive/active list from debugfs Chris Wilson
2016-08-12 6:53 ` [PATCH 06/37] drm/i915: Focus debugfs/i915_gem_pinned to show only display pins Chris Wilson
2016-08-12 6:53 ` [PATCH 07/37] drm/i915: Reduce i915_gem_objects to only show object information Chris Wilson
2016-08-12 7:21 ` Joonas Lahtinen
2016-08-12 6:53 ` [PATCH 08/37] drm/i915: Record the device capabilities at the time of a hang Chris Wilson
2016-08-12 7:42 ` Joonas Lahtinen
2016-08-12 6:53 ` [PATCH 09/37] drm/i915: Remove redundant WARN_ON from __i915_add_request() Chris Wilson
2016-08-12 6:54 ` [PATCH 10/37] drm/i915: Always set the vma->pages Chris Wilson
2016-08-12 7:48 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 11/37] drm/i915: Create a VMA for an object Chris Wilson
2016-08-12 6:54 ` [PATCH 12/37] drm/i915: Add fetch_and_zero() macro Chris Wilson
2016-08-12 7:55 ` Joonas Lahtinen
2016-08-12 8:05 ` Chris Wilson
2016-08-12 6:54 ` [PATCH 13/37] drm/i915: Add convenience wrappers for vma's object get/put Chris Wilson
2016-08-12 8:03 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 14/37] drm/i915: Track pinned vma inside guc Chris Wilson
2016-08-12 9:42 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 15/37] drm/i915: Convert fence computations to use vma directly Chris Wilson
2016-08-12 6:54 ` [PATCH 16/37] drm/i915: Use VMA directly for checking tiling parameters Chris Wilson
2016-08-12 8:16 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 17/37] drm/i915: Use VMA as the primary object for context state Chris Wilson
2016-08-12 6:54 ` [PATCH 18/37] drm/i915: Only clflush the context object when binding Chris Wilson
2016-08-12 8:19 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 19/37] drm/i915: Move assertion for iomap access to i915_vma_pin_iomap Chris Wilson
2016-08-12 8:21 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 20/37] drm/i915: Use VMA for ringbuffer tracking Chris Wilson
2016-08-12 8:34 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 21/37] drm/i915: Use VMA for scratch page tracking Chris Wilson
2016-08-12 6:54 ` [PATCH 22/37] drm/i915: Move common scratch allocation/destroy to intel_engine_cs.c Chris Wilson
2016-08-12 8:40 ` Joonas Lahtinen [this message]
2016-08-12 6:54 ` [PATCH 23/37] drm/i915: Move common seqno reset " Chris Wilson
2016-08-12 8:42 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 24/37] drm/i915/overlay: Use VMA as the primary tracker for images Chris Wilson
2016-08-12 6:54 ` [PATCH 25/37] drm/i915: Use VMA as the primary tracker for semaphore page Chris Wilson
2016-08-12 6:54 ` [PATCH 26/37] drm/i915: Use VMA for render state page tracking Chris Wilson
2016-08-12 6:54 ` [PATCH 27/37] drm/i915: Use VMA for wa_ctx tracking Chris Wilson
2016-08-12 6:54 ` [PATCH 28/37] drm/i915: Consolidate i915_vma_unpin_and_release() Chris Wilson
2016-08-12 8:45 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 29/37] drm/i915: Track pinned VMA Chris Wilson
2016-08-12 8:53 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 30/37] drm/i915: Introduce i915_ggtt_offset() Chris Wilson
2016-08-12 9:01 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 31/37] drm/i915: Print the batchbuffer offset next to BBADDR in error state Chris Wilson
2016-08-12 6:54 ` [PATCH 32/37] drm/i915: Move debug only per-request pid tracking from request to ctx Chris Wilson
2016-08-12 9:03 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 33/37] drm/i915: Only record active and pending requests upon a GPU hang Chris Wilson
2016-08-12 12:39 ` Matthew Auld
2016-08-12 12:49 ` Chris Wilson
2016-08-12 6:54 ` [PATCH 34/37] drm/i915: Record the RING_MODE register for post-mortem debugging Chris Wilson
2016-08-12 9:07 ` Joonas Lahtinen
2016-08-12 6:54 ` [PATCH 35/37] drm/i915: Always use the GTT for error capture Chris Wilson
2016-08-12 6:54 ` [PATCH 36/37] drm/i915: Consolidate error object printing Chris Wilson
2016-08-12 6:54 ` [PATCH 37/37] drm/i915: Compress GPU objects in error state Chris Wilson
2016-08-12 7:27 ` ✗ Ro.CI.BAT: failure for series starting with [01/37] drm/i915: Record the position of the start of the request Patchwork
2016-08-12 9:45 ` [PATCH 01/37] " Joonas Lahtinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1470991237.3709.18.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox