From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/i915: Use intel_engine_stop_cs when stopping ringbuffer
Date: Wed, 27 Feb 2019 19:03:38 +0200 [thread overview]
Message-ID: <87pnrdupsl.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20190227165850.17277-1-mika.kuoppala@linux.intel.com>
Mika Kuoppala <mika.kuoppala@linux.intel.com> writes:
> We have an exported function for stopping the engine before
> disabling a ringbuffer. Take it into use.
>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_engine_cs.c | 3 +++
> drivers/gpu/drm/i915/intel_ringbuffer.c | 31 +++++++++++--------------
> 2 files changed, 16 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 4f244019560d..3feb0f74c239 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -817,6 +817,9 @@ void intel_engine_cancel_stop_cs(struct intel_engine_cs *engine)
> {
> struct drm_i915_private *dev_priv = engine->i915;
>
> + if (INTEL_GEN(dev_priv) < 3)
> + return;
> +
> GEM_TRACE("%s\n", engine->name);
>
> I915_WRITE_FW(RING_MI_MODE(engine->mmio_base),
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 1b96b0960adc..5363dad1208d 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -607,23 +607,19 @@ static void ring_setup_status_page(struct intel_engine_cs *engine)
> static bool stop_ring(struct intel_engine_cs *engine)
> {
> struct drm_i915_private *dev_priv = engine->i915;
> + int ret;
>
> - if (INTEL_GEN(dev_priv) > 2) {
> - I915_WRITE_MODE(engine, _MASKED_BIT_ENABLE(STOP_RING));
> - if (intel_wait_for_register(dev_priv,
> - RING_MI_MODE(engine->mmio_base),
> - MODE_IDLE,
> - MODE_IDLE,
> - 1000)) {
> - DRM_ERROR("%s : timed out trying to stop ring\n",
> - engine->name);
> - /* Sometimes we observe that the idle flag is not
> - * set even though the ring is empty. So double
> - * check before giving up.
> - */
> - if (I915_READ_HEAD(engine) != I915_READ_TAIL(engine))
> - return false;
> - }
> + ret = intel_engine_stop_cs(engine);
> + if (ret == -ENODEV)
> + ret = 0;
> +
> + if (ret) {
> + /* Sometimes we observe that the idle flag is not
> + * set even though the ring is empty. So double
> + * check before giving up.
> + */
> + if (I915_READ_HEAD(engine) != I915_READ_TAIL(engine))
Hmm these could have been also converted to the _FW variants.
-Mika
> + return false;
> }
>
> I915_WRITE_HEAD(engine, I915_READ_TAIL(engine));
> @@ -718,8 +714,7 @@ static int init_ring_common(struct intel_engine_cs *engine)
> goto out;
> }
>
> - if (INTEL_GEN(dev_priv) > 2)
> - I915_WRITE_MODE(engine, _MASKED_BIT_DISABLE(STOP_RING));
> + intel_engine_cancel_stop_cs(engine);
>
> /* Now awake, let it get started */
> if (ring->tail != ring->head) {
> --
> 2.17.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-02-27 17:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-27 16:58 [PATCH 1/3] drm/i915: Use intel_engine_stop_cs when stopping ringbuffer Mika Kuoppala
2019-02-27 16:58 ` [PATCH 2/3] drm/i915: Introduce intel_engine_stop_ringbuffer Mika Kuoppala
2019-02-27 17:12 ` Chris Wilson
2019-02-27 16:58 ` [PATCH 3/3] drm/i915: Disable PSMI idle messaging when stopping ring Mika Kuoppala
2019-02-27 17:14 ` Chris Wilson
2019-02-27 17:03 ` Mika Kuoppala [this message]
2019-02-27 17:15 ` [PATCH 1/3] drm/i915: Use intel_engine_stop_cs when stopping ringbuffer Chris Wilson
2019-02-27 17:08 ` Chris Wilson
2019-02-27 17:41 ` ✗ Fi.CI.BAT: failure for series starting with [1/3] " Patchwork
2019-02-27 17:47 ` Chris Wilson
-- strict thread matches above, loose matches on Subject: below --
2019-02-28 16:01 [PATCH 1/3] " Mika Kuoppala
2019-02-28 16:10 ` Mika Kuoppala
2019-02-28 16:14 ` Mika Kuoppala
2019-02-28 16:34 ` Chris Wilson
2019-02-28 16:53 ` Mika Kuoppala
2019-02-28 17:00 ` Chris Wilson
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=87pnrdupsl.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.