Mesa (master): r300g: Utilize DONTBLOCK.

Corbin Simpson csimpson at kemper.freedesktop.org
Wed Aug 19 04:29:00 UTC 2009


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

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Tue Aug 18 18:14:22 2009 -0700

r300g: Utilize DONTBLOCK.

Also ALGYRHYTHMS.

---

 src/gallium/drivers/r300/r300_query.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c
index b3a8dc1..1d5185b 100644
--- a/src/gallium/drivers/r300/r300_query.c
+++ b/src/gallium/drivers/r300/r300_query.c
@@ -95,23 +95,34 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
                                      uint64_t* result)
 {
     struct r300_context* r300 = r300_context(pipe);
+    struct r300_screen* r300screen = r300_screen(r300->context.screen);
     struct r300_query* q = (struct r300_query*)query;
+    unsigned flags = PIPE_BUFFER_USAGE_CPU_READ;
     uint32_t* map;
     uint32_t temp;
+    unsigned i;
 
     if (wait) {
-        /* Well, we're expected to just sit here and spin, so let's go ahead
-         * and flush so we can be sure that the card's spinning... */
-        /* XXX double-check these params */
         pipe->flush(pipe, 0, NULL);
+    } else {
+        flags |= PIPE_BUFFER_USAGE_DONTBLOCK;
     }
 
-
-    map = pipe->screen->buffer_map(pipe->screen, r300->oqbo,
-            PIPE_BUFFER_USAGE_CPU_WRITE);
+    map = pipe->screen->buffer_map(pipe->screen, r300->oqbo, flags);
     map += q->offset / 4;
-    temp = *map;
-    *map = ~0;
+    for (i = 0; i < r300screen->caps->num_frag_pipes; i++) {
+        if (*map == ~0) {
+            /* Looks like our results aren't ready yet. */
+            if (wait) {
+                debug_printf("r300: Despite waiting, OQ results haven't"
+                        " come in yet.\n");
+            }
+            temp = ~0;
+            break;
+        }
+        temp += *map;
+        map++;
+    }
     pipe->screen->buffer_unmap(pipe->screen, r300->oqbo);
 
     if (temp == ~0) {




More information about the mesa-commit mailing list