aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_drv.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-14 07:57:08 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-01-29 12:23:37 -0500
commit1690e1eb7a9021826853e181baa48dd77090da28 (patch)
tree397210ab6f278ca81b8108320768b39465db6d08 /drivers/gpu/drm/i915/i915_drv.h
parent6a233c78878d8795517d716544d045d5675b3061 (diff)
drm/i915: Separate fence pin counting from normal bind pin counting
In order to correctly account for reserving space in the GTT and fences for a batch buffer, we need to independently track whether the fence is pinned due to a fenced GPU access in the batch or whether the buffer is pinned in the aperture. Currently we count the fenced as pinned if the buffer has already been seen in the execbuffer. This leads to a false accounting of available fence registers, causing frequent mass evictions. Worse, if coupled with the change to make i915_gem_object_get_fence() report EDADLK upon fence starvation, the batchbuffer can fail with only one fence required... Fixes intel-gpu-tools/tests/gem_fenced_exec_thrash Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38735 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Tested-by: Paul Neumann <paul104x@yahoo.de> [danvet: Resolve the functional conflict with Jesse Barnes sprite patches, acked by Chris Wilson on irc.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 733f5f57babf..12e8cce79289 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -135,6 +135,7 @@ struct drm_i915_fence_reg {
135 struct list_head lru_list; 135 struct list_head lru_list;
136 struct drm_i915_gem_object *obj; 136 struct drm_i915_gem_object *obj;
137 uint32_t setup_seqno; 137 uint32_t setup_seqno;
138 int pin_count;
138}; 139};
139 140
140struct sdvo_device_mapping { 141struct sdvo_device_mapping {
@@ -1159,6 +1160,24 @@ int __must_check i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
1159 struct intel_ring_buffer *pipelined); 1160 struct intel_ring_buffer *pipelined);
1160int __must_check i915_gem_object_put_fence(struct drm_i915_gem_object *obj); 1161int __must_check i915_gem_object_put_fence(struct drm_i915_gem_object *obj);
1161 1162
1163static inline void
1164i915_gem_object_pin_fence(struct drm_i915_gem_object *obj)
1165{
1166 if (obj->fence_reg != I915_FENCE_REG_NONE) {
1167 struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
1168 dev_priv->fence_regs[obj->fence_reg].pin_count++;
1169 }
1170}
1171
1172static inline void
1173i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj)
1174{
1175 if (obj->fence_reg != I915_FENCE_REG_NONE) {
1176 struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
1177 dev_priv->fence_regs[obj->fence_reg].pin_count--;
1178 }
1179}
1180
1162void i915_gem_retire_requests(struct drm_device *dev); 1181void i915_gem_retire_requests(struct drm_device *dev);
1163void i915_gem_reset(struct drm_device *dev); 1182void i915_gem_reset(struct drm_device *dev);
1164void i915_gem_clflush_object(struct drm_i915_gem_object *obj); 1183void i915_gem_clflush_object(struct drm_i915_gem_object *obj);