[Intel-gfx] [PATCH 16/26] drm/i915: Clip the partial view against the object not vma

Chris Wilson chris at chris-wilson.co.uk
Sat Dec 31 12:06:52 UTC 2016


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 at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 669c11f62376..ea507d3eadba 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1759,7 +1759,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)
 {
@@ -1773,7 +1772,7 @@ compute_partial_view(struct drm_i915_gem_object *obj,
 	view.partial.offset_size =
 		(view.partial.offset_size << INTEL_PARTIAL_SIZE_BITS) |
 		(min_t(unsigned int, chunk,
-		       vma_pages(area) - view.partial.offset_size) - 1);
+		       (obj->base.size >> PAGE_SHIFT) - view.partial.offset_size) - 1);
 
 	/* If the partial covers the entire object, just create a
 	 * normal VMA.
@@ -1862,8 +1861,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.
-- 
2.11.0



More information about the Intel-gfx mailing list