From da0115b1c37e263773fb56dc28fbd22eb0f66811 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 18 Jun 2018 15:46:53 -0700 Subject: [PATCH] v3d: Fix blitting from a linear winsys BO. This is the case for the simulator environment, and broke many blitter tests by trying to texture from linear while the HW can only actually do UIF/UBLINEAR/LT. Just make a temporary and copy into it with the CPU, then blit from that. This is the kind of path that should use the TFU, but I haven't exposed that hardware yet. Fixes dEQP-GLES3.functional.fbo.blit.default_framebuffer.* --- src/gallium/drivers/v3d/v3d_blit.c | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/gallium/drivers/v3d/v3d_blit.c b/src/gallium/drivers/v3d/v3d_blit.c index 6e609fbe3cb..1a0406a6ed9 100644 --- a/src/gallium/drivers/v3d/v3d_blit.c +++ b/src/gallium/drivers/v3d/v3d_blit.c @@ -195,6 +195,40 @@ static bool v3d_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info) { struct v3d_context *v3d = v3d_context(ctx); + struct v3d_resource *src = v3d_resource(info->src.resource); + struct pipe_resource *tiled = NULL; + + if (!src->tiled) { + struct pipe_box box = { + .x = 0, + .y = 0, + .width = u_minify(info->src.resource->width0, + info->src.level), + .height = u_minify(info->src.resource->height0, + info->src.level), + .depth = 1, + }; + struct pipe_resource tmpl = { + .target = info->src.resource->target, + .format = info->src.resource->format, + .width0 = box.width, + .height0 = box.height, + .depth0 = 1, + .array_size = 1, + }; + tiled = ctx->screen->resource_create(ctx->screen, &tmpl); + if (!tiled) { + fprintf(stderr, "Failed to create tiled blit temp\n"); + return false; + } + ctx->resource_copy_region(ctx, + tiled, 0, + 0, 0, 0, + info->src.resource, info->src.level, + &box); + info->src.level = 0; + info->src.resource = tiled; + } if (!util_blitter_is_blit_supported(v3d->blitter, info)) { fprintf(stderr, "blit unsupported %s -> %s\n", @@ -206,6 +240,8 @@ v3d_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info) v3d_blitter_save(v3d); util_blitter_blit(v3d->blitter, info); + pipe_resource_reference(&tiled, NULL); + return true; } -- 2.30.2