Fix missing ttm_open_vma call from previous commit.

Honour the ttm backend cant-use-aperture flag.
main
Thomas Hellstrom 2007-02-01 13:19:05 +01:00
parent 9677c5ecc6
commit dd733dea38
6 changed files with 21 additions and 14 deletions

View 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;

View 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;
}

View 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);

View 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)

View 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;

View 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: