| .. | .. |
|---|
| 21 | 21 | * OTHER DEALINGS IN THE SOFTWARE. |
|---|
| 22 | 22 | */ |
|---|
| 23 | 23 | |
|---|
| 24 | +#include <linux/kthread.h> |
|---|
| 25 | + |
|---|
| 26 | +#include <drm/drm_ioctl.h> |
|---|
| 27 | +#include <drm/drm_vblank.h> |
|---|
| 28 | + |
|---|
| 24 | 29 | #define DRM_IF_MAJOR 1 |
|---|
| 25 | 30 | #define DRM_IF_MINOR 4 |
|---|
| 26 | 31 | |
|---|
| 32 | +#define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
|---|
| 33 | + |
|---|
| 34 | +struct dentry; |
|---|
| 35 | +struct dma_buf; |
|---|
| 36 | +struct drm_connector; |
|---|
| 37 | +struct drm_crtc; |
|---|
| 38 | +struct drm_framebuffer; |
|---|
| 39 | +struct drm_gem_object; |
|---|
| 40 | +struct drm_master; |
|---|
| 41 | +struct drm_minor; |
|---|
| 42 | +struct drm_prime_file_private; |
|---|
| 43 | +struct drm_printer; |
|---|
| 44 | +struct drm_vblank_crtc; |
|---|
| 45 | + |
|---|
| 27 | 46 | /* drm_file.c */ |
|---|
| 28 | 47 | extern struct mutex drm_global_mutex; |
|---|
| 48 | +bool drm_dev_needs_global_mutex(struct drm_device *dev); |
|---|
| 29 | 49 | struct drm_file *drm_file_alloc(struct drm_minor *minor); |
|---|
| 30 | 50 | void drm_file_free(struct drm_file *file); |
|---|
| 31 | 51 | void drm_lastclose(struct drm_device *dev); |
|---|
| 52 | + |
|---|
| 53 | +#ifdef CONFIG_PCI |
|---|
| 32 | 54 | |
|---|
| 33 | 55 | /* drm_pci.c */ |
|---|
| 34 | 56 | int drm_irq_by_busid(struct drm_device *dev, void *data, |
|---|
| 35 | 57 | struct drm_file *file_priv); |
|---|
| 36 | 58 | void drm_pci_agp_destroy(struct drm_device *dev); |
|---|
| 37 | 59 | int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master); |
|---|
| 60 | + |
|---|
| 61 | +#else |
|---|
| 62 | + |
|---|
| 63 | +static inline int drm_irq_by_busid(struct drm_device *dev, void *data, |
|---|
| 64 | + struct drm_file *file_priv) |
|---|
| 65 | +{ |
|---|
| 66 | + return -EINVAL; |
|---|
| 67 | +} |
|---|
| 68 | + |
|---|
| 69 | +static inline void drm_pci_agp_destroy(struct drm_device *dev) |
|---|
| 70 | +{ |
|---|
| 71 | +} |
|---|
| 72 | + |
|---|
| 73 | +static inline int drm_pci_set_busid(struct drm_device *dev, |
|---|
| 74 | + struct drm_master *master) |
|---|
| 75 | +{ |
|---|
| 76 | + return -EINVAL; |
|---|
| 77 | +} |
|---|
| 78 | + |
|---|
| 79 | +#endif |
|---|
| 38 | 80 | |
|---|
| 39 | 81 | /* drm_prime.c */ |
|---|
| 40 | 82 | int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, |
|---|
| .. | .. |
|---|
| 51 | 93 | struct drm_minor *drm_minor_acquire(unsigned int minor_id); |
|---|
| 52 | 94 | void drm_minor_release(struct drm_minor *minor); |
|---|
| 53 | 95 | |
|---|
| 54 | | -/* drm_info.c */ |
|---|
| 55 | | -int drm_name_info(struct seq_file *m, void *data); |
|---|
| 56 | | -int drm_clients_info(struct seq_file *m, void* data); |
|---|
| 57 | | -int drm_gem_name_info(struct seq_file *m, void *data); |
|---|
| 96 | +/* drm_managed.c */ |
|---|
| 97 | +void drm_managed_release(struct drm_device *dev); |
|---|
| 98 | +void drmm_add_final_kfree(struct drm_device *dev, void *container); |
|---|
| 58 | 99 | |
|---|
| 59 | 100 | /* drm_vblank.c */ |
|---|
| 101 | +static inline bool drm_vblank_passed(u64 seq, u64 ref) |
|---|
| 102 | +{ |
|---|
| 103 | + return (seq - ref) <= (1 << 23); |
|---|
| 104 | +} |
|---|
| 105 | + |
|---|
| 60 | 106 | void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe); |
|---|
| 61 | | -void drm_vblank_cleanup(struct drm_device *dev); |
|---|
| 107 | +int drm_vblank_get(struct drm_device *dev, unsigned int pipe); |
|---|
| 108 | +void drm_vblank_put(struct drm_device *dev, unsigned int pipe); |
|---|
| 109 | +u64 drm_vblank_count(struct drm_device *dev, unsigned int pipe); |
|---|
| 110 | + |
|---|
| 111 | +/* drm_vblank_work.c */ |
|---|
| 112 | +static inline void drm_vblank_flush_worker(struct drm_vblank_crtc *vblank) |
|---|
| 113 | +{ |
|---|
| 114 | + kthread_flush_worker(vblank->worker); |
|---|
| 115 | +} |
|---|
| 116 | + |
|---|
| 117 | +static inline void drm_vblank_destroy_worker(struct drm_vblank_crtc *vblank) |
|---|
| 118 | +{ |
|---|
| 119 | + if (vblank->worker) |
|---|
| 120 | + kthread_destroy_worker(vblank->worker); |
|---|
| 121 | +} |
|---|
| 122 | + |
|---|
| 123 | +int drm_vblank_worker_init(struct drm_vblank_crtc *vblank); |
|---|
| 124 | +void drm_vblank_cancel_pending_works(struct drm_vblank_crtc *vblank); |
|---|
| 125 | +void drm_handle_vblank_works(struct drm_vblank_crtc *vblank); |
|---|
| 62 | 126 | |
|---|
| 63 | 127 | /* IOCTLS */ |
|---|
| 64 | 128 | int drm_wait_vblank_ioctl(struct drm_device *dev, void *data, |
|---|
| .. | .. |
|---|
| 69 | 133 | /* drm_irq.c */ |
|---|
| 70 | 134 | |
|---|
| 71 | 135 | /* IOCTLS */ |
|---|
| 136 | +#if IS_ENABLED(CONFIG_DRM_LEGACY) |
|---|
| 72 | 137 | int drm_legacy_irq_control(struct drm_device *dev, void *data, |
|---|
| 73 | 138 | struct drm_file *file_priv); |
|---|
| 139 | +#endif |
|---|
| 74 | 140 | |
|---|
| 75 | 141 | int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data, |
|---|
| 76 | 142 | struct drm_file *filp); |
|---|
| .. | .. |
|---|
| 89 | 155 | struct drm_file *file_priv); |
|---|
| 90 | 156 | int drm_master_open(struct drm_file *file_priv); |
|---|
| 91 | 157 | void drm_master_release(struct drm_file *file_priv); |
|---|
| 158 | +bool drm_master_internal_acquire(struct drm_device *dev); |
|---|
| 159 | +void drm_master_internal_release(struct drm_device *dev); |
|---|
| 92 | 160 | |
|---|
| 93 | 161 | /* drm_sysfs.c */ |
|---|
| 94 | 162 | extern struct class *drm_class; |
|---|
| .. | .. |
|---|
| 102 | 170 | void drm_sysfs_lease_event(struct drm_device *dev); |
|---|
| 103 | 171 | |
|---|
| 104 | 172 | /* drm_gem.c */ |
|---|
| 173 | +struct drm_gem_object; |
|---|
| 105 | 174 | int drm_gem_init(struct drm_device *dev); |
|---|
| 106 | | -void drm_gem_destroy(struct drm_device *dev); |
|---|
| 107 | 175 | int drm_gem_handle_create_tail(struct drm_file *file_priv, |
|---|
| 108 | 176 | struct drm_gem_object *obj, |
|---|
| 109 | 177 | u32 *handlep); |
|---|
| .. | .. |
|---|
| 118 | 186 | void drm_gem_print_info(struct drm_printer *p, unsigned int indent, |
|---|
| 119 | 187 | const struct drm_gem_object *obj); |
|---|
| 120 | 188 | |
|---|
| 189 | +int drm_gem_pin(struct drm_gem_object *obj); |
|---|
| 190 | +void drm_gem_unpin(struct drm_gem_object *obj); |
|---|
| 191 | +void *drm_gem_vmap(struct drm_gem_object *obj); |
|---|
| 192 | +void drm_gem_vunmap(struct drm_gem_object *obj, void *vaddr); |
|---|
| 193 | + |
|---|
| 121 | 194 | /* drm_debugfs.c drm_debugfs_crc.c */ |
|---|
| 122 | 195 | #if defined(CONFIG_DEBUG_FS) |
|---|
| 123 | 196 | int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
|---|
| 124 | 197 | struct dentry *root); |
|---|
| 125 | | -int drm_debugfs_cleanup(struct drm_minor *minor); |
|---|
| 126 | | -int drm_debugfs_connector_add(struct drm_connector *connector); |
|---|
| 198 | +void drm_debugfs_cleanup(struct drm_minor *minor); |
|---|
| 199 | +void drm_debugfs_connector_add(struct drm_connector *connector); |
|---|
| 127 | 200 | void drm_debugfs_connector_remove(struct drm_connector *connector); |
|---|
| 128 | | -int drm_debugfs_crtc_add(struct drm_crtc *crtc); |
|---|
| 201 | +void drm_debugfs_crtc_add(struct drm_crtc *crtc); |
|---|
| 129 | 202 | void drm_debugfs_crtc_remove(struct drm_crtc *crtc); |
|---|
| 130 | | -int drm_debugfs_crtc_crc_add(struct drm_crtc *crtc); |
|---|
| 131 | | -#if defined(CONFIG_ROCKCHIP_DRM_DEBUG) |
|---|
| 132 | | -int drm_debugfs_vop_add(struct drm_crtc *crtc, struct dentry *root); |
|---|
| 133 | | -int vop_plane_dump(struct vop_dump_info *dump_info, int frame_count); |
|---|
| 134 | | -#endif |
|---|
| 203 | +void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc); |
|---|
| 135 | 204 | #else |
|---|
| 136 | 205 | static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
|---|
| 137 | 206 | struct dentry *root) |
|---|
| .. | .. |
|---|
| 139 | 208 | return 0; |
|---|
| 140 | 209 | } |
|---|
| 141 | 210 | |
|---|
| 142 | | -static inline int drm_debugfs_cleanup(struct drm_minor *minor) |
|---|
| 211 | +static inline void drm_debugfs_cleanup(struct drm_minor *minor) |
|---|
| 143 | 212 | { |
|---|
| 144 | | - return 0; |
|---|
| 145 | 213 | } |
|---|
| 146 | 214 | |
|---|
| 147 | | -static inline int drm_debugfs_connector_add(struct drm_connector *connector) |
|---|
| 215 | +static inline void drm_debugfs_connector_add(struct drm_connector *connector) |
|---|
| 148 | 216 | { |
|---|
| 149 | | - return 0; |
|---|
| 150 | 217 | } |
|---|
| 151 | 218 | static inline void drm_debugfs_connector_remove(struct drm_connector *connector) |
|---|
| 152 | 219 | { |
|---|
| 153 | 220 | } |
|---|
| 154 | 221 | |
|---|
| 155 | | -static inline int drm_debugfs_crtc_add(struct drm_crtc *crtc) |
|---|
| 222 | +static inline void drm_debugfs_crtc_add(struct drm_crtc *crtc) |
|---|
| 156 | 223 | { |
|---|
| 157 | | - return 0; |
|---|
| 158 | 224 | } |
|---|
| 159 | 225 | static inline void drm_debugfs_crtc_remove(struct drm_crtc *crtc) |
|---|
| 160 | 226 | { |
|---|
| 161 | 227 | } |
|---|
| 162 | 228 | |
|---|
| 163 | | -static inline int drm_debugfs_crtc_crc_add(struct drm_crtc *crtc) |
|---|
| 229 | +static inline void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc) |
|---|
| 164 | 230 | { |
|---|
| 165 | | - return 0; |
|---|
| 166 | 231 | } |
|---|
| 167 | | - |
|---|
| 168 | | -#if defined(CONFIG_ROCKCHIP_DRM_DEBUG) |
|---|
| 169 | | -static inline int drm_debugfs_vop_add(struct drm_crtc *crtc, struct dentry *root) |
|---|
| 170 | | -{ |
|---|
| 171 | | - return 0; |
|---|
| 172 | | -} |
|---|
| 173 | | - |
|---|
| 174 | | -static inline int vop_plane_dump(struct vop_dump_info *dump_info, int frame_count) |
|---|
| 175 | | -{ |
|---|
| 176 | | - return 0; |
|---|
| 177 | | -} |
|---|
| 178 | | -#endif |
|---|
| 179 | 232 | |
|---|
| 180 | 233 | #endif |
|---|
| 181 | 234 | |
|---|
| .. | .. |
|---|
| 194 | 247 | struct drm_file *file_private); |
|---|
| 195 | 248 | int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data, |
|---|
| 196 | 249 | struct drm_file *file_private); |
|---|
| 250 | +int drm_syncobj_transfer_ioctl(struct drm_device *dev, void *data, |
|---|
| 251 | + struct drm_file *file_private); |
|---|
| 197 | 252 | int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data, |
|---|
| 198 | 253 | struct drm_file *file_private); |
|---|
| 254 | +int drm_syncobj_timeline_wait_ioctl(struct drm_device *dev, void *data, |
|---|
| 255 | + struct drm_file *file_private); |
|---|
| 199 | 256 | int drm_syncobj_reset_ioctl(struct drm_device *dev, void *data, |
|---|
| 200 | 257 | struct drm_file *file_private); |
|---|
| 201 | 258 | int drm_syncobj_signal_ioctl(struct drm_device *dev, void *data, |
|---|
| 202 | 259 | struct drm_file *file_private); |
|---|
| 260 | +int drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, |
|---|
| 261 | + struct drm_file *file_private); |
|---|
| 262 | +int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, |
|---|
| 263 | + struct drm_file *file_private); |
|---|
| 203 | 264 | |
|---|
| 204 | 265 | /* drm_framebuffer.c */ |
|---|
| 205 | 266 | void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, |
|---|
| 206 | 267 | const struct drm_framebuffer *fb); |
|---|
| 207 | | -int drm_framebuffer_debugfs_init(struct drm_minor *minor); |
|---|
| 268 | +void drm_framebuffer_debugfs_init(struct drm_minor *minor); |
|---|