[Intel-gfx] [PATCH] don't install fence regs if execbuffer can

Jesse Barnes jbarnes at virtuousgeek.org
Wed Mar 18 21:16:07 CET 2009


On Tue, 17 Mar 2009 09:47:09 -0700
Jesse Barnes <jbarnes at virtuousgeek.org> wrote:

> If execbuffer is setting up fences, it also means that the kernel is
> managing them at pin time, so installing one in the 2D driver in that
> case is an error. The fence should stick around as long as the buffer
> is pinned (the kernel won't steal these), though it will be freed at
> leavevt and re-allocated at entervt.
> 
> Fixes #20265.
> 
> Any comments?
> 
> Thanks,
> Jesse
> 
> diff --git a/src/i830_memory.c b/src/i830_memory.c
> index 96e1763..36dab11 100644
> --- a/src/i830_memory.c
> +++ b/src/i830_memory.c
> @@ -253,7 +253,8 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory
> *mem) mem->bound = TRUE;
>      }
>  
> -    if (mem->tiling != TILE_NONE && !pI830->use_drm_mode) {
> +    if (mem->tiling != TILE_NONE && !pI830->use_drm_mode &&
> +	!pI830->kernel_exec_fencing) {
>  	mem->fence_nr = i830_set_tiling(pScrn, mem->offset,
> mem->pitch, mem->allocated_size, mem->tiling);
>      }
> @@ -532,12 +533,8 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned
> long offset, unsigned long size) int ret;
>  
>  		sp.param = I915_SETPARAM_NUM_USED_FENCES;
> -		if (pI830->use_drm_mode)
> -		    sp.value = 0; /* kernel gets them all */
> -		else if (pI830->directRenderingType == DRI_XF86DRI)
> -		    sp.value = 3; /* front/back/depth */
> -		else
> -		    sp.value = 2; /* just front for DRI2 (both old &
> new though) */
> +		sp.value = 0; /* kernel gets them all */
> +
>  		ret = drmCommandWrite(pI830->drmSubFD,
> DRM_I915_SETPARAM, &sp, sizeof(sp));
>  		if (ret == 0)

I'd like to push this, but it does make an assumption about fencing
behavior:
  - 965+ chips don't get the fence installed a pin time
    this should be ok though, since all 965+ ops have tiling bits, and
any direct fb access should be bracketed by prepare/finish calls, which
will either use the backing store mapping or GTT maps (the latter will
install fences as needed at fault time)

On pre-965, fences for pinned objects will be installed at pin time,
and will remain as long as the object is pinned, so should be safe.

Jian, how hard have you pushed this patch on various platforms?  Any
other comments?

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center




More information about the Intel-gfx mailing list