summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-01-10 12:56:33 +0300
committerChris Wilson <chris@chris-wilson.co.uk>2017-01-10 14:59:24 +0300
commit8201c1fad4f4d5b2952255af11189ec676ebf340 (patch)
tree470d7f19c9afc0a94a4b5ab27f05e5c67fab6014 /drivers
parent2d4281bb93046fc97fb8ad5dc17ea291a1fb38e2 (diff)
downloadlinux-8201c1fad4f4d5b2952255af11189ec676ebf340.tar.xz
drm/i915: Clip the partial view against the object not vma
The VMA is later clipped against the vm_area_struct before insertion of the faulting PTE so we are free to create the partial view as we desire. If we use the object as the extents rather than the area, this partial can then be used for other areas. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170110095633.6612-2-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 341f7f025828..e02afd8728f1 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1751,7 +1751,6 @@ int i915_gem_mmap_gtt_version(void)
static inline struct i915_ggtt_view
compute_partial_view(struct drm_i915_gem_object *obj,
- struct vm_area_struct *area,
pgoff_t page_offset,
unsigned int chunk)
{
@@ -1765,7 +1764,7 @@ compute_partial_view(struct drm_i915_gem_object *obj,
view.params.partial.offset = rounddown(page_offset, chunk);
view.params.partial.size =
min_t(unsigned int, chunk,
- vma_pages(area) - view.params.partial.offset);
+ (obj->base.size >> PAGE_SHIFT) - view.params.partial.offset);
/* If the partial covers the entire object, just create a normal VMA. */
if (chunk >= obj->base.size >> PAGE_SHIFT)
@@ -1852,8 +1851,7 @@ int i915_gem_fault(struct vm_area_struct *area, struct vm_fault *vmf)
if (IS_ERR(vma)) {
/* Use a partial view if it is bigger than available space */
struct i915_ggtt_view view =
- compute_partial_view(obj, area,
- page_offset, MIN_CHUNK_PAGES);
+ compute_partial_view(obj, page_offset, MIN_CHUNK_PAGES);
/* Userspace is now writing through an untracked VMA, abandon
* all hope that the hardware is able to track future writes.