summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm/drmP.h
diff options
context:
space:
mode:
authorrnoland <rnoland@FreeBSD.org>2008-08-23 20:59:12 +0000
committerrnoland <rnoland@FreeBSD.org>2008-08-23 20:59:12 +0000
commit8ebfdfe248e93b41d01041a5ec069bf5761f8741 (patch)
tree702bd8b6b1d2549932511454499d13cba551297c /sys/dev/drm/drmP.h
parentcd5da88fc1464a435965660ff2af024771c4333b (diff)
downloadFreeBSD-src-8ebfdfe248e93b41d01041a5ec069bf5761f8741.zip
FreeBSD-src-8ebfdfe248e93b41d01041a5ec069bf5761f8741.tar.gz
Update drm kernel drivers.
This is a sync to mesa/drm pre-gem, with a few fixes on top of that. It also contains one local patch supplied by kib@ that I can't apply to git.master shared code. Approved by: flz Obtained from: mesa/drm git.master MFC after: 2 weeks
Diffstat (limited to 'sys/dev/drm/drmP.h')
-rw-r--r--sys/dev/drm/drmP.h464
1 files changed, 278 insertions, 186 deletions
diff --git a/sys/dev/drm/drmP.h b/sys/dev/drm/drmP.h
index 44c0130..6132760 100644
--- a/sys/dev/drm/drmP.h
+++ b/sys/dev/drm/drmP.h
@@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
#if defined(_KERNEL) || defined(__KERNEL__)
-typedef struct drm_device drm_device_t;
+struct drm_device;
typedef struct drm_file drm_file_t;
#include <sys/param.h>
@@ -62,6 +62,8 @@ typedef struct drm_file drm_file_t;
#include <sys/bus.h>
#include <sys/signalvar.h>
#include <sys/poll.h>
+#include <sys/tree.h>
+#include <sys/taskqueue.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_extern.h>
@@ -79,9 +81,9 @@ typedef struct drm_file drm_file_t;
#include <sys/memrange.h>
#if __FreeBSD_version >= 800004
#include <dev/agp/agpvar.h>
-#else
+#else /* __FreeBSD_version >= 800004 */
#include <pci/agpvar.h>
-#endif
+#endif /* __FreeBSD_version >= 800004 */
#include <sys/agpio.h>
#if __FreeBSD_version >= 500000
#include <sys/mutex.h>
@@ -113,6 +115,7 @@ typedef struct drm_file drm_file_t;
#include "dev/drm/drm.h"
#include "dev/drm/drm_linux_list.h"
#include "dev/drm/drm_atomic.h"
+#include "dev/drm/drm_internal.h"
#ifdef __FreeBSD__
#include <opt_drm.h>
@@ -159,6 +162,7 @@ typedef struct drm_file drm_file_t;
#define DRM_MEM_CTXBITMAP 17
#define DRM_MEM_STUB 18
#define DRM_MEM_SGLISTS 19
+#define DRM_MEM_DRAWABLE 20
#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
@@ -191,10 +195,15 @@ MALLOC_DECLARE(M_DRM);
#define DRM_CURPROC curthread
#define DRM_STRUCTPROC struct thread
#define DRM_SPINTYPE struct mtx
-#define DRM_SPININIT(l,name) mtx_init(&l, name, NULL, MTX_DEF)
-#define DRM_SPINUNINIT(l) mtx_destroy(&l)
+#define DRM_SPININIT(l,name) mtx_init(l, name, NULL, MTX_DEF)
+#define DRM_SPINUNINIT(l) mtx_destroy(l)
#define DRM_SPINLOCK(l) mtx_lock(l)
-#define DRM_SPINUNLOCK(u) mtx_unlock(u);
+#define DRM_SPINUNLOCK(u) mtx_unlock(u)
+#define DRM_SPINLOCK_IRQSAVE(l, irqflags) do { \
+ mtx_lock(l); \
+ (void)irqflags; \
+} while (0)
+#define DRM_SPINUNLOCK_IRQRESTORE(u, irqflags) mtx_unlock(u)
#define DRM_SPINLOCK_ASSERT(l) mtx_assert(l, MA_OWNED)
#define DRM_CURRENTPID curthread->td_proc->p_pid
#define DRM_LOCK() mtx_lock(&dev->dev_lock)
@@ -216,10 +225,6 @@ MALLOC_DECLARE(M_DRM);
#define spldrm() spltty()
#endif /* __NetBSD__ || __OpenBSD__ */
-/* Currently our DRMFILE (filp) is a void * which is actually the pid
- * of the current process. It should be a per-open unique pointer, but
- * code for that is not yet written */
-#define DRMFILE void *
#define DRM_IRQ_ARGS void *arg
typedef void irqreturn_t;
#define IRQ_HANDLED /* nothing */
@@ -233,15 +238,19 @@ enum {
#define DRM_AGP_MEM struct agp_memory_info
#if defined(__FreeBSD__)
-#define DRM_DEVICE \
- drm_device_t *dev = kdev->si_drv1
-#define DRM_IOCTL_ARGS struct cdev *kdev, u_long cmd, caddr_t data, \
- int flags, DRM_STRUCTPROC *p, DRMFILE filp
+#define drm_get_device_from_kdev(_kdev) (_kdev->si_drv1)
+#elif defined(__NetBSD__)
+#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, minor(_kdev))
+#elif defined(__OpenBSD__)
+#define drm_get_device_from_kdev(_kdev) device_lookup(&drm_cd, \
+ minor(_kdev)))->dv_cfdata->cf_driver->cd_devs[minor(_kdev)]
+#endif
+#if defined(__FreeBSD__)
#define PAGE_ALIGN(addr) round_page(addr)
/* DRM_SUSER returns true if the user is superuser */
#if __FreeBSD_version >= 700000
-#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0)
+#define DRM_SUSER(p) (priv_check(p, PRIV_DRIVER) == 0)
#else
#define DRM_SUSER(p) (suser(p) == 0)
#endif
@@ -251,17 +260,6 @@ enum {
#else /* __FreeBSD__ */
-#if defined(__NetBSD__)
-#define DRM_DEVICE \
- drm_device_t *dev = device_lookup(&drm_cd, minor(kdev))
-#elif defined(__OpenBSD__)
-#define DRM_DEVICE \
- drm_device_t *dev = (device_lookup(&drm_cd, \
- minor(kdev)))->dv_cfdata->cf_driver->cd_devs[minor(kdev)]
-#endif /* __OpenBSD__ */
-#define DRM_IOCTL_ARGS dev_t kdev, u_long cmd, caddr_t data, \
- int flags, DRM_STRUCTPROC *p, DRMFILE filp
-
#define CDEV_MAJOR 34
#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
/* DRM_SUSER returns true if the user is superuser */
@@ -270,7 +268,7 @@ enum {
#define DRM_MTRR_WC MTRR_TYPE_WC
#define jiffies hardclock_ticks
-typedef drm_device_t *device_t;
+typedef struct drm_device *device_t;
extern struct cfdriver drm_cd;
#endif /* !__FreeBSD__ */
@@ -349,14 +347,6 @@ typedef vaddr_t vm_offset_t;
(!uvm_useracc((caddr_t)uaddr, size, VM_PROT_READ))
#endif /* !__FreeBSD__ */
-#define DRM_COPY_TO_USER_IOCTL(user, kern, size) \
- if ( IOCPARM_LEN(cmd) != size) \
- return EINVAL; \
- *user = kern;
-#define DRM_COPY_FROM_USER_IOCTL(kern, user, size) \
- if ( IOCPARM_LEN(cmd) != size) \
- return EINVAL; \
- kern = *user;
#define DRM_COPY_TO_USER(user, kern, size) \
copyout(kern, user, size)
#define DRM_COPY_FROM_USER(kern, user, size) \
@@ -376,7 +366,6 @@ typedef vaddr_t vm_offset_t;
#define cpu_to_le32(x) htole32(x)
#define le32_to_cpu(x) le32toh(x)
-#define DRM_ERR(v) v
#define DRM_HZ hz
#define DRM_UDELAY(udelay) DELAY(udelay)
#define DRM_TIME_SLICE (hz/20) /* Time slice for GLXContexts */
@@ -385,59 +374,35 @@ typedef vaddr_t vm_offset_t;
(_map) = (_dev)->context_sareas[_ctx]; \
} while(0)
-#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) \
-do { \
- if (_filp != (DRMFILE)(intptr_t)DRM_CURRENTPID) { \
- DRM_ERROR("filp doesn't match curproc\n"); \
- return EINVAL; \
- } \
- _priv = drm_find_file_by_proc(dev, DRM_CURPROC); \
- if (_priv == NULL) { \
- DRM_ERROR("can't find authenticator\n"); \
- return EINVAL; \
- } \
-} while (0)
-
-#define LOCK_TEST_WITH_RETURN(dev, filp) \
+#define LOCK_TEST_WITH_RETURN(dev, file_priv) \
do { \
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) || \
- dev->lock.filp != filp) { \
+ dev->lock.file_priv != file_priv) { \
DRM_ERROR("%s called without lock held\n", \
__FUNCTION__); \
return EINVAL; \
} \
} while (0)
-#define DRM_GETSAREA() \
-do { \
- drm_local_map_t *map; \
- DRM_SPINLOCK_ASSERT(&dev->dev_lock); \
- TAILQ_FOREACH(map, &dev->maplist, link) { \
- if (map->type == _DRM_SHM && \
- map->flags & _DRM_CONTAINS_LOCK) { \
- dev_priv->sarea = map; \
- break; \
- } \
- } \
-} while (0)
-
#if defined(__FreeBSD__) && __FreeBSD_version > 500000
+/* Returns -errno to shared code */
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
for ( ret = 0 ; !ret && !(condition) ; ) { \
DRM_UNLOCK(); \
mtx_lock(&dev->irq_lock); \
if (!(condition)) \
- ret = msleep(&(queue), &dev->irq_lock, \
+ ret = -mtx_sleep(&(queue), &dev->irq_lock, \
PZERO | PCATCH, "drmwtq", (timeout)); \
mtx_unlock(&dev->irq_lock); \
DRM_LOCK(); \
}
#else
+/* Returns -errno to shared code */
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \
for ( ret = 0 ; !ret && !(condition) ; ) { \
int s = spldrm(); \
if (!(condition)) \
- ret = tsleep( &(queue), PZERO | PCATCH, \
+ ret = -tsleep( &(queue), PZERO | PCATCH, \
"drmwtq", (timeout) ); \
splx(s); \
}
@@ -467,9 +432,17 @@ typedef struct drm_pci_id_list
#define DRM_MASTER 0x2
#define DRM_ROOT_ONLY 0x4
typedef struct drm_ioctl_desc {
- int (*func)(DRM_IOCTL_ARGS);
+ unsigned long cmd;
+ int (*func)(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
int flags;
} drm_ioctl_desc_t;
+/**
+ * Creates a driver or general drm_ioctl_desc array entry for the given
+ * ioctl, for use by drm_ioctl().
+ */
+#define DRM_IOCTL_DEF(ioctl, func, flags) \
+ [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags}
typedef struct drm_magic_entry {
drm_magic_t magic;
@@ -492,7 +465,7 @@ typedef struct drm_buf {
unsigned long bus_address; /* Bus address of buffer */
struct drm_buf *next; /* Kernel-only: used for free list */
__volatile__ int pending; /* On hardware DMA queue */
- DRMFILE filp; /* Unique identifier of holding process */
+ struct drm_file *file_priv; /* Unique identifier of holding process */
int context; /* Kernel queue for this buffer */
enum {
DRM_LIST_NONE = 0,
@@ -554,12 +527,13 @@ struct drm_file {
typedef struct drm_lock_data {
drm_hw_lock_t *hw_lock; /* Hardware lock */
- DRMFILE filp; /* Unique identifier of holding process (NULL is kernel)*/
+ struct drm_file *file_priv; /* Unique identifier of holding process (NULL is kernel)*/
int lock_queue; /* Queue of blocked processes */
unsigned long lock_time; /* Time of last lock in jiffies */
} drm_lock_data_t;
-/* This structure, in the drm_device_t, is always initialized while the device
+/* This structure, in the struct drm_device, is always initialized while the
+ * device
* is open. dev->dma_lock protects the incrementing of dev->buf_use, which
* when set marks that no further bufs may be allocated until device teardown
* occurs (when the last open of the device has closed). The high/low
@@ -637,28 +611,57 @@ typedef struct drm_vbl_sig {
int pid;
} drm_vbl_sig_t;
+struct drm_vblank_info {
+ wait_queue_head_t queue; /* vblank wait queue */
+ atomic_t count; /* number of VBLANK interrupts */
+ /* (driver must alloc the right number of counters) */
+ struct drm_vbl_sig_list sigs; /* signal list to send on VBLANK */
+ atomic_t refcount; /* number of users of vblank interrupts */
+ u32 last; /* protected by dev->vbl_lock, used */
+ /* for wraparound handling */
+ int enabled; /* so we don't call enable more than */
+ /* once per disable */
+ int inmodeset; /* Display driver is setting mode */
+};
+
/* location of GART table */
#define DRM_ATI_GART_MAIN 1
#define DRM_ATI_GART_FB 2
-typedef struct ati_pcigart_info {
+#define DRM_ATI_GART_PCI 1
+#define DRM_ATI_GART_PCIE 2
+#define DRM_ATI_GART_IGP 3
+
+struct drm_ati_pcigart_info {
int gart_table_location;
- int is_pcie;
+ int gart_reg_if;
void *addr;
dma_addr_t bus_addr;
+ dma_addr_t table_mask;
+ dma_addr_t member_mask;
+ struct drm_dma_handle *table_handle;
drm_local_map_t mapping;
-} drm_ati_pcigart_info;
+ int table_size;
+};
+
+#ifndef DMA_BIT_MASK
+#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
+#endif
+
+#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
struct drm_driver_info {
int (*load)(struct drm_device *, unsigned long flags);
int (*firstopen)(struct drm_device *);
int (*open)(struct drm_device *, drm_file_t *);
- void (*preclose)(struct drm_device *, void *filp);
+ void (*preclose)(struct drm_device *, struct drm_file *file_priv);
void (*postclose)(struct drm_device *, drm_file_t *);
void (*lastclose)(struct drm_device *);
int (*unload)(struct drm_device *);
- void (*reclaim_buffers_locked)(struct drm_device *, void *filp);
- int (*dma_ioctl)(DRM_IOCTL_ARGS);
+ void (*reclaim_buffers_locked)(struct drm_device *,
+ struct drm_file *file_priv);
+ int (*dma_ioctl)(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
void (*dma_ready)(struct drm_device *);
int (*dma_quiescent)(struct drm_device *);
int (*dma_flush_block_and_flush)(struct drm_device *, int context,
@@ -670,11 +673,13 @@ struct drm_driver_info {
int (*kernel_context_switch)(struct drm_device *dev, int old,
int new);
int (*kernel_context_switch_unlock)(struct drm_device *dev);
- void (*irq_preinstall)(drm_device_t *dev);
- void (*irq_postinstall)(drm_device_t *dev);
- void (*irq_uninstall)(drm_device_t *dev);
+ void (*irq_preinstall)(struct drm_device *dev);
+ int (*irq_postinstall)(struct drm_device *dev);
+ void (*irq_uninstall)(struct drm_device *dev);
void (*irq_handler)(DRM_IRQ_ARGS);
- int (*vblank_wait)(drm_device_t *dev, unsigned int *sequence);
+ u32 (*get_vblank_counter)(struct drm_device *dev, int crtc);
+ int (*enable_vblank)(struct drm_device *dev, int crtc);
+ void (*disable_vblank)(struct drm_device *dev, int crtc);
drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
@@ -711,6 +716,7 @@ struct drm_driver_info {
unsigned use_dma_queue :1;
unsigned use_irq :1;
unsigned use_vbl_irq :1;
+ unsigned use_vbl_irq2 :1;
unsigned use_mtrr :1;
};
@@ -743,10 +749,14 @@ struct drm_device {
/* Locks */
#if defined(__FreeBSD__) && __FreeBSD_version > 500000
+ struct mtx vbl_lock; /* protects vblank operations */
struct mtx dma_lock; /* protects dev->dma */
struct mtx irq_lock; /* protects irq condition checks */
struct mtx dev_lock; /* protects everything else */
#endif
+ DRM_SPINTYPE drw_lock;
+ DRM_SPINTYPE tsk_lock;
+
/* Usage Counters */
int open_count; /* Outstanding files open */
int buf_use; /* Buffers in use -- cannot alloc */
@@ -793,8 +803,13 @@ struct drm_device {
atomic_t context_flag; /* Context swapping flag */
int last_context; /* Last current context */
- int vbl_queue; /* vbl wait channel */
- atomic_t vbl_received;
+
+ int vblank_disable_allowed;
+ atomic_t vbl_signal_pending; /* number of signals pending on all crtcs */
+ struct callout vblank_disable_timer;
+ u32 max_vblank_count; /* size of vblank counter register */
+ struct drm_vblank_info *vblank; /* per crtc vblank info */
+ int num_crtcs;
#ifdef __FreeBSD__
struct sigio *buf_sigio; /* Processes waiting for SIGIO */
@@ -811,6 +826,13 @@ struct drm_device {
void *dev_private;
unsigned int agp_buffer_token;
drm_local_map_t *agp_buffer_map;
+
+ struct unrhdr *drw_unrhdr;
+ /* RB tree of drawable infos */
+ RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
+
+ struct task locked_task;
+ void (*locked_task_call)(struct drm_device *dev);
};
extern int drm_debug_flag;
@@ -836,17 +858,20 @@ dev_type_read(drm_read);
dev_type_poll(drm_poll);
dev_type_mmap(drm_mmap);
#endif
+extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
/* File operations helpers (drm_fops.c) */
#ifdef __FreeBSD__
-extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
- DRM_STRUCTPROC *p, drm_device_t *dev);
-extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
- DRM_STRUCTPROC *p);
+extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
+ DRM_STRUCTPROC *p,
+ struct drm_device *dev);
+extern drm_file_t *drm_find_file_by_proc(struct drm_device *dev,
+ DRM_STRUCTPROC *p);
#elif defined(__NetBSD__) || defined(__OpenBSD__)
-extern int drm_open_helper(dev_t kdev, int flags, int fmt,
- DRM_STRUCTPROC *p, drm_device_t *dev);
-extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
+extern int drm_open_helper(dev_t kdev, int flags, int fmt,
+ DRM_STRUCTPROC *p,
+ struct drm_device *dev);
+extern drm_file_t *drm_find_file_by_proc(struct drm_device *dev,
DRM_STRUCTPROC *p);
#endif /* __NetBSD__ || __OpenBSD__ */
@@ -858,171 +883,238 @@ void *drm_calloc(size_t nmemb, size_t size, int area);
void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
int area);
void drm_free(void *pt, size_t size, int area);
-void *drm_ioremap(drm_device_t *dev, drm_local_map_t *map);
+void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map);
void drm_ioremapfree(drm_local_map_t *map);
int drm_mtrr_add(unsigned long offset, size_t size, int flags);
int drm_mtrr_del(int handle, unsigned long offset, size_t size, int flags);
-int drm_context_switch(drm_device_t *dev, int old, int new);
-int drm_context_switch_complete(drm_device_t *dev, int new);
+int drm_context_switch(struct drm_device *dev, int old, int new);
+int drm_context_switch_complete(struct drm_device *dev, int new);
-int drm_ctxbitmap_init(drm_device_t *dev);
-void drm_ctxbitmap_cleanup(drm_device_t *dev);
-void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
-int drm_ctxbitmap_next(drm_device_t *dev);
+int drm_ctxbitmap_init(struct drm_device *dev);
+void drm_ctxbitmap_cleanup(struct drm_device *dev);
+void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
+int drm_ctxbitmap_next(struct drm_device *dev);
/* Locking IOCTL support (drm_lock.c) */
int drm_lock_take(__volatile__ unsigned int *lock,
unsigned int context);
-int drm_lock_transfer(drm_device_t *dev,
- __volatile__ unsigned int *lock,
- unsigned int context);
-int drm_lock_free(drm_device_t *dev,
- __volatile__ unsigned int *lock,
- unsigned int context);
+int drm_lock_transfer(struct drm_device *dev,
+ __volatile__ unsigned int *lock,
+ unsigned int context);
+int drm_lock_free(struct drm_device *dev,
+ __volatile__ unsigned int *lock,
+ unsigned int context);
/* Buffer management support (drm_bufs.c) */
-unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource);
-unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource);
-void drm_rmmap(drm_device_t *dev, drm_local_map_t *map);
+unsigned long drm_get_resource_start(struct drm_device *dev,
+ unsigned int resource);
+unsigned long drm_get_resource_len(struct drm_device *dev,
+ unsigned int resource);
+void drm_rmmap(struct drm_device *dev, drm_local_map_t *map);
int drm_order(unsigned long size);
-int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
+int drm_addmap(struct drm_device *dev, unsigned long offset,
+ unsigned long size,
drm_map_type_t type, drm_map_flags_t flags,
drm_local_map_t **map_ptr);
-int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request);
-int drm_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request);
-int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request);
+int drm_addbufs_pci(struct drm_device *dev, drm_buf_desc_t *request);
+int drm_addbufs_sg(struct drm_device *dev, drm_buf_desc_t *request);
+int drm_addbufs_agp(struct drm_device *dev, drm_buf_desc_t *request);
/* DMA support (drm_dma.c) */
-int drm_dma_setup(drm_device_t *dev);
-void drm_dma_takedown(drm_device_t *dev);
-void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
-void drm_reclaim_buffers(drm_device_t *dev, DRMFILE filp);
+int drm_dma_setup(struct drm_device *dev);
+void drm_dma_takedown(struct drm_device *dev);
+void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf);
+void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv);
#define drm_core_reclaim_buffers drm_reclaim_buffers
/* IRQ support (drm_irq.c) */
-int drm_irq_install(drm_device_t *dev);
-int drm_irq_uninstall(drm_device_t *dev);
+int drm_irq_install(struct drm_device *dev);
+int drm_irq_uninstall(struct drm_device *dev);
irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
-void drm_driver_irq_preinstall(drm_device_t *dev);
-void drm_driver_irq_postinstall(drm_device_t *dev);
-void drm_driver_irq_uninstall(drm_device_t *dev);
-int drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq);
-void drm_vbl_send_signals(drm_device_t *dev);
+void drm_driver_irq_preinstall(struct drm_device *dev);
+void drm_driver_irq_postinstall(struct drm_device *dev);
+void drm_driver_irq_uninstall(struct drm_device *dev);
+void drm_handle_vblank(struct drm_device *dev, int crtc);
+u32 drm_vblank_count(struct drm_device *dev, int crtc);
+int drm_vblank_get(struct drm_device *dev, int crtc);
+void drm_vblank_put(struct drm_device *dev, int crtc);
+int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq);
+int drm_vblank_init(struct drm_device *dev, int num_crtcs);
+void drm_vbl_send_signals(struct drm_device *dev, int crtc);
+int drm_modeset_ctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
/* AGP/PCI Express/GART support (drm_agpsupport.c) */
-int drm_device_is_agp(drm_device_t *dev);
-int drm_device_is_pcie(drm_device_t *dev);
+int drm_device_is_agp(struct drm_device *dev);
+int drm_device_is_pcie(struct drm_device *dev);
drm_agp_head_t *drm_agp_init(void);
-int drm_agp_acquire(drm_device_t *dev);
-int drm_agp_release(drm_device_t *dev);
-int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info);
-int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode);
+int drm_agp_acquire(struct drm_device *dev);
+int drm_agp_release(struct drm_device *dev);
+int drm_agp_info(struct drm_device * dev, drm_agp_info_t *info);
+int drm_agp_enable(struct drm_device *dev, drm_agp_mode_t mode);
void *drm_agp_allocate_memory(size_t pages, u32 type);
int drm_agp_free_memory(void *handle);
int drm_agp_bind_memory(void *handle, off_t start);
int drm_agp_unbind_memory(void *handle);
-int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request);
-int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request);
-int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request);
-int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request);
+int drm_agp_alloc(struct drm_device *dev, drm_agp_buffer_t *request);
+int drm_agp_free(struct drm_device *dev, drm_agp_buffer_t *request);
+int drm_agp_bind(struct drm_device *dev, drm_agp_binding_t *request);
+int drm_agp_unbind(struct drm_device *dev, drm_agp_binding_t *request);
/* Scatter Gather Support (drm_scatter.c) */
void drm_sg_cleanup(drm_sg_mem_t *entry);
+int drm_sg_alloc(struct drm_device *dev, drm_scatter_gather_t * request);
#ifdef __FreeBSD__
/* sysctl support (drm_sysctl.h) */
-extern int drm_sysctl_init(drm_device_t *dev);
-extern int drm_sysctl_cleanup(drm_device_t *dev);
+extern int drm_sysctl_init(struct drm_device *dev);
+extern int drm_sysctl_cleanup(struct drm_device *dev);
#endif /* __FreeBSD__ */
/* ATI PCIGART support (ati_pcigart.c) */
-int drm_ati_pcigart_init(drm_device_t *dev,
- drm_ati_pcigart_info *gart_info);
-int drm_ati_pcigart_cleanup(drm_device_t *dev,
- drm_ati_pcigart_info *gart_info);
+int drm_ati_pcigart_init(struct drm_device *dev,
+ struct drm_ati_pcigart_info *gart_info);
+int drm_ati_pcigart_cleanup(struct drm_device *dev,
+ struct drm_ati_pcigart_info *gart_info);
/* Locking IOCTL support (drm_drv.c) */
-int drm_lock(DRM_IOCTL_ARGS);
-int drm_unlock(DRM_IOCTL_ARGS);
-int drm_version(DRM_IOCTL_ARGS);
-int drm_setversion(DRM_IOCTL_ARGS);
+int drm_lock(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_unlock(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_version(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_setversion(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
/* Misc. IOCTL support (drm_ioctl.c) */
-int drm_irq_by_busid(DRM_IOCTL_ARGS);
-int drm_getunique(DRM_IOCTL_ARGS);
-int drm_setunique(DRM_IOCTL_ARGS);
-int drm_getmap(DRM_IOCTL_ARGS);
-int drm_getclient(DRM_IOCTL_ARGS);
-int drm_getstats(DRM_IOCTL_ARGS);
-int drm_noop(DRM_IOCTL_ARGS);
+int drm_irq_by_busid(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_getunique(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_setunique(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_getmap(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_getclient(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_getstats(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_noop(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
/* Context IOCTL support (drm_context.c) */
-int drm_resctx(DRM_IOCTL_ARGS);
-int drm_addctx(DRM_IOCTL_ARGS);
-int drm_modctx(DRM_IOCTL_ARGS);
-int drm_getctx(DRM_IOCTL_ARGS);
-int drm_switchctx(DRM_IOCTL_ARGS);
-int drm_newctx(DRM_IOCTL_ARGS);
-int drm_rmctx(DRM_IOCTL_ARGS);
-int drm_setsareactx(DRM_IOCTL_ARGS);
-int drm_getsareactx(DRM_IOCTL_ARGS);
+int drm_resctx(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_addctx(struct drm_device *dev, void *data,
+struct drm_file *file_priv);
+int drm_modctx(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_getctx(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_switchctx(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_newctx(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_rmctx(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_setsareactx(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_getsareactx(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
/* Drawable IOCTL support (drm_drawable.c) */
-int drm_adddraw(DRM_IOCTL_ARGS);
-int drm_rmdraw(DRM_IOCTL_ARGS);
+int drm_adddraw(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_rmdraw(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_update_draw(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev,
+ int handle);
+
+/* Drawable support (drm_drawable.c) */
+void drm_drawable_free_all(struct drm_device *dev);
/* Authentication IOCTL support (drm_auth.c) */
-int drm_getmagic(DRM_IOCTL_ARGS);
-int drm_authmagic(DRM_IOCTL_ARGS);
+int drm_getmagic(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_authmagic(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
/* Buffer management support (drm_bufs.c) */
-int drm_addmap_ioctl(DRM_IOCTL_ARGS);
-int drm_rmmap_ioctl(DRM_IOCTL_ARGS);
-int drm_addbufs_ioctl(DRM_IOCTL_ARGS);
-int drm_infobufs(DRM_IOCTL_ARGS);
-int drm_markbufs(DRM_IOCTL_ARGS);
-int drm_freebufs(DRM_IOCTL_ARGS);
-int drm_mapbufs(DRM_IOCTL_ARGS);
+int drm_addmap_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_rmmap_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_addbufs_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_infobufs(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_markbufs(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_freebufs(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_mapbufs(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
/* DMA support (drm_dma.c) */
-int drm_dma(DRM_IOCTL_ARGS);
+int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv);
/* IRQ support (drm_irq.c) */
-int drm_control(DRM_IOCTL_ARGS);
-int drm_wait_vblank(DRM_IOCTL_ARGS);
+int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv);
+int drm_wait_vblank(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+void drm_locked_tasklet(struct drm_device *dev,
+ void (*tasklet)(struct drm_device *dev));
/* AGP/GART support (drm_agpsupport.c) */
-int drm_agp_acquire_ioctl(DRM_IOCTL_ARGS);
-int drm_agp_release_ioctl(DRM_IOCTL_ARGS);
-int drm_agp_enable_ioctl(DRM_IOCTL_ARGS);
-int drm_agp_info_ioctl(DRM_IOCTL_ARGS);
-int drm_agp_alloc_ioctl(DRM_IOCTL_ARGS);
-int drm_agp_free_ioctl(DRM_IOCTL_ARGS);
-int drm_agp_unbind_ioctl(DRM_IOCTL_ARGS);
-int drm_agp_bind_ioctl(DRM_IOCTL_ARGS);
+int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_agp_release_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_agp_info_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_agp_free_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
/* Scatter Gather Support (drm_scatter.c) */
-int drm_sg_alloc(DRM_IOCTL_ARGS);
-int drm_sg_free(DRM_IOCTL_ARGS);
+int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
+int drm_sg_free(struct drm_device *dev, void *data,
+ struct drm_file *file_priv);
/* consistent PCI memory functions (drm_pci.c) */
-drm_dma_handle_t *drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
- dma_addr_t maxaddr);
-void drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah);
+drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
+ size_t align, dma_addr_t maxaddr);
+void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
+
+#define drm_core_ioremap_wc drm_core_ioremap
/* Inline replacements for DRM_IOREMAP macros */
-static __inline__ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
+static __inline__ void
+drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
{
map->handle = drm_ioremap(dev, map);
}
-static __inline__ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
+static __inline__ void
+drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
{
if ( map->handle && map->size )
drm_ioremapfree(map);
}
-static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, unsigned long offset)
+static __inline__ struct drm_local_map *
+drm_core_findmap(struct drm_device *dev, unsigned long offset)
{
drm_local_map_t *map;
OpenPOWER on IntegriCloud