xf86-video-intel: 2 commits - src/sna/gen7_render.c src/sna/kgem.c src/sna/kgem.h

Chris Wilson ickle at kemper.freedesktop.org
Fri Nov 1 12:06:07 CET 2013


 src/sna/gen7_render.c |   29 +++++++++++++++++++++--------
 src/sna/kgem.c        |   11 +++++++----
 src/sna/kgem.h        |   12 +++++++++---
 3 files changed, 37 insertions(+), 15 deletions(-)

New commits:
commit 6b1a6f32179f7bff8503c6b8b38351a7cf1d08b7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Nov 1 10:48:06 2013 +0000

    sna: Scale uses of aperture_mappable by PAGE_SIZE
    
    After converting aperture_mappable to count in pages, there were a few
    residual users expecting a byte count.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71117
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 4c66917..2710557 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -4717,7 +4717,10 @@ static bool aperture_check(struct kgem *kgem, unsigned num_pages)
 			aperture.aper_available_size -= 2 * kgem->nexec * PAGE_SIZE;
 
 		aperture.aper_available_size -= aperture.aper_size - aperture.aper_available_size;
-		if (num_pages < aperture.aper_available_size / PAGE_SIZE)
+		DBG(("%s: num_pages=%d, estimated max=%ld\n",
+		     __FUNCTION__, num_pages, (long)(aperture.aper_available_size/PAGE_SIZE)));
+
+		if (num_pages <= aperture.aper_available_size / PAGE_SIZE)
 			return true;
 	}
 
