diff options
author | Russell King <rmk@arm.linux.org.uk> | 2015-06-02 12:59:16 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2015-06-29 12:58:33 +0100 |
commit | 852797ab5ce277c74ffa3c8ace9c73f103777358 (patch) | |
tree | 1de31e8b52951665fdf28d9b507b35731c0e3079 | |
parent | b59f72c890fc8ac82b620d6e0ff38ce399abe7ad (diff) |
etnaviv: add support for multiple source origin modes
Add support for multiple source origin modes. When we setup the
source bo, we support:
* None - no source origin, absolute mode.
* Relative - relative top-left corner of source.
* Absolute - absolute top-left corner of source.
We treat None and Absolute the same, since we need the additional word
in the command stream for alignment anyway.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
-rw-r--r-- | etnaviv/etnaviv_accel.c | 7 | ||||
-rw-r--r-- | etnaviv/etnaviv_op.c | 10 | ||||
-rw-r--r-- | etnaviv/etnaviv_op.h | 8 |
3 files changed, 20 insertions, 5 deletions
diff --git a/etnaviv/etnaviv_accel.c b/etnaviv/etnaviv_accel.c index 1b06c37..3727a71 100644 --- a/etnaviv/etnaviv_accel.c +++ b/etnaviv/etnaviv_accel.c @@ -412,6 +412,7 @@ static void etnaviv_init_fill(struct etnaviv *etnaviv, { op->src = INIT_BLIT_NULL; op->blend_op = NULL; + op->src_origin_mode = SRC_ORIGIN_NONE; op->rop = etnaviv_fill_rop[pGC->alu]; op->brush = TRUE; op->fg_colour = etnaviv_fg_col(etnaviv, pGC); @@ -624,6 +625,7 @@ void etnaviv_accel_CopyNtoN(DrawablePtr pSrc, DrawablePtr pDst, /* Include the copy delta on the source */ op.src.offset.x += dx - op.dst.offset.x; op.src.offset.y += dy - op.dst.offset.y; + op.src_origin_mode = SRC_ORIGIN_RELATIVE; /* Calculate the overall extent */ extent.x1 = max_t(short, pDst->x, pSrc->x - dx); @@ -960,6 +962,7 @@ Bool etnaviv_accel_PolyFillRectTiled(DrawablePtr pDrawable, GCPtr pGC, int n, return FALSE; op.blend_op = NULL; + op.src_origin_mode = SRC_ORIGIN_RELATIVE; op.rop = etnaviv_copy_rop[pGC ? pGC->alu : GXcopy]; op.cmd = VIVS_DE_DEST_CONFIG_COMMAND_BIT_BLT; op.brush = FALSE; @@ -1164,6 +1167,7 @@ static Bool etnaviv_blend(struct etnaviv *etnaviv, const BoxRec *clip, struct etnaviv_de_op op = { .blend_op = blend, .clip = clip, + .src_origin_mode = SRC_ORIGIN_RELATIVE, .rop = 0xcc, .cmd = VIVS_DE_DEST_CONFIG_COMMAND_BIT_BLT, .brush = FALSE, @@ -1848,6 +1852,7 @@ int etnaviv_accel_Composite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, if (rc) { final_op.clip = RegionExtents(®ion); final_op.blend_op = &final_blend; + final_op.src_origin_mode = SRC_ORIGIN_RELATIVE; final_op.rop = 0xcc; final_op.cmd = VIVS_DE_DEST_CONFIG_COMMAND_BIT_BLT; final_op.brush = FALSE; @@ -1936,6 +1941,7 @@ Bool etnaviv_accel_Glyphs(CARD8 final_op, PicturePtr pSrc, PicturePtr pDst, op.dst = INIT_BLIT_PIX(vMask, vMask->pict_format, ZERO_OFFSET); op.blend_op = &etnaviv_composite_op[PictOpAdd]; op.clip = &box; + op.src_origin_mode = SRC_ORIGIN_RELATIVE; op.rop = 0xcc; op.cmd = VIVS_DE_DEST_CONFIG_COMMAND_BIT_BLT; op.brush = FALSE; @@ -2074,6 +2080,7 @@ void etnaviv_accel_glyph_upload(ScreenPtr pScreen, PicturePtr pDst, op.dst = INIT_BLIT_PIX(vdst, vdst->pict_format, dst_offset); op.blend_op = NULL; op.clip = &box; + op.src_origin_mode = SRC_ORIGIN_RELATIVE; op.rop = 0xcc; op.cmd = VIVS_DE_DEST_CONFIG_COMMAND_BIT_BLT; op.brush = FALSE; diff --git a/etnaviv/etnaviv_op.c b/etnaviv/etnaviv_op.c index e33122b..584375e 100644 --- a/etnaviv/etnaviv_op.c +++ b/etnaviv/etnaviv_op.c @@ -35,9 +35,10 @@ static inline uint32_t etnaviv_src_config(struct etnaviv_format fmt, } static void etnaviv_set_source_bo(struct etnaviv *etnaviv, - const struct etnaviv_blit_buf *buf) + const struct etnaviv_blit_buf *buf, unsigned int src_origin_mode) { - uint32_t src_cfg = etnaviv_src_config(buf->format, true); + uint32_t src_cfg = etnaviv_src_config(buf->format, src_origin_mode == + SRC_ORIGIN_RELATIVE); EMIT_LOADSTATE(etnaviv, VIVS_DE_SRC_ADDRESS, 5); EMIT_RELOC(etnaviv, buf->bo, 0, FALSE); @@ -154,7 +155,7 @@ void etnaviv_de_start(struct etnaviv *etnaviv, const struct etnaviv_de_op *op) BATCH_SETUP_START(etnaviv); if (op->src.bo) - etnaviv_set_source_bo(etnaviv, &op->src); + etnaviv_set_source_bo(etnaviv, &op->src, op->src_origin_mode); etnaviv_set_dest_bo(etnaviv, &op->dst, op->cmd); etnaviv_set_blend(etnaviv, op->blend_op); if (op->brush) @@ -171,7 +172,8 @@ void etnaviv_de_end(struct etnaviv *etnaviv) BoxRec box = { 0, 1, 1, 2 }; /* Append the GC320 workaround - 6 + 6 + 2 + 4 + 4 */ - etnaviv_set_source_bo(etnaviv, &etnaviv->gc320_wa_src); + etnaviv_set_source_bo(etnaviv, &etnaviv->gc320_wa_src, + SRC_ORIGIN_RELATIVE); etnaviv_set_dest_bo(etnaviv, &etnaviv->gc320_wa_dst, VIVS_DE_DEST_CONFIG_COMMAND_BIT_BLT); etnaviv_set_blend(etnaviv, NULL); diff --git a/etnaviv/etnaviv_op.h b/etnaviv/etnaviv_op.h index cdcd358..201191b 100644 --- a/etnaviv/etnaviv_op.h +++ b/etnaviv/etnaviv_op.h @@ -60,12 +60,18 @@ struct etnaviv_blit_buf { #define ZERO_OFFSET ((xPoint){ 0, 0 }) +#define SRC_ORIGIN_NONE 0 +#define SRC_ORIGIN_ABSOLUTE 1 +#define SRC_ORIGIN_RELATIVE 2 + struct etnaviv_de_op { struct etnaviv_blit_buf dst; struct etnaviv_blit_buf src; const struct etnaviv_blend_op *blend_op; const BoxRec *clip; - unsigned rop, cmd; + uint8_t src_origin_mode; + uint8_t rop; + unsigned cmd; Bool brush; uint32_t fg_colour; }; |