[PATCH v2 1/2] etnaviv: implement handling for large number of clip rects in vr_op

Lucas Stach l.stach at pengutronix.de
Tue Dec 13 19:19:43 UTC 2016


Unlike de_op, vr_op had no way to deal with a large number of clip rects
which would make the draw operation overflow a single command stream
buffer.

Implement splitting the draw operation into multiple chunks, to be able
to submit them to the kernel in several pieces.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
v2:
- use MAX_BATCH_SIZE instead of DE high watermark
- get rid of mixed code and declaration waring
---
 etnaviv/etnaviv_op.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/etnaviv/etnaviv_op.c b/etnaviv/etnaviv_op.c
index 53d0c0547cb9..6bd03e24eeaa 100644
--- a/etnaviv/etnaviv_op.c
+++ b/etnaviv/etnaviv_op.c
@@ -424,7 +424,7 @@ void etnaviv_vr_op(struct etnaviv *etnaviv, struct etnaviv_vr_op *op,
 
 	etnaviv_set_dest_bo(etnaviv, &op->dst, op->cmd);
 
-	EL_START(etnaviv, 10 + 8 * n);
+	EL_START(etnaviv, 10);
 	EL(LOADSTATE(VIVS_DE_ALPHA_CONTROL, 1));
 	EL(VIVS_DE_ALPHA_CONTROL_ENABLE_OFF);
 
@@ -438,12 +438,18 @@ void etnaviv_vr_op(struct etnaviv *etnaviv, struct etnaviv_vr_op *op,
 	   VIVS_DE_VR_SOURCE_IMAGE_LOW_TOP(op->src_bounds.y1));
 	EL(VIVS_DE_VR_SOURCE_IMAGE_HIGH_RIGHT(op->src_bounds.x2) |
 	   VIVS_DE_VR_SOURCE_IMAGE_HIGH_BOTTOM(op->src_bounds.y2));
-	EL_ALIGN();
+	EL_END();
+	BATCH_SETUP_END(etnaviv);
 
 	while (n--) {
-		BoxRec box = *boxes++;
+		BoxRec box = *boxes;
 		uint32_t x, y;
 
+		if (8 > MAX_BATCH_SIZE - etnaviv->batch_size) {
+			etnaviv_emit(etnaviv);
+			BATCH_OP_START(etnaviv);
+		}
+
 		x = x1 + (box.x1 - dst->x1) * op->h_scale;
 		y = y1 + (box.y1 - dst->y1) * op->v_scale;
 
@@ -453,6 +459,7 @@ void etnaviv_vr_op(struct etnaviv *etnaviv, struct etnaviv_vr_op *op,
 		box.x2 += op->dst.offset.x;
 		box.y2 += op->dst.offset.y;
 
+		EL_START(etnaviv, 8);
 		/* 6 */
 		EL(LOADSTATE(VIVS_DE_VR_SOURCE_ORIGIN_LOW, 4));
 		EL(VIVS_DE_VR_SOURCE_ORIGIN_LOW_X(x));
@@ -466,8 +473,9 @@ void etnaviv_vr_op(struct etnaviv *etnaviv, struct etnaviv_vr_op *op,
 		/* 2 */
 		EL(LOADSTATE(VIVS_DE_VR_CONFIG, 1));
 		EL(op->vr_op);
+		EL_END();
+		boxes++;
 	}
-	EL_END();
 
 	etnaviv_emit(etnaviv);
 }
-- 
2.10.2



More information about the etnaviv mailing list