drm/ttm: introduce callback for ttm_tt populate & unpopulate V4
[linux-2.6.git] / drivers / gpu / drm / ttm / ttm_bo_vm.c
index 221b924..5441284 100644 (file)
@@ -174,18 +174,23 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
                vma->vm_page_prot = (bo->mem.placement & TTM_PL_FLAG_CACHED) ?
                    vm_get_page_prot(vma->vm_flags) :
                    ttm_io_prot(bo->mem.placement, vma->vm_page_prot);
+
+               /* Allocate all page at once, most common usage */
+               if (ttm->bdev->driver->ttm_tt_populate(ttm)) {
+                       retval = VM_FAULT_OOM;
+                       goto out_io_unlock;
+               }
        }
 
        /*
         * Speculatively prefault a number of pages. Only error on
         * first page.
         */
-
        for (i = 0; i < TTM_BO_VM_NUM_PREFAULT; ++i) {
                if (bo->mem.bus.is_iomem)
                        pfn = ((bo->mem.bus.base + bo->mem.bus.offset) >> PAGE_SHIFT) + page_offset;
                else {
-                       page = ttm_tt_get_page(ttm, page_offset);
+                       page = ttm->pages[page_offset];
                        if (unlikely(!page && i == 0)) {
                                retval = VM_FAULT_OOM;
                                goto out_io_unlock;