etnaviv: update resource status after flushing
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Fri, 29 Nov 2019 08:44:43 +0000 (09:44 +0100)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Fri, 20 Dec 2019 11:43:23 +0000 (12:43 +0100)
Currently piglit spec@arb_occlusion_query@occlusion_query_conform
spins for ever as the resource status is never reset. See
etna_hw_get_query_result(..) for more details.

Fixes: 1456aa61cc5 ("etnaviv: Rework resource status tracking")
CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Marek Vasut <marex@denx.de>
src/gallium/drivers/etnaviv/etnaviv_context.c

index 5f455c4412a9d696eeb54898b7226f2456f6b005..5652107f4dc4eeab894084c517223f5ec3d03473 100644 (file)
@@ -460,6 +460,10 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
 
       _mesa_set_remove_key(rsc->pending_ctx, ctx);
 
+      /* if resource has no pending ctx's reset its status */
+      if (_mesa_set_next_entry(rsc->pending_ctx, NULL) == NULL)
+         rsc->status &= ~ETNA_PENDING_READ;
+
       pipe_resource_reference(&referenced, NULL);
    }
    _mesa_set_clear(ctx->used_resources_read, NULL);
@@ -470,6 +474,10 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
 
       _mesa_set_remove_key(rsc->pending_ctx, ctx);
 
+      /* if resource has no pending ctx's reset its status */
+      if (_mesa_set_next_entry(rsc->pending_ctx, NULL) == NULL)
+         rsc->status &= ~ETNA_PENDING_WRITE;
+
       pipe_resource_reference(&referenced, NULL);
    }
    _mesa_set_clear(ctx->used_resources_write, NULL);