aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-08-07 06:01:20 -0400
committerEric Anholt <eric@anholt.net>2010-08-09 14:24:32 -0400
commitbf1a10923920f56da23a118de2511a72af341d61 (patch)
tree32d01acfdc89a6e29c436b16b79ef319decc5a45
parent6ef3d4278034982c13df87c4a51e0445f762d316 (diff)
drm/i915: Append the object onto the inactive list on binding.
In order to properly track bound objects, they need to exist on one of the inactive/active lists or be pinned. As this is a requirement, do the work inside i915_gem_bind_to_gtt() rather than dotted around the callsites. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b0fb394b9ff4..75e7b899e033 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1137,7 +1137,6 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1137{ 1137{
1138 struct drm_gem_object *obj = vma->vm_private_data; 1138 struct drm_gem_object *obj = vma->vm_private_data;
1139 struct drm_device *dev = obj->dev; 1139 struct drm_device *dev = obj->dev;
1140 struct drm_i915_private *dev_priv = dev->dev_private;
1141 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); 1140 struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
1142 pgoff_t page_offset; 1141 pgoff_t page_offset;
1143 unsigned long pfn; 1142 unsigned long pfn;
@@ -1155,8 +1154,6 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1155 if (ret) 1154 if (ret)
1156 goto unlock; 1155 goto unlock;
1157 1156
1158 list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
1159
1160 ret = i915_gem_object_set_to_gtt_domain(obj, write); 1157 ret = i915_gem_object_set_to_gtt_domain(obj, write);
1161 if (ret) 1158 if (ret)
1162 goto unlock; 1159 goto unlock;
@@ -1363,7 +1360,6 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
1363 struct drm_file *file_priv) 1360 struct drm_file *file_priv)
1364{ 1361{
1365 struct drm_i915_gem_mmap_gtt *args = data; 1362 struct drm_i915_gem_mmap_gtt *args = data;
1366 struct drm_i915_private *dev_priv = dev->dev_private;
1367 struct drm_gem_object *obj; 1363 struct drm_gem_object *obj;
1368 struct drm_i915_gem_object *obj_priv; 1364 struct drm_i915_gem_object *obj_priv;
1369 int ret; 1365 int ret;
@@ -1409,7 +1405,6 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
1409 mutex_unlock(&dev->struct_mutex); 1405 mutex_unlock(&dev->struct_mutex);
1410 return ret; 1406 return ret;
1411 } 1407 }
1412 list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
1413 } 1408 }
1414 1409
1415 drm_gem_object_unreference(obj); 1410 drm_gem_object_unreference(obj);
@@ -2723,6 +2718,9 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
2723 atomic_inc(&dev->gtt_count); 2718 atomic_inc(&dev->gtt_count);
2724 atomic_add(obj->size, &dev->gtt_memory); 2719 atomic_add(obj->size, &dev->gtt_memory);
2725 2720
2721 /* keep track of bounds object by adding it to the inactive list */
2722 list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
2723
2726 /* Assert that the object is not currently in any GPU domain. As it 2724 /* Assert that the object is not currently in any GPU domain. As it
2727 * wasn't in the GTT, there shouldn't be any way it could have been in 2725 * wasn't in the GTT, there shouldn't be any way it could have been in
2728 * a GPU cache 2726 * a GPU cache
@@ -4223,8 +4221,7 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
4223 atomic_inc(&dev->pin_count); 4221 atomic_inc(&dev->pin_count);
4224 atomic_add(obj->size, &dev->pin_memory); 4222 atomic_add(obj->size, &dev->pin_memory);
4225 if (!obj_priv->active && 4223 if (!obj_priv->active &&
4226 (obj->write_domain & I915_GEM_GPU_DOMAINS) == 0 && 4224 (obj->write_domain & I915_GEM_GPU_DOMAINS) == 0)
4227 !list_empty(&obj_priv->list))
4228 list_del_init(&obj_priv->list); 4225 list_del_init(&obj_priv->list);
4229 } 4226 }
4230 i915_verify_inactive(dev, __FILE__, __LINE__); 4227 i915_verify_inactive(dev, __FILE__, __LINE__);