r300g: port over last parts of oq support.
authorDave Airlie <airlied@redhat.com>
Wed, 14 Oct 2009 07:44:19 +0000 (17:44 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 14 Oct 2009 07:44:19 +0000 (17:44 +1000)
Add support for begin/end in each CS so we don't get any other
processes rendering in between.

TODO:
blame other parts of driver for this not working like Z.

src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_emit.h
src/gallium/drivers/r300/r300_flush.c
src/gallium/drivers/r300/r300_query.c

index 3a01869ba10d35128dff1c59a51825b0847aeec7..7826ed1452523fd0c0cf6b410ebd14f348717df1 100644 (file)
@@ -175,6 +175,8 @@ struct r300_query {
     unsigned offset;
     /* if we've flushed the query */
     boolean flushed;
+    /* if begin has been emitted */
+    boolean begin_emitted;
     /* Linked list members. */
     struct r300_query* prev;
     struct r300_query* next;
index babbe0dd74a8706a30e9f308c6b0dbdb4cb1b64c..6e616cd5b2c2b466db3bd0f528d21c3a1569ecf0 100644 (file)
@@ -340,6 +340,7 @@ void r300_emit_query_start(struct r300_context *r300)
     }
     OUT_CS_REG(R300_ZB_ZPASS_DATA, 0);
     END_CS;
+    query->begin_emitted = TRUE;
 }
 
 
@@ -429,10 +430,16 @@ static void rv530_emit_query_double(struct r300_context *r300,
     END_CS;
 }
 
-void r300_emit_query_end(struct r300_context* r300,
-                         struct r300_query* query)
+void r300_emit_query_end(struct r300_context* r300)
 {
     struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps;
+    struct r300_query *query = r300->query_current;
+
+    if (!query)
+       return;
+
+    if (query->begin_emitted == FALSE)
+        return;
 
     if (!r300->winsys->add_buffer(r300->winsys, r300->oqbo,
                 0, RADEON_GEM_DOMAIN_GTT)) {
index c4002b8e5d00efa5dbca087d285899e888eb9c4a..b62aa9fec50c929b13baeb2d5aaa5efbac71f68b 100644 (file)
@@ -58,8 +58,7 @@ void r300_emit_fb_state(struct r300_context* r300,
 
 void r300_emit_query_begin(struct r300_context* r300,
                            struct r300_query* query);
-void r300_emit_query_end(struct r300_context* r300,
-                         struct r300_query* query);
+void r300_emit_query_end(struct r300_context* r300);
 
 void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs);
 
index a8ab0d72120c6123b7489eeeb65e43de9f98e193..241ea71d6b19de0d2cf9930bc2390eb222813381 100644 (file)
@@ -36,6 +36,8 @@ static void r300_flush(struct pipe_context* pipe,
         draw_flush(r300->draw);
     }
 
+    r300_emit_query_end(r300);
+
     if (r300->dirty_hw) {
         FLUSH_CS;
         r300_emit_invariant_state(r300);
index fb4340ff3d1fe0b73d2eb44ca703915f3980fb3e..2b0fbfb7d22c11b5bdc805ef58fa5e991926c27c 100644 (file)
@@ -88,14 +88,11 @@ static void r300_begin_query(struct pipe_context* pipe,
 }
 
 static void r300_end_query(struct pipe_context* pipe,
-                           struct pipe_query* query)
+                          struct pipe_query* query)
 {
     struct r300_context* r300 = r300_context(pipe);
-    struct r300_query* q = (struct r300_query*)query;
-
-    r300_emit_dirty_state(r300);
-    r300_emit_query_end(r300, q);
 
+    r300_emit_query_end(r300);
     r300->query_current = NULL;
 }