diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2010-02-19 05:51:56 -0500 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-02-26 16:23:21 -0500 |
commit | 798750e30d3de7932b0ac420f8fae2a970f2ac34 (patch) | |
tree | f272868107b9e8193e8344dd75d4dceaefa2d924 /drivers/gpu/drm/i915 | |
parent | 1f7a6e372e9cb4d749f34c0738d832e6cadb4071 (diff) |
drm/i915: reuse i915_gem_object_put_fence_reg for fence stealing code
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. This is a noop, but still try to keep the
bookkeeping correct.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | 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 c73da4049c81..302e096c3ca0 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2460,39 +2460,16 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj) | |||
2460 | */ | 2460 | */ |
2461 | drm_gem_object_reference(old_obj); | 2461 | drm_gem_object_reference(old_obj); |
2462 | 2462 | ||
2463 | /* i915 uses fences for GPU access to tiled buffers */ | ||
2464 | if (IS_I965G(dev) || !old_obj_priv->active) | ||
2465 | break; | ||
2466 | |||
2467 | /* This brings the object to the head of the LRU if it | ||
2468 | * had been written to. The only way this should | ||
2469 | * result in us waiting longer than the expected | ||
2470 | * optimal amount of time is if there was a | ||
2471 | * fence-using buffer later that was read-only. | ||
2472 | */ | ||
2473 | i915_gem_object_flush_gpu_write_domain(old_obj); | ||
2474 | ret = i915_gem_object_wait_rendering(old_obj); | ||
2475 | if (ret != 0) { | ||
2476 | drm_gem_object_unreference(old_obj); | ||
2477 | return ret; | ||
2478 | } | ||
2479 | |||
2480 | break; | 2463 | break; |
2481 | } | 2464 | } |
2482 | 2465 | ||
2483 | /* | ||
2484 | * Zap this virtual mapping so we can set up a fence again | ||
2485 | * for this object next time we need it. | ||
2486 | */ | ||
2487 | i915_gem_release_mmap(old_obj); | ||
2488 | |||
2489 | i = old_obj_priv->fence_reg; | 2466 | i = old_obj_priv->fence_reg; |
2490 | reg = &dev_priv->fence_regs[i]; | 2467 | reg = &dev_priv->fence_regs[i]; |
2491 | 2468 | ||
2492 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; | 2469 | ret = i915_gem_object_put_fence_reg(old_obj); |
2493 | list_del_init(&old_obj_priv->fence_list); | ||
2494 | |||
2495 | drm_gem_object_unreference(old_obj); | 2470 | drm_gem_object_unreference(old_obj); |
2471 | if (ret != 0) | ||
2472 | return ret; | ||
2496 | } | 2473 | } |
2497 | 2474 | ||
2498 | obj_priv->fence_reg = i; | 2475 | obj_priv->fence_reg = i; |