[Intel-gfx] [PATCH 02/26] drm/i915: Extract switch to default context

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 18 09:38:40 CET 2014


On Mon, Mar 17, 2014 at 10:48:34PM -0700, Ben Widawsky wrote:
> This patch existed for another reason which no longer exists. I liked
> it, so I kept it in the series. It can skipped if undesirable.
> 
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
>  drivers/gpu/drm/i915/i915_drv.h | 2 ++
>  drivers/gpu/drm/i915/i915_gem.c | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 35f9a37..c59b707 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2476,6 +2476,8 @@ int i915_gem_context_enable(struct drm_i915_private *dev_priv);
>  void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
>  int i915_switch_context(struct intel_ring_buffer *ring,
>  			struct drm_file *file, struct i915_hw_context *to);
> +#define i915_switch_to_default(ring) \
> +	i915_switch_context(ring, NULL, ring->default_context)
>  struct i915_hw_context *
>  i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id);
>  void i915_gem_context_free(struct kref *ctx_ref);
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index b2565d2..ed09dda 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2799,7 +2799,7 @@ int i915_gpu_idle(struct drm_device *dev)
>  
>  	/* Flush everything onto the inactive list. */
>  	for_each_ring(ring, dev_priv, i) {
> -		ret = i915_switch_context(ring, NULL, ring->default_context);
> +		ret = i915_switch_to_default(ring);

Switch what to default? What it does is not very clear, sorry.
Skip unless we change it to i915_switch_to_default_context()?
intel_ring_switch_to_default_context()? Doesn't seem like much of a win
by that point. :|
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list