public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: "Volkin, Bradley D" <bradley.d.volkin@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: Abort command parsing for chained batches
Date: Thu, 23 Oct 2014 14:31:12 +0200	[thread overview]
Message-ID: <20141023123112.GL26941@phenom.ffwll.local> (raw)
In-Reply-To: <20141022160432.GC19810@bdvolkin-ubuntu-desktop>

On Wed, Oct 22, 2014 at 09:04:32AM -0700, Volkin, Bradley D wrote:
> [snip]
> 
> On Tue, Oct 21, 2014 at 08:50:33AM -0700, Daniel Vetter wrote:
> > On Thu, Oct 16, 2014 at 12:24:42PM -0700, bradley.d.volkin@intel.com wrote:
> > > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > > index 1a0611b..1ed5702 100644
> > > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> > > @@ -1368,17 +1368,19 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
> > >  				      batch_obj,
> > >  				      args->batch_start_offset,
> > >  				      file->is_master);
> > > -		if (ret)
> > > -			goto err;
> > > -
> > > -		/*
> > > -		 * XXX: Actually do this when enabling batch copy...
> > > -		 *
> > > -		 * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit
> > > -		 * from MI_BATCH_BUFFER_START commands issued in the
> > > -		 * dispatch_execbuffer implementations. We specifically don't
> > > -		 * want that set when the command parser is enabled.
> > > -		 */
> > > +		if (ret) {
> > > +			if (ret != -EACCES)
> > > +				goto err;
> > > +		} else {
> > > +			/*
> > > +			 * XXX: Actually do this when enabling batch copy...
> > > +			 *
> > > +			 * Set the DISPATCH_SECURE bit to remove the NON_SECURE bit
> > > +			 * from MI_BATCH_BUFFER_START commands issued in the
> > > +			 * dispatch_execbuffer implementations. We specifically don't
> > > +			 * want that set when the command parser is enabled.
> > > +			 */
> > > +		}
> > 
> > Tbh this hunk here confuses me ... Why do we need to change anything here?
> 
> Yeah, it makes more sense with the batch copy code, it's just that this
> patch has to go in before the patch where we set I915_DISPATCH_SECURE.
> The final logic basically goes like this:
> 
> ret = i915_parse_cmds()
> if ret == 0
>     dispatch shadow_batch_obj, flags = I915_DISPATCH_SECURE
> else if ret == -EACCES // i.e. i915_parse_cmds() found an MI_BB_S
>     dispatch batch_obj, flags = 0
> else
>     return error
> 
> The point is that there's a restriction that chained batches must have
> the AddressSpace bit set to the same value as the parent batch (i.e.
> GGTT when batch copy is present). But because of the way libva uses
> chained batches we can't parse or copy the chained batch to safely put
> it into GGTT. So we fall back to dispatching the userspace-supplied
> batch from PPGTT. I should probably have mentioned this restriction in
> the commit message.

Yeah I've figured that this makes more sense with the actual batch copy.
Hence the suggestion to just leave out this hunk for now - that shouldn't
have a functional impact at this stage if I'm not again blind?
> 
> As you suggest below, we could instead start to conditionally check
> batches based on the flag from userspace. However, I thought we had
> decided not to take that approach in general. Mesa already implements
> all of the code that they need the command parser for, with a runtime
> check as to whether hardware will nop their LRI, etc commands. So if
> we run the parser on all batches, then once we switch to enabling mode
> features magically work for them. Also, the I915_EXEC_SECURE flag is
> currently root-only, so there's a bit of a semantic/API/whatever change
> that we'd have to make there, or add a new flag I suppose. Maybe not a
> big deal, but I think that the choice of running the parser on all
> batches is the right direction.

Hm yeah, that's a good reason to just go ahead. If people still hate the
overhead too much we can just add more flags to execbuf ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-10-23 12:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 19:24 [PATCH] drm/i915: Abort command parsing for chained batches bradley.d.volkin
2014-10-16 19:26 ` [PATCH] drm/i915: Abort command parsing for chained shuang.he
2014-10-21 15:50 ` [PATCH] drm/i915: Abort command parsing for chained batches Daniel Vetter
2014-10-22 16:04   ` Volkin, Bradley D
2014-10-23 12:31     ` Daniel Vetter [this message]
2014-10-23 15:52       ` Volkin, Bradley D
2014-10-24 17:17         ` Volkin, Bradley D
2014-10-27  8:58           ` Daniel Vetter

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=20141023123112.GL26941@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=bradley.d.volkin@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox