Re: [PATCH] drm/i915: Clean up lrc context init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 07, 2015 at 11:05:24AM +0100, Nick Hoath wrote:
> Clean up lrc context init by:
>    - Move context initialisation in to i915_gem_init_hw
>    - Move one off initialisation for render ring to
>         i915_gem_validate_context
>    - Move default context initialisation to logical_ring_init
> 
> Rename intel_lr_context_deferred_create to
> intel_lr_context_deferred_alloc, to reflect reduced functionality.
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 923a3c4..37b440a 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -994,6 +994,7 @@ i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
>  {
>  	struct intel_context *ctx = NULL;
>  	struct i915_ctx_hang_stats *hs;
> +	int ret;
>  
>  	if (ring->id != RCS && ctx_id != DEFAULT_CONTEXT_HANDLE)
>  		return ERR_PTR(-EINVAL);
> @@ -1009,14 +1010,47 @@ i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,
>  	}
>  
>  	if (i915.enable_execlists && !ctx->engine[ring->id].state) {
> -		int ret = intel_lr_context_deferred_create(ctx, ring);
> +		ret = intel_lr_context_deferred_alloc(ctx, ring);
>  		if (ret) {
>  			DRM_DEBUG("Could not create LRC %u: %d\n", ctx_id, ret);
>  			return ERR_PTR(ret);
>  		}
> +
> +		if (ring->id == RCS && !ctx->rcs_initialized) {
> +			if (ring->init_context) {
> +				struct drm_i915_gem_request *req;
> +
> +				ret = i915_gem_request_alloc(ring,
> +					ring->default_context, &req);
> +				if (ret) {
> +					DRM_ERROR("ring create req: %d\n",
> +						  ret);
> +					i915_gem_request_cancel(req);
> +					goto validate_error;
> +				}
> +
> +				ret = ring->init_context(req);
> +				if (ret) {
> +					DRM_ERROR("ring init context: %d\n",
> +						  ret);
> +					i915_gem_request_cancel(req);
> +					goto validate_error;
> +				}
> +				i915_add_request_no_flush(req);
> +			}
> +
> +			ctx->rcs_initialized = true;
> +		}
>  	}

Nak.

"Clean up"?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux