[PATCH 3/7] etnaviv: implement handling for large number of clip rects in vr_op

Lucas Stach l.stach at pengutronix.de
Tue Nov 22 11:44:16 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>
---
 etnaviv/etnaviv_op.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/etnaviv/etnaviv_op.c b/etnaviv/etnaviv_op.c
index 838438a7c740..e8f87ef73e81 100644
--- a/etnaviv/etnaviv_op.c
+++ b/etnaviv/etnaviv_op.c
@@ -419,7 +419,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);
 
@@ -433,9 +433,15 @@ 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--) {
+		unsigned int high_wm = etnaviv->batch_de_high_watermark;
+		if (8 > high_wm - etnaviv->batch_size) {
+			etnaviv_emit(etnaviv);
+			BATCH_OP_START(etnaviv);
+		}
 		BoxRec box = *boxes++;
 		uint32_t x, y;
 
@@ -448,6 +454,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));
@@ -461,8 +468,8 @@ 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();
 	}
-	EL_END();
 
 	etnaviv_emit(etnaviv);
 }
-- 
2.10.2



More information about the etnaviv mailing list