summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2019-08-11 14:03:13 +0200
committerMarge Bot <[email protected]>2020-04-24 13:51:28 +0000
commit709f26c47df758cd3d3952c5a9edc40053ffded9 (patch)
tree67ac5faa7f57ebec6ab052bedbb136fc465f757d /src/gallium/drivers/etnaviv
parentb043c40edd36f9fc1d84dcfb3ab1c2b8de5a6035 (diff)
etnaviv: support for using generic blit path
Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Jonathan Marek <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1641>
Diffstat (limited to 'src/gallium/drivers/etnaviv')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_blt.c40
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_clear_blit.c29
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_context.h2
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_rs.c39
4 files changed, 51 insertions, 59 deletions
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
@@ -94,6 +94,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,
unsigned dsty, unsigned width, unsigned height,
@@ -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;
}