[Intel-gfx] [PATCH 05/53] drm/i915: Move i915_gem_validate_context() to i915_gem_context.c

Chris Wilson chris at chris-wilson.co.uk
Fri Jun 13 19:11:22 CEST 2014


On Fri, Jun 13, 2014 at 04:37:23PM +0100, oscar.mateo at intel.com wrote:
> From: Oscar Mateo <oscar.mateo at intel.com>
> 
> ... and namespace appropriately.
> 
> It looks to me like it belongs logically there.
> 
> Signed-off-by: Oscar Mateo <oscar.mateo at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h            |  3 +++
>  drivers/gpu/drm/i915/i915_gem_context.c    | 23 +++++++++++++++++++++++
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 25 +------------------------
>  3 files changed, 27 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index ec7e352..a15370c 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2409,6 +2409,9 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
>  				  struct drm_file *file);
>  int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
>  				   struct drm_file *file);
> +struct intel_context *
> +i915_gem_context_validate(struct drm_device *dev, struct drm_file *file,
> +			  struct intel_engine_cs *ring, const u32 ctx_id);
>  
>  /* i915_gem_render_state.c */
>  int i915_gem_render_state_init(struct intel_engine_cs *ring);
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index f6c2538..801b891 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -824,3 +824,26 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
>  	DRM_DEBUG_DRIVER("HW context %d destroyed\n", args->ctx_id);
>  	return 0;
>  }
> +
> +struct intel_context *
> +i915_gem_context_validate(struct drm_device *dev, struct drm_file *file,
> +			  struct intel_engine_cs *ring, const u32 ctx_id)
> +{
> +	struct intel_context *ctx = NULL;
> +	struct i915_ctx_hang_stats *hs;
> +
> +	if (ring->id != RCS && ctx_id != DEFAULT_CONTEXT_ID)
> +		return ERR_PTR(-EINVAL);
> +
> +	ctx = i915_gem_context_get(file->driver_priv, ctx_id);
> +	if (IS_ERR(ctx))
> +		return ctx;
> +
> +	hs = &ctx->hang_stats;
> +	if (hs->banned) {
> +		DRM_DEBUG("Context %u tried to submit while banned\n", ctx_id);
> +		return ERR_PTR(-EIO);

Ugh. No.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list