summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-06-18 15:46:53 -0700
committerEric Anholt <[email protected]>2018-06-19 09:42:20 -0700
commitda0115b1c37e263773fb56dc28fbd22eb0f66811 (patch)
treedccbf3f277a313253f78d4887892c7c4af84bbc3 /src
parent07b243674f2358e3e291864062068d1fb049f736 (diff)
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.*
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/v3d/v3d_blit.c36
1 files changed, 36 insertions, 0 deletions
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;
}