From: Daniel Vetter <daniel@ffwll.ch>
To: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, miku@iki.fi
Subject: Re: [PATCH v4] drm/i915: Add null state batch to active list
Date: Thu, 22 May 2014 14:10:59 +0200 [thread overview]
Message-ID: <20140522121059.GR14357@phenom.ffwll.local> (raw)
In-Reply-To: <1400688066-3452-1-git-send-email-mika.kuoppala@intel.com>
On Wed, May 21, 2014 at 07:01:06PM +0300, Mika Kuoppala wrote:
> From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
>
> for proper refcounting to take place as we use
> i915_add_request() for it.
>
> i915_add_request() also takes the context for the request
> from ring->last_context so move the null state batch
> submission after the ring context has been set.
>
> v2: we need to check for correct ring now (Ville Syrjälä)
> v3: no need to expose i915_gem_move_object_to_active (Chris Wilson)
> v4: cargoculted vma/active/inactive error handling removed (Chris Wilson)
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Damien Lespiau <damien.lespiau@intel.com>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Ok, merged instead of v3 with Chris' irc r-b.
Thanks, Daniel
> ---
> drivers/gpu/drm/i915/i915_gem_context.c | 16 ++++++++--------
> drivers/gpu/drm/i915/i915_gem_render_state.c | 8 ++++++--
> 2 files changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index f220c94..6a2d847a 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -700,21 +700,21 @@ static int do_switch(struct intel_ring_buffer *ring,
> /* obj is kept alive until the next request by its active ref */
> i915_gem_object_ggtt_unpin(from->obj);
> i915_gem_context_unreference(from);
> - } else {
> - if (to->is_initialized == false) {
> - ret = i915_gem_render_state_init(ring);
> - if (ret)
> - DRM_ERROR("init render state: %d\n", ret);
> - }
> }
>
> - to->is_initialized = true;
> -
> done:
> i915_gem_context_reference(to);
> ring->last_context = to;
> to->last_ring = ring;
>
> + if (ring->id == RCS && !to->is_initialized && from == NULL) {
> + ret = i915_gem_render_state_init(ring);
> + if (ret)
> + DRM_ERROR("init render state: %d\n", ret);
> + }
> +
> + to->is_initialized = true;
> +
> return 0;
>
> unpin_out:
> diff --git a/drivers/gpu/drm/i915/i915_gem_render_state.c b/drivers/gpu/drm/i915/i915_gem_render_state.c
> index 392aa7b..cfbf6fc 100644
> --- a/drivers/gpu/drm/i915/i915_gem_render_state.c
> +++ b/drivers/gpu/drm/i915/i915_gem_render_state.c
> @@ -164,9 +164,11 @@ int i915_gem_render_state_init(struct intel_ring_buffer *ring)
> const int gen = INTEL_INFO(ring->dev)->gen;
> struct i915_render_state *so;
> const struct intel_renderstate_rodata *rodata;
> - u32 seqno;
> int ret;
>
> + if (WARN_ON(ring->id != RCS))
> + return -ENOENT;
> +
> rodata = render_state_get_rodata(ring->dev, gen);
> if (rodata == NULL)
> return 0;
> @@ -186,8 +188,10 @@ int i915_gem_render_state_init(struct intel_ring_buffer *ring)
> if (ret)
> goto out;
>
> - ret = i915_add_request(ring, &seqno);
> + i915_vma_move_to_active(i915_gem_obj_to_ggtt(so->obj), ring);
>
> + ret = __i915_add_request(ring, NULL, so->obj, NULL);
> + /* __i915_add_request moves object to inactive if it fails */
> out:
> render_state_free(so);
> return ret;
> --
> 1.7.9.5
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2014-05-22 12:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-21 12:08 [PATCH] drm/i915: Add null state batch to active list Mika Kuoppala
2014-05-21 12:22 ` Ville Syrjälä
2014-05-21 12:59 ` [PATCH v2] " Mika Kuoppala
2014-05-21 13:06 ` [PATCH] " Chris Wilson
2014-05-21 14:02 ` [PATCH v3] " Mika Kuoppala
2014-05-21 14:54 ` Daniel Vetter
2014-05-21 15:00 ` Chris Wilson
2014-05-21 15:17 ` Daniel Vetter
2014-05-21 16:01 ` [PATCH v4] " Mika Kuoppala
2014-05-22 12:10 ` Daniel Vetter [this message]
2014-05-21 15:29 ` [PATCH v3] " Volkin, Bradley D
2014-05-22 13:34 ` Mika Kuoppala
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=20140522121059.GR14357@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kuoppala@linux.intel.com \
--cc=miku@iki.fi \
/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