freedreno: add a fd_resource_pitch helper
[mesa.git] / src / gallium / drivers / freedreno / a5xx / fd5_blitter.c
index cffcae86a8b7d87dd9cbd10875a0721cc68c1a0c..9bcfa7af82bc672096b79514ed64c11f4f169248 100644 (file)
@@ -72,7 +72,7 @@ ok_format(enum pipe_format fmt)
                break;
        }
 
-       if (fd5_pipe2color(fmt) == ~0)
+       if (fd5_pipe2color(fmt) == RB5_NONE)
                return false;
 
        return true;
@@ -289,7 +289,7 @@ emit_blit_buffer(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
                OUT_RING(ring, A5XX_RB_2D_DST_INFO_COLOR_FORMAT(RB5_R8_UNORM) |
                                A5XX_RB_2D_DST_INFO_TILE_MODE(TILE5_LINEAR) |
                                A5XX_RB_2D_DST_INFO_COLOR_SWAP(WZYX));
-               OUT_RELOCW(ring, dst->bo, doff, 0, 0);   /* RB_2D_DST_LO/HI */
+               OUT_RELOC(ring, dst->bo, doff, 0, 0);   /* RB_2D_DST_LO/HI */
                OUT_RING(ring, A5XX_RB_2D_DST_SIZE_PITCH(p) |
                                A5XX_RB_2D_DST_SIZE_ARRAY_PITCH(128));
                OUT_RING(ring, 0x00000000);
@@ -348,8 +348,8 @@ emit_blit(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
        sswap = fd5_pipe2swap(info->src.format);
        dswap = fd5_pipe2swap(info->dst.format);
 
-       spitch = sslice->pitch * src->layout.cpp;
-       dpitch = dslice->pitch * dst->layout.cpp;
+       spitch = fd_resource_pitch(src, info->src.level);
+       dpitch = fd_resource_pitch(dst, info->dst.level);
 
        /* 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
@@ -419,7 +419,7 @@ emit_blit(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
                OUT_RING(ring, A5XX_RB_2D_DST_INFO_COLOR_FORMAT(dfmt) |
                                A5XX_RB_2D_DST_INFO_TILE_MODE(dtile) |
                                A5XX_RB_2D_DST_INFO_COLOR_SWAP(dswap));
-               OUT_RELOCW(ring, dst->bo, doff, 0, 0);   /* RB_2D_DST_LO/HI */
+               OUT_RELOC(ring, dst->bo, doff, 0, 0);   /* RB_2D_DST_LO/HI */
                OUT_RING(ring, A5XX_RB_2D_DST_SIZE_PITCH(dpitch) |
                                A5XX_RB_2D_DST_SIZE_ARRAY_PITCH(dsize));
                OUT_RING(ring, 0x00000000);