@@ -5123,7 +5126,7 @@ void *kgem_bo_map__async(struct kgem *kgem, struct kgem_bo *bo)
 
 	ptr = MAP(bo->map__gtt);
 	if (ptr == NULL) {
-		assert(kgem_bo_size(bo) <= kgem->aperture_mappable / 2);
+		assert(num_pages(bo) <= kgem->aperture_mappable / 2);
 
 		kgem_trim_vma_cache(kgem, MAP_GTT, bucket(bo));
 
@@ -5167,7 +5170,7 @@ void *kgem_bo_map(struct kgem *kgem, struct kgem_bo *bo)
 
 	ptr = MAP(bo->map__gtt);
 	if (ptr == NULL) {
-		assert(kgem_bo_size(bo) <= kgem->aperture_mappable / 2);
+		assert(num_pages(bo) <= kgem->aperture_mappable / 2);
 		assert(kgem->gen != 021 || bo->tiling != I915_TILING_Y);
 
 		kgem_trim_vma_cache(kgem, MAP_GTT, bucket(bo));
@@ -5220,7 +5223,7 @@ void *kgem_bo_map__gtt(struct kgem *kgem, struct kgem_bo *bo)
 
 	ptr = MAP(bo->map__gtt);
 	if (ptr == NULL) {
-		assert(bytes(bo) <= kgem->aperture_mappable / 4);
+		assert(num_pages(bo) <= kgem->aperture_mappable / 4);
 
 		kgem_trim_vma_cache(kgem, MAP_GTT, bucket(bo));
 
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index e2bb4f9..9804d6c 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -476,6 +476,12 @@ static inline int __kgem_bo_size(struct kgem_bo *bo)
 	return PAGE_SIZE * bo->size.pages.count;
 }
 
+static inline int __kgem_bo_num_pages(struct kgem_bo *bo)
+{
+	assert(bo->proxy == NULL);
+	return bo->size.pages.count;
+}
+
 static inline int kgem_bo_size(struct kgem_bo *bo)
 {
 	if (bo->proxy)
@@ -528,9 +534,9 @@ static inline bool __kgem_bo_is_mappable(struct kgem *kgem,
 		return true;
 
 	if (!bo->presumed_offset)
-		return kgem_bo_size(bo) <= kgem->aperture_mappable / 4;
+		return __kgem_bo_num_pages(bo) <= kgem->aperture_mappable / 4;
 
-	return bo->presumed_offset + kgem_bo_size(bo) <= kgem->aperture_mappable;
+	return bo->presumed_offset / PAGE_SIZE + __kgem_bo_num_pages(bo) <= kgem->aperture_mappable;
 }
 
 static inline bool kgem_bo_is_mappable(struct kgem *kgem,
@@ -565,7 +571,7 @@ static inline bool kgem_bo_can_map(struct kgem *kgem, struct kgem_bo *bo)
 	if (kgem->gen == 021 && bo->tiling == I915_TILING_Y)
 		return false;
 
-	return kgem_bo_size(bo) <= kgem->aperture_mappable / 4;
+	return __kgem_bo_num_pages(bo) <= kgem->aperture_mappable / 4;
 }
 
 static inline bool kgem_bo_can_map__cpu(struct kgem *kgem,
commit d580a30aaf97687f9669ea72fbc3310c2fea26f1
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Oct 31 15:58:47 2013 +0000

    sna/gen7: Flush render cache when changing CC state
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=68410
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index b8c46c0..6261f65 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -1109,10 +1109,14 @@ gen7_emit_state(struct sna *sna,
 	if (ALWAYS_INVALIDATE)
 		need_invalidate = true;
 
-	need_flush = sna->render_state.gen7.emit_flush;
+	need_flush =
+		sna->render_state.gen7.emit_flush ||
+		wm_binding_table & GEN7_READS_DST(op->u.gen7.flags);
 	if (ALWAYS_FLUSH)
 		need_flush = true;
 
+	wm_binding_table &= ~1;
+
 	need_stall = sna->render_state.gen7.surface_table != wm_binding_table;
 	need_stall &= gen7_emit_drawing_rectangle(sna, op);
 	if (ALWAYS_STALL)
@@ -1495,12 +1499,14 @@ static void gen7_emit_composite_state(struct sna *sna,
 				      const struct sna_composite_op *op)
 {
 	uint32_t *binding_table;
-	uint16_t offset;
+	uint16_t offset, dirty;
 
 	gen7_get_batch(sna, op);
 
 	binding_table = gen7_composite_get_binding_table(sna, &offset);
 
+	dirty = kgem_bo_is_dirty(op->dst.bo);
+
 	binding_table[0] =
 		gen7_bind_bo(sna,
 			    op->dst.bo, op->dst.width, op->dst.height,
@@ -1529,7 +1535,7 @@ static void gen7_emit_composite_state(struct sna *sna,
 		offset = sna->render_state.gen7.surface_table;
 	}
 
-	gen7_emit_state(sna, op, offset);
+	gen7_emit_state(sna, op, offset | dirty);
 }
 
 static void
@@ -1747,7 +1753,7 @@ static void gen7_emit_video_state(struct sna *sna,
 	int src_height[6];
 	int src_pitch[6];
 	uint32_t *binding_table;
-	uint16_t offset;
+	uint16_t offset, dirty;
 	int n_src, n;
 
 	gen7_get_batch(sna, op);
@@ -1785,6 +1791,8 @@ static void gen7_emit_video_state(struct sna *sna,
 
 	binding_table = gen7_composite_get_binding_table(sna, &offset);
 
+	dirty = kgem_bo_is_dirty(op->dst.bo);
+
 	binding_table[0] =
 		gen7_bind_bo(sna,
 			     op->dst.bo, op->dst.width, op->dst.height,
@@ -1801,7 +1809,7 @@ static void gen7_emit_video_state(struct sna *sna,
 					       src_surf_format);
 	}
 
-	gen7_emit_state(sna, op, offset);
+	gen7_emit_state(sna, op, offset | dirty);
 }
 
 static bool
@@ -2777,12 +2785,14 @@ gen7_emit_copy_state(struct sna *sna,
 		     const struct sna_composite_op *op)
 {
 	uint32_t *binding_table;
-	uint16_t offset;
+	uint16_t offset, dirty;
 
 	gen7_get_batch(sna, op);
 
 	binding_table = gen7_composite_get_binding_table(sna, &offset);
 
+	dirty = kgem_bo_is_dirty(op->dst.bo);
+
 	binding_table[0] =
 		gen7_bind_bo(sna,
 			     op->dst.bo, op->dst.width, op->dst.height,
@@ -2801,7 +2811,7 @@ gen7_emit_copy_state(struct sna *sna,
 	}
 
 	assert(!GEN7_READS_DST(op->u.gen7.flags));
-	gen7_emit_state(sna, op, offset);
+	gen7_emit_state(sna, op, offset | dirty);
 }
 
 static inline bool
@@ -3198,6 +3208,7 @@ fallback:
 static void
 gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op)
 {
+	uint16_t dirty;
 	uint32_t *binding_table;
 	uint16_t offset;
 
@@ -3211,6 +3222,8 @@ gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op)
 
 	binding_table = gen7_composite_get_binding_table(sna, &offset);
 
+	dirty = kgem_bo_is_dirty(op->dst.bo);
+
 	binding_table[0] =
 		gen7_bind_bo(sna,
 			     op->dst.bo, op->dst.width, op->dst.height,
@@ -3229,7 +3242,7 @@ gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op)
 		offset = sna->render_state.gen7.surface_table;
 	}
 
-	gen7_emit_state(sna, op, offset);
+	gen7_emit_state(sna, op, offset | dirty);
 }
 
 static bool


More information about the xorg-commit mailing list