diff options
author | Russell King <rmk@arm.linux.org.uk> | 2015-12-02 11:12:28 +0000 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2015-12-02 12:38:01 +0000 |
commit | ae1e60b2186cc509bb367e0cd0409ff011508629 (patch) | |
tree | f0abff5efb40b1c7060d6c860bdc77f376b1d0c9 | |
parent | 70634ef7fd56966c13f97ca5275d1d718360fec6 (diff) |
etnaviv: add some further emit helpers
Add some further emit helpers to prepare to move to a more efficient
command stream generation scheme.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-rw-r--r-- | etnaviv/etnaviv_op.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/etnaviv/etnaviv_op.c b/etnaviv/etnaviv_op.c index b65ee5e..5612c23 100644 --- a/etnaviv/etnaviv_op.c +++ b/etnaviv/etnaviv_op.c @@ -13,6 +13,15 @@ #include <etnaviv/state.xml.h> #include <etnaviv/state_2d.xml.h> +#define LOADSTATE(st, num) \ + (VIV_FE_LOAD_STATE_HEADER_OP_LOAD_STATE | \ + VIV_FE_LOAD_STATE_HEADER_COUNT(num) | \ + VIV_FE_LOAD_STATE_HEADER_OFFSET((st) >> 2)) + +#define DRAW2D(count) \ + (VIV_FE_DRAW_2D_HEADER_OP_DRAW_2D | \ + VIV_FE_DRAW_2D_HEADER_COUNT(count)) + #define BATCH_SETUP_START(etp) \ do { \ struct etnaviv *_et = etp; \ @@ -45,10 +54,7 @@ #define EMIT_RELOC(etp, _bo, _off, _wr) \ do { \ struct etnaviv *__et = etp; \ - struct etnaviv_reloc *r = &__et->reloc[__et->reloc_size++]; \ - r->bo = _bo; \ - r->batch_index = __et->batch_size; \ - r->write = _wr; \ + etnaviv_add_reloc(__et, _bo, _wr, __et->batch_size); \ EMIT(__et, _off); \ } while (0) @@ -56,17 +62,14 @@ do { \ struct etnaviv *__et = etp; \ assert(!(__et->batch_size & 1)); \ - EMIT(__et, VIV_FE_LOAD_STATE_HEADER_OP_LOAD_STATE | \ - VIV_FE_LOAD_STATE_HEADER_COUNT(num) | \ - VIV_FE_LOAD_STATE_HEADER_OFFSET((st) >> 2)); \ + EMIT(__et, LOADSTATE(st, num)); \ } while (0) #define EMIT_DRAW_2D(etp, count) \ do { \ struct etnaviv *__et = etp; \ assert(!(__et->batch_size & 1)); \ - EMIT(__et, VIV_FE_DRAW_2D_HEADER_OP_DRAW_2D | \ - VIV_FE_DRAW_2D_HEADER_COUNT(count)); \ + EMIT(__et, DRAW2D(count)); \ /* next word is unused */ \ __et->batch_size ++; \ } while (0) @@ -94,6 +97,16 @@ __et->batch_size += __et->batch_size & 1; \ } while (0) +static void etnaviv_add_reloc(struct etnaviv *etnaviv, struct etna_bo *bo, + int write, unsigned int batch_index) +{ + struct etnaviv_reloc *r = &etnaviv->reloc[etnaviv->reloc_size++]; + + r->bo = bo; + r->batch_index = batch_index; + r->write = write; +} + static inline uint32_t etnaviv_src_config(struct etnaviv_format fmt, Bool relative) { |