diff options
author | Russell King <rmk@arm.linux.org.uk> | 2015-06-20 11:17:25 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2015-06-29 12:58:37 +0100 |
commit | 153b76ab946fa4034ecc6339ca082a1ff7ca5377 (patch) | |
tree | f54a1a7e7315297f5127105d58e1b80c442353a1 | |
parent | 795d8cbefaf1fc2acad5ab860dd6bb3d10e3fb8a (diff) |
etnaviv: move box splitting into etnaviv_de_op()
Move the draw box splitting into etnaviv_de_op(), rather than
etnaviv_blit(). This allows us to calculate how many boxes we can fit
into the remainder of the batch buffer.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-rw-r--r-- | etnaviv/etnaviv_accel.c | 12 | ||||
-rw-r--r-- | etnaviv/etnaviv_op.c | 39 |
2 files changed, 27 insertions, 24 deletions
diff --git a/etnaviv/etnaviv_accel.c b/etnaviv/etnaviv_accel.c index 1a5c439..dab4522 100644 --- a/etnaviv/etnaviv_accel.c +++ b/etnaviv/etnaviv_accel.c @@ -117,17 +117,7 @@ static void etnaviv_blit_start(struct etnaviv *etnaviv, static void etnaviv_blit(struct etnaviv *etnaviv, const struct etnaviv_de_op *op, const BoxRec *pBox, size_t nBox) { - while (nBox) { - size_t n = nBox; - - if (n > VIVANTE_MAX_2D_RECTS) - n = VIVANTE_MAX_2D_RECTS; - - etnaviv_de_op(etnaviv, op, pBox, n); - - pBox += n; - nBox -= n; - } + etnaviv_de_op(etnaviv, op, pBox, nBox); } static void etnaviv_blit_clipped(struct etnaviv *etnaviv, diff --git a/etnaviv/etnaviv_op.c b/etnaviv/etnaviv_op.c index e831466..9ef6b33 100644 --- a/etnaviv/etnaviv_op.c +++ b/etnaviv/etnaviv_op.c @@ -234,7 +234,6 @@ void etnaviv_de_op(struct etnaviv *etnaviv, const struct etnaviv_de_op *op, { unsigned int high_wm = etnaviv->batch_de_high_watermark; - assert(nBox <= VIVANTE_MAX_2D_RECTS); assert(nBox); if (op->cmd == VIVS_DE_DEST_CONFIG_COMMAND_BIT_BLT && @@ -258,21 +257,35 @@ void etnaviv_de_op(struct etnaviv *etnaviv, const struct etnaviv_de_op *op, EMIT(etnaviv, 0); } } else { - unsigned int remaining = high_wm - etnaviv->batch_size; + unsigned int n; - if (etnaviv_size_2d_draw(etnaviv, nBox) + 6 > remaining) { - etnaviv_de_end(etnaviv); - BATCH_OP_START(etnaviv); - } + do { + unsigned int remaining = high_wm - etnaviv->batch_size; + + if (remaining <= 8) { + etnaviv_de_end(etnaviv); + BATCH_OP_START(etnaviv); + continue; + } + + n = (remaining - 8) / 2; + if (n > VIVANTE_MAX_2D_RECTS) + n = VIVANTE_MAX_2D_RECTS; + if (n > nBox) + n = nBox; + + etnaviv_emit_2d_draw(etnaviv, pBox, n, op->dst.offset); - etnaviv_emit_2d_draw(etnaviv, pBox, nBox, op->dst.offset); + pBox += n; + nBox -= n; - EMIT_LOADSTATE(etnaviv, 4, 1); - EMIT(etnaviv, 0); - EMIT_LOADSTATE(etnaviv, 4, 1); - EMIT(etnaviv, 0); - EMIT_LOADSTATE(etnaviv, 4, 1); - EMIT(etnaviv, 0); + EMIT_LOADSTATE(etnaviv, 4, 1); + EMIT(etnaviv, 0); + EMIT_LOADSTATE(etnaviv, 4, 1); + EMIT(etnaviv, 0); + EMIT_LOADSTATE(etnaviv, 4, 1); + EMIT(etnaviv, 0); + } while (nBox); } } |