drm/nouveau: fix regression causing ttm to not be able to evict vram
authorBen Skeggs <bskeggs@redhat.com>
Mon, 7 Mar 2011 07:18:03 +0000 (17:18 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 7 Mar 2011 21:03:01 +0000 (07:03 +1000)
TTM assumes an error condition from man->func->get_node() means that
something went horribly wrong, and causes it to bail.

The driver is supposed to return 0, and leave mm_node == NULL to
signal that it couldn't allocate any memory.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/nouveau/nouveau_mem.c
drivers/gpu/drm/nouveau/nouveau_mm.c

index 26347b7cd8722e95c70d425416b8ed40c236e15e..b0fb9bdcddb76a3ff5711142090a16a8cbfe66a3 100644 (file)
@@ -725,8 +725,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
        ret = vram->get(dev, mem->num_pages << PAGE_SHIFT,
                        mem->page_alignment << PAGE_SHIFT, size_nc,
                        (nvbo->tile_flags >> 8) & 0xff, &node);
-       if (ret)
-               return ret;
+       if (ret) {
+               mem->mm_node = NULL;
+               return (ret == -ENOSPC) ? 0 : ret;
+       }
 
        node->page_shift = 12;
        if (nvbo->vma.node)
index 8844b50c3e540f697b973748da96203f9a5b9993..7609756b6faf9352fa5e833cf86f54f4bc031d31 100644 (file)
@@ -123,7 +123,7 @@ nouveau_mm_get(struct nouveau_mm *rmm, int type, u32 size, u32 size_nc,
                return 0;
        }
 
-       return -ENOMEM;
+       return -ENOSPC;
 }
 
 int