[Intel-gfx] [PATCH v7] drm/i915: Support to enable TRTT on GEN9

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 18 09:35:25 UTC 2016


On Fri, Mar 18, 2016 at 02:05:26PM +0530, akash.goel at intel.com wrote:
> @@ -974,6 +1108,13 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
>  		return PTR_ERR(ctx);
>  	}
>  
> +	/*
> +	 * Take a reference also, as in certain cases we have to release &
> +	 * reacquire the struct_mutex and we don't want the context to
> +	 * go away.
> +	 */
> +	i915_gem_context_reference(ctx);
> +
>  	switch (args->param) {
>  	case I915_CONTEXT_PARAM_BAN_PERIOD:
>  		if (args->size)
> @@ -992,10 +1133,14 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
>  			ctx->flags |= args->value ? CONTEXT_NO_ZEROMAP : 0;
>  		}
>  		break;
> +	case I915_CONTEXT_PARAM_TRTT:
> +		ret = intel_context_set_trtt(ctx, args);
> +		break;
>  	default:
>  		ret = -EINVAL;
>  		break;
>  	}
> +	i915_gem_context_unreference(ctx);
>  	mutex_unlock(&dev->struct_mutex);

Having applied the safety net with the nice comment to setparam, we
should do the same for getparam for consistency. It just makes it easier
for us to keep extending the ioctls in future.

With that,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list