On Thu, May 10, 2012 at 11:21:25PM +0100, Chris Wilson wrote: > Rather than use the magic feature tests HAS_BLT/HAS_BSD just check > whether the ring we are about to dispatch the execbuffer on is > initialised. > > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk> I like these two, but I think with the intel_ring_initialized suggestion from the for_each_ring patch they'd look even better ;-) -Daniel > --- > drivers/gpu/drm/i915/i915_gem_execbuffer.c | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > index 21fc11d..932e82b 100644 > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > @@ -1064,17 +1064,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, > ring = &dev_priv->ring[RCS]; > break; > case I915_EXEC_BSD: > - if (!HAS_BSD(dev)) { > - DRM_DEBUG("execbuf with invalid ring (BSD)\n"); > - return -EINVAL; > - } > ring = &dev_priv->ring[VCS]; > break; > case I915_EXEC_BLT: > - if (!HAS_BLT(dev)) { > - DRM_DEBUG("execbuf with invalid ring (BLT)\n"); > - return -EINVAL; > - } > ring = &dev_priv->ring[BCS]; > break; > default: > @@ -1082,6 +1074,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, > (int)(args->flags & I915_EXEC_RING_MASK)); > return -EINVAL; > } > + if (!ring->obj) { > + DRM_DEBUG("execbuf with invalid ring: %d\n", > + (int)(args->flags & I915_EXEC_RING_MASK)); > + return -EINVAL; > + } > > mode = args->flags & I915_EXEC_CONSTANTS_MASK; > mask = I915_EXEC_CONSTANTS_MASK; > -- > 1.7.10 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Mail: daniel at ffwll.ch Mobile: +41 (0)79 365 57 48