[PATCH 03/14] drm/i915: consider page size when doing insertion

Matthew Auld matthew.auld at intel.com
Sun Apr 23 15:33:39 UTC 2017


Signed-off-by: Matthew Auld <matthew.auld at intel.com>
---
 drivers/gpu/drm/i915/i915_vma.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 1aba47024656..032c3835833c 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -471,6 +471,21 @@ i915_vma_insert(struct i915_vma *vma, u64 size, u64 alignment, u64 flags)
 	if (ret)
 		return ret;
 
+	if (i915_vm_is_48bit(vma->vm) &&
+	    obj->gtt_page_size > I915_GTT_PAGE_SIZE) {
+		unsigned int page_alignment = obj->gtt_page_size;
+
+		/* We can't mix 64K and 4K pte's in the same page-table (2M
+		 * block), and so to avoid the ugliness and complexity of
+		 * coloring we opt for just aligning 64K objects to 2M.
+		 */
+		if (page_alignment == I915_GTT_PAGE_SIZE_64K)
+			page_alignment = I915_GTT_PAGE_SIZE_2M;
+
+		alignment = max_t(typeof(alignment), alignment, page_alignment);
+		size = roundup(size, page_alignment);
+	}
+
 	if (flags & PIN_OFFSET_FIXED) {
 		u64 offset = flags & PIN_OFFSET_MASK;
 		if (!IS_ALIGNED(offset, alignment) ||
-- 
2.9.3



More information about the Intel-gfx-trybot mailing list