Mesa (master): etnaviv: extend result(..) to return if data is ready

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Apr 5 18:12:00 UTC 2020


Module: Mesa
Branch: master
Commit: e0bc251ef8918dd4fe89604941d8d5a0c482aae7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0bc251ef8918dd4fe89604941d8d5a0c482aae7

Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date:   Fri Jul 19 12:57:11 2019 +0200

etnaviv: extend result(..) to return if data is ready

For the upcoming conversion of perfmon queries to the acc query
framework we need a way to tell that the data is not ready.

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

---

 src/gallium/drivers/etnaviv/etnaviv_query_acc.c | 12 ++++++++----
 src/gallium/drivers/etnaviv/etnaviv_query_acc.h |  4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_acc.c b/src/gallium/drivers/etnaviv/etnaviv_query_acc.c
index f156363e951..094c7c84125 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_query_acc.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_query_acc.c
@@ -85,7 +85,7 @@ occlusion_suspend(struct etna_acc_query *aq, struct etna_context *ctx)
    resource_written(ctx, aq->prsc);
 }
 
-static void
+static bool
 occlusion_result(struct etna_acc_query *aq, void *buf,
                  union pipe_query_result *result)
 {
@@ -99,6 +99,8 @@ occlusion_result(struct etna_acc_query *aq, void *buf,
       result->u64 = sum;
    else
       result->b = !!sum;
+
+   return true;
 }
 
 static void
@@ -214,12 +216,14 @@ etna_acc_get_query_result(struct etna_context *ctx, struct etna_query *q,
       return false;
 
    void *ptr = etna_bo_map(rsc->bo);
-   p->result(aq, ptr, result);
-   aq->samples = 0;
+   bool success = p->result(aq, ptr, result);
+
+   if (success)
+      aq->samples = 0;
 
    etna_bo_cpu_fini(rsc->bo);
 
-   return true;
+   return success;
 }
 
 static const struct etna_query_funcs acc_query_funcs = {
diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_acc.h b/src/gallium/drivers/etnaviv/etnaviv_query_acc.h
index b22b2214728..8dd4bae5b71 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_query_acc.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_query_acc.h
@@ -39,8 +39,8 @@ struct etna_acc_sample_provider {
    void (*resume)(struct etna_acc_query *aq, struct etna_context *ctx);
    void (*suspend)(struct etna_acc_query *aq, struct etna_context *ctx);
 
-   void (*result)(struct etna_acc_query *aq, void *buf,
-           union pipe_query_result *result);
+   bool (*result)(struct etna_acc_query *aq, void *buf,
+                  union pipe_query_result *result);
 };
 
 struct etna_acc_query {



More information about the mesa-commit mailing list