nv50: only over-allocate by a page for code
authorIlia Mirkin <imirkin@alum.mit.edu>
Tue, 4 Feb 2014 07:30:18 +0000 (02:30 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 6 Feb 2014 23:50:19 +0000 (18:50 -0500)
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@alum.mit.edu>
Cc: 10.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
src/gallium/drivers/nouveau/nv50/nv50_screen.c

index 2b6ec3a11c0ba4a7e141ec4f32a47482fe8ea724..2144140551a5fe5633f85baf94d1643034072368 100644 (file)
@@ -739,12 +739,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.
     */
    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;