[Intel-gfx] [PATCH 07/15] drm/i915: Allow i915_gem_setup_global_gtt to fail

Thierry, Michel michel.thierry at intel.com
Tue Aug 12 10:48:48 CEST 2014



> -----Original Message-----
> From: Intel-gfx [mailto:intel-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Daniel Vetter
> Sent: Wednesday, August 06, 2014 2:05 PM
> To: Intel Graphics Development
> Cc: Daniel Vetter
> Subject: [Intel-gfx] [PATCH 07/15] drm/i915: Allow
> i915_gem_setup_global_gtt to fail
> 
> We already needs this just as a safety check in case the preallocation
> reservation dance fails. But we definitely need this to be able to
> move tha aliasing ppgtt setup back out of the context code to this
> place, where it belongs.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_gem.c     |  7 ++++++-
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 16 ++++++++++------
>  drivers/gpu/drm/i915/i915_gem_gtt.h |  4 ++--
>  3 files changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c
> b/drivers/gpu/drm/i915/i915_gem.c
> index f4e57fe05c6a..d8399ee622b9 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4762,7 +4762,12 @@ int i915_gem_init(struct drm_device *dev)
>  			DRM_DEBUG_DRIVER("allow wake ack timed
> out\n");
>  	}
> 
> -	i915_gem_init_userptr(dev);
> +	ret = i915_gem_init_userptr(dev);
> +	if (ret) {
> +		mutex_unlock(&dev->struct_mutex);
> +		return ret;
> +	}
> +
>  	i915_gem_init_global_gtt(dev);
> 
>  	ret = i915_gem_context_init(dev);
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 3753bf184865..4fa7807ed4d5 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1709,10 +1709,10 @@ static void i915_gtt_color_adjust(struct
> drm_mm_node *node,
>  	}
>  }
> 
> -void i915_gem_setup_global_gtt(struct drm_device *dev,
> -			       unsigned long start,
> -			       unsigned long mappable_end,
> -			       unsigned long end)
> +int i915_gem_setup_global_gtt(struct drm_device *dev,
> +			      unsigned long start,
> +			      unsigned long mappable_end,
> +			      unsigned long end)
>  {
>  	/* Let GEM Manage all of the aperture.
>  	 *
> @@ -1745,8 +1745,10 @@ void i915_gem_setup_global_gtt(struct
> drm_device *dev,
> 
>  		WARN_ON(i915_gem_obj_ggtt_bound(obj));
>  		ret = drm_mm_reserve_node(&ggtt_vm->mm, &vma-
> >node);
> -		if (ret)
> -			DRM_DEBUG_KMS("Reservation failed\n");
> +		if (ret) {
> +			DRM_DEBUG_KMS("Reservation failed: %i\n", ret);
> +			return ret;
> +		}
>  		obj->has_global_gtt_mapping = 1;
>  	}
> 
> @@ -1763,6 +1765,8 @@ void i915_gem_setup_global_gtt(struct
> drm_device *dev,
> 
>  	/* And finally clear the reserved guard page */
>  	ggtt_vm->clear_range(ggtt_vm, end - PAGE_SIZE, PAGE_SIZE, true);
> +
> +	return 0;
>  }
> 
>  void i915_gem_init_global_gtt(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h
> b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index 0b04ef6167f8..bea3541d5525 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -271,8 +271,8 @@ struct i915_hw_ppgtt {
> 
>  int i915_gem_gtt_init(struct drm_device *dev);
>  void i915_gem_init_global_gtt(struct drm_device *dev);
> -void i915_gem_setup_global_gtt(struct drm_device *dev, unsigned long
> start,
> -			       unsigned long mappable_end, unsigned long
> end);
> +int i915_gem_setup_global_gtt(struct drm_device *dev, unsigned long
> start,
> +			      unsigned long mappable_end, unsigned long
> end);
> 
>  bool intel_enable_ppgtt(struct drm_device *dev, bool full);
> 

Reviewed-by: Michel Thierry <michel.thierry at intel.com>

> --
> 1.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6656 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20140812/bc3ba438/attachment.bin>


More information about the Intel-gfx mailing list