Mesa (master): radeong: flush CS if a buffer being mapped is referenced by it

Corbin Simpson csimpson at kemper.freedesktop.org
Fri Dec 4 17:24:19 UTC 2009


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Fri Dec  4 15:54:29 2009 +0100

radeong: flush CS if a buffer being mapped is referenced by it

Also, overlapping occlusion queries seems to work now.

---

 src/gallium/drivers/r300/r300_emit.c               |    2 --
 src/gallium/winsys/drm/radeon/core/radeon_buffer.c |    5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 3bb42f9..60be03f 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -382,8 +382,6 @@ static void r300_emit_query_start(struct r300_context *r300)
     if (!query)
 	return;
 
-    /* XXX This will almost certainly not return good results
-     * for overlapping queries. */
     BEGIN_CS(4);
     if (caps->family == CHIP_FAMILY_RV530) {
         OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
index 0ca7b39..2a8daed 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
@@ -140,10 +140,15 @@ static void *radeon_buffer_map(struct pipe_winsys *ws,
                                struct pipe_buffer *buffer,
                                unsigned flags)
 {
+    struct radeon_winsys_priv *priv = ((struct radeon_winsys *)ws)->priv;
     struct radeon_pipe_buffer *radeon_buffer =
         (struct radeon_pipe_buffer*)buffer;
     int write = 0;
 
+    if (radeon_bo_is_referenced_by_cs(radeon_buffer->bo, priv->cs)) {
+        priv->cs->space_flush_fn(priv->cs->space_flush_data);
+    }
+
     if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
         uint32_t domain;
 




More information about the mesa-commit mailing list