aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_blitter.c7
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_blitter.h2
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_blitter.c2
-rw-r--r--src/gallium/drivers/freedreno/freedreno_blitter.c17
-rw-r--r--src/gallium/drivers/freedreno/freedreno_blitter.h2
-rw-r--r--src/gallium/drivers/freedreno/freedreno_context.c3
-rw-r--r--src/gallium/drivers/freedreno/freedreno_context.h2
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c21
8 files changed, 29 insertions, 27 deletions
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
index 09ff2b71ecc..0cfe92ac22f 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
@@ -449,14 +449,13 @@ emit_blit(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
}
}
-void
+bool
fd5_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
{
struct fd_batch *batch;
if (!can_do_blit(info)) {
- fd_blitter_blit(ctx, info);
- return;
+ return false;
}
batch = fd_bc_alloc_batch(&ctx->screen->batch_cache, ctx, true);
@@ -482,6 +481,8 @@ fd5_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
batch->needs_flush = true;
fd_batch_flush(batch, false, false);
+
+ return true;
}
unsigned
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.h b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.h
index b03c77eb1ab..69a071cd223 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.h
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.h
@@ -31,7 +31,7 @@
#include "freedreno_context.h"
-void fd5_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info);
+bool fd5_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info);
unsigned fd5_tile_mode(const struct pipe_resource *tmpl);
#endif /* FD5_BLIT_H_ */
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
index 97e015d19eb..e1635966f21 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
@@ -562,9 +562,7 @@ fd6_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
struct fd_context *ctx = fd_context(pctx);
if (!can_do_blit(info)) {
- fd_blitter_pipe_begin(ctx, info->render_condition_enable, false, FD_STAGE_BLIT);
fd_blitter_blit(ctx, info);
- fd_blitter_pipe_end(ctx);
return;
}
diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.c b/src/gallium/drivers/freedreno/freedreno_blitter.c
index f1ed5381bfc..5c480757772 100644
--- a/src/gallium/drivers/freedreno/freedreno_blitter.c
+++ b/src/gallium/drivers/freedreno/freedreno_blitter.c
@@ -82,7 +82,7 @@ default_src_texture(struct pipe_sampler_view *src_templ,
src_templ->swizzle_a = PIPE_SWIZZLE_W;
}
-void
+bool
fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
{
struct pipe_resource *dst = info->dst.resource;
@@ -90,6 +90,16 @@ fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
struct pipe_context *pipe = &ctx->base;
struct pipe_surface *dst_view, dst_templ;
struct pipe_sampler_view src_templ, *src_view;
+ bool discard = false;
+
+ if (!info->scissor_enable && !info->alpha_blend) {
+ discard = util_texrange_covers_whole_level(info->dst.resource,
+ info->dst.level, info->dst.box.x, info->dst.box.y,
+ info->dst.box.z, info->dst.box.width,
+ info->dst.box.height, info->dst.box.depth);
+ }
+
+ fd_blitter_pipe_begin(ctx, info->render_condition_enable, discard, FD_STAGE_BLIT);
/* Initialize the surface. */
default_dst_texture(&dst_templ, dst, info->dst.level,
@@ -111,6 +121,11 @@ fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);
+
+ fd_blitter_pipe_end(ctx);
+
+ /* The fallback blitter must never fail: */
+ return true;
}
/**
diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.h b/src/gallium/drivers/freedreno/freedreno_blitter.h
index 1fe85a840a6..70f71fcb667 100644
--- a/src/gallium/drivers/freedreno/freedreno_blitter.h
+++ b/src/gallium/drivers/freedreno/freedreno_blitter.h
@@ -31,7 +31,7 @@
#include "freedreno_context.h"
-void fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info);
+bool fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info);
void fd_resource_copy_region(struct pipe_context *pctx,
struct pipe_resource *dst,
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index a08acea7a48..6c01c15bb32 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -333,9 +333,6 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
slab_create_child(&ctx->transfer_pool, &screen->transfer_pool);
- if (!ctx->blit)
- ctx->blit = fd_blitter_blit;
-
fd_draw_init(pctx);
fd_resource_context_init(pctx);
fd_query_context_init(pctx);
diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index 3a03845b4ab..f44738fc398 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -343,7 +343,7 @@ struct fd_context {
void (*query_set_stage)(struct fd_batch *batch, enum fd_render_stage stage);
/* blitter: */
- void (*blit)(struct fd_context *ctx, const struct pipe_blit_info *info);
+ bool (*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,
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 482ce949595..f1e439b7133 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -122,15 +122,15 @@ realloc_bo(struct fd_resource *rsc, uint32_t size)
static void
do_blit(struct fd_context *ctx, const struct pipe_blit_info *blit, bool fallback)
{
+ struct pipe_context *pctx = &ctx->base;
+
/* TODO size threshold too?? */
if (!fallback) {
/* do blit on gpu: */
- fd_blitter_pipe_begin(ctx, false, true, FD_STAGE_BLIT);
- ctx->blit(ctx, blit);
- fd_blitter_pipe_end(ctx);
+ pctx->blit(pctx, blit);
} else {
/* do blit on cpu: */
- util_resource_copy_region(&ctx->base,
+ util_resource_copy_region(pctx,
blit->dst.resource, blit->dst.level, blit->dst.box.x,
blit->dst.box.y, blit->dst.box.z,
blit->src.resource, blit->src.level, &blit->src.box);
@@ -975,18 +975,10 @@ fd_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
{
struct fd_context *ctx = fd_context(pctx);
struct pipe_blit_info info = *blit_info;
- bool discard = false;
if (info.render_condition_enable && !fd_render_condition_check(pctx))
return;
- if (!info.scissor_enable && !info.alpha_blend) {
- discard = util_texrange_covers_whole_level(info.dst.resource,
- info.dst.level, info.dst.box.x, info.dst.box.y,
- info.dst.box.z, info.dst.box.width,
- info.dst.box.height, info.dst.box.depth);
- }
-
if (util_try_blit_via_copy_region(pctx, &info)) {
return; /* done */
}
@@ -1003,9 +995,8 @@ fd_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
return;
}
- fd_blitter_pipe_begin(ctx, info.render_condition_enable, discard, FD_STAGE_BLIT);
- ctx->blit(ctx, &info);
- fd_blitter_pipe_end(ctx);
+ if (!(ctx->blit && ctx->blit(ctx, &info)))
+ fd_blitter_blit(ctx, &info);
}
void