Skip to content

Commit

Permalink
drm/i915: Discard the unused obj->last_fenced_ring
Browse files Browse the repository at this point in the history
As we now never pipeline a fence update, obj->last_fenced_ring is always
the same as the obj->ring whenever obj->last_fenced_seqno is active, so
remove it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Chris Wilson authored and Daniel Vetter committed Apr 18, 2012
1 parent 69963e7 commit 1c293ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
5 changes: 2 additions & 3 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -930,13 +930,12 @@ struct drm_i915_gem_object {
*/
uint32_t gtt_offset;

/** Breadcrumb of last rendering to the buffer. */
uint32_t last_rendering_seqno;
struct intel_ring_buffer *ring;

/** Breadcrumb of last rendering to the buffer. */
uint32_t last_rendering_seqno;
/** Breadcrumb of last fenced GPU access to the buffer. */
uint32_t last_fenced_seqno;
struct intel_ring_buffer *last_fenced_ring;

/** Current tiling stride for the object, if it's tiled. */
uint32_t stride;
Expand Down
16 changes: 5 additions & 11 deletions drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,6 @@ i915_gem_object_move_to_active(struct drm_i915_gem_object *obj,

if (obj->fenced_gpu_access) {
obj->last_fenced_seqno = seqno;
obj->last_fenced_ring = ring;

/* Bump MRU to take account of the delayed flush */
if (obj->fence_reg != I915_FENCE_REG_NONE) {
Expand Down Expand Up @@ -1445,7 +1444,6 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj)
BUG_ON(!list_empty(&obj->gpu_write_list));
BUG_ON(!obj->active);
obj->ring = NULL;
obj->last_fenced_ring = NULL;

i915_gem_object_move_off_active(obj);
obj->fenced_gpu_access = false;
Expand Down Expand Up @@ -1650,7 +1648,6 @@ static void i915_gem_reset_fences(struct drm_device *dev)
reg->obj->fence_reg = I915_FENCE_REG_NONE;
reg->obj->fenced_gpu_access = false;
reg->obj->last_fenced_seqno = 0;
reg->obj->last_fenced_ring = NULL;
i915_gem_clear_fence_reg(dev, reg);
}
}
Expand Down Expand Up @@ -2295,7 +2292,7 @@ i915_gem_object_flush_fence(struct drm_i915_gem_object *obj)

if (obj->fenced_gpu_access) {
if (obj->base.write_domain & I915_GEM_GPU_DOMAINS) {
ret = i915_gem_flush_ring(obj->last_fenced_ring,
ret = i915_gem_flush_ring(obj->ring,
0, obj->base.write_domain);
if (ret)
return ret;
Expand All @@ -2304,18 +2301,17 @@ i915_gem_object_flush_fence(struct drm_i915_gem_object *obj)
obj->fenced_gpu_access = false;
}

if (obj->last_fenced_seqno && NULL != obj->last_fenced_ring) {
if (!ring_passed_seqno(obj->last_fenced_ring,
if (obj->last_fenced_seqno) {
if (!ring_passed_seqno(obj->ring,
obj->last_fenced_seqno)) {
ret = i915_wait_request(obj->last_fenced_ring,
ret = i915_wait_request(obj->ring,
obj->last_fenced_seqno,
true);
if (ret)
return ret;
}

obj->last_fenced_seqno = 0;
obj->last_fenced_ring = NULL;
}

/* Ensure that all CPU reads are completed before installing a fence
Expand Down Expand Up @@ -2382,7 +2378,7 @@ i915_find_fence_reg(struct drm_device *dev)
if (first == NULL)
first = reg;

if (reg->obj->last_fenced_ring == NULL) {
if (reg->obj->last_fenced_seqno == 0) {
avail = reg;
break;
}
Expand Down Expand Up @@ -2458,7 +2454,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj)
}

old->fence_reg = I915_FENCE_REG_NONE;
old->last_fenced_ring = NULL;
old->last_fenced_seqno = 0;

drm_gem_object_unreference(&old->base);
Expand All @@ -2467,7 +2462,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj)
reg->obj = obj;
list_move_tail(&reg->lru_list, &dev_priv->mm.fence_list);
obj->fence_reg = reg - dev_priv->fence_regs;
obj->last_fenced_ring = NULL;

update:
obj->tiling_changed = false;
Expand Down

0 comments on commit 1c293ea

Please sign in to comment.