Mesa (master): etnaviv: extend acc query provider with supports(..) function

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


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

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

etnaviv: extend acc query provider with supports(..) function

Move the logic if a query provider supports a query_type
directly to the provider.

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 | 16 ++++++++++++++++
 src/gallium/drivers/etnaviv/etnaviv_query_acc.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_acc.c b/src/gallium/drivers/etnaviv/etnaviv_query_acc.c
index 446a629c6e8..976bfa1c497 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_query_acc.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_query_acc.c
@@ -42,6 +42,21 @@
  * interpret results
  */
 
+static bool
+occlusion_supports(unsigned query_type)
+{
+   switch (query_type) {
+   case PIPE_QUERY_OCCLUSION_COUNTER:
+      /* fallthrough */
+   case PIPE_QUERY_OCCLUSION_PREDICATE:
+      /* fallthrough */
+   case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
+      return true;
+   default:
+      return false;
+   }
+}
+
 static void
 occlusion_resume(struct etna_acc_query *aq, struct etna_context *ctx)
 {
@@ -98,6 +113,7 @@ etna_acc_destroy_query(struct etna_context *ctx, struct etna_query *q)
 }
 
 static const struct etna_acc_sample_provider occlusion_provider = {
+   .supports = occlusion_supports,
    .suspend = occlusion_suspend,
    .resume = occlusion_resume,
    .result = occlusion_result,
diff --git a/src/gallium/drivers/etnaviv/etnaviv_query_acc.h b/src/gallium/drivers/etnaviv/etnaviv_query_acc.h
index 5927d7da564..b22b2214728 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_query_acc.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_query_acc.h
@@ -34,6 +34,8 @@
 struct etna_acc_query;
 
 struct etna_acc_sample_provider {
+   bool (*supports)(unsigned query_type);
+
    void (*resume)(struct etna_acc_query *aq, struct etna_context *ctx);
    void (*suspend)(struct etna_acc_query *aq, struct etna_context *ctx);
 



More information about the mesa-commit mailing list