From 44b63cf5c051f7eccfc1d7427247fd58dabb7761 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 8 Apr 2015 12:49:24 -0700 Subject: [PATCH] vc4: When asked to sample from a raster texture, make a shadow tiled copy. So, it turns out my simulator doesn't *quite* match the hardware. And the errata about raster textures tells you most of what's wrong, but there's still stuff wrong after that. Instead, if we're asked to sample from raster, we'll just blit it to a tiled temporary. Raster textures should only be screen scanout, and word is that it's faster to copy to tiled using the tiling engine first than to texture from an entire raster texture, anyway. --- src/gallium/drivers/vc4/vc4_state.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c index 332f310..df75b6e 100644 --- a/src/gallium/drivers/vc4/vc4_state.c +++ b/src/gallium/drivers/vc4/vc4_state.c @@ -516,6 +516,7 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc, const struct pipe_sampler_view *cso) { struct pipe_sampler_view *so = malloc(sizeof(*so)); + struct vc4_resource *rsc = vc4_resource(prsc); if (!so) return NULL; @@ -527,8 +528,12 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc, /* There is no hardware level clamping, and the start address of a * texture may be misaligned, so in that case we have to copy to a * temporary. + * + * Also, Raspberry Pi doesn't support sampling from raster textures, + * so we also have to copy to a temporary then. */ - if (so->u.tex.first_level) { + if (so->u.tex.first_level || + rsc->vc4_format == VC4_TEXTURE_TYPE_RGBA32R) { struct vc4_resource *shadow_parent = vc4_resource(prsc); struct pipe_resource tmpl = shadow_parent->base.b; struct vc4_resource *clone; @@ -574,8 +579,10 @@ vc4_set_sampler_views(struct pipe_context *pctx, unsigned shader, for (i = 0; i < nr; i++) { if (views[i]) { + struct vc4_resource *rsc = + vc4_resource(views[i]->texture); new_nr = i + 1; - if (views[i]->u.tex.first_level != 0) + if (rsc->shadow_parent) vc4_update_shadow_baselevel_texture(pctx, views[i]); } pipe_sampler_view_reference(&stage_tex->textures[i], views[i]); -- 2.7.4