diff options
author | Mark Kettenis <kettenis@openbsd.org> | 2013-07-21 12:24:52 +0200 |
---|---|---|
committer | Jonathan Gray <jsg@jsg.id.au> | 2013-08-12 10:46:24 +1000 |
commit | ceffd920a45d2eaa5602875bf66c21d804db42e6 (patch) | |
tree | b60e318bba88b7e4307e155984f11b2cf0c13cae /sys | |
parent | 4075c3969f53c79f6c8220154625d047078ccb45 (diff) |
add support for having multiple drm devices
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 8 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 14 |
2 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 17dc727dc87..44c3513160b 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -101,14 +101,6 @@ #define DRM_READUNLOCK() rw_exit_read(&dev->dev_lock) #define DRM_MAXUNITS 8 -/* D_CLONE only supports one device, this will be fixed eventually */ -#define drm_get_device_from_kdev(_kdev) \ - (drm_cd.cd_ndevs > 0 ? drm_cd.cd_devs[0] : NULL) -#if 0 -#define drm_get_device_from_kdev(_kdev) \ - (minor(_kdev) < drm_cd.cd_ndevs) ? drm_cd.cd_devs[minor(_kdev)] : NULL -#endif - /* DRM_SUSER returns true if the user is superuser */ #define DRM_SUSER(p) (suser(p, 0) == 0) #define DRM_MTRR_WC MDF_WRITECOMBINE diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 11c6a1b33ec..d8f919a10a1 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -56,6 +56,7 @@ int drm_debug_flag = 1; #endif +struct drm_device *drm_get_device_from_kdev(dev_t); int drm_firstopen(struct drm_device *); int drm_lastclose(struct drm_device *); void drm_attach(struct device *, struct device *, void *); @@ -326,6 +327,17 @@ drm_find_file_by_minor(struct drm_device *dev, int minor) return (SPLAY_FIND(drm_file_tree, &dev->files, &key)); } +struct drm_device * +drm_get_device_from_kdev(dev_t kdev) +{ + int unit = minor(kdev) & 0xff; + + if (unit < drm_cd.cd_ndevs) + return drm_cd.cd_devs[unit]; + + return NULL; +} + int drm_firstopen(struct drm_device *dev) { @@ -1761,7 +1773,7 @@ struct uvm_object * udv_attach_drm(void *arg, vm_prot_t accessprot, voff_t off, vsize_t size) { dev_t device = *((dev_t *)arg); - struct drm_device *dev = drm_get_device_from_kdev(kdev); + struct drm_device *dev = drm_get_device_from_kdev(device); struct drm_local_map *map; struct drm_obj *obj; |