drm/i915: trivial: kill-agp collateral cleanups
Subsystems (2)
PATCH 1/2 drm/i915: trivial: kill-agp collateral cleanups
- i915_gem_init_aliasing_ppgtt should now be static
- move i915_gem_init_ppgtt declaration to the right place
I expected sparse to catch the first one, but somehow it didn't.
--- drivers/gpu/drm/i915/i915_drv.h | 3 +-- drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -2
@@ -1522,7 +1522,6 @@ int __must_check i915_gem_init(struct drm_device *dev);int __must_check i915_gem_init_hw (struct drm_device *dev);void i915_gem_l3_remap (struct drm_device *dev);void i915_gem_init_swizzling (struct drm_device *dev); -void i915_gem_init_ppgtt (struct drm_device *dev);void i915_gem_cleanup_ringbuffer (struct drm_device *dev);int __must_check i915_gpu_idle (struct drm_device *dev);int __must_check i915_gem_idle (struct drm_device *dev);
@@ -1576,7 +1575,7 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, struct drm_file *file);/* i915_gem_gtt.c */ -int __must_check i915_gem_init_aliasing_ppgtt (struct drm_device *dev); +void i915_gem_init_ppgtt (struct drm_device *dev);void i915_gem_cleanup_aliasing_ppgtt (struct drm_device *dev); void i915_ppgtt_bind_object(struct i915_hw_ppgtt *ppgtt, struct drm_i915_gem_object *obj,
drivers/gpu/drm/i915/i915_gem_gtt.c +1 -1
@@ -108,7 +108,7 @@ static void i915_ppgtt_clear_range(struct i915_hw_ppgtt *ppgtt, } } -int i915_gem_init_aliasing_ppgtt (struct drm_device *dev) +static int i915_gem_init_aliasing_ppgtt (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;struct i915_hw_ppgtt *ppgtt;
Signature · 1 line
1.8.0.2
PATCH 2/2 drm/i915: Reclaim GGTT space for failed ppgtt
When the ppgtt init fails, we may as well reuse the space that were were reserving for the ppgtt PDEs.
This also fixes an extraneous mutex_unlock.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +16 -17
@@ -525,12 +525,20 @@ static void i915_gtt_color_adjust(struct drm_mm_node *node, *end -=4096 ; } } -void 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. +* +* However, leave one page at the end still bound to the scratch page. +* There are a number of places where the hardware apparently prefetches +* past the end of the object, and we've seen multiple hangs with the +* GPU head pointer stuck in a batchbuffer bound at the last page of the +* aperture. One page should be enough to keep any prefetching inside +* of the aperture. +*/ drm_i915_private_t *dev_priv = dev->dev_private;struct drm_mm_node *entry;struct drm_i915_gem_object *obj;
@@ -593,12 +601,12 @@ void i915_gem_init_global_gtt(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;unsigned long gtt_size, mappable_size; -int ret; gtt_size = dev_priv->mm.gtt->gtt_total_entries <<PAGE_SHIFT ; mappable_size = dev_priv->mm.gtt->gtt_mappable_entries <<PAGE_SHIFT ;if (intel_enable_ppgtt (dev) &&HAS_ALIASING_PPGTT (dev)) { +int ret;/* PPGTT pdes are stolen from global gtt ptes, so shrink the * aperture accordingly when using aliasing ppgtt. */ gtt_size -=I915_PPGTT_PD_ENTRIES *PAGE_SIZE ;
@@ -606,23 +614,14 @@ void i915_gem_init_global_gtt(struct drm_device *dev)i915_gem_setup_global_gtt (dev,0 , mappable_size, gtt_size); ret =i915_gem_init_aliasing_ppgtt (dev); -if (ret) { -mutex_unlock (&dev->struct_mutex); +if (!ret)return ; - } - }else { -/* Let GEM Manage all of the aperture. -* -* However, leave one page at the end still bound to the scratch -* page. There are a number of places where the hardware -* apparently prefetches past the end of the object, and we've -* seen multiple hangs with the GPU head pointer stuck in a -* batchbuffer bound at the last page of the aperture. One page -* should be enough to keep any prefetching inside of the -* aperture. -*/ -i915_gem_setup_global_gtt (dev,0 , mappable_size, gtt_size); + +DRM_ERROR ("Aliased PPGTT setup failed %d\n" , ret); +drm_mm_takedown (&dev_priv->mm.gtt_space); + gtt_size +=I915_PPGTT_PD_ENTRIES *PAGE_SIZE ; } +i915_gem_setup_global_gtt (dev,0 , mappable_size, gtt_size); }static int setup_scratch_page (struct drm_device *dev)
Signature · 1 line
1.8.0.2
Re: [PATCH 2/2] drm/i915: Reclaim GGTT space for failed ppgtt
Quoted 4 lines · Ben Widawsky
When the ppgtt init fails, we may as well reuse the space that were were reserving for the ppgtt PDEs.
This also fixes an extraneous
mutex_unlock.
Hear, hear.
Could I ask for the int ret; to be killed off entirely?
[both] Reviewed-by: Chris Wilson <[email protected]> -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Jani Nikula
maintainerQuoted 4 lines · Ben Widawsky
-
i915_gem_init_aliasing_ppgttshould now be static
- movei915_gem_init_ppgttdeclaration to the right placeI expected sparse to catch the first one, but somehow it didn't.
FWIW, it only complains if you don't declare the function first. But you still had the declaration sitting in i915_drv.h. I'm sure we'd have plenty of cleaning up to do if we did have a tool to detect these...
BR,
Jani.
Quoted 48 lines
Signed-off-by Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 3 +-- drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_drv.h +1
-2@@ -1522,7 +1522,6 @@ int __must_check i915_gem_init(struct drm_device *dev);int __must_check i915_gem_init_hw (struct drm_device *dev);void i915_gem_l3_remap (struct drm_device *dev);void i915_gem_init_swizzling (struct drm_device *dev); -void i915_gem_init_ppgtt (struct drm_device *dev);void i915_gem_cleanup_ringbuffer (struct drm_device *dev);int __must_check i915_gpu_idle (struct drm_device *dev);int __must_check i915_gem_idle (struct drm_device *dev);@@ -1576,7 +1575,7 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, struct drm_file *file);/* i915_gem_gtt.c */ -int __must_check i915_gem_init_aliasing_ppgtt (struct drm_device *dev); +void i915_gem_init_ppgtt (struct drm_device *dev);void i915_gem_cleanup_aliasing_ppgtt (struct drm_device *dev); void i915_ppgtt_bind_object(struct i915_hw_ppgtt *ppgtt, struct drm_i915_gem_object *obj,drivers/gpu/drm/i915/i915_gem_gtt.c +1
-1@@ -108,7 +108,7 @@ static void i915_ppgtt_clear_range(struct i915_hw_ppgtt *ppgtt, } } -int i915_gem_init_aliasing_ppgtt (struct drm_device *dev) +static int i915_gem_init_aliasing_ppgtt (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;struct i915_hw_ppgtt *ppgtt;Signature · 6 lines
1.8.0.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx