提交 39a01d1f 编写于 作者: C Chris Wilson

drm/i915: Remove mmap_offset

Since we rarely use the mmap_offset and it is easily computable from the
obj->map_list.hash, remove it.
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
上级 17250b71
...@@ -796,11 +796,6 @@ struct drm_i915_gem_object { ...@@ -796,11 +796,6 @@ struct drm_i915_gem_object {
/* Which ring is refering to is this object */ /* Which ring is refering to is this object */
struct intel_ring_buffer *ring; struct intel_ring_buffer *ring;
/**
* Fake offset for use by mmap(2)
*/
uint64_t mmap_offset;
/** Breadcrumb of last rendering to the buffer. */ /** Breadcrumb of last rendering to the buffer. */
uint32_t last_rendering_seqno; uint32_t last_rendering_seqno;
......
...@@ -1392,7 +1392,6 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj) ...@@ -1392,7 +1392,6 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_gem_mm *mm = dev->mm_private; struct drm_gem_mm *mm = dev->mm_private;
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct drm_map_list *list; struct drm_map_list *list;
struct drm_local_map *map; struct drm_local_map *map;
int ret = 0; int ret = 0;
...@@ -1431,16 +1430,13 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj) ...@@ -1431,16 +1430,13 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj)
goto out_free_mm; goto out_free_mm;
} }
/* By now we should be all set, any drm_mmap request on the offset
* below will get to our mmap & fault handler */
obj_priv->mmap_offset = ((uint64_t) list->hash.key) << PAGE_SHIFT;
return 0; return 0;
out_free_mm: out_free_mm:
drm_mm_put_block(list->file_offset_node); drm_mm_put_block(list->file_offset_node);
out_free_list: out_free_list:
kfree(list->map); kfree(list->map);
list->map = NULL;
return ret; return ret;
} }
...@@ -1466,9 +1462,10 @@ i915_gem_release_mmap(struct drm_gem_object *obj) ...@@ -1466,9 +1462,10 @@ i915_gem_release_mmap(struct drm_gem_object *obj)
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
if (dev->dev_mapping) if (unlikely(obj->map_list.map && dev->dev_mapping))
unmap_mapping_range(dev->dev_mapping, unmap_mapping_range(dev->dev_mapping,
obj_priv->mmap_offset, obj->size, 1); (loff_t)obj->map_list.hash.key<<PAGE_SHIFT,
obj->size, 1);
if (obj_priv->fault_mappable) { if (obj_priv->fault_mappable) {
obj_priv->fault_mappable = false; obj_priv->fault_mappable = false;
...@@ -1480,24 +1477,13 @@ static void ...@@ -1480,24 +1477,13 @@ static void
i915_gem_free_mmap_offset(struct drm_gem_object *obj) i915_gem_free_mmap_offset(struct drm_gem_object *obj)
{ {
struct drm_device *dev = obj->dev; struct drm_device *dev = obj->dev;
struct drm_i915_gem_object *obj_priv = to_intel_bo(obj);
struct drm_gem_mm *mm = dev->mm_private; struct drm_gem_mm *mm = dev->mm_private;
struct drm_map_list *list; struct drm_map_list *list = &obj->map_list;
list = &obj->map_list;
drm_ht_remove_item(&mm->offset_hash, &list->hash); drm_ht_remove_item(&mm->offset_hash, &list->hash);
if (list->file_offset_node) {
drm_mm_put_block(list->file_offset_node); drm_mm_put_block(list->file_offset_node);
list->file_offset_node = NULL;
}
if (list->map) {
kfree(list->map); kfree(list->map);
list->map = NULL; list->map = NULL;
}
obj_priv->mmap_offset = 0;
} }
/** /**
...@@ -1586,23 +1572,13 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, ...@@ -1586,23 +1572,13 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
goto out; goto out;
} }
if (!obj_priv->mmap_offset) { if (!obj->map_list.map) {
ret = i915_gem_create_mmap_offset(obj); ret = i915_gem_create_mmap_offset(obj);
if (ret) if (ret)
goto out; goto out;
} }
args->offset = obj_priv->mmap_offset; args->offset = (u64)obj->map_list.hash.key << PAGE_SHIFT;
/*
* Pull it into the GTT so that we have a page list (makes the
* initial fault faster and any subsequent flushing possible).
*/
if (!obj_priv->agp_mem) {
ret = i915_gem_object_bind_to_gtt(obj, 0, true);
if (ret)
goto out;
}
out: out:
drm_gem_object_unreference(obj); drm_gem_object_unreference(obj);
...@@ -4477,7 +4453,7 @@ static void i915_gem_free_object_tail(struct drm_gem_object *obj) ...@@ -4477,7 +4453,7 @@ static void i915_gem_free_object_tail(struct drm_gem_object *obj)
return; return;
} }
if (obj_priv->mmap_offset) if (obj->map_list.map)
i915_gem_free_mmap_offset(obj); i915_gem_free_mmap_offset(obj);
drm_gem_object_release(obj); drm_gem_object_release(obj);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册