From: Christian Gmeiner Date: Sun, 11 Aug 2019 12:03:13 +0000 (+0200) Subject: etnaviv: support for using generic blit path X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=709f26c47df758cd3d3952c5a9edc40053ffded9;p=mesa.git etnaviv: support for using generic blit path Signed-off-by: Christian Gmeiner Reviewed-by: Jonathan Marek Part-of: --- diff --git a/src/gallium/drivers/etnaviv/etnaviv_blt.c b/src/gallium/drivers/etnaviv/etnaviv_blt.c index 81217918d3b..225d2a7c243 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_blt.c +++ b/src/gallium/drivers/etnaviv/etnaviv_blt.c @@ -531,46 +531,26 @@ etna_try_blt_blit(struct pipe_context *pctx, return true; } -static void +static bool etna_blit_blt(struct pipe_context *pctx, const struct pipe_blit_info *blit_info) { - struct etna_context *ctx = etna_context(pctx); - struct pipe_blit_info info = *blit_info; - - if (info.src.resource->nr_samples > 1 && - info.dst.resource->nr_samples <= 1 && - !util_format_is_depth_or_stencil(info.src.resource->format) && - !util_format_is_pure_integer(info.src.resource->format)) { + if (blit_info->src.resource->nr_samples > 1 && + blit_info->dst.resource->nr_samples <= 1 && + !util_format_is_depth_or_stencil(blit_info->src.resource->format) && + !util_format_is_pure_integer(blit_info->src.resource->format)) { DBG("color resolve unimplemented"); - return; - } - - if (etna_try_blt_blit(pctx, blit_info)) - return; - - if (util_try_blit_via_copy_region(pctx, blit_info)) - return; - - if (info.mask & PIPE_MASK_S) { - DBG("cannot blit stencil, skipping"); - info.mask &= ~PIPE_MASK_S; - } - - if (!util_blitter_is_blit_supported(ctx->blitter, &info)) { - DBG("blit unsupported %s -> %s", - util_format_short_name(info.src.resource->format), - util_format_short_name(info.dst.resource->format)); - return; + return false; } - etna_blit_save_state(ctx); - util_blitter_blit(ctx->blitter, &info); + return etna_try_blt_blit(pctx, blit_info); } void etna_clear_blit_blt_init(struct pipe_context *pctx) { + struct etna_context *ctx = etna_context(pctx); + DBG("etnaviv: Using BLT blit engine"); pctx->clear = etna_clear_blt; - pctx->blit = etna_blit_blt; + ctx->blit = etna_blit_blt; } diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c index 3619ea5bb77..7b0da00c6b1 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c @@ -93,6 +93,34 @@ etna_clear_blit_pack_rgba(enum pipe_format format, const union pipe_color_union } } +static void +etna_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info) +{ + struct etna_context *ctx = etna_context(pctx); + struct pipe_blit_info info = *blit_info; + + if (ctx->blit(pctx, &info)) + return; + + if (util_try_blit_via_copy_region(pctx, &info)) + return; + + if (info.mask & PIPE_MASK_S) { + DBG("cannot blit stencil, skipping"); + info.mask &= ~PIPE_MASK_S; + } + + if (!util_blitter_is_blit_supported(ctx->blitter, &info)) { + DBG("blit unsupported %s -> %s", + util_format_short_name(info.src.resource->format), + util_format_short_name(info.dst.resource->format)); + return; + } + + etna_blit_save_state(ctx); + util_blitter_blit(ctx->blitter, &info); +} + static void etna_clear_render_target(struct pipe_context *pctx, struct pipe_surface *dst, const union pipe_color_union *color, unsigned dstx, @@ -238,6 +266,7 @@ etna_clear_blit_init(struct pipe_context *pctx) struct etna_context *ctx = etna_context(pctx); struct etna_screen *screen = ctx->screen; + pctx->blit = etna_blit; pctx->clear_render_target = etna_clear_render_target; pctx->clear_depth_stencil = etna_clear_depth_stencil; pctx->resource_copy_region = etna_resource_copy_region; diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h index b115e737771..4f489a10877 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.h +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h @@ -113,6 +113,8 @@ struct etna_context { void (*emit_texture_state)(struct etna_context *pctx); /* Get sampler TS pointer for sampler view */ struct etna_sampler_ts *(*ts_for_sampler_view)(struct pipe_sampler_view *pview); + /* GPU-specific blit implementation */ + bool (*blit)(struct pipe_context *pipe, const struct pipe_blit_info *info); struct etna_screen *screen; struct etna_cmd_stream *stream; diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c b/src/gallium/drivers/etnaviv/etnaviv_rs.c index aa3563a7da9..47ba585e304 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_rs.c +++ b/src/gallium/drivers/etnaviv/etnaviv_rs.c @@ -803,7 +803,7 @@ manual: return false; } -static void +static bool etna_blit_rs(struct pipe_context *pctx, const struct pipe_blit_info *blit_info) { /* This is a more extended version of resource_copy_region */ @@ -820,43 +820,24 @@ etna_blit_rs(struct pipe_context *pctx, const struct pipe_blit_info *blit_info) * * For the rest, fall back to util_blitter * XXX this goes wrong when source surface is supertiled. */ - struct etna_context *ctx = etna_context(pctx); - struct pipe_blit_info info = *blit_info; - if (info.src.resource->nr_samples > 1 && - info.dst.resource->nr_samples <= 1 && - !util_format_is_depth_or_stencil(info.src.resource->format) && - !util_format_is_pure_integer(info.src.resource->format)) { + if (blit_info->src.resource->nr_samples > 1 && + blit_info->dst.resource->nr_samples <= 1 && + !util_format_is_depth_or_stencil(blit_info->src.resource->format) && + !util_format_is_pure_integer(blit_info->src.resource->format)) { DBG("color resolve unimplemented"); - return; - } - - if (etna_try_rs_blit(pctx, blit_info)) - return; - - if (util_try_blit_via_copy_region(pctx, blit_info)) - return; - - if (info.mask & PIPE_MASK_S) { - DBG("cannot blit stencil, skipping"); - info.mask &= ~PIPE_MASK_S; - } - - if (!util_blitter_is_blit_supported(ctx->blitter, &info)) { - DBG("blit unsupported %s -> %s", - util_format_short_name(info.src.resource->format), - util_format_short_name(info.dst.resource->format)); - return; + return false; } - etna_blit_save_state(ctx); - util_blitter_blit(ctx->blitter, &info); + return etna_try_rs_blit(pctx, blit_info); } void etna_clear_blit_rs_init(struct pipe_context *pctx) { + struct etna_context *ctx = etna_context(pctx); + DBG("etnaviv: Using RS blit engine"); pctx->clear = etna_clear_rs; - pctx->blit = etna_blit_rs; + ctx->blit = etna_blit_rs; }