mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 01:38:06 +02:00
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 <jonathan@marek.ca>
This commit is contained in:
parent
e3591b0339
commit
61e3188633
3 changed files with 15 additions and 11 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue