Commit ab18282d authored by Chris Wilson's avatar Chris Wilson

drm/i915: Warn before mmaping a purgeable buffer.

Only allow the user to mmap buffers that have not been marked as
purgeable.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent bb6baf76
...@@ -1431,6 +1431,14 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, ...@@ -1431,6 +1431,14 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
obj_priv = obj->driver_private; obj_priv = obj->driver_private;
if (obj_priv->madv != I915_MADV_WILLNEED) {
DRM_ERROR("Attempting to mmap a purgeable buffer\n");
drm_gem_object_unreference(obj);
mutex_unlock(&dev->struct_mutex);
return -EINVAL;
}
if (!obj_priv->mmap_offset) { if (!obj_priv->mmap_offset) {
ret = i915_gem_create_mmap_offset(obj); ret = i915_gem_create_mmap_offset(obj);
if (ret) { if (ret) {
......
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