Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306996
b: refs/heads/master
c: 96d79b5
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Vetter committed Mar 27, 2012
1 parent 5fe84fc commit ca70793
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 935aaa692ec5e4b7261ed7f17f962d7e978c542b
refs/heads/master: 96d79b52701758404cf8701986891afc99ce810b
16 changes: 11 additions & 5 deletions trunk/drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ i915_gem_shmem_pread(struct drm_device *dev,
int shmem_page_offset, page_length, ret = 0;
int obj_do_bit17_swizzling, page_do_bit17_swizzling;
int hit_slowpath = 0;
int prefaulted = 0;
int needs_clflush = 0;
int release_page;

Expand Down Expand Up @@ -368,6 +369,16 @@ i915_gem_shmem_pread(struct drm_device *dev,
page_cache_get(page);
mutex_unlock(&dev->struct_mutex);

if (!prefaulted) {
ret = fault_in_pages_writeable(user_data, remain);
/* Userspace is tricking us, but we've already clobbered
* its pages with the prefault and promised to write the
* data up to the first fault. Hence ignore any errors
* and just continue. */
(void)ret;
prefaulted = 1;
}

vaddr = kmap(page);
if (needs_clflush)
drm_clflush_virt_range(vaddr + shmem_page_offset,
Expand Down Expand Up @@ -431,11 +442,6 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
args->size))
return -EFAULT;

ret = fault_in_pages_writeable((char __user *)(uintptr_t)args->data_ptr,
args->size);
if (ret)
return -EFAULT;

ret = i915_mutex_lock_interruptible(dev);
if (ret)
return ret;
Expand Down

0 comments on commit ca70793

Please sign in to comment.