diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-17 10:31:32 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-04-18 07:34:53 -0400 |
commit | ada726c734e79c83f72676c02b5d68d4f9faead0 (patch) | |
tree | 39fc67d2327440fb3da7269408ee02a52935b4f6 /drivers/gpu/drm | |
parent | 61050808bb019ebea966b7b5bfd357aaf219fb51 (diff) |
drm/i915: Refactor fence clearing to use the common fence writing routine
Now that we have a routine that is able to clear the fences as well as
setup up the register for a tiled object, remove the surplus routines to
clear the fences.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 62 |
1 files changed, 9 insertions, 53 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 3601b8b6e45f..e09ac3a95308 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -42,8 +42,6 @@ static void i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *o | |||
42 | static __must_check int i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj, | 42 | static __must_check int i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj, |
43 | unsigned alignment, | 43 | unsigned alignment, |
44 | bool map_and_fenceable); | 44 | bool map_and_fenceable); |
45 | static void i915_gem_clear_fence_reg(struct drm_device *dev, | ||
46 | struct drm_i915_fence_reg *reg); | ||
47 | static int i915_gem_phys_pwrite(struct drm_device *dev, | 45 | static int i915_gem_phys_pwrite(struct drm_device *dev, |
48 | struct drm_i915_gem_object *obj, | 46 | struct drm_i915_gem_object *obj, |
49 | struct drm_i915_gem_pwrite *args, | 47 | struct drm_i915_gem_pwrite *args, |
@@ -1655,19 +1653,18 @@ static void i915_gem_reset_fences(struct drm_device *dev) | |||
1655 | 1653 | ||
1656 | for (i = 0; i < dev_priv->num_fence_regs; i++) { | 1654 | for (i = 0; i < dev_priv->num_fence_regs; i++) { |
1657 | struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; | 1655 | struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; |
1658 | struct drm_i915_gem_object *obj = reg->obj; | ||
1659 | 1656 | ||
1660 | if (!obj) | 1657 | i915_gem_write_fence(dev, i, NULL); |
1661 | continue; | ||
1662 | 1658 | ||
1663 | if (obj->tiling_mode) | 1659 | if (reg->obj) |
1664 | i915_gem_release_mmap(obj); | 1660 | i915_gem_object_fence_lost(reg->obj); |
1665 | 1661 | ||
1666 | reg->obj->fence_reg = I915_FENCE_REG_NONE; | 1662 | reg->pin_count = 0; |
1667 | reg->obj->fenced_gpu_access = false; | 1663 | reg->obj = NULL; |
1668 | reg->obj->last_fenced_seqno = 0; | 1664 | INIT_LIST_HEAD(®->lru_list); |
1669 | i915_gem_clear_fence_reg(dev, reg); | ||
1670 | } | 1665 | } |
1666 | |||
1667 | INIT_LIST_HEAD(&dev_priv->mm.fence_list); | ||
1671 | } | 1668 | } |
1672 | 1669 | ||
1673 | void i915_gem_reset(struct drm_device *dev) | 1670 | void i915_gem_reset(struct drm_device *dev) |
@@ -2513,45 +2510,6 @@ update: | |||
2513 | } | 2510 | } |
2514 | 2511 | ||
2515 | /** | 2512 | /** |
2516 | * i915_gem_clear_fence_reg - clear out fence register info | ||
2517 | * @obj: object to clear | ||
2518 | * | ||
2519 | * Zeroes out the fence register itself and clears out the associated | ||
2520 | * data structures in dev_priv and obj. | ||
2521 | */ | ||
2522 | static void | ||
2523 | i915_gem_clear_fence_reg(struct drm_device *dev, | ||
2524 | struct drm_i915_fence_reg *reg) | ||
2525 | { | ||
2526 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
2527 | uint32_t fence_reg = reg - dev_priv->fence_regs; | ||
2528 | |||
2529 | switch (INTEL_INFO(dev)->gen) { | ||
2530 | case 7: | ||
2531 | case 6: | ||
2532 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + fence_reg*8, 0); | ||
2533 | break; | ||
2534 | case 5: | ||
2535 | case 4: | ||
2536 | I915_WRITE64(FENCE_REG_965_0 + fence_reg*8, 0); | ||
2537 | break; | ||
2538 | case 3: | ||
2539 | if (fence_reg >= 8) | ||
2540 | fence_reg = FENCE_REG_945_8 + (fence_reg - 8) * 4; | ||
2541 | else | ||
2542 | case 2: | ||
2543 | fence_reg = FENCE_REG_830_0 + fence_reg * 4; | ||
2544 | |||
2545 | I915_WRITE(fence_reg, 0); | ||
2546 | break; | ||
2547 | } | ||
2548 | |||
2549 | list_del_init(®->lru_list); | ||
2550 | reg->obj = NULL; | ||
2551 | reg->pin_count = 0; | ||
2552 | } | ||
2553 | |||
2554 | /** | ||
2555 | * Finds free space in the GTT aperture and binds the object there. | 2513 | * Finds free space in the GTT aperture and binds the object there. |
2556 | */ | 2514 | */ |
2557 | static int | 2515 | static int |
@@ -3788,9 +3746,7 @@ i915_gem_load(struct drm_device *dev) | |||
3788 | dev_priv->num_fence_regs = 8; | 3746 | dev_priv->num_fence_regs = 8; |
3789 | 3747 | ||
3790 | /* Initialize fence registers to zero */ | 3748 | /* Initialize fence registers to zero */ |
3791 | for (i = 0; i < dev_priv->num_fence_regs; i++) { | 3749 | i915_gem_reset_fences(dev); |
3792 | i915_gem_clear_fence_reg(dev, &dev_priv->fence_regs[i]); | ||
3793 | } | ||
3794 | 3750 | ||
3795 | i915_gem_detect_bit_6_swizzle(dev); | 3751 | i915_gem_detect_bit_6_swizzle(dev); |
3796 | init_waitqueue_head(&dev_priv->pending_flip_queue); | 3752 | init_waitqueue_head(&dev_priv->pending_flip_queue); |