diff options
author | Jonathan Marek <[email protected]> | 2019-02-26 11:54:56 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2019-02-27 18:46:28 +0000 |
commit | 61e31886339b167bc85c48521664e456f0cfcf8e (patch) | |
tree | 123c1ba3e2ccdbc7926a3d9ab79ed01065c4e58c | |
parent | e3591b03393402321d24e10b93ec5a827a4b9b6a (diff) |
freedreno: catch failing fd_blit and fallback to software blit
Fixes cases where the fd_blit fails and never happens (ex: blit to etc1)
Signed-off-by: Jonathan Marek <[email protected]>
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_blitter.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_blitter.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_resource.c | 14 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.c b/src/gallium/drivers/freedreno/freedreno_blitter.c index f779f0fefb2..2687d1e426b 100644 --- a/src/gallium/drivers/freedreno/freedreno_blitter.c +++ b/src/gallium/drivers/freedreno/freedreno_blitter.c @@ -249,17 +249,17 @@ fd_blitter_clear(struct pipe_context *pctx, unsigned buffers, * Optimal hardware path for blitting pixels. * Scaling, format conversion, up- and downsampling (resolve) are allowed. */ -void +bool 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; if (info.render_condition_enable && !fd_render_condition_check(pctx)) - return; + return true; if (ctx->blit && ctx->blit(ctx, &info)) - return; + return true; if (info.mask & PIPE_MASK_S) { DBG("cannot blit stencil, skipping"); @@ -270,10 +270,10 @@ fd_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_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; } - fd_blitter_blit(ctx, &info); + return fd_blitter_blit(ctx, &info); } /** diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.h b/src/gallium/drivers/freedreno/freedreno_blitter.h index 1a58ad69959..669893961e8 100644 --- a/src/gallium/drivers/freedreno/freedreno_blitter.h +++ b/src/gallium/drivers/freedreno/freedreno_blitter.h @@ -45,6 +45,6 @@ void fd_resource_copy_region(struct pipe_context *pctx, unsigned src_level, const struct pipe_box *src_box); -void fd_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info); +bool fd_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info); #endif /* FREEDRENO_BLIT_H_ */ diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 144d725fdec..5635d8ffde7 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -126,10 +126,7 @@ 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: */ - pctx->blit(pctx, blit); - } else { + if (fallback || !fd_blit(pctx, blit)) { /* do blit on cpu: */ util_resource_copy_region(pctx, blit->dst.resource, blit->dst.level, blit->dst.box.x, @@ -1255,6 +1252,13 @@ fd_get_sample_position(struct pipe_context *context, pos_out[1] = ptr[sample_index][1] / 16.0f; } +static void +fd_blit_pipe(struct pipe_context *pctx, const struct pipe_blit_info *blit_info) +{ + /* wrap fd_blit to return void */ + fd_blit(pctx, blit_info); +} + void fd_resource_context_init(struct pipe_context *pctx) { @@ -1266,7 +1270,7 @@ fd_resource_context_init(struct pipe_context *pctx) pctx->create_surface = fd_create_surface; pctx->surface_destroy = fd_surface_destroy; pctx->resource_copy_region = fd_resource_copy_region; - pctx->blit = fd_blit; + pctx->blit = fd_blit_pipe; pctx->flush_resource = fd_flush_resource; pctx->invalidate_resource = fd_invalidate_resource; pctx->get_sample_position = fd_get_sample_position; |