Mesa (refs/tags/del-dw): nouveau: transfer_del take1

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


Module: Mesa
Branch: refs/tags/del-dw
Commit: 576a5302ec27e47392e44f6acb05bbf8285add13
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=576a5302ec27e47392e44f6acb05bbf8285add13

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Thu Jun 13 18:46:38 2013 +0100

nouveau: transfer_del take1

grab the bits from the dw/read/cache

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

---

 src/gallium/drivers/nouveau/nouveau_buffer.c |   26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 2190ef9..cc360b2 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -187,9 +187,6 @@ nouveau_transfer_read(struct nouveau_context *nv, struct nouveau_transfer *tx)
 
    buf->status &= ~NOUVEAU_BUFFER_STATUS_GPU_WRITING;
 
-   nouveau_bo_ref(NULL, &tx->bo);
-   if (tx->mm)
-      nouveau_mm_free(tx->mm);
    return TRUE;
 }
 
@@ -291,6 +288,27 @@ nouveau_buffer_transfer_init(struct nouveau_transfer *tx,
    tx->map = NULL;
 }
 
+static INLINE void
+nouveau_buffer_transfer_del(struct nouveau_context *nv,
+                            struct nouveau_transfer *tx)
+{
+   if (tx->map) {
+      if (likely(tx->bo)) {
+         nouveau_bo_ref(NULL, &tx->bo);
+         if (tx->mm)
+            release_allocation(&tx->mm, nv->screen->fence.current);
+      } else {
+         fprintf(stderr, "%s:%d tx->bo NULL\n", __func__, __LINE__);
+/*
+         align_free(tx->map -
+                    (tx->base.box.x & NOUVEAU_MIN_BUFFER_MAP_ALIGN_MASK));
+*/
+      }
+   }
+   else {
+      fprintf(stderr, "%s:%d tx->map NULL\n", __func__, __LINE__);
+   }
+}
 
 static boolean
 nouveau_buffer_cache(struct nouveau_context *nv, struct nv04_resource *buf)
@@ -311,6 +329,7 @@ nouveau_buffer_cache(struct nouveau_context *nv, struct nv04_resource *buf)
       return FALSE;
 
    ret = nouveau_transfer_read(nv, &tx);
+   nouveau_buffer_transfer_del(nv, &tx);
    return ret;
 }
 
@@ -343,6 +362,7 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe,
             // XXX: No error checking
             nouveau_transfer_staging(nv, NOUVEAU_BO_RD, nv->client, tx, TRUE);
             nouveau_transfer_read(nv, tx);
+            nouveau_buffer_transfer_del(nv, tx);
       }
    }
 




More information about the mesa-commit mailing list