summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/drmP.h1
-rw-r--r--sys/dev/pci/drm/drm_drv.c22
-rw-r--r--sys/dev/pci/drm/radeon/radeon.h1
-rw-r--r--sys/dev/pci/drm/radeon/radeon_kms.c1
-rw-r--r--sys/dev/pci/drm/radeon/radeon_ttm.c2
5 files changed, 6 insertions, 21 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index a56e87abefb..17dc727dc87 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -630,6 +630,7 @@ struct drm_driver_info {
struct drm_file *);
void (*close)(struct drm_device *, struct drm_file *);
void (*lastclose)(struct drm_device *);
+ struct uvm_object *(*mmap)(struct drm_device *, voff_t, vsize_t);
int (*dma_ioctl)(struct drm_device *, struct drm_dma *,
struct drm_file *);
int (*irq_handler)(void *);
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index 952d64ecf3e..11c6a1b33ec 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -1757,24 +1757,6 @@ out_free_list:
return ret;
}
-#if 1
-struct uvm_object *radeon_mmap(struct drm_device *, voff_t, vsize_t);
-
-struct uvm_object *
-udv_attach_drm(void *arg, vm_prot_t accessprot, voff_t off, vsize_t size)
-{
- dev_t kdev = *((dev_t *)arg);
- struct drm_device *dev = drm_get_device_from_kdev(kdev);
-
- if (cdevsw[major(kdev)].d_mmap != drmmmap)
- return NULL;
-
- if (dev == NULL)
- return NULL;
-
- return radeon_mmap(dev, off, size);
-}
-#else
struct uvm_object *
udv_attach_drm(void *arg, vm_prot_t accessprot, voff_t off, vsize_t size)
{
@@ -1789,6 +1771,9 @@ udv_attach_drm(void *arg, vm_prot_t accessprot, voff_t off, vsize_t size)
if (dev == NULL)
return NULL;
+ if (dev->driver->mmap)
+ return dev->driver->mmap(dev, off, size);
+
again:
DRM_LOCK();
TAILQ_FOREACH(map, &dev->maplist, link) {
@@ -1820,7 +1805,6 @@ again:
DRM_UNLOCK();
return &obj->uobj;
}
-#endif
int
drm_handle_cmp(struct drm_handle *a, struct drm_handle *b)
diff --git a/sys/dev/pci/drm/radeon/radeon.h b/sys/dev/pci/drm/radeon/radeon.h
index 1f9aea4b201..64877253910 100644
--- a/sys/dev/pci/drm/radeon/radeon.h
+++ b/sys/dev/pci/drm/radeon/radeon.h
@@ -1903,6 +1903,7 @@ extern void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc
extern int radeon_resume_kms(struct drm_device *dev);
extern int radeon_suspend_kms(struct drm_device *dev);
extern void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size);
+extern struct uvm_object *radeon_mmap(struct drm_device *, voff_t, vsize_t);
/*
* vm
diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c
index 4b932f5a716..8c7146c6d2d 100644
--- a/sys/dev/pci/drm/radeon/radeon_kms.c
+++ b/sys/dev/pci/drm/radeon/radeon_kms.c
@@ -1295,6 +1295,7 @@ static struct drm_driver_info kms_driver = {
.ioctl = radeondrm_ioctl_kms,
.firstopen = radeon_driver_firstopen_kms,
.open = radeon_driver_open_kms,
+ .mmap = radeon_mmap,
#ifdef notyet
.preclose = radeon_driver_preclose_kms,
.postclose = radeon_driver_postclose_kms,
diff --git a/sys/dev/pci/drm/radeon/radeon_ttm.c b/sys/dev/pci/drm/radeon/radeon_ttm.c
index d698dd7d1d7..9f692327ff7 100644
--- a/sys/dev/pci/drm/radeon/radeon_ttm.c
+++ b/sys/dev/pci/drm/radeon/radeon_ttm.c
@@ -890,8 +890,6 @@ radeon_ttm_fault(struct uvm_faultinfo *ufi, vaddr_t vaddr, vm_page_t *pps,
return r;
}
-struct uvm_object *radeon_mmap(struct drm_device *, voff_t, vsize_t);
-
struct uvm_object *
radeon_mmap(struct drm_device *dev, voff_t off, vsize_t size)
{