[Intel-gfx] [PATCH] drm/i915: return -ENODEV if hw context are not supported

Daniel Vetter daniel at ffwll.ch
Wed Jun 20 11:18:17 CEST 2012


On Tue, Jun 19, 2012 at 02:50:17PM -0700, Ben Widawsky wrote:
> On Tue, 19 Jun 2012 17:16:01 +0200
> daniel.vetter at ffwll.ch wrote:
> 
> > From: Daniel Vetter <daniel.vetter at ffwll.ch>
> > 
> > Otherwise userspace has no way to figure this out.
> > 
> > Signed-Off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> 
> It would probably be ideal to change the if DRIVER_GEM stuff to return
> something else, just to make things a bit clearer to people.

Well, I've figured we shouldn't ever try to call this ioctl without GEM
(because only gen6+ has hw context support, and that never worked without
KMS+GEM). I agree that the errno values are sometimes a bit arbitraray
though, but mea culpa.

> Either way it's
> Reviewed-by: Ben Widawsky <ben at bwidawsk.net>

I've picked all my context patches up, thanks a lot for your review.
-Daniel

> > ---
> >  drivers/gpu/drm/i915/i915_gem_context.c |    4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> > index fe3f21f..8f533cf 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> > @@ -480,6 +480,7 @@ int i915_switch_context(struct intel_ring_buffer *ring,
> >  int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
> >  				  struct drm_file *file)
> >  {
> > +	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	struct drm_i915_gem_context_create *args = data;
> >  	struct drm_i915_file_private *file_priv = file->driver_priv;
> >  	struct i915_hw_context *ctx;
> > @@ -488,6 +489,9 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
> >  	if (!(dev->driver->driver_features & DRIVER_GEM))
> >  		return -ENODEV;
> >  
> > +	if (dev_priv->hw_contexts_disabled)
> > +		return -ENODEV;
> > +
> >  	ret = i915_mutex_lock_interruptible(dev);
> >  	if (ret)
> >  		return ret;
> 
> 
> 
> -- 
> Ben Widawsky, Intel Open Source Technology Center

-- 
Daniel Vetter
Mail: daniel at ffwll.ch
Mobile: +41 (0)79 365 57 48



More information about the Intel-gfx mailing list