Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / gallium / drivers / freedreno / freedreno_query_acc.c
index 5e4354bd0e76f64d70189bdd92738717bbf91439..888f7763d85ea2ab65df9e7c5c2a93020faa0351 100644 (file)
 #include "freedreno_resource.h"
 #include "freedreno_util.h"
 
-
-static bool
-is_active(struct fd_acc_query *aq, enum fd_render_stage stage)
-{
-       return !!(aq->provider->active & stage);
-}
-
 static void
 fd_acc_destroy_query(struct fd_context *ctx, struct fd_query *q)
 {
@@ -93,6 +86,10 @@ fd_acc_query_resume(struct fd_acc_query *aq, struct fd_batch *batch)
 
        aq->batch = batch;
        p->resume(aq, aq->batch);
+
+       fd_screen_lock(batch->ctx->screen);
+       fd_batch_resource_write(batch, fd_resource(aq->prsc));
+       fd_screen_unlock(batch->ctx->screen);
 }
 
 static void
@@ -243,7 +240,8 @@ fd_acc_query_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
                LIST_FOR_EACH_ENTRY(aq, &ctx->acc_active_queries, node) {
                        bool batch_change = aq->batch != batch;
                        bool was_active = aq->batch != NULL;
-                       bool now_active = is_active(aq, stage);
+                       bool now_active = stage != FD_STAGE_NULL &&
+                               (ctx->active_queries || aq->provider->always);
 
                        if (was_active && (!now_active || batch_change))
                                fd_acc_query_pause(aq);