summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drmP.h1
-rw-r--r--linux-core/drm_agpsupport.c4
-rw-r--r--linux-core/drm_compat.c17
-rw-r--r--linux-core/drm_ttm.c3
-rw-r--r--linux-core/drm_ttm.h2
-rw-r--r--linux-core/drm_vm.c8
6 files changed, 21 insertions, 14 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 2453c756..090bd124 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -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;
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index 9cdbdaf0..7a692af1 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -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;
}
diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c
index 6bb58424..93d9b95d 100644
--- a/linux-core/drm_compat.c
+++ b/linux-core/drm_compat.c
@@ -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);
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index c17c41cb..f1e3ea40 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -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)
diff --git a/linux-core/drm_ttm.h b/linux-core/drm_ttm.h
index 796f2317..a7858549 100644
--- a/linux-core/drm_ttm.h
+++ b/linux-core/drm_ttm.h
@@ -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;
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index b11e09f8..63cf6f56 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -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: