etnaviv: support for using generic blit path
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1641>
This commit is contained in:
parent
b043c40edd
commit
709f26c47d
|
@ -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;
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue