diff options
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index c8e64bbadbcf..db56a6add5de 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -245,16 +245,6 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
245 | 245 | ||
246 | #endif | 246 | #endif |
247 | 247 | ||
248 | #define DRM_PROC_LIMIT (PAGE_SIZE-80) | ||
249 | |||
250 | #define DRM_PROC_PRINT(fmt, arg...) \ | ||
251 | len += sprintf(&buf[len], fmt , ##arg); \ | ||
252 | if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; } | ||
253 | |||
254 | #define DRM_PROC_PRINT_RET(ret, fmt, arg...) \ | ||
255 | len += sprintf(&buf[len], fmt , ##arg); \ | ||
256 | if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; } | ||
257 | |||
258 | /*@}*/ | 248 | /*@}*/ |
259 | 249 | ||
260 | /***********************************************************************/ | 250 | /***********************************************************************/ |
@@ -265,19 +255,8 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
265 | 255 | ||
266 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) | 256 | #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) |
267 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) | 257 | #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) |
268 | #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist) | ||
269 | 258 | ||
270 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) | 259 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
271 | /** | ||
272 | * Get the private SAREA mapping. | ||
273 | * | ||
274 | * \param _dev DRM device. | ||
275 | * \param _ctx context number. | ||
276 | * \param _map output mapping. | ||
277 | */ | ||
278 | #define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ | ||
279 | (_map) = (_dev)->context_sareas[_ctx]; \ | ||
280 | } while(0) | ||
281 | 260 | ||
282 | /** | 261 | /** |
283 | * Test that the hardware lock is held by the caller, returning otherwise. | 262 | * Test that the hardware lock is held by the caller, returning otherwise. |
@@ -297,18 +276,6 @@ do { \ | |||
297 | } while (0) | 276 | } while (0) |
298 | 277 | ||
299 | /** | 278 | /** |
300 | * Copy and IOCTL return string to user space | ||
301 | */ | ||
302 | #define DRM_COPY( name, value ) \ | ||
303 | len = strlen( value ); \ | ||
304 | if ( len > name##_len ) len = name##_len; \ | ||
305 | name##_len = strlen( value ); \ | ||
306 | if ( len && name ) { \ | ||
307 | if ( copy_to_user( name, value, len ) ) \ | ||
308 | return -EFAULT; \ | ||
309 | } | ||
310 | |||
311 | /** | ||
312 | * Ioctl function type. | 279 | * Ioctl function type. |
313 | * | 280 | * |
314 | * \param inode device inode. | 281 | * \param inode device inode. |
@@ -322,6 +289,9 @@ typedef int drm_ioctl_t(struct drm_device *dev, void *data, | |||
322 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, | 289 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, |
323 | unsigned long arg); | 290 | unsigned long arg); |
324 | 291 | ||
292 | #define DRM_IOCTL_NR(n) _IOC_NR(n) | ||
293 | #define DRM_MAJOR 226 | ||
294 | |||
325 | #define DRM_AUTH 0x1 | 295 | #define DRM_AUTH 0x1 |
326 | #define DRM_MASTER 0x2 | 296 | #define DRM_MASTER 0x2 |
327 | #define DRM_ROOT_ONLY 0x4 | 297 | #define DRM_ROOT_ONLY 0x4 |
@@ -426,6 +396,14 @@ struct drm_buf_entry { | |||
426 | struct drm_freelist freelist; | 396 | struct drm_freelist freelist; |
427 | }; | 397 | }; |
428 | 398 | ||
399 | /* Event queued up for userspace to read */ | ||
400 | struct drm_pending_event { | ||
401 | struct drm_event *event; | ||
402 | struct list_head link; | ||
403 | struct drm_file *file_priv; | ||
404 | void (*destroy)(struct drm_pending_event *event); | ||
405 | }; | ||
406 | |||
429 | /** File private data */ | 407 | /** File private data */ |
430 | struct drm_file { | 408 | struct drm_file { |
431 | int authenticated; | 409 | int authenticated; |
@@ -449,6 +427,10 @@ struct drm_file { | |||
449 | struct drm_master *master; /* master this node is currently associated with | 427 | struct drm_master *master; /* master this node is currently associated with |
450 | N.B. not always minor->master */ | 428 | N.B. not always minor->master */ |
451 | struct list_head fbs; | 429 | struct list_head fbs; |
430 | |||
431 | wait_queue_head_t event_wait; | ||
432 | struct list_head event_list; | ||
433 | int event_space; | ||
452 | }; | 434 | }; |
453 | 435 | ||
454 | /** Wait queue */ | 436 | /** Wait queue */ |
@@ -795,6 +777,15 @@ struct drm_driver { | |||
795 | /* Master routines */ | 777 | /* Master routines */ |
796 | int (*master_create)(struct drm_device *dev, struct drm_master *master); | 778 | int (*master_create)(struct drm_device *dev, struct drm_master *master); |
797 | void (*master_destroy)(struct drm_device *dev, struct drm_master *master); | 779 | void (*master_destroy)(struct drm_device *dev, struct drm_master *master); |
780 | /** | ||
781 | * master_set is called whenever the minor master is set. | ||
782 | * master_drop is called whenever the minor master is dropped. | ||
783 | */ | ||
784 | |||
785 | int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, | ||
786 | bool from_open); | ||
787 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, | ||
788 | bool from_release); | ||
798 | 789 | ||
799 | int (*proc_init)(struct drm_minor *minor); | 790 | int (*proc_init)(struct drm_minor *minor); |
800 | void (*proc_cleanup)(struct drm_minor *minor); | 791 | void (*proc_cleanup)(struct drm_minor *minor); |
@@ -900,6 +891,12 @@ struct drm_minor { | |||
900 | struct drm_mode_group mode_group; | 891 | struct drm_mode_group mode_group; |
901 | }; | 892 | }; |
902 | 893 | ||
894 | struct drm_pending_vblank_event { | ||
895 | struct drm_pending_event base; | ||
896 | int pipe; | ||
897 | struct drm_event_vblank event; | ||
898 | }; | ||
899 | |||
903 | /** | 900 | /** |
904 | * DRM device structure. This structure represent a complete card that | 901 | * DRM device structure. This structure represent a complete card that |
905 | * may contain multiple heads. | 902 | * may contain multiple heads. |
@@ -999,6 +996,12 @@ struct drm_device { | |||
999 | 996 | ||
1000 | u32 max_vblank_count; /**< size of vblank counter register */ | 997 | u32 max_vblank_count; /**< size of vblank counter register */ |
1001 | 998 | ||
999 | /** | ||
1000 | * List of events | ||
1001 | */ | ||
1002 | struct list_head vblank_event_list; | ||
1003 | spinlock_t event_lock; | ||
1004 | |||
1002 | /*@} */ | 1005 | /*@} */ |
1003 | cycles_t ctx_start; | 1006 | cycles_t ctx_start; |
1004 | cycles_t lck_start; | 1007 | cycles_t lck_start; |
@@ -1135,6 +1138,8 @@ extern int drm_lastclose(struct drm_device *dev); | |||
1135 | extern int drm_open(struct inode *inode, struct file *filp); | 1138 | extern int drm_open(struct inode *inode, struct file *filp); |
1136 | extern int drm_stub_open(struct inode *inode, struct file *filp); | 1139 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
1137 | extern int drm_fasync(int fd, struct file *filp, int on); | 1140 | extern int drm_fasync(int fd, struct file *filp, int on); |
1141 | extern ssize_t drm_read(struct file *filp, char __user *buffer, | ||
1142 | size_t count, loff_t *offset); | ||
1138 | extern int drm_release(struct inode *inode, struct file *filp); | 1143 | extern int drm_release(struct inode *inode, struct file *filp); |
1139 | 1144 | ||
1140 | /* Mapping support (drm_vm.h) */ | 1145 | /* Mapping support (drm_vm.h) */ |