[Intel-gfx] [PATCH v6 19/19] drm/i915: Save some page table setup on repeated binds

Michel Thierry michel.thierry at intel.com
Wed Jul 29 09:24:03 PDT 2015


Check if the required page tables are already allocated, if so, we can
skip altogether the inner loop of pdes, and move to the next page
directory.

If the new allocation is different than the existing one (i.e. new
allocation spans more ptes than already covered from earlier allocations),
the used_ptes bitmap may not get updated correctly, but none of the
code-checks rely on this.

Suggested-by: Akash Goel <akash.goel at intel.com>
Signed-off-by: Michel Thierry <michel.thierry at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index a7d3c07..13cf23c 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -1249,6 +1249,16 @@ static int gen8_alloc_va_range_3lvl(struct i915_address_space *vm,
 		/* Every pd should be allocated, we just did that above. */
 		WARN_ON(!pd);
 
+		/* Check if the required page tables are already allocated /
+		 * mapped; if so, we can skip altogether the inner loop of pdes,
+		 * and move to the next page directory.
+		 */
+		if (bitmap_subset(new_page_tables[pdpe], pd->used_pdes,
+				  I915_PDES)) {
+			kunmap_px(ppgtt, page_directory);
+			continue;
+		}
+
 		gen8_for_each_pde(pt, pd, pd_start, pd_len, temp, pde) {
 			/* Same reasoning as pd */
 			WARN_ON(!pt);
-- 
2.4.5



More information about the Intel-gfx mailing list