summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_blit.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-02-22 17:43:21 -0800
committerEric Anholt <[email protected]>2018-02-23 08:42:13 -0800
commitbc3d16e633fd27b05dfdcda0b7efb000b2c35ed6 (patch)
treee925a103a0a4f855f690609ad27631bc954935da /src/gallium/drivers/vc4/vc4_blit.c
parentc824a045ea639b8a93cbc2518b16900402d9150f (diff)
broadcom/vc4: Add support for YUV textures using unaccelerated blits.
Previously we would assertion fail about having no hardware format. This is enough to get kmscube -M nv12-2img working.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_blit.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_blit.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_blit.c b/src/gallium/drivers/vc4/vc4_blit.c
index 7f4c76968e7..f23f74c8f16 100644
--- a/src/gallium/drivers/vc4/vc4_blit.c
+++ b/src/gallium/drivers/vc4/vc4_blit.c
@@ -184,6 +184,32 @@ vc4_blitter_save(struct vc4_context *vc4)
}
static bool
+vc4_yuv_blit(struct pipe_context *pctx, const struct pipe_blit_info *info)
+{
+ struct vc4_resource *src = vc4_resource(info->src.resource);
+ struct vc4_resource *dst = vc4_resource(info->dst.resource);
+ bool ok;
+
+ if (src->tiled)
+ return false;
+ if (src->base.format != PIPE_FORMAT_R8_UNORM &&
+ src->base.format != PIPE_FORMAT_R8G8_UNORM)
+ return false;
+
+ /* YUV blits always turn raster-order to tiled */
+ assert(dst->base.format == src->base.format);
+ assert(dst->tiled);
+
+ /* Do an immediate SW fallback, since the render blit path
+ * would just recurse.
+ */
+ ok = util_try_blit_via_copy_region(pctx, info);
+ assert(ok); (void)ok;
+
+ return true;
+}
+
+static bool
vc4_render_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
{
struct vc4_context *vc4 = vc4_context(ctx);
@@ -218,6 +244,9 @@ vc4_blit(struct pipe_context *pctx, const struct pipe_blit_info *blit_info)
{
struct pipe_blit_info info = *blit_info;
+ if (vc4_yuv_blit(pctx, blit_info))
+ return;
+
if (vc4_tile_blit(pctx, blit_info))
return;