summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-02-14 12:39:02 +0100
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-02-14 12:39:02 +0100
commit04760563b88c8e94f3ae448710d1ab8b350c2e5f (patch)
treed3f24155c6084b67322b6481d321bc2f0e82d4d6
parent7bcb62b45d18ab7b48ad3cb5d13aec3bc577678e (diff)
downloaddrm-04760563b88c8e94f3ae448710d1ab8b350c2e5f.tar.gz
Set the drm bus map type for each buffer object memory type.
-rw-r--r--linux-core/drmP.h1
-rw-r--r--linux-core/drm_compat.c3
-rw-r--r--linux-core/drm_vm.c4
-rw-r--r--linux-core/i915_buffer.c4
4 files changed, 9 insertions, 3 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index c472689b..e070c073 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -664,6 +664,7 @@ typedef struct drm_mem_type_manager {
struct list_head lru;
struct list_head pinned;
uint32_t flags;
+ uint32_t drm_bus_maptype;
unsigned long io_offset;
unsigned long io_size;
void *io_addr;
diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c
index eeda4e4a..3bb35997 100644
--- a/linux-core/drm_compat.c
+++ b/linux-core/drm_compat.c
@@ -306,8 +306,9 @@ int drm_bo_map_bound(struct vm_area_struct *vma)
BUG_ON(ret);
if (bus_size) {
+ drm_mem_type_manager_t *man = &dev->bm.man[bo->mem.mem_type];
unsigned long pfn = (bus_base + bus_offset) >> PAGE_SHIFT;
- pgprot_t pgprot = drm_io_prot(_DRM_AGP, vma);
+ pgprot_t pgprot = drm_io_prot(man->drm_bus_maptype, vma);
ret = io_remap_pfn_range(vma, vma->vm_start, pfn,
vma->vm_end - vma->vm_start,
pgprot);
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index 4a340b57..f3b1088f 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -816,8 +816,10 @@ struct page *drm_bo_vm_fault(struct vm_area_struct *vma,
page_offset = (address - vma->vm_start) >> PAGE_SHIFT;
if (bus_size) {
+ drm_mem_type_manager_t *man = &dev->bm.man[bo->mem.mem_type];
+
pfn = ((bus_base + bus_offset) >> PAGE_SHIFT) + page_offset;
- vma->vm_page_prot = drm_io_prot(_DRM_AGP, vma);
+ vma->vm_page_prot = drm_io_prot(man->drm_bus_maptype, vma);
} else {
ttm = bo->ttm;
diff --git a/linux-core/i915_buffer.c b/linux-core/i915_buffer.c
index 3ccfab38..374b28df 100644
--- a/linux-core/i915_buffer.c
+++ b/linux-core/i915_buffer.c
@@ -71,6 +71,7 @@ int i915_init_mem_type(drm_device_t * dev, uint32_t type,
case DRM_BO_MEM_LOCAL:
man->flags = _DRM_FLAG_MEMTYPE_MAPPABLE |
_DRM_FLAG_MEMTYPE_CACHED;
+ man->drm_bus_maptype = 0;
break;
case DRM_BO_MEM_TT:
if (!(drm_core_has_AGP(dev) && dev->agp)) {
@@ -83,6 +84,7 @@ int i915_init_mem_type(drm_device_t * dev, uint32_t type,
man->io_addr = NULL;
man->flags = _DRM_FLAG_MEMTYPE_MAPPABLE |
_DRM_FLAG_MEMTYPE_CSELECT | _DRM_FLAG_NEEDS_IOREMAP;
+ man->drm_bus_maptype = _DRM_AGP;
break;
case DRM_BO_MEM_PRIV0:
if (!(drm_core_has_AGP(dev) && dev->agp)) {
@@ -95,7 +97,7 @@ int i915_init_mem_type(drm_device_t * dev, uint32_t type,
man->io_addr = NULL;
man->flags = _DRM_FLAG_MEMTYPE_MAPPABLE |
_DRM_FLAG_MEMTYPE_FIXED | _DRM_FLAG_NEEDS_IOREMAP;
-
+ man->drm_bus_maptype = _DRM_AGP;
break;
default:
DRM_ERROR("Unsupported memory type %u\n", (unsigned)type);