Mesa (master): r300g: forbid overlapping queries and print error messages

Marek Olšák mareko at kemper.freedesktop.org
Sat May 15 17:40:44 UTC 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat May 15 19:39:11 2010 +0200

r300g: forbid overlapping queries and print error messages

---

 src/gallium/drivers/r300/r300_query.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index 5c27796..9bd2853 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -59,6 +59,7 @@ static struct pipe_query *r300_create_query(struct pipe_context *pipe,
     /* XXX */
     if (q->offset >= 4096) {
         q->offset = 0;
+        fprintf(stderr, "r300: Rewinding OQBO...\n");
     }
 
     return (struct pipe_query*)q;
@@ -80,7 +81,12 @@ static void r300_begin_query(struct pipe_context* pipe,
     struct r300_context* r300 = r300_context(pipe);
     struct r300_query* q = (struct r300_query*)query;
 
-    assert(r300->query_current == NULL);
+    if (r300->query_current != NULL) {
+        fprintf(stderr, "r300: begin_query: "
+                "Some other query has already been started.\n");
+        assert(0);
+        return;
+    }
 
     pipe_buffer_write(pipe,
 		      r300->oqbo,
@@ -99,6 +105,12 @@ static void r300_end_query(struct pipe_context* pipe,
     struct r300_context* r300 = r300_context(pipe);
     struct r300_query* q = (struct r300_query*)query;
 
+    if ((struct r300_query*)query != r300->query_current) {
+        fprintf(stderr, "r300: end_query: Got invalid query.\n");
+        assert(0);
+        return;
+    }
+
     r300_emit_query_end(r300);
     q->begin_emitted = false;
     r300->query_current = NULL;




More information about the mesa-commit mailing list