Fix missing ttm_open_vma call from previous commit.
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Thu, 1 Feb 2007 12:19:05 +0000 (13:19 +0100)
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Thu, 1 Feb 2007 12:19:05 +0000 (13:19 +0100)
Honour the ttm backend cant-use-aperture flag.

linux-core/drmP.h
linux-core/drm_agpsupport.c
linux-core/drm_compat.c
linux-core/drm_ttm.c
linux-core/drm_ttm.h
linux-core/drm_vm.c

index 2453c75..090bd12 100644 (file)
@@ -1043,6 +1043,7 @@ typedef struct drm_buffer_object{
        unsigned long bus_offset;
        unsigned long num_pages;
        uint32_t vm_flags;
+        void *iomap;
 
 } drm_buffer_object_t;
 
index 9cdbdaf..7a692af 100644 (file)
@@ -720,8 +720,8 @@ drm_ttm_backend_t *drm_agp_init_ttm(struct drm_device *dev,
        agp_be->destroy = drm_agp_destroy_ttm;
        DRM_MASK_VAL(agp_be->flags, DRM_BE_FLAG_NEEDS_FREE,
                     (backend == NULL) ? DRM_BE_FLAG_NEEDS_FREE : 0);
-       DRM_MASK_VAL(agp_be->flags, DRM_BE_FLAG_CBA,
-                    (dev->agp->cant_use_aperture) ? DRM_BE_FLAG_CBA : 0);
+       DRM_MASK_VAL(agp_be->flags, DRM_BE_FLAG_CMA,
+                    (dev->agp->cant_use_aperture) ? DRM_BE_FLAG_CMA : 0);
        agp_be->drm_map_type = _DRM_AGP;
        return agp_be;
 }
index 6bb5842..93d9b95 100644 (file)
@@ -277,7 +277,9 @@ int drm_ttm_map_bound(struct vm_area_struct *vma)
        drm_ttm_t *ttm = (drm_ttm_t *) map->offset;
        int ret = 0;
 
-       if (ttm->page_flags & DRM_TTM_PAGE_UNCACHED) {
+       if ((ttm->page_flags & DRM_TTM_PAGE_UNCACHED) && 
+           !(ttm->be->flags & DRM_BE_FLAG_CMA)) {
+
                unsigned long pfn = ttm->aper_offset + 
                        (ttm->be->aperture_base >> PAGE_SHIFT);
                pgprot_t pgprot = drm_io_prot(ttm->be->drm_map_type, vma);
@@ -286,6 +288,7 @@ int drm_ttm_map_bound(struct vm_area_struct *vma)
                                         vma->vm_end - vma->vm_start,
                                         pgprot);
        }
+
        return ret;
 }
        
@@ -408,10 +411,14 @@ int drm_ttm_remap_bound(drm_ttm_t *ttm)
        vma_entry_t *v_entry;
        int ret = 0;
        
-       list_for_each_entry(v_entry, &ttm->vma_list, head) {
-               ret = drm_ttm_map_bound(v_entry->vma);
-               if (ret)
-                       break;
+       if ((ttm->page_flags & DRM_TTM_PAGE_UNCACHED) && 
+           !(ttm->be->flags & DRM_BE_FLAG_CMA)) {
+
+               list_for_each_entry(v_entry, &ttm->vma_list, head) {
+                       ret = drm_ttm_map_bound(v_entry->vma);
+                       if (ret)
+                               break;
+               }
        }
 
        drm_ttm_unlock_mm(ttm);
index c17c41c..f1e3ea4 100644 (file)
@@ -162,7 +162,7 @@ int drm_destroy_ttm(drm_ttm_t * ttm)
 
        DRM_DEBUG("Destroying a ttm\n");
 
-#ifdef DRM_TTM_ODD_COMPAT
+#ifdef DRM_ODD_MM_COMPAT
        BUG_ON(!list_empty(&ttm->vma_list));
        BUG_ON(!list_empty(&ttm->p_mm_list));
 #endif
@@ -364,6 +364,7 @@ int drm_bind_ttm(drm_ttm_t * ttm, int cached, unsigned long aper_offset)
        ret = drm_ttm_populate(ttm);
        if (ret)
                return ret;
+
        if (ttm->state == ttm_unbound && !cached) {
                ret = unmap_vma_pages(ttm);
                if (ret)
index 796f231..a785854 100644 (file)
@@ -46,7 +46,7 @@
 
 #define DRM_BE_FLAG_NEEDS_FREE     0x00000001
 #define DRM_BE_FLAG_BOUND_CACHED   0x00000002
-#define DRM_BE_FLAG_CBA            0x00000004
+#define DRM_BE_FLAG_CMA            0x00000004 /* Don't map through aperture */
 
 typedef struct drm_ttm_backend {
        unsigned long aperture_base;
index b11e09f..63cf6f5 100644 (file)
@@ -222,11 +222,8 @@ struct page *drm_vm_ttm_fault(struct vm_area_struct *vma,
 #endif
        }
 
-       if (ttm->page_flags & DRM_TTM_PAGE_UNCACHED) {
-
-               /*
-                * FIXME: Check can't map aperture flag.
-                */
+       if ((ttm->page_flags & DRM_TTM_PAGE_UNCACHED) && 
+           !(ttm->be->flags & DRM_BE_FLAG_CMA)) {
 
                pfn = ttm->aper_offset + page_offset + 
                        (ttm->be->aperture_base >> PAGE_SHIFT);
@@ -845,6 +842,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
 #ifdef DRM_ODD_MM_COMPAT
                drm_ttm_map_bound(vma);
 #endif         
+               drm_vm_ttm_open_locked(vma);
                return 0;
        }
        default: