__OUT_IB(ring, true, target);
}
+static void
+fd4_mem_to_mem(struct fd_ringbuffer *ring, struct pipe_resource *dst,
+ unsigned dst_off, struct pipe_resource *src, unsigned src_off,
+ unsigned sizedwords)
+{
+ struct fd_bo *src_bo = fd_resource(src)->bo;
+ struct fd_bo *dst_bo = fd_resource(dst)->bo;
+ unsigned i;
+
+ for (i = 0; i < sizedwords; i++) {
+ OUT_PKT3(ring, CP_MEM_TO_MEM, 3);
+ OUT_RING(ring, 0x00000000);
+ OUT_RELOCW(ring, dst_bo, dst_off, 0, 0);
+ OUT_RELOC (ring, src_bo, src_off, 0, 0);
+
+ dst_off += 4;
+ src_off += 4;
+ }
+}
+
void
fd4_emit_init(struct pipe_context *pctx)
{
ctx->emit_const = fd4_emit_const;
ctx->emit_const_bo = fd4_emit_const_bo;
ctx->emit_ib = fd4_emit_ib;
+ ctx->mem_to_mem = fd4_mem_to_mem;
}
__OUT_IB5(ring, target);
}
+static void
+fd5_mem_to_mem(struct fd_ringbuffer *ring, struct pipe_resource *dst,
+ unsigned dst_off, struct pipe_resource *src, unsigned src_off,
+ unsigned sizedwords)
+{
+ struct fd_bo *src_bo = fd_resource(src)->bo;
+ struct fd_bo *dst_bo = fd_resource(dst)->bo;
+ unsigned i;
+
+ for (i = 0; i < sizedwords; i++) {
+ OUT_PKT7(ring, CP_MEM_TO_MEM, 5);
+ OUT_RING(ring, 0x00000000);
+ OUT_RELOCW(ring, dst_bo, dst_off, 0, 0);
+ OUT_RELOC (ring, src_bo, src_off, 0, 0);
+
+ dst_off += 4;
+ src_off += 4;
+ }
+}
+
void
fd5_emit_init(struct pipe_context *pctx)
{
ctx->emit_const = fd5_emit_const;
ctx->emit_const_bo = fd5_emit_const_bo;
ctx->emit_ib = fd5_emit_ib;
+ ctx->mem_to_mem = fd5_mem_to_mem;
}
/* blit: */
void (*blit)(struct fd_context *ctx, const struct pipe_blit_info *info);
+ /* simple gpu "memcpy": */
+ void (*mem_to_mem)(struct fd_ringbuffer *ring, struct pipe_resource *dst,
+ unsigned dst_off, struct pipe_resource *src, unsigned src_off,
+ unsigned sizedwords);
+
/*
* Common pre-cooked VBO state (used for a3xx and later):
*/
0x1000);
indirect_offset = 0;
- if (is_a5xx(ctx->screen)) {
- struct fd_bo *src = fd_resource(info->indirect)->bo;
- struct fd_bo *dst = fd_resource(indirect)->bo;
- for (unsigned i = 0; i < 3; i++) {
- unsigned dst_off = i * 4;
- unsigned src_off = (i * 4) + info->indirect_offset;
- OUT_PKT7(ring, CP_MEM_TO_MEM, 5);
- OUT_RING(ring, 0x00000000);
- OUT_RELOCW(ring, dst, dst_off, 0, 0);
- OUT_RELOC (ring, src, src_off, 0, 0);
- }
- } else {
- assert(0);
- }
+ ctx->mem_to_mem(ring, indirect, 0, info->indirect,
+ info->indirect_offset, 3);
} else {
pipe_resource_reference(&indirect, info->indirect);
indirect_offset = info->indirect_offset;