summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_blit.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-11-21 19:26:54 -0800
committerEric Anholt <[email protected]>2015-12-04 09:10:53 -0800
commit3a508a0d94d020d9cd95f8882e9393d83ffac377 (patch)
treef42000fd419a962e3129a08031aa3ee013adda89 /src/gallium/drivers/vc4/vc4_blit.c
parenta664233042e1ad343184a0c237c3bd7ac5010779 (diff)
vc4: Fix up tile alignment checks for blitting using just an RCL.
We were checking that the blit started at 0 and was 1:1, but not that it went to the full width of the surface, or that the width was aligned to a tile. We then told it to blit to the full width/height of the surface, causing contents to be stomped in a bunch of MSAA tests that happen to include half-screen-width blits to 0,0.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_blit.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_blit.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/gallium/drivers/vc4/vc4_blit.c b/src/gallium/drivers/vc4/vc4_blit.c
index e52a1941730..d5839c58199 100644
--- a/src/gallium/drivers/vc4/vc4_blit.c
+++ b/src/gallium/drivers/vc4/vc4_blit.c
@@ -42,9 +42,17 @@ vc4_get_blit_surface(struct pipe_context *pctx,
}
static bool
+is_tile_unaligned(unsigned size, unsigned tile_size)
+{
+ return size & (tile_size - 1);
+}
+
+static bool
vc4_tile_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
{
struct vc4_context *vc4 = vc4_context(pctx);
+ int tile_width = 64;
+ int tile_height = 64;
if (util_format_is_depth_or_stencil(info->dst.resource->format))
return false;
@@ -52,13 +60,20 @@ vc4_tile_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
if ((info->mask & PIPE_MASK_RGBA) == 0)
return false;
- if (info->dst.box.x != 0 || info->dst.box.y != 0 ||
- info->src.box.x != 0 || info->src.box.y != 0 ||
+ if (info->dst.box.x != info->src.box.x ||
+ info->src.box.y != info->src.box.y ||
info->dst.box.width != info->src.box.width ||
info->dst.box.height != info->src.box.height) {
return false;
}
+ if (is_tile_unaligned(info->dst.box.x, tile_width) ||
+ is_tile_unaligned(info->dst.box.y, tile_height) ||
+ is_tile_unaligned(info->dst.box.width, tile_width) ||
+ is_tile_unaligned(info->dst.box.height, tile_height)) {
+ return false;
+ }
+
if (info->dst.resource->format != info->src.resource->format)
return false;
@@ -73,12 +88,13 @@ vc4_tile_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
pipe_surface_reference(&vc4->color_write, dst_surf);
pipe_surface_reference(&vc4->zs_read, NULL);
pipe_surface_reference(&vc4->zs_write, NULL);
- vc4->draw_min_x = 0;
- vc4->draw_min_y = 0;
- vc4->draw_max_x = dst_surf->width;
- vc4->draw_max_y = dst_surf->height;
+ vc4->draw_min_x = info->dst.box.x;
+ vc4->draw_min_y = info->dst.box.y;
+ vc4->draw_max_x = info->dst.box.x + info->dst.box.width;
+ vc4->draw_max_y = info->dst.box.y + info->dst.box.height;
vc4->draw_width = dst_surf->width;
vc4->draw_height = dst_surf->height;
+
vc4->needs_flush = true;
vc4_job_submit(vc4);