Mesa (refs/tags/untested-1): nouveau: set cb_dirty flag is we had bound a constant buffer, during transfer_unmap

Emil Velikov evelikov at kemper.freedesktop.org
Mon Sep 1 00:17:35 UTC 2014


Module: Mesa
Branch: refs/tags/untested-1
Commit: 4c5f3723b0e749b4e45c6092104bbdbbb1bdd73a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c5f3723b0e749b4e45c6092104bbdbbb1bdd73a

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Thu Jun 13 10:47:59 2013 +0100

nouveau: set cb_dirty flag is we had bound a constant buffer, during transfer_unmap

while we're at it rename nouveau_transfer variable to something
more sensible

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>

---

 src/gallium/drivers/nouveau/nouveau_buffer.c |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 89ea2de..63e4c25 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -322,25 +322,29 @@ static void
 nouveau_buffer_transfer_unmap(struct pipe_context *pipe,
                               struct pipe_transfer *transfer)
 {
-   struct nv04_resource *buf = nv04_resource(transfer->resource);
-   struct nouveau_transfer *xfr = nouveau_transfer(transfer);
    struct nouveau_context *nv = nouveau_context(pipe);
+   struct nouveau_transfer *tx = nouveau_transfer(transfer);
+   struct nv04_resource *buf = nv04_resource(transfer->resource);
 
-   if (xfr->base.usage & PIPE_TRANSFER_WRITE) {
+   if (tx->base.usage & PIPE_TRANSFER_WRITE) {
       if (buf->domain == NOUVEAU_BO_VRAM) {
          nouveau_buffer_upload(nv, buf, transfer->box.x, transfer->box.width);
       }
 
-      if (buf->domain != 0 && (buf->base.bind & (PIPE_BIND_VERTEX_BUFFER |
-                                                 PIPE_BIND_INDEX_BUFFER)))
-         nouveau_context(pipe)->vbo_dirty = TRUE;
+      if (likely(buf->domain)) {
+         const uint8_t bind = buf->base.bind;
+         /* make sure we invalidate dedicated caches */
+         if (bind & (PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_INDEX_BUFFER))
+            nv->vbo_dirty = TRUE;
+         if (bind & (PIPE_BIND_CONSTANT_BUFFER))
+            nv->cb_dirty = TRUE;
+      }
    }
 
-//   if (!xfr->bo && (xfr->base.usage & PIPE_TRANSFER_WRITE))
-   if (xfr->base.usage & PIPE_TRANSFER_WRITE)
-      NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_direct, xfr->base.box.width);
+   if (tx->base.usage & PIPE_TRANSFER_WRITE)
+      NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_direct, tx->base.box.width);
 
-   FREE(xfr);
+   FREE(tx);
 }
 
 




More information about the mesa-commit mailing list