From 3a728d4dfbd727c30f36116772803674beffcbb6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 14 Apr 2015 11:31:11 -0700 Subject: [PATCH] vc4: Update the shadow texture for public textures on every draw. We don't know who else has written to it, so we'd better update it every time. This makes the gears spin in X again. --- src/gallium/drivers/vc4/vc4_draw.c | 18 ++++++++++++++++++ src/gallium/drivers/vc4/vc4_resource.c | 2 +- src/gallium/drivers/vc4/vc4_state.c | 7 +------ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c index 717eb8aea2b..16418bf12da 100644 --- a/src/gallium/drivers/vc4/vc4_draw.c +++ b/src/gallium/drivers/vc4/vc4_draw.c @@ -131,6 +131,20 @@ vc4_start_draw(struct vc4_context *vc4) vc4->draw_call_queued = true; } +static void +vc4_update_shadow_textures(struct pipe_context *pctx, + struct vc4_texture_stateobj *stage_tex) +{ + for (int i = 0; i < stage_tex->num_textures; i++) { + struct pipe_sampler_view *view = stage_tex->textures[i]; + if (!view) + continue; + struct vc4_resource *rsc = vc4_resource(view->texture); + if (rsc->shadow_parent) + vc4_update_shadow_baselevel_texture(pctx, view); + } +} + static void vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) { @@ -145,6 +159,10 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) return; } + /* Before setting up the draw, do any fixup blits necessary. */ + vc4_update_shadow_textures(pctx, &vc4->verttex); + vc4_update_shadow_textures(pctx, &vc4->fragtex); + vc4_get_draw_cl_space(vc4); struct vc4_vertex_stateobj *vtx = vc4->vtx; diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c index 94bab9934e7..3f180d5845d 100644 --- a/src/gallium/drivers/vc4/vc4_resource.c +++ b/src/gallium/drivers/vc4/vc4_resource.c @@ -583,7 +583,7 @@ vc4_update_shadow_baselevel_texture(struct pipe_context *pctx, struct vc4_resource *orig = vc4_resource(shadow->shadow_parent); assert(orig); - if (shadow->writes == orig->writes) + if (shadow->writes == orig->writes && orig->bo->private) return; perf_debug("Updating shadow texture due to %s\n", diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c index df75b6ec81b..80e963ea2ee 100644 --- a/src/gallium/drivers/vc4/vc4_state.c +++ b/src/gallium/drivers/vc4/vc4_state.c @@ -578,13 +578,8 @@ vc4_set_sampler_views(struct pipe_context *pctx, unsigned shader, vc4->dirty |= VC4_DIRTY_TEXSTATE; for (i = 0; i < nr; i++) { - if (views[i]) { - struct vc4_resource *rsc = - vc4_resource(views[i]->texture); + if (views[i]) new_nr = i + 1; - if (rsc->shadow_parent) - vc4_update_shadow_baselevel_texture(pctx, views[i]); - } pipe_sampler_view_reference(&stage_tex->textures[i], views[i]); stage_tex->dirty_samplers |= (1 << i); } -- 2.30.2