[Mesa-dev] [PATCH] nv50: only over-allocate by a page for code

Ilia Mirkin imirkin at alum.mit.edu
Tue Feb 4 08:32:09 CET 2014


The pre-fetching doesn't go too far. Tested with over-allocating by only
a page, and didn't see any errors in dmesg. Saves ~512KB of VRAM.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Cc: 10.1 <mesa-stable at lists.freedesktop.org>
---
 src/gallium/drivers/nouveau/nv50/nv50_screen.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index bdfb931..b02b6f8 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -747,12 +747,13 @@ nv50_screen_create(struct nouveau_device *dev)
       goto fail;
    }
 
-   /* This over-allocates by a whole code BO. The GP, which would execute at
-    * the end of the last page, would trigger faults. The going theory is that
-    * it prefetches up to a certain amount. This avoids dmesg spam.
+   /* This over-allocates by a page. The GP, which would execute at the end of
+    * the last page, would trigger faults. The going theory is that it
+    * prefetches up to a certain amount. This avoids dmesg spam.
     */
    ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 16,
-                        4 << NV50_CODE_BO_SIZE_LOG2, NULL, &screen->code);
+                        (3 << NV50_CODE_BO_SIZE_LOG2) + 0x1000,
+                        NULL, &screen->code);
    if (ret) {
       NOUVEAU_ERR("Failed to allocate code bo: %d\n", ret);
       goto fail;
-- 
1.8.3.2



More information about the mesa-dev mailing list