Commit ef0cf27c authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Use the .release hook to drop the stolen drm_mm tracking

Now that we have a release hook into i915_gem_object_free, we can move
the explicit call to the internal stolen function and hook it up
throught the callback instead.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent a33d7105
...@@ -2439,7 +2439,6 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, ...@@ -2439,7 +2439,6 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
u32 stolen_offset, u32 stolen_offset,
u32 gtt_offset, u32 gtt_offset,
u32 size); u32 size);
void i915_gem_object_release_stolen(struct drm_i915_gem_object *obj);
/* i915_gem_tiling.c */ /* i915_gem_tiling.c */
static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj)
......
...@@ -4444,7 +4444,6 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj) ...@@ -4444,7 +4444,6 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
obj->madv = I915_MADV_DONTNEED; obj->madv = I915_MADV_DONTNEED;
i915_gem_object_put_pages(obj); i915_gem_object_put_pages(obj);
i915_gem_object_free_mmap_offset(obj); i915_gem_object_free_mmap_offset(obj);
i915_gem_object_release_stolen(obj);
BUG_ON(obj->pages); BUG_ON(obj->pages);
......
...@@ -292,9 +292,20 @@ static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj) ...@@ -292,9 +292,20 @@ static void i915_gem_object_put_pages_stolen(struct drm_i915_gem_object *obj)
kfree(obj->pages); kfree(obj->pages);
} }
static void
i915_gem_object_release_stolen(struct drm_i915_gem_object *obj)
{
if (obj->stolen) {
drm_mm_remove_node(obj->stolen);
kfree(obj->stolen);
obj->stolen = NULL;
}
}
static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = { static const struct drm_i915_gem_object_ops i915_gem_object_stolen_ops = {
.get_pages = i915_gem_object_get_pages_stolen, .get_pages = i915_gem_object_get_pages_stolen,
.put_pages = i915_gem_object_put_pages_stolen, .put_pages = i915_gem_object_put_pages_stolen,
.release = i915_gem_object_release_stolen,
}; };
static struct drm_i915_gem_object * static struct drm_i915_gem_object *
...@@ -452,13 +463,3 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, ...@@ -452,13 +463,3 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
drm_gem_object_unreference(&obj->base); drm_gem_object_unreference(&obj->base);
return NULL; return NULL;
} }
void
i915_gem_object_release_stolen(struct drm_i915_gem_object *obj)
{
if (obj->stolen) {
drm_mm_remove_node(obj->stolen);
kfree(obj->stolen);
obj->stolen = NULL;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment