diff options
| author | Dave Airlie <airlied@redhat.com> | 2014-03-16 22:29:29 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2014-03-16 22:29:29 -0400 |
| commit | e40d641099213145a034981e646dc2180a488152 (patch) | |
| tree | 49b892d13877e2ff7bc6cf1875bfc190500d4437 /include | |
| parent | 28b90a9e7fda90846b5257d7dce6311997c930f1 (diff) | |
| parent | 0d639883ee26359e1bf38195df1dbca0f879e239 (diff) | |
Merge branch 'drm-minor' of git://people.freedesktop.org/~dvdhrm/linux into drm-next
This series contains several cleanups for the DRM-minor handling. All but the
last one reviewed by Daniel and tested by Thierry. Initially, the series
included patches to convert minor-handling to a common base-ID, but have
been NACKed by Daniel so I dropped them and only included the main part in the
last patch. With this in place, drm_global_mutex is no longer needed for
minor-handling (but still for device unregistration..).
There are some pending patches that try to remove the global mutex entirely, but
they need some more reviews and thus are not included.
* 'drm-minor' of git://people.freedesktop.org/~dvdhrm/linux:
drm: make minors independent of global lock
drm: inline drm_minor_get_id()
drm: coding-style fixes in minor handling
drm: remove redundant minor->device field
drm: remove unneeded #ifdef CONFIG_DEBUGFS
drm: rename drm_unplug/get_minor() to drm_minor_register/unregister()
drm: move drm_put_minor() to drm_minor_free()
drm: allocate minors early
drm: add minor-lookup/release helpers
drm: provide device-refcount
drm: turn DRM_MINOR_* into enum
drm: remove unused DRM_MINOR_UNASSIGNED
drm: skip redundant minor-lookup in open path
drm: group dev-lifetime related members
Diffstat (limited to 'include')
| -rw-r--r-- | include/drm/drmP.h | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 04a7f31301f8..538079030be0 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include <asm/current.h> | 43 | #include <asm/current.h> |
| 44 | #endif /* __alpha__ */ | 44 | #endif /* __alpha__ */ |
| 45 | #include <linux/kernel.h> | 45 | #include <linux/kernel.h> |
| 46 | #include <linux/kref.h> | ||
| 46 | #include <linux/miscdevice.h> | 47 | #include <linux/miscdevice.h> |
| 47 | #include <linux/fs.h> | 48 | #include <linux/fs.h> |
| 48 | #include <linux/init.h> | 49 | #include <linux/init.h> |
| @@ -1008,10 +1009,12 @@ struct drm_driver { | |||
| 1008 | struct list_head legacy_dev_list; | 1009 | struct list_head legacy_dev_list; |
| 1009 | }; | 1010 | }; |
| 1010 | 1011 | ||
| 1011 | #define DRM_MINOR_UNASSIGNED 0 | 1012 | enum drm_minor_type { |
| 1012 | #define DRM_MINOR_LEGACY 1 | 1013 | DRM_MINOR_LEGACY, |
| 1013 | #define DRM_MINOR_CONTROL 2 | 1014 | DRM_MINOR_CONTROL, |
| 1014 | #define DRM_MINOR_RENDER 3 | 1015 | DRM_MINOR_RENDER, |
| 1016 | DRM_MINOR_CNT, | ||
| 1017 | }; | ||
| 1015 | 1018 | ||
| 1016 | /** | 1019 | /** |
| 1017 | * Info file list entry. This structure represents a debugfs or proc file to | 1020 | * Info file list entry. This structure represents a debugfs or proc file to |
| @@ -1040,7 +1043,6 @@ struct drm_info_node { | |||
| 1040 | struct drm_minor { | 1043 | struct drm_minor { |
| 1041 | int index; /**< Minor device number */ | 1044 | int index; /**< Minor device number */ |
| 1042 | int type; /**< Control or render */ | 1045 | int type; /**< Control or render */ |
| 1043 | dev_t device; /**< Device number for mknod */ | ||
| 1044 | struct device *kdev; /**< Linux device */ | 1046 | struct device *kdev; /**< Linux device */ |
| 1045 | struct drm_device *dev; | 1047 | struct drm_device *dev; |
| 1046 | 1048 | ||
| @@ -1098,6 +1100,19 @@ struct drm_device { | |||
| 1098 | char *devname; /**< For /proc/interrupts */ | 1100 | char *devname; /**< For /proc/interrupts */ |
| 1099 | int if_version; /**< Highest interface version set */ | 1101 | int if_version; /**< Highest interface version set */ |
| 1100 | 1102 | ||
| 1103 | /** \name Lifetime Management */ | ||
| 1104 | /*@{ */ | ||
| 1105 | struct kref ref; /**< Object ref-count */ | ||
| 1106 | struct device *dev; /**< Device structure of bus-device */ | ||
| 1107 | struct drm_driver *driver; /**< DRM driver managing the device */ | ||
| 1108 | void *dev_private; /**< DRM driver private data */ | ||
| 1109 | struct address_space *dev_mapping; /**< Private addr-space just for the device */ | ||
| 1110 | struct drm_minor *control; /**< Control node */ | ||
| 1111 | struct drm_minor *primary; /**< Primary node */ | ||
| 1112 | struct drm_minor *render; /**< Render node */ | ||
| 1113 | atomic_t unplugged; /**< Flag whether dev is dead */ | ||
| 1114 | /*@} */ | ||
| 1115 | |||
| 1101 | /** \name Locks */ | 1116 | /** \name Locks */ |
| 1102 | /*@{ */ | 1117 | /*@{ */ |
| 1103 | spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ | 1118 | spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ |
| @@ -1171,7 +1186,6 @@ struct drm_device { | |||
| 1171 | 1186 | ||
| 1172 | struct drm_agp_head *agp; /**< AGP data */ | 1187 | struct drm_agp_head *agp; /**< AGP data */ |
| 1173 | 1188 | ||
| 1174 | struct device *dev; /**< Device structure */ | ||
| 1175 | struct pci_dev *pdev; /**< PCI device structure */ | 1189 | struct pci_dev *pdev; /**< PCI device structure */ |
| 1176 | #ifdef __alpha__ | 1190 | #ifdef __alpha__ |
| 1177 | struct pci_controller *hose; | 1191 | struct pci_controller *hose; |
| @@ -1182,17 +1196,11 @@ struct drm_device { | |||
| 1182 | 1196 | ||
| 1183 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | 1197 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
| 1184 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ | 1198 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
| 1185 | void *dev_private; /**< device private data */ | ||
| 1186 | struct address_space *dev_mapping; | ||
| 1187 | struct drm_sigdata sigdata; /**< For block_all_signals */ | 1199 | struct drm_sigdata sigdata; /**< For block_all_signals */ |
| 1188 | sigset_t sigmask; | 1200 | sigset_t sigmask; |
| 1189 | 1201 | ||
| 1190 | struct drm_driver *driver; | ||
| 1191 | struct drm_local_map *agp_buffer_map; | 1202 | struct drm_local_map *agp_buffer_map; |
| 1192 | unsigned int agp_buffer_token; | 1203 | unsigned int agp_buffer_token; |
| 1193 | struct drm_minor *control; /**< Control node for card */ | ||
| 1194 | struct drm_minor *primary; /**< render type primary screen head */ | ||
| 1195 | struct drm_minor *render; /**< render node for card */ | ||
| 1196 | 1204 | ||
| 1197 | struct drm_mode_config mode_config; /**< Current mode config */ | 1205 | struct drm_mode_config mode_config; /**< Current mode config */ |
| 1198 | 1206 | ||
| @@ -1203,8 +1211,6 @@ struct drm_device { | |||
| 1203 | struct drm_vma_offset_manager *vma_offset_manager; | 1211 | struct drm_vma_offset_manager *vma_offset_manager; |
| 1204 | /*@} */ | 1212 | /*@} */ |
| 1205 | int switch_power_state; | 1213 | int switch_power_state; |
| 1206 | |||
| 1207 | atomic_t unplugged; /* device has been unplugged or gone away */ | ||
| 1208 | }; | 1214 | }; |
| 1209 | 1215 | ||
| 1210 | #define DRM_SWITCH_POWER_ON 0 | 1216 | #define DRM_SWITCH_POWER_ON 0 |
| @@ -1661,9 +1667,14 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map) | |||
| 1661 | 1667 | ||
| 1662 | struct drm_device *drm_dev_alloc(struct drm_driver *driver, | 1668 | struct drm_device *drm_dev_alloc(struct drm_driver *driver, |
| 1663 | struct device *parent); | 1669 | struct device *parent); |
| 1664 | void drm_dev_free(struct drm_device *dev); | 1670 | void drm_dev_ref(struct drm_device *dev); |
| 1671 | void drm_dev_unref(struct drm_device *dev); | ||
| 1665 | int drm_dev_register(struct drm_device *dev, unsigned long flags); | 1672 | int drm_dev_register(struct drm_device *dev, unsigned long flags); |
| 1666 | void drm_dev_unregister(struct drm_device *dev); | 1673 | void drm_dev_unregister(struct drm_device *dev); |
| 1674 | |||
| 1675 | struct drm_minor *drm_minor_acquire(unsigned int minor_id); | ||
| 1676 | void drm_minor_release(struct drm_minor *minor); | ||
| 1677 | |||
| 1667 | /*@}*/ | 1678 | /*@}*/ |
| 1668 | 1679 | ||
| 1669 | /* PCI section */ | 1680 | /* PCI section */ |
