summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-01-08 13:40:22 -0500
committerRob Clark <[email protected]>2018-01-14 16:14:19 -0500
commit50f9a9aa960b6340b84aae2fa0e86e14c0e40fa8 (patch)
treee013be6838f1eb61654da32b9001c78f7114dbfa
parent39b63c18f1a838d57458ceb99ca58d3c0257c402 (diff)
freedreno/a5xx: work around SWAP vs TILE_MODE constraint
If the blit isn't changing format, but is changing tiling, just lie and call things ARGB (since the exact component order doesn't matter for a tiling blit). Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_blitter.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
index 6d4fa2c684c..6e8177d3444 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
@@ -93,6 +93,16 @@ can_do_blit(const struct pipe_blit_info *info)
if (!ok_format(info->src.format))
return false;
+ /* hw ignores {SRC,DST}_INFO.COLOR_SWAP if {SRC,DST}_INFO.TILE_MODE
+ * is set (not linear). We can kind of get around that when tiling/
+ * untiling by setting both src and dst COLOR_SWAP=WZYX, but that
+ * means the formats must match:
+ */
+ if ((fd_resource(info->dst.resource)->tile_mode ||
+ fd_resource(info->src.resource)->tile_mode) &&
+ info->dst.format != info->src.format)
+ return false;
+
/* until we figure out a few more registers: */
if ((info->dst.box.width != info->src.box.width) ||
(info->dst.box.height != info->src.box.height))
@@ -342,6 +352,16 @@ emit_blit(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
spitch = sslice->pitch * src->cpp;
dpitch = dslice->pitch * dst->cpp;
+ /* if dtile, then dswap ignored by hw, and likewise if stile then sswap
+ * ignored by hw.. but in this case we have already rejected the blit
+ * if src and dst formats differ, so juse use WZYX for both src and
+ * dst swap mode (so we don't change component order)
+ */
+ if (stile || dtile) {
+ debug_assert(info->src.format == info->dst.format);
+ sswap = dswap = WZYX;
+ }
+
sx1 = sbox->x;
sy1 = sbox->y;
sx2 = sbox->x + sbox->width - 1;