[Intel-gfx] [PATCH 3/3] drm/i915: s/seqno/request/ tracking inside objects
Chris Wilson
chris at chris-wilson.co.uk
Mon Aug 25 08:11:16 CEST 2014
On Sun, Aug 24, 2014 at 04:54:22PM +0100, Chris Wilson wrote:
> +static int execlists_add_request(struct i915_gem_request *rq)
> +{
> + unsigned long flags;
> +
> + if (intel_engine_stopped(rq->engine))
> + return -EIO;
> +
> + spin_lock_irqsave(&rq->engine->execlist_lock, flags);
> +
> + list_add_tail(&rq->engine_list, &rq->engine->pending);
> + if (rq->engine->execlists_submitted < 2)
> + execlists_submit(rq->engine);
> +
> + spin_unlock_irqrestore(&rq->engine->execlist_lock, flags);
> +
> + return 0;
> +}
> +
> +static int execlists_suspend(struct intel_engine_cs *engine)
> +{
> + struct drm_i915_private *dev_priv = engine->i915;
> + unsigned long flags;
> +
> + /* disable submitting more requests until resume */
> + spin_lock_irqsave(&engine->execlist_lock, flags);
> + engine->execlists_submitted = ~0;
> + spin_unlock_irqrestore(&engine->execlist_lock, flags);
> +
> + I915_WRITE(RING_MODE_GEN7(engine),
> + _MASKED_BIT_ENABLE(GFX_REPLAY_MODE) |
> + _MASKED_BIT_DISABLE(GFX_RUN_LIST_ENABLE));
> + POSTING_READ(RING_MODE_GEN7(engine));
> + DRM_DEBUG_DRIVER("Execlists disabled for %s\n", engine->name);
> +
> + return 0;
> +}
> +
> +static int execlists_resume(struct intel_engine_cs *engine)
> +{
> + struct drm_i915_private *dev_priv = engine->i915;
> + unsigned long flags;
> +
> + /* XXX */
> + I915_WRITE_IMR(engine, ~(engine->irq_enable_mask | engine->irq_keep_mask));
> + I915_WRITE(RING_HWSTAM(engine->mmio_base), 0xffffffff);
> +
> + I915_WRITE(RING_MODE_GEN7(engine),
> + _MASKED_BIT_DISABLE(GFX_REPLAY_MODE) |
> + _MASKED_BIT_ENABLE(GFX_RUN_LIST_ENABLE));
> + POSTING_READ(RING_MODE_GEN7(engine));
> + DRM_DEBUG_DRIVER("Execlists enabled for %s\n", engine->name);
> +
> + spin_lock_irqsave(&engine->execlist_lock, flags);
> + engine->execlists_submitted = 0;
> + execlists_submit(engine);
> + spin_unlock_irqrestore(&engine->execlist_lock, flags);
> +
> + return 0;
> +}
> +
> +static int execlists_reset(struct intel_engine_cs *engine)
> +{
> + unsigned long flags;
> +
> + spin_lock_irqsave(&engine->execlist_lock, flags);
> + while (!list_empty(&engine->pending))
> + list_move_tail(engine->pending.next, &engine->requests);
> + spin_unlock_irqrestore(&engine->execlist_lock, flags);
> +
> + return 0;
> +}
> +
> +int intel_engine_enable_execlist(struct intel_engine_cs *engine)
> +{
> + if (!i915.enable_execlists)
> + return 0;
> +
> + engine->get_ring = execlists_get_ring;
> + engine->put_ring = execlists_put_ring;
> + engine->add_request = execlists_add_request;
> +
> + engine->suspend = execlists_suspend;
> + engine->resume = execlists_resume;
> + engine->reset = execlists_reset;
This is missing
engine->execlists_submitted = ~O;
to suspend add_request until the engine is enabled.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list