diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 0fe313d0f609..3136e8ac02e8 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -632,6 +632,8 @@ i915_gem_shmem_pread(struct drm_device *dev, int prefaulted = 0; int needs_clflush = 0; struct sg_page_iter sg_iter; + struct page *page; + int i; user_data = to_user_ptr(args->data_ptr); remain = args->size; @@ -644,10 +646,8 @@ i915_gem_shmem_pread(struct drm_device *dev, offset = args->offset; - for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, - offset >> PAGE_SHIFT) { - struct page *page = sg_page_iter_page(&sg_iter); - + i = offset >> PAGE_SHIFT; + for_each_obj_page(obj, page, sg_iter, i) { if (remain <= 0) break; @@ -934,6 +934,8 @@ i915_gem_shmem_pwrite(struct drm_device *dev, int needs_clflush_after = 0; int needs_clflush_before = 0; struct sg_page_iter sg_iter; + struct page *page; + int i; user_data = to_user_ptr(args->data_ptr); remain = args->size; @@ -969,9 +971,8 @@ i915_gem_shmem_pwrite(struct drm_device *dev, offset = args->offset; obj->dirty = 1; - for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, - offset >> PAGE_SHIFT) { - struct page *page = sg_page_iter_page(&sg_iter); + i = offset >> PAGE_SHIFT; + for_each_obj_page(obj, page, sg_iter, i) { int partial_cacheline_write; if (remain <= 0) @@ -1984,7 +1985,8 @@ static void i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj) { struct sg_page_iter sg_iter; - int ret; + struct page *page; + int ret, i; BUG_ON(obj->madv == __I915_MADV_PURGED); @@ -2004,9 +2006,8 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj) if (obj->madv == I915_MADV_DONTNEED) obj->dirty = 0; - for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, 0) { - struct page *page = sg_page_iter_page(&sg_iter); - + i = 0; + for_each_obj_page(obj, page, sg_iter, i) { if (obj->dirty) set_page_dirty(page); |