Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdd55a29 authored by Dave Airlie's avatar Dave Airlie
Browse files

drm: detypef waitlist/freelist/buf_entry/device_dma/drm_queue structs



Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 8fc2fdf4
Loading
Loading
Loading
Loading
+16 −16
Original line number Original line Diff line number Diff line
@@ -319,7 +319,7 @@ struct drm_buf {
};
};


/** bufs is one longer than it has to be */
/** bufs is one longer than it has to be */
typedef struct drm_waitlist {
struct drm_waitlist {
	int count;			/**< Number of possible buffers */
	int count;			/**< Number of possible buffers */
	struct drm_buf **bufs;		/**< List of pointers to buffers */
	struct drm_buf **bufs;		/**< List of pointers to buffers */
	struct drm_buf **rp;			/**< Read pointer */
	struct drm_buf **rp;			/**< Read pointer */
@@ -327,9 +327,9 @@ typedef struct drm_waitlist {
	struct drm_buf **end;		/**< End pointer */
	struct drm_buf **end;		/**< End pointer */
	spinlock_t read_lock;
	spinlock_t read_lock;
	spinlock_t write_lock;
	spinlock_t write_lock;
} drm_waitlist_t;
};


typedef struct drm_freelist {
struct drm_freelist {
	int initialized;	       /**< Freelist in use */
	int initialized;	       /**< Freelist in use */
	atomic_t count;		       /**< Number of free buffers */
	atomic_t count;		       /**< Number of free buffers */
	struct drm_buf *next;	       /**< End pointer */
	struct drm_buf *next;	       /**< End pointer */
@@ -339,7 +339,7 @@ typedef struct drm_freelist {
	int high_mark;		       /**< High water mark */
	int high_mark;		       /**< High water mark */
	atomic_t wfh;		       /**< If waiting for high mark */
	atomic_t wfh;		       /**< If waiting for high mark */
	spinlock_t lock;
	spinlock_t lock;
} drm_freelist_t;
};


typedef struct drm_dma_handle {
typedef struct drm_dma_handle {
	dma_addr_t busaddr;
	dma_addr_t busaddr;
@@ -350,16 +350,16 @@ typedef struct drm_dma_handle {
/**
/**
 * Buffer entry.  There is one of this for each buffer size order.
 * Buffer entry.  There is one of this for each buffer size order.
 */
 */
typedef struct drm_buf_entry {
struct drm_buf_entry {
	int buf_size;			/**< size */
	int buf_size;			/**< size */
	int buf_count;			/**< number of buffers */
	int buf_count;			/**< number of buffers */
	struct drm_buf *buflist;		/**< buffer list */
	struct drm_buf *buflist;		/**< buffer list */
	int seg_count;
	int seg_count;
	int page_order;
	int page_order;
	drm_dma_handle_t **seglist;
	struct drm_dma_handle **seglist;


	drm_freelist_t freelist;
	struct drm_freelist freelist;
} drm_buf_entry_t;
};


/** File private data */
/** File private data */
struct drm_file {
struct drm_file {
@@ -378,7 +378,7 @@ struct drm_file {
};
};


/** Wait queue */
/** Wait queue */
typedef struct drm_queue {
struct drm_queue {
	atomic_t use_count;		/**< Outstanding uses (+1) */
	atomic_t use_count;		/**< Outstanding uses (+1) */
	atomic_t finalization;		/**< Finalization in progress */
	atomic_t finalization;		/**< Finalization in progress */
	atomic_t block_count;		/**< Count of processes waiting */
	atomic_t block_count;		/**< Count of processes waiting */
@@ -392,9 +392,9 @@ typedef struct drm_queue {
	atomic_t total_locks;		/**< Total locks statistics */
	atomic_t total_locks;		/**< Total locks statistics */
#endif
#endif
	enum drm_ctx_flags flags;	/**< Context preserving and 2D-only */
	enum drm_ctx_flags flags;	/**< Context preserving and 2D-only */
	drm_waitlist_t waitlist;	/**< Pending buffers */
	struct drm_waitlist waitlist;	/**< Pending buffers */
	wait_queue_head_t flush_queue;	/**< Processes waiting until flush */
	wait_queue_head_t flush_queue;	/**< Processes waiting until flush */
} drm_queue_t;
};


/**
/**
 * Lock data.
 * Lock data.
@@ -413,9 +413,9 @@ typedef struct drm_lock_data {
/**
/**
 * DMA data.
 * DMA data.
 */
 */
typedef struct drm_device_dma {
struct drm_device_dma {


	drm_buf_entry_t bufs[DRM_MAX_ORDER + 1];	/**< buffers, grouped by their size order */
	struct drm_buf_entry bufs[DRM_MAX_ORDER + 1];	/**< buffers, grouped by their size order */
	int buf_count;			/**< total number of buffers */
	int buf_count;			/**< total number of buffers */
	struct drm_buf **buflist;		/**< Vector of pointers into drm_device_dma::bufs */
	struct drm_buf **buflist;		/**< Vector of pointers into drm_device_dma::bufs */
	int seg_count;
	int seg_count;
@@ -429,7 +429,7 @@ typedef struct drm_device_dma {
		_DRM_DMA_USE_PCI_RO = 0x08
		_DRM_DMA_USE_PCI_RO = 0x08
	} flags;
	} flags;


} drm_device_dma_t;
};


/**
/**
 * AGP memory entry.  Stored as a doubly linked list.
 * AGP memory entry.  Stored as a doubly linked list.
@@ -688,8 +688,8 @@ struct drm_device {
	int queue_count;		/**< Number of active DMA queues */
	int queue_count;		/**< Number of active DMA queues */
	int queue_reserved;		  /**< Number of reserved DMA queues */
	int queue_reserved;		  /**< Number of reserved DMA queues */
	int queue_slots;		/**< Actual length of queuelist */
	int queue_slots;		/**< Actual length of queuelist */
	drm_queue_t **queuelist;	/**< Vector of pointers to DMA queues */
	struct drm_queue **queuelist;	/**< Vector of pointers to DMA queues */
	drm_device_dma_t *dma;		/**< Optional pointer for DMA support */
	struct drm_device_dma *dma;		/**< Optional pointer for DMA support */
	/*@} */
	/*@} */


	/** \name Context support */
	/** \name Context support */
+17 −16
Original line number Original line Diff line number Diff line
@@ -504,7 +504,8 @@ int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
 *
 *
 * Frees any pages and buffers associated with the given entry.
 * Frees any pages and buffers associated with the given entry.
 */
 */
static void drm_cleanup_buf_error(struct drm_device * dev, drm_buf_entry_t * entry)
static void drm_cleanup_buf_error(struct drm_device * dev,
				  struct drm_buf_entry * entry)
{
{
	int i;
	int i;


@@ -551,8 +552,8 @@ static void drm_cleanup_buf_error(struct drm_device * dev, drm_buf_entry_t * ent
 */
 */
int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
{
{
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	drm_buf_entry_t *entry;
	struct drm_buf_entry *entry;
	drm_agp_mem_t *agp_entry;
	drm_agp_mem_t *agp_entry;
	struct drm_buf *buf;
	struct drm_buf *buf;
	unsigned long offset;
	unsigned long offset;
@@ -721,13 +722,13 @@ EXPORT_SYMBOL(drm_addbufs_agp);


int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
{
{
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	int count;
	int count;
	int order;
	int order;
	int size;
	int size;
	int total;
	int total;
	int page_order;
	int page_order;
	drm_buf_entry_t *entry;
	struct drm_buf_entry *entry;
	drm_dma_handle_t *dmah;
	drm_dma_handle_t *dmah;
	struct drm_buf *buf;
	struct drm_buf *buf;
	int alignment;
	int alignment;
@@ -947,8 +948,8 @@ EXPORT_SYMBOL(drm_addbufs_pci);


static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request)
static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request)
{
{
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	drm_buf_entry_t *entry;
	struct drm_buf_entry *entry;
	struct drm_buf *buf;
	struct drm_buf *buf;
	unsigned long offset;
	unsigned long offset;
	unsigned long agp_offset;
	unsigned long agp_offset;
@@ -1109,8 +1110,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request


static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request)
static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request)
{
{
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	drm_buf_entry_t *entry;
	struct drm_buf_entry *entry;
	struct drm_buf *buf;
	struct drm_buf *buf;
	unsigned long offset;
	unsigned long offset;
	unsigned long agp_offset;
	unsigned long agp_offset;
@@ -1339,7 +1340,7 @@ int drm_infobufs(struct inode *inode, struct file *filp,
{
{
	struct drm_file *priv = filp->private_data;
	struct drm_file *priv = filp->private_data;
	struct drm_device *dev = priv->head->dev;
	struct drm_device *dev = priv->head->dev;
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	struct drm_buf_info request;
	struct drm_buf_info request;
	struct drm_buf_info __user *argp = (void __user *)arg;
	struct drm_buf_info __user *argp = (void __user *)arg;
	int i;
	int i;
@@ -1374,8 +1375,8 @@ int drm_infobufs(struct inode *inode, struct file *filp,
			if (dma->bufs[i].buf_count) {
			if (dma->bufs[i].buf_count) {
				struct drm_buf_desc __user *to =
				struct drm_buf_desc __user *to =
				    &request.list[count];
				    &request.list[count];
				drm_buf_entry_t *from = &dma->bufs[i];
				struct drm_buf_entry *from = &dma->bufs[i];
				drm_freelist_t *list = &dma->bufs[i].freelist;
				struct drm_freelist *list = &dma->bufs[i].freelist;
				if (copy_to_user(&to->count,
				if (copy_to_user(&to->count,
						 &from->buf_count,
						 &from->buf_count,
						 sizeof(from->buf_count)) ||
						 sizeof(from->buf_count)) ||
@@ -1427,10 +1428,10 @@ int drm_markbufs(struct inode *inode, struct file *filp,
{
{
	struct drm_file *priv = filp->private_data;
	struct drm_file *priv = filp->private_data;
	struct drm_device *dev = priv->head->dev;
	struct drm_device *dev = priv->head->dev;
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	struct drm_buf_desc request;
	struct drm_buf_desc request;
	int order;
	int order;
	drm_buf_entry_t *entry;
	struct drm_buf_entry *entry;


	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
		return -EINVAL;
		return -EINVAL;
@@ -1477,7 +1478,7 @@ int drm_freebufs(struct inode *inode, struct file *filp,
{
{
	struct drm_file *priv = filp->private_data;
	struct drm_file *priv = filp->private_data;
	struct drm_device *dev = priv->head->dev;
	struct drm_device *dev = priv->head->dev;
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	struct drm_buf_free request;
	struct drm_buf_free request;
	int i;
	int i;
	int idx;
	int idx;
@@ -1533,7 +1534,7 @@ int drm_mapbufs(struct inode *inode, struct file *filp,
{
{
	struct drm_file *priv = filp->private_data;
	struct drm_file *priv = filp->private_data;
	struct drm_device *dev = priv->head->dev;
	struct drm_device *dev = priv->head->dev;
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	struct drm_buf_map __user *argp = (void __user *)arg;
	struct drm_buf_map __user *argp = (void __user *)arg;
	int retcode = 0;
	int retcode = 0;
	const int zero = 0;
	const int zero = 0;
+2 −2
Original line number Original line Diff line number Diff line
@@ -69,7 +69,7 @@ int drm_dma_setup(struct drm_device *dev)
 */
 */
void drm_dma_takedown(struct drm_device *dev)
void drm_dma_takedown(struct drm_device *dev)
{
{
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	int i, j;
	int i, j;


	if (!dma)
	if (!dma)
@@ -154,7 +154,7 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
 */
 */
void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp)
void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp)
{
{
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	int i;
	int i;


	if (!dma)
	if (!dma)
+2 −2
Original line number Original line Diff line number Diff line
@@ -287,7 +287,7 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
	struct drm_device *dev = (struct drm_device *) data;
	struct drm_device *dev = (struct drm_device *) data;
	int len = 0;
	int len = 0;
	int i;
	int i;
	drm_queue_t *q;
	struct drm_queue *q;


	if (offset > DRM_PROC_LIMIT) {
	if (offset > DRM_PROC_LIMIT) {
		*eof = 1;
		*eof = 1;
@@ -359,7 +359,7 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
{
{
	struct drm_device *dev = (struct drm_device *) data;
	struct drm_device *dev = (struct drm_device *) data;
	int len = 0;
	int len = 0;
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	int i;
	int i;


	if (!dma || offset > DRM_PROC_LIMIT) {
	if (!dma || offset > DRM_PROC_LIMIT) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -276,7 +276,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
{
{
	struct drm_file *priv = vma->vm_file->private_data;
	struct drm_file *priv = vma->vm_file->private_data;
	struct drm_device *dev = priv->head->dev;
	struct drm_device *dev = priv->head->dev;
	drm_device_dma_t *dma = dev->dma;
	struct drm_device_dma *dma = dev->dma;
	unsigned long offset;
	unsigned long offset;
	unsigned long page_nr;
	unsigned long page_nr;
	struct page *page;
	struct page *page;
@@ -474,7 +474,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
{
{
	struct drm_file *priv = filp->private_data;
	struct drm_file *priv = filp->private_data;
	struct drm_device *dev;
	struct drm_device *dev;
	drm_device_dma_t *dma;
	struct drm_device_dma *dma;
	unsigned long length = vma->vm_end - vma->vm_start;
	unsigned long length = vma->vm_end - vma->vm_start;


	dev = priv->head->dev;
	dev = priv->head->dev;
Loading