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

Author: Marek Olšák <[email protected]>
Date:   Sun Mar 12 21:44:07 2017 +0100

gallium/radeon: subclass and handle threaded_query

Reviewed-by: Nicolai Hähnle <[email protected]>
Tested-by: Dieter Nützel <[email protected]>

---

 src/gallium/drivers/radeon/r600_query.c | 14 ++++++++++----
 src/gallium/drivers/radeon/r600_query.h |  5 ++---
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index cbf4bbac3e..dac9b9cbc6 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -354,7 +354,9 @@ static bool r600_query_sw_get_result(struct 
r600_common_context *rctx,
                return true;
        case PIPE_QUERY_GPU_FINISHED: {
                struct pipe_screen *screen = rctx->b.screen;
-               result->b = screen->fence_finish(screen, &rctx->b, query->fence,
+               struct pipe_context *ctx = rquery->b.flushed ? NULL : &rctx->b;
+
+               result->b = screen->fence_finish(screen, ctx, query->fence,
                                                 wait ? PIPE_TIMEOUT_INFINITE : 
0);
                return result->b;
        }
@@ -1212,12 +1214,16 @@ bool r600_query_hw_get_result(struct 
r600_common_context *rctx,
        query->ops->clear_result(query, result);
 
        for (qbuf = &query->buffer; qbuf; qbuf = qbuf->previous) {
+               unsigned usage = PIPE_TRANSFER_READ |
+                                (wait ? 0 : PIPE_TRANSFER_DONTBLOCK);
                unsigned results_base = 0;
                void *map;
 
-               map = r600_buffer_map_sync_with_rings(rctx, qbuf->buf,
-                                                     PIPE_TRANSFER_READ |
-                                                     (wait ? 0 : 
PIPE_TRANSFER_DONTBLOCK));
+               if (rquery->b.flushed)
+                       map = rctx->ws->buffer_map(qbuf->buf->buf, NULL, usage);
+               else
+                       map = r600_buffer_map_sync_with_rings(rctx, qbuf->buf, 
usage);
+
                if (!map)
                        return false;
 
diff --git a/src/gallium/drivers/radeon/r600_query.h 
b/src/gallium/drivers/radeon/r600_query.h
index 05aceb7283..485bb61b70 100644
--- a/src/gallium/drivers/radeon/r600_query.h
+++ b/src/gallium/drivers/radeon/r600_query.h
@@ -28,9 +28,7 @@
 #ifndef R600_QUERY_H
 #define R600_QUERY_H
 
-#include "pipe/p_defines.h"
-#include "pipe/p_state.h"
-#include "util/list.h"
+#include "util/u_threaded_context.h"
 
 struct pipe_context;
 struct pipe_query;
@@ -129,6 +127,7 @@ struct r600_query_ops {
 };
 
 struct r600_query {
+       struct threaded_query b;
        struct r600_query_ops *ops;
 
        /* The type of query */

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to