[Intel-gfx] [PATCH 1/2] intel: Recount fences after rewinding relocations

Daniel Vetter daniel at ffwll.ch
Wed May 8 18:11:19 CEST 2013


On Wed, May 08, 2013 at 04:33:09PM +0100, Chris Wilson wrote:
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59771
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

I guess we've walked past a "please stop and return" sign here a bit.
Originally this was just add for opportunistic state emission in mesa (and
still documents that check_aperture will return fobar). But then uxa
started to abuse it to reset batches completely in

commit 441ef916ae6569c88b3d6abaf7fea4d69be49d76
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jan 10 19:14:21 2013 +0000

    intel: Throttle harder

which required some band-aids in libdrm to have some semblances of working

commit fdda97007b1dbf95beb16a0e3510fd36c89e8c33
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Jan 11 00:55:12 2013 +0000

    intel: Remove the fence count contributions when clearing relocs

Apparently not yet good enough. Personally I vote for reverting the libdrm
patch and doing a normal wait_rendering + unref/bo realloc for the uxa
throttling.
-Daniel


> ---
>  intel/intel_bufmgr_gem.c |   13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> index 3cf8503..6ebeec9 100644
> --- a/intel/intel_bufmgr_gem.c
> +++ b/intel/intel_bufmgr_gem.c
> @@ -1746,6 +1746,7 @@ drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start)
>  	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
>  	int i;
>  	struct timespec time;
> +	int fence_count;
>  
>  	clock_gettime(CLOCK_MONOTONIC, &time);
>  
> @@ -1753,13 +1754,19 @@ drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start)
>  	/* Unreference the cleared target buffers */
>  	for (i = start; i < bo_gem->reloc_count; i++) {
>  		drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) bo_gem->reloc_target_info[i].bo;
> -		if (&target_bo_gem->bo != bo) {
> -			bo_gem->reloc_tree_fences -= target_bo_gem->reloc_tree_fences;
> +		if (&target_bo_gem->bo != bo)
>  			drm_intel_gem_bo_unreference_locked_timed(&target_bo_gem->bo,
>  								  time.tv_sec);
> -		}
>  	}
>  	bo_gem->reloc_count = start;
> +
> +	fence_count = 0;
> +	for (i = 0; i < bo_gem->reloc_count; i++) {
> +		drm_intel_bo_gem *target_bo_gem = (drm_intel_bo_gem *) bo_gem->reloc_target_info[i].bo;
> +		if (&target_bo_gem->bo != bo)
> +			fence_count += target_bo_gem->reloc_tree_fences;
> +	}
> +	bo_gem->reloc_tree_fences = fence_count;
>  }
>  
>  /**
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch



More information about the Intel-gfx mailing list