vc4: Update the shadow texture for public textures on every draw.
authorEric Anholt <eric@anholt.net>
Tue, 14 Apr 2015 18:31:11 +0000 (11:31 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 15 Apr 2015 23:50:23 +0000 (16:50 -0700)
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
src/gallium/drivers/vc4/vc4_resource.c
src/gallium/drivers/vc4/vc4_state.c

index 717eb8aea2b58700ed40aa0ff7b022a41f1a8fc4..16418bf12dac7e5199b50255332c1b17ad357697 100644 (file)
@@ -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;
index 94bab9934e79c2fc93d409fbbb8154891c01fe40..3f180d5845d86405cadc6f9d1c286648ffda702f 100644 (file)
@@ -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",
index df75b6ec81b3c35c35c9e07c3fea2791aac07f03..80e963ea2ee2a3a5c43b494b61f32c732b61a5f0 100644 (file)
@@ -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);
         }