summaryrefslogtreecommitdiffstats
path: root/include/drm/drmP.h
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2017-03-08 09:12:42 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2017-03-09 10:18:02 -0500
commita8f8b1d9b8701465f1309d551fba2ebda6760f49 (patch)
tree956134c967ac448b8e4048281b696d265e18fd60 /include/drm/drmP.h
parent721dacbbeb062b99adea9ab6046b6ec04a8ec5fc (diff)
drm: Extract drm_file.h
I'm torn on whether drm_minor really should be here or somewhere else. Maybe with more clarity after untangling drmP.h more this is easier to decide, for now I've put a FIXME comment right next to it. Right now we need struct drm_minor for the inline drm_file type helpers, and so it does kinda make sense to have them here. Next patch will kerneldoc-ify the entire pile. Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170308141257.12119-10-daniel.vetter@ffwll.ch
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r--include/drm/drmP.h127
1 files changed, 1 insertions, 126 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7bd6752683a4..4a0260e2b067 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -77,10 +77,10 @@
77#include <drm/drm_drv.h> 77#include <drm/drm_drv.h>
78#include <drm/drm_prime.h> 78#include <drm/drm_prime.h>
79#include <drm/drm_pci.h> 79#include <drm/drm_pci.h>
80#include <drm/drm_file.h>
80 81
81struct module; 82struct module;
82 83
83struct drm_file;
84struct drm_device; 84struct drm_device;
85struct drm_agp_head; 85struct drm_agp_head;
86struct drm_local_map; 86struct drm_local_map;
@@ -360,76 +360,6 @@ struct drm_ioctl_desc {
360 .name = #ioctl \ 360 .name = #ioctl \
361 } 361 }
362 362
363/* Event queued up for userspace to read */
364struct drm_pending_event {
365 struct completion *completion;
366 void (*completion_release)(struct completion *completion);
367 struct drm_event *event;
368 struct dma_fence *fence;
369 struct list_head link;
370 struct list_head pending_link;
371 struct drm_file *file_priv;
372 pid_t pid; /* pid of requester, no guarantee it's valid by the time
373 we deliver the event, for tracing only */
374};
375
376/** File private data */
377struct drm_file {
378 unsigned authenticated :1;
379 /* true when the client has asked us to expose stereo 3D mode flags */
380 unsigned stereo_allowed :1;
381 /*
382 * true if client understands CRTC primary planes and cursor planes
383 * in the plane list
384 */
385 unsigned universal_planes:1;
386 /* true if client understands atomic properties */
387 unsigned atomic:1;
388 /*
389 * This client is the creator of @master.
390 * Protected by struct drm_device::master_mutex.
391 */
392 unsigned is_master:1;
393
394 struct pid *pid;
395 drm_magic_t magic;
396 struct list_head lhead;
397 struct drm_minor *minor;
398 unsigned long lock_count;
399
400 /** Mapping of mm object handles to object pointers. */
401 struct idr object_idr;
402 /** Lock for synchronization of access to object_idr. */
403 spinlock_t table_lock;
404
405 struct file *filp;
406 void *driver_priv;
407
408 struct drm_master *master; /* master this node is currently associated with
409 N.B. not always dev->master */
410 /**
411 * fbs - List of framebuffers associated with this file.
412 *
413 * Protected by fbs_lock. Note that the fbs list holds a reference on
414 * the fb object to prevent it from untimely disappearing.
415 */
416 struct list_head fbs;
417 struct mutex fbs_lock;
418
419 /** User-created blob properties; this retains a reference on the
420 * property. */
421 struct list_head blobs;
422
423 wait_queue_head_t event_wait;
424 struct list_head pending_event_list;
425 struct list_head event_list;
426 int event_space;
427
428 struct mutex event_read_lock;
429
430 struct drm_prime_file_private prime;
431};
432
433/* Flags and return codes for get_vblank_timestamp() driver function. */ 363/* Flags and return codes for get_vblank_timestamp() driver function. */
434#define DRM_CALLED_FROM_VBLIRQ 1 364#define DRM_CALLED_FROM_VBLIRQ 1
435#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) 365#define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0)
@@ -440,12 +370,6 @@ struct drm_file {
440#define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) 370#define DRM_SCANOUTPOS_IN_VBLANK (1 << 1)
441#define DRM_SCANOUTPOS_ACCURATE (1 << 2) 371#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
442 372
443enum drm_minor_type {
444 DRM_MINOR_PRIMARY,
445 DRM_MINOR_CONTROL,
446 DRM_MINOR_RENDER,
447};
448
449/** 373/**
450 * Info file list entry. This structure represents a debugfs or proc file to 374 * Info file list entry. This structure represents a debugfs or proc file to
451 * be created by the drm core 375 * be created by the drm core
@@ -468,21 +392,6 @@ struct drm_info_node {
468}; 392};
469 393
470/** 394/**
471 * DRM minor structure. This structure represents a drm minor number.
472 */
473struct drm_minor {
474 int index; /**< Minor device number */
475 int type; /**< Control or render */
476 struct device *kdev; /**< Linux device */
477 struct drm_device *dev;
478
479 struct dentry *debugfs_root;
480
481 struct list_head debugfs_list;
482 struct mutex debugfs_lock; /* Protects debugfs_list. */
483};
484
485/**
486 * DRM device structure. This structure represent a complete card that 395 * DRM device structure. This structure represent a complete card that
487 * may contain multiple heads. 396 * may contain multiple heads.
488 */ 397 */
@@ -656,21 +565,6 @@ static inline int drm_device_is_unplugged(struct drm_device *dev)
656 return ret; 565 return ret;
657} 566}
658 567
659static inline bool drm_is_render_client(const struct drm_file *file_priv)
660{
661 return file_priv->minor->type == DRM_MINOR_RENDER;
662}
663
664static inline bool drm_is_control_client(const struct drm_file *file_priv)
665{
666 return file_priv->minor->type == DRM_MINOR_CONTROL;
667}
668
669static inline bool drm_is_primary_client(const struct drm_file *file_priv)
670{
671 return file_priv->minor->type == DRM_MINOR_PRIMARY;
672}
673
674/******************************************************************/ 568/******************************************************************/
675/** \name Internal function definitions */ 569/** \name Internal function definitions */
676/*@{*/ 570/*@{*/
@@ -688,25 +582,6 @@ extern long drm_compat_ioctl(struct file *filp,
688#endif 582#endif
689extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); 583extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
690 584
691/* File Operations (drm_file.c) */
692int drm_open(struct inode *inode, struct file *filp);
693ssize_t drm_read(struct file *filp, char __user *buffer,
694 size_t count, loff_t *offset);
695int drm_release(struct inode *inode, struct file *filp);
696unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
697int drm_event_reserve_init_locked(struct drm_device *dev,
698 struct drm_file *file_priv,
699 struct drm_pending_event *p,
700 struct drm_event *e);
701int drm_event_reserve_init(struct drm_device *dev,
702 struct drm_file *file_priv,
703 struct drm_pending_event *p,
704 struct drm_event *e);
705void drm_event_cancel_free(struct drm_device *dev,
706 struct drm_pending_event *p);
707void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e);
708void drm_send_event(struct drm_device *dev, struct drm_pending_event *e);
709
710/* Misc. IOCTL support (drm_ioctl.c) */ 585/* Misc. IOCTL support (drm_ioctl.c) */
711int drm_noop(struct drm_device *dev, void *data, 586int drm_noop(struct drm_device *dev, void *data,
712 struct drm_file *file_priv); 587 struct drm_file *file_priv);