[Intel-gfx] [PATCH 03/11] drm/i915: reuse i915_gem_object_put_fence_reg for fence stealing code
Chris Wilson
chris at chris-wilson.co.uk
Fri Jan 15 13:47:55 CET 2010
On Fri, 15 Jan 2010 13:24:10 +0100, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> This has a few functional changes against the old code:
>
> * a few more unnecessary loads and stores to the drm_i915_fence_reg
> objects. Also an unnecessary store to the hw fence register.
>
> * zaps any userspace mappings before doing other flushes. Only changes
> anything when userspace does racy stuff against itself.
>
> * also flush GTT domain. Now that the gtt flushing code actually
> does something, we should put it to some good use.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 29 +++--------------------------
> 1 files changed, 3 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index a092025..b11dbeb 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2448,39 +2448,16 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
> */
> drm_gem_object_reference(old_obj);
>
> - /* i915 uses fences for GPU access to tiled buffers */
> - if (IS_I965G(dev) || !old_obj_priv->active)
> - break;
> -
> - /* This brings the object to the head of the LRU if it
> - * had been written to. The only way this should
> - * result in us waiting longer than the expected
> - * optimal amount of time is if there was a
> - * fence-using buffer later that was read-only.
> - */
> - i915_gem_object_flush_gpu_write_domain(old_obj);
> - ret = i915_gem_object_wait_rendering(old_obj);
> - if (ret != 0) {
> - drm_gem_object_unreference(old_obj);
> - return ret;
> - }
> -
> break;
> }
>
> - /*
> - * Zap this virtual mapping so we can set up a fence again
> - * for this object next time we need it.
> - */
> - i915_gem_release_mmap(old_obj);
> -
> i = old_obj_priv->fence_reg;
> reg = &dev_priv->fence_regs[i];
>
> - old_obj_priv->fence_reg = I915_FENCE_REG_NONE;
> - list_del_init(&old_obj_priv->fence_list);
> -
> + ret = i915_gem_object_put_fence_reg(old_obj);
> drm_gem_object_unreference(old_obj);
> + if (ret != 0)
> + return ret;
> }
>
> obj_priv->fence_reg = i;
This leaves the code slightly ugly, I'd prefer the reference/unreference
to be tighter given the rearrangement.
-ickle
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list