Mesa (master): gallium/hud: disable queries during HUD draw calls

Marek Olšák mareko at kemper.freedesktop.org
Mon Jan 16 14:35:47 UTC 2017


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sun Jan 15 22:28:15 2017 +0100

gallium/hud: disable queries during HUD draw calls

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/gallium/auxiliary/hud/hud_context.c      | 10 ++++++++++
 src/gallium/auxiliary/hud/hud_driver_query.c | 18 +++++++++++++++++-
 src/gallium/auxiliary/hud/hud_private.h      |  2 ++
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index 9f067f3..fd9a7bc 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -662,6 +662,16 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
    cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX);
 
    pipe_surface_reference(&surf, NULL);
+
+   /* Start queries. */
+   hud_batch_query_begin(hud->batch_query);
+
+   LIST_FOR_EACH_ENTRY(pane, &hud->pane_list, head) {
+      LIST_FOR_EACH_ENTRY(gr, &pane->graph_list, head) {
+         if (gr->begin_query)
+            gr->begin_query(gr);
+      }
+   }
 }
 
 static void
diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c b/src/gallium/auxiliary/hud/hud_driver_query.c
index d80b8ed..6a97dbd 100644
--- a/src/gallium/auxiliary/hud/hud_driver_query.c
+++ b/src/gallium/auxiliary/hud/hud_driver_query.c
@@ -116,8 +116,15 @@ hud_batch_query_update(struct hud_batch_query_context *bq)
          return;
       }
    }
+}
+
+void
+hud_batch_query_begin(struct hud_batch_query_context *bq)
+{
+   if (!bq || bq->failed || !bq->query[bq->head])
+      return;
 
-   if (!pipe->begin_query(pipe, bq->query[bq->head])) {
+   if (!bq->pipe->begin_query(bq->pipe, bq->query[bq->head])) {
       fprintf(stderr,
               "gallium_hud: could not begin batch query. You may have "
               "selected too many or incompatible queries.\n");
@@ -277,7 +284,15 @@ query_new_value_normal(struct query_info *info)
       /* initialize */
       info->query[info->head] = pipe->create_query(pipe, info->query_type, 0);
    }
+}
+
+static void
+begin_query(struct hud_graph *gr)
+{
+   struct query_info *info = gr->query_data;
+   struct pipe_context *pipe = info->pipe;
 
+   assert(!info->batch);
    if (info->query[info->head])
       pipe->begin_query(pipe, info->query[info->head]);
 }
@@ -374,6 +389,7 @@ hud_pipe_query_install(struct hud_batch_query_context **pbq,
          goto fail_info;
       info->batch = *pbq;
    } else {
+      gr->begin_query = begin_query;
       info->query_type = query_type;
       info->result_index = result_index;
    }
diff --git a/src/gallium/auxiliary/hud/hud_private.h b/src/gallium/auxiliary/hud/hud_private.h
index d719e5f..b23439e 100644
--- a/src/gallium/auxiliary/hud/hud_private.h
+++ b/src/gallium/auxiliary/hud/hud_private.h
@@ -41,6 +41,7 @@ struct hud_graph {
    /* name and query */
    char name[128];
    void *query_data;
+   void (*begin_query)(struct hud_graph *gr);
    void (*query_new_value)(struct hud_graph *gr);
    void (*free_query_data)(void *ptr); /**< do not use ordinary free() */
 
@@ -103,6 +104,7 @@ void hud_pipe_query_install(struct hud_batch_query_context **pbq,
 boolean hud_driver_query_install(struct hud_batch_query_context **pbq,
                                  struct hud_pane *pane,
                                  struct pipe_context *pipe, const char *name);
+void hud_batch_query_begin(struct hud_batch_query_context *bq);
 void hud_batch_query_update(struct hud_batch_query_context *bq);
 void hud_batch_query_cleanup(struct hud_batch_query_context **pbq);
 




More information about the mesa-commit mailing list