freedreno/a6xx: rework blitter API

Switch over to using fd_context::blit(), in the same way that a5xx does.
The previous patch wires fd_resource_copy_region() up to the blitter so
a6xx no longer needs to bypass the core layer to accelerate this.

Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
Rob Clark 2019-01-02 11:06:11 -05:00
parent 53b8eb78d5
commit 2fc17e16a3

View file

@ -512,12 +512,11 @@ emit_blit_texture(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
}
static void
emit_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
emit_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
{
struct fd_context *ctx = fd_context(pctx);
struct fd_batch *batch;
fd_fence_ref(pctx->screen, &ctx->last_fence, NULL);
fd_fence_ref(ctx->base.screen, &ctx->last_fence, NULL);
batch = fd_bc_alloc_batch(&ctx->screen->batch_cache, ctx, true);
@ -556,60 +555,16 @@ emit_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
fd_batch_reference(&batch, NULL);
}
static void
fd6_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
static bool
fd6_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
{
struct fd_context *ctx = fd_context(pctx);
if (!can_do_blit(info)) {
fd_blitter_blit(ctx, info);
return;
return false;
}
emit_blit(pctx, info);
}
emit_blit(ctx, info);
static void
fd6_resource_copy_region(struct pipe_context *pctx,
struct pipe_resource *dst,
unsigned dst_level,
unsigned dstx, unsigned dsty, unsigned dstz,
struct pipe_resource *src,
unsigned src_level,
const struct pipe_box *src_box)
{
struct pipe_blit_info info;
debug_assert(src->format == dst->format);
memset(&info, 0, sizeof info);
info.dst.resource = dst;
info.dst.level = dst_level;
info.dst.box.x = dstx;
info.dst.box.y = dsty;
info.dst.box.z = dstz;
info.dst.box.width = src_box->width;
info.dst.box.height = src_box->height;
assert(info.dst.box.width >= 0);
assert(info.dst.box.height >= 0);
info.dst.box.depth = 1;
info.dst.format = dst->format;
info.src.resource = src;
info.src.level = src_level;
info.src.box = *src_box;
info.src.format = src->format;
info.mask = util_format_get_mask(src->format);
info.filter = PIPE_TEX_FILTER_NEAREST;
info.scissor_enable = 0;
if (!can_do_blit(&info)) {
fd_resource_copy_region(pctx,
dst, dst_level, dstx, dsty, dstz,
src, src_level, src_box);
return;
}
emit_blit(pctx, &info);
return true;
}
void
@ -618,8 +573,7 @@ fd6_blitter_init(struct pipe_context *pctx)
if (fd_mesa_debug & FD_DBG_NOBLIT)
return;
pctx->resource_copy_region = fd6_resource_copy_region;
pctx->blit = fd6_blit;
fd_context(pctx)->blit = fd6_blit;
}
unsigned