Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
Conflicts: shared-core/i915_dma.c shared-core/i915_drv.hmain
commit
3a3f39d144
|
@ -35,7 +35,8 @@
|
||||||
|
|
||||||
#define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */
|
#define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */
|
||||||
|
|
||||||
int drm_ati_pcigart_init(drm_device_t *dev, struct drm_ati_pcigart_info *gart_info)
|
int drm_ati_pcigart_init(struct drm_device *dev,
|
||||||
|
struct drm_ati_pcigart_info *gart_info)
|
||||||
{
|
{
|
||||||
unsigned long pages;
|
unsigned long pages;
|
||||||
u32 *pci_gart = NULL, page_base;
|
u32 *pci_gart = NULL, page_base;
|
||||||
|
@ -94,7 +95,8 @@ int drm_ati_pcigart_init(drm_device_t *dev, struct drm_ati_pcigart_info *gart_in
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_ati_pcigart_cleanup(drm_device_t *dev, struct drm_ati_pcigart_info *gart_info)
|
int drm_ati_pcigart_cleanup(struct drm_device *dev,
|
||||||
|
struct drm_ati_pcigart_info *gart_info)
|
||||||
{
|
{
|
||||||
if (dev->sg == NULL) {
|
if (dev->sg == NULL) {
|
||||||
DRM_ERROR( "no scatter/gather memory!\n" );
|
DRM_ERROR( "no scatter/gather memory!\n" );
|
||||||
|
|
329
bsd-core/drmP.h
329
bsd-core/drmP.h
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#if defined(_KERNEL) || defined(__KERNEL__)
|
#if defined(_KERNEL) || defined(__KERNEL__)
|
||||||
|
|
||||||
typedef struct drm_device drm_device_t;
|
struct drm_device;
|
||||||
typedef struct drm_file drm_file_t;
|
typedef struct drm_file drm_file_t;
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -265,7 +265,7 @@ enum {
|
||||||
#define DRM_MTRR_WC MTRR_TYPE_WC
|
#define DRM_MTRR_WC MTRR_TYPE_WC
|
||||||
#define jiffies hardclock_ticks
|
#define jiffies hardclock_ticks
|
||||||
|
|
||||||
typedef drm_device_t *device_t;
|
typedef struct drm_device *device_t;
|
||||||
extern struct cfdriver drm_cd;
|
extern struct cfdriver drm_cd;
|
||||||
#endif /* !__FreeBSD__ */
|
#endif /* !__FreeBSD__ */
|
||||||
|
|
||||||
|
@ -430,7 +430,8 @@ typedef struct drm_pci_id_list
|
||||||
#define DRM_ROOT_ONLY 0x4
|
#define DRM_ROOT_ONLY 0x4
|
||||||
typedef struct drm_ioctl_desc {
|
typedef struct drm_ioctl_desc {
|
||||||
unsigned long cmd;
|
unsigned long cmd;
|
||||||
int (*func)(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int (*func)(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv);
|
||||||
int flags;
|
int flags;
|
||||||
} drm_ioctl_desc_t;
|
} drm_ioctl_desc_t;
|
||||||
/**
|
/**
|
||||||
|
@ -528,7 +529,8 @@ typedef struct drm_lock_data {
|
||||||
unsigned long lock_time; /* Time of last lock in jiffies */
|
unsigned long lock_time; /* Time of last lock in jiffies */
|
||||||
} drm_lock_data_t;
|
} 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
|
* 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
|
* 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
|
* occurs (when the last open of the device has closed). The high/low
|
||||||
|
@ -619,10 +621,19 @@ struct drm_ati_pcigart_info {
|
||||||
int gart_reg_if;
|
int gart_reg_if;
|
||||||
void *addr;
|
void *addr;
|
||||||
dma_addr_t bus_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_local_map_t mapping;
|
||||||
int table_size;
|
int table_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef DMA_BIT_MASK
|
||||||
|
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) - 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define upper_32_bits(_val) (((u64)(_val)) >> 32)
|
||||||
|
|
||||||
struct drm_driver_info {
|
struct drm_driver_info {
|
||||||
int (*load)(struct drm_device *, unsigned long flags);
|
int (*load)(struct drm_device *, unsigned long flags);
|
||||||
int (*firstopen)(struct drm_device *);
|
int (*firstopen)(struct drm_device *);
|
||||||
|
@ -633,7 +644,8 @@ struct drm_driver_info {
|
||||||
int (*unload)(struct drm_device *);
|
int (*unload)(struct drm_device *);
|
||||||
void (*reclaim_buffers_locked)(struct drm_device *,
|
void (*reclaim_buffers_locked)(struct drm_device *,
|
||||||
struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int (*dma_ioctl)(drm_device_t *dev, void *data, 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 *);
|
void (*dma_ready)(struct drm_device *);
|
||||||
int (*dma_quiescent)(struct drm_device *);
|
int (*dma_quiescent)(struct drm_device *);
|
||||||
int (*dma_flush_block_and_flush)(struct drm_device *, int context,
|
int (*dma_flush_block_and_flush)(struct drm_device *, int context,
|
||||||
|
@ -645,12 +657,13 @@ struct drm_driver_info {
|
||||||
int (*kernel_context_switch)(struct drm_device *dev, int old,
|
int (*kernel_context_switch)(struct drm_device *dev, int old,
|
||||||
int new);
|
int new);
|
||||||
int (*kernel_context_switch_unlock)(struct drm_device *dev);
|
int (*kernel_context_switch_unlock)(struct drm_device *dev);
|
||||||
void (*irq_preinstall)(drm_device_t *dev);
|
void (*irq_preinstall)(struct drm_device *dev);
|
||||||
void (*irq_postinstall)(drm_device_t *dev);
|
int (*irq_postinstall)(struct drm_device *dev);
|
||||||
void (*irq_uninstall)(drm_device_t *dev);
|
void (*irq_uninstall)(struct drm_device *dev);
|
||||||
void (*irq_handler)(DRM_IRQ_ARGS);
|
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 (*vblank_wait2)(drm_device_t *dev, unsigned int *sequence);
|
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 */
|
drm_pci_id_list_t *id_entry; /* PCI ID, name, and chipset private */
|
||||||
|
|
||||||
|
@ -772,9 +785,25 @@ struct drm_device {
|
||||||
|
|
||||||
atomic_t context_flag; /* Context swapping flag */
|
atomic_t context_flag; /* Context swapping flag */
|
||||||
int last_context; /* Last current context */
|
int last_context; /* Last current context */
|
||||||
int vbl_queue; /* vbl wait channel */
|
wait_queue_head_t *vbl_queue; /* vblank wait queue */
|
||||||
atomic_t vbl_received;
|
atomic_t *_vblank_count; /* number of VBLANK interrupts */
|
||||||
atomic_t vbl_received2;
|
/* (driver must alloc the right number of counters) */
|
||||||
|
struct mtx vbl_lock;
|
||||||
|
struct drm_vbl_sig_list *vbl_sigs; /* signal list to send on VBLANK */
|
||||||
|
atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/
|
||||||
|
atomic_t *vblank_refcount; /* number of users of vblank interrupts per crtc */
|
||||||
|
u32 *last_vblank; /* protected by dev->vbl_lock, used */
|
||||||
|
/* for wraparound handling */
|
||||||
|
|
||||||
|
u32 *vblank_offset; /* used to track how many vblanks */
|
||||||
|
int *vblank_enabled; /* so we don't call enable more than */
|
||||||
|
/* once per disable */
|
||||||
|
u32 *vblank_premodeset; /* were lost during modeset */
|
||||||
|
struct callout vblank_disable_timer;
|
||||||
|
unsigned long max_vblank_count; /* size of vblank counter register */
|
||||||
|
int num_crtcs;
|
||||||
|
atomic_t vbl_received;
|
||||||
|
atomic_t vbl_received2;
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
struct sigio *buf_sigio; /* Processes waiting for SIGIO */
|
struct sigio *buf_sigio; /* Processes waiting for SIGIO */
|
||||||
|
@ -797,7 +826,7 @@ struct drm_device {
|
||||||
RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
|
RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
|
||||||
|
|
||||||
struct task locked_task;
|
struct task locked_task;
|
||||||
void (*locked_task_call)(drm_device_t *dev);
|
void (*locked_task_call)(struct drm_device *dev);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int drm_debug_flag;
|
extern int drm_debug_flag;
|
||||||
|
@ -823,18 +852,20 @@ dev_type_read(drm_read);
|
||||||
dev_type_poll(drm_poll);
|
dev_type_poll(drm_poll);
|
||||||
dev_type_mmap(drm_mmap);
|
dev_type_mmap(drm_mmap);
|
||||||
#endif
|
#endif
|
||||||
extern drm_local_map_t *drm_getsarea(drm_device_t *dev);
|
extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
|
||||||
|
|
||||||
/* File operations helpers (drm_fops.c) */
|
/* File operations helpers (drm_fops.c) */
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
|
extern int drm_open_helper(struct cdev *kdev, int flags, int fmt,
|
||||||
DRM_STRUCTPROC *p, drm_device_t *dev);
|
DRM_STRUCTPROC *p,
|
||||||
extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
|
struct drm_device *dev);
|
||||||
DRM_STRUCTPROC *p);
|
extern drm_file_t *drm_find_file_by_proc(struct drm_device *dev,
|
||||||
|
DRM_STRUCTPROC *p);
|
||||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
extern int drm_open_helper(dev_t kdev, int flags, int fmt,
|
extern int drm_open_helper(dev_t kdev, int flags, int fmt,
|
||||||
DRM_STRUCTPROC *p, drm_device_t *dev);
|
DRM_STRUCTPROC *p,
|
||||||
extern drm_file_t *drm_find_file_by_proc(drm_device_t *dev,
|
struct drm_device *dev);
|
||||||
|
extern drm_file_t *drm_find_file_by_proc(struct drm_device *dev,
|
||||||
DRM_STRUCTPROC *p);
|
DRM_STRUCTPROC *p);
|
||||||
#endif /* __NetBSD__ || __OpenBSD__ */
|
#endif /* __NetBSD__ || __OpenBSD__ */
|
||||||
|
|
||||||
|
@ -846,176 +877,234 @@ void *drm_calloc(size_t nmemb, size_t size, int area);
|
||||||
void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
|
void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
|
||||||
int area);
|
int area);
|
||||||
void drm_free(void *pt, 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);
|
void drm_ioremapfree(drm_local_map_t *map);
|
||||||
int drm_mtrr_add(unsigned long offset, size_t size, int flags);
|
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_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(struct drm_device *dev, int old, int new);
|
||||||
int drm_context_switch_complete(drm_device_t *dev, int new);
|
int drm_context_switch_complete(struct drm_device *dev, int new);
|
||||||
|
|
||||||
int drm_ctxbitmap_init(drm_device_t *dev);
|
int drm_ctxbitmap_init(struct drm_device *dev);
|
||||||
void drm_ctxbitmap_cleanup(drm_device_t *dev);
|
void drm_ctxbitmap_cleanup(struct drm_device *dev);
|
||||||
void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle);
|
void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
|
||||||
int drm_ctxbitmap_next(drm_device_t *dev);
|
int drm_ctxbitmap_next(struct drm_device *dev);
|
||||||
|
|
||||||
/* Locking IOCTL support (drm_lock.c) */
|
/* Locking IOCTL support (drm_lock.c) */
|
||||||
int drm_lock_take(__volatile__ unsigned int *lock,
|
int drm_lock_take(__volatile__ unsigned int *lock,
|
||||||
unsigned int context);
|
unsigned int context);
|
||||||
int drm_lock_transfer(drm_device_t *dev,
|
int drm_lock_transfer(struct drm_device *dev,
|
||||||
__volatile__ unsigned int *lock,
|
__volatile__ unsigned int *lock,
|
||||||
unsigned int context);
|
unsigned int context);
|
||||||
int drm_lock_free(drm_device_t *dev,
|
int drm_lock_free(struct drm_device *dev,
|
||||||
__volatile__ unsigned int *lock,
|
__volatile__ unsigned int *lock,
|
||||||
unsigned int context);
|
unsigned int context);
|
||||||
|
|
||||||
/* Buffer management support (drm_bufs.c) */
|
/* Buffer management support (drm_bufs.c) */
|
||||||
unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource);
|
unsigned long drm_get_resource_start(struct drm_device *dev,
|
||||||
unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource);
|
unsigned int resource);
|
||||||
void drm_rmmap(drm_device_t *dev, drm_local_map_t *map);
|
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_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_map_type_t type, drm_map_flags_t flags,
|
||||||
drm_local_map_t **map_ptr);
|
drm_local_map_t **map_ptr);
|
||||||
int drm_addbufs_pci(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(drm_device_t *dev, drm_buf_desc_t *request);
|
int drm_addbufs_sg(struct drm_device *dev, drm_buf_desc_t *request);
|
||||||
int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request);
|
int drm_addbufs_agp(struct drm_device *dev, drm_buf_desc_t *request);
|
||||||
|
|
||||||
/* DMA support (drm_dma.c) */
|
/* DMA support (drm_dma.c) */
|
||||||
int drm_dma_setup(drm_device_t *dev);
|
int drm_dma_setup(struct drm_device *dev);
|
||||||
void drm_dma_takedown(drm_device_t *dev);
|
void drm_dma_takedown(struct drm_device *dev);
|
||||||
void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf);
|
void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf);
|
||||||
void drm_reclaim_buffers(drm_device_t *dev, struct drm_file *file_priv);
|
void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv);
|
||||||
#define drm_core_reclaim_buffers drm_reclaim_buffers
|
#define drm_core_reclaim_buffers drm_reclaim_buffers
|
||||||
|
|
||||||
/* IRQ support (drm_irq.c) */
|
/* IRQ support (drm_irq.c) */
|
||||||
int drm_irq_install(drm_device_t *dev);
|
int drm_irq_install(struct drm_device *dev);
|
||||||
int drm_irq_uninstall(drm_device_t *dev);
|
int drm_irq_uninstall(struct drm_device *dev);
|
||||||
irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
|
irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
|
||||||
void drm_driver_irq_preinstall(drm_device_t *dev);
|
void drm_driver_irq_preinstall(struct drm_device *dev);
|
||||||
void drm_driver_irq_postinstall(drm_device_t *dev);
|
void drm_driver_irq_postinstall(struct drm_device *dev);
|
||||||
void drm_driver_irq_uninstall(drm_device_t *dev);
|
void drm_driver_irq_uninstall(struct drm_device *dev);
|
||||||
int drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq);
|
void drm_handle_vblank(struct drm_device *dev, int crtc);
|
||||||
void drm_vbl_send_signals(drm_device_t *dev);
|
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);
|
||||||
|
void drm_update_vblank_count(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) */
|
/* AGP/PCI Express/GART support (drm_agpsupport.c) */
|
||||||
int drm_device_is_agp(drm_device_t *dev);
|
int drm_device_is_agp(struct drm_device *dev);
|
||||||
int drm_device_is_pcie(drm_device_t *dev);
|
int drm_device_is_pcie(struct drm_device *dev);
|
||||||
drm_agp_head_t *drm_agp_init(void);
|
drm_agp_head_t *drm_agp_init(void);
|
||||||
int drm_agp_acquire(drm_device_t *dev);
|
int drm_agp_acquire(struct drm_device *dev);
|
||||||
int drm_agp_release(drm_device_t *dev);
|
int drm_agp_release(struct drm_device *dev);
|
||||||
int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info);
|
int drm_agp_info(struct drm_device * dev, drm_agp_info_t *info);
|
||||||
int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode);
|
int drm_agp_enable(struct drm_device *dev, drm_agp_mode_t mode);
|
||||||
void *drm_agp_allocate_memory(size_t pages, u32 type);
|
void *drm_agp_allocate_memory(size_t pages, u32 type);
|
||||||
int drm_agp_free_memory(void *handle);
|
int drm_agp_free_memory(void *handle);
|
||||||
int drm_agp_bind_memory(void *handle, off_t start);
|
int drm_agp_bind_memory(void *handle, off_t start);
|
||||||
int drm_agp_unbind_memory(void *handle);
|
int drm_agp_unbind_memory(void *handle);
|
||||||
int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request);
|
int drm_agp_alloc(struct drm_device *dev, drm_agp_buffer_t *request);
|
||||||
int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request);
|
int drm_agp_free(struct drm_device *dev, drm_agp_buffer_t *request);
|
||||||
int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request);
|
int drm_agp_bind(struct drm_device *dev, drm_agp_binding_t *request);
|
||||||
int drm_agp_unbind(drm_device_t *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) */
|
/* Scatter Gather Support (drm_scatter.c) */
|
||||||
void drm_sg_cleanup(drm_sg_mem_t *entry);
|
void drm_sg_cleanup(drm_sg_mem_t *entry);
|
||||||
int drm_sg_alloc(drm_device_t * dev, drm_scatter_gather_t * request);
|
int drm_sg_alloc(struct drm_device *dev, drm_scatter_gather_t * request);
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
/* sysctl support (drm_sysctl.h) */
|
/* sysctl support (drm_sysctl.h) */
|
||||||
extern int drm_sysctl_init(drm_device_t *dev);
|
extern int drm_sysctl_init(struct drm_device *dev);
|
||||||
extern int drm_sysctl_cleanup(drm_device_t *dev);
|
extern int drm_sysctl_cleanup(struct drm_device *dev);
|
||||||
#endif /* __FreeBSD__ */
|
#endif /* __FreeBSD__ */
|
||||||
|
|
||||||
/* ATI PCIGART support (ati_pcigart.c) */
|
/* ATI PCIGART support (ati_pcigart.c) */
|
||||||
int drm_ati_pcigart_init(drm_device_t *dev,
|
int drm_ati_pcigart_init(struct drm_device *dev,
|
||||||
struct drm_ati_pcigart_info *gart_info);
|
struct drm_ati_pcigart_info *gart_info);
|
||||||
int drm_ati_pcigart_cleanup(drm_device_t *dev,
|
int drm_ati_pcigart_cleanup(struct drm_device *dev,
|
||||||
struct drm_ati_pcigart_info *gart_info);
|
struct drm_ati_pcigart_info *gart_info);
|
||||||
|
|
||||||
/* Locking IOCTL support (drm_drv.c) */
|
/* Locking IOCTL support (drm_drv.c) */
|
||||||
int drm_lock(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_lock(struct drm_device *dev, void *data,
|
||||||
int drm_unlock(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_version(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_unlock(struct drm_device *dev, void *data,
|
||||||
int drm_setversion(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
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) */
|
/* Misc. IOCTL support (drm_ioctl.c) */
|
||||||
int drm_irq_by_busid(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_irq_by_busid(struct drm_device *dev, void *data,
|
||||||
int drm_getunique(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_setunique(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_getunique(struct drm_device *dev, void *data,
|
||||||
int drm_getmap(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_getclient(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_setunique(struct drm_device *dev, void *data,
|
||||||
int drm_getstats(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_noop(drm_device_t *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) */
|
/* Context IOCTL support (drm_context.c) */
|
||||||
int drm_resctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_resctx(struct drm_device *dev, void *data,
|
||||||
int drm_addctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_modctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_addctx(struct drm_device *dev, void *data,
|
||||||
int drm_getctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_switchctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_modctx(struct drm_device *dev, void *data,
|
||||||
int drm_newctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_rmctx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_getctx(struct drm_device *dev, void *data,
|
||||||
int drm_setsareactx(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_getsareactx(drm_device_t *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) */
|
/* Drawable IOCTL support (drm_drawable.c) */
|
||||||
int drm_adddraw(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_adddraw(struct drm_device *dev, void *data,
|
||||||
int drm_rmdraw(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_update_draw(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_rmdraw(struct drm_device *dev, void *data,
|
||||||
struct drm_drawable_info *drm_get_drawable_info(drm_device_t *dev, int handle);
|
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);
|
||||||
|
|
||||||
/* Authentication IOCTL support (drm_auth.c) */
|
/* Authentication IOCTL support (drm_auth.c) */
|
||||||
int drm_getmagic(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_getmagic(struct drm_device *dev, void *data,
|
||||||
int drm_authmagic(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
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) */
|
/* Buffer management support (drm_bufs.c) */
|
||||||
int drm_addmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_addmap_ioctl(struct drm_device *dev, void *data,
|
||||||
int drm_rmmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_addbufs_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_rmmap_ioctl(struct drm_device *dev, void *data,
|
||||||
int drm_infobufs(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_markbufs(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_addbufs_ioctl(struct drm_device *dev, void *data,
|
||||||
int drm_freebufs(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_mapbufs(drm_device_t *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) */
|
/* DMA support (drm_dma.c) */
|
||||||
int drm_dma(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||||
|
|
||||||
/* IRQ support (drm_irq.c) */
|
/* IRQ support (drm_irq.c) */
|
||||||
int drm_control(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||||
int drm_wait_vblank(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_wait_vblank(struct drm_device *dev, void *data,
|
||||||
void drm_locked_tasklet(drm_device_t *dev,
|
struct drm_file *file_priv);
|
||||||
void (*tasklet)(drm_device_t *dev));
|
void drm_locked_tasklet(struct drm_device *dev,
|
||||||
|
void (*tasklet)(struct drm_device *dev));
|
||||||
|
|
||||||
/* AGP/GART support (drm_agpsupport.c) */
|
/* AGP/GART support (drm_agpsupport.c) */
|
||||||
int drm_agp_acquire_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
|
||||||
int drm_agp_release_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_agp_enable_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_agp_release_ioctl(struct drm_device *dev, void *data,
|
||||||
int drm_agp_info_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_agp_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
|
||||||
int drm_agp_free_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
struct drm_file *file_priv);
|
||||||
int drm_agp_unbind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_agp_info_ioctl(struct drm_device *dev, void *data,
|
||||||
int drm_agp_bind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
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) */
|
/* Scatter Gather Support (drm_scatter.c) */
|
||||||
int drm_sg_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
|
||||||
int drm_sg_free(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
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) */
|
/* consistent PCI memory functions (drm_pci.c) */
|
||||||
drm_dma_handle_t *drm_pci_alloc(drm_device_t *dev, size_t size, size_t align,
|
drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
|
||||||
dma_addr_t maxaddr);
|
size_t align, dma_addr_t maxaddr);
|
||||||
void drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah);
|
void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
|
||||||
|
|
||||||
/* Inline replacements for DRM_IOREMAP macros */
|
/* 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);
|
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 )
|
if ( map->handle && map->size )
|
||||||
drm_ioremapfree(map);
|
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;
|
drm_local_map_t *map;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
|
|
||||||
/* Returns 1 if AGP or 0 if not. */
|
/* Returns 1 if AGP or 0 if not. */
|
||||||
static int
|
static int
|
||||||
drm_device_find_capability(drm_device_t *dev, int cap)
|
drm_device_find_capability(struct drm_device *dev, int cap)
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
#if __FreeBSD_version >= 602102
|
#if __FreeBSD_version >= 602102
|
||||||
|
@ -88,7 +88,7 @@ drm_device_find_capability(drm_device_t *dev, int cap)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_device_is_agp(drm_device_t *dev)
|
int drm_device_is_agp(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
if (dev->driver.device_is_agp != NULL) {
|
if (dev->driver.device_is_agp != NULL) {
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -104,12 +104,12 @@ int drm_device_is_agp(drm_device_t *dev)
|
||||||
return (drm_device_find_capability(dev, PCIY_AGP));
|
return (drm_device_find_capability(dev, PCIY_AGP));
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_device_is_pcie(drm_device_t *dev)
|
int drm_device_is_pcie(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
return (drm_device_find_capability(dev, PCIY_EXPRESS));
|
return (drm_device_find_capability(dev, PCIY_EXPRESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info)
|
int drm_agp_info(struct drm_device * dev, drm_agp_info_t *info)
|
||||||
{
|
{
|
||||||
struct agp_info *kern;
|
struct agp_info *kern;
|
||||||
|
|
||||||
|
@ -131,7 +131,8 @@ int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_info_ioctl(drm_device_t *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 err;
|
int err;
|
||||||
drm_agp_info_t info;
|
drm_agp_info_t info;
|
||||||
|
@ -144,13 +145,14 @@ int drm_agp_info_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_acquire_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
|
|
||||||
return drm_agp_acquire(dev);
|
return drm_agp_acquire(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_acquire(drm_device_t *dev)
|
int drm_agp_acquire(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
|
|
||||||
|
@ -165,13 +167,14 @@ int drm_agp_acquire(drm_device_t *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_release_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_agp_release_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
|
|
||||||
return drm_agp_release(dev);
|
return drm_agp_release(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_release(drm_device_t * dev)
|
int drm_agp_release(struct drm_device * dev)
|
||||||
{
|
{
|
||||||
if (!dev->agp || !dev->agp->acquired)
|
if (!dev->agp || !dev->agp->acquired)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
@ -180,7 +183,7 @@ int drm_agp_release(drm_device_t * dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode)
|
int drm_agp_enable(struct drm_device *dev, drm_agp_mode_t mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!dev->agp || !dev->agp->acquired)
|
if (!dev->agp || !dev->agp->acquired)
|
||||||
|
@ -192,7 +195,8 @@ int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_enable_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_agp_mode_t mode;
|
drm_agp_mode_t mode;
|
||||||
|
|
||||||
|
@ -201,7 +205,7 @@ int drm_agp_enable_ioctl(drm_device_t *dev, void *data, struct drm_file *file_pr
|
||||||
return drm_agp_enable(dev, mode);
|
return drm_agp_enable(dev, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request)
|
int drm_agp_alloc(struct drm_device *dev, drm_agp_buffer_t *request)
|
||||||
{
|
{
|
||||||
drm_agp_mem_t *entry;
|
drm_agp_mem_t *entry;
|
||||||
void *handle;
|
void *handle;
|
||||||
|
@ -244,7 +248,8 @@ int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_agp_buffer_t request;
|
drm_agp_buffer_t request;
|
||||||
int retcode;
|
int retcode;
|
||||||
|
@ -260,7 +265,8 @@ int drm_agp_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_pri
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static drm_agp_mem_t * drm_agp_lookup_entry(drm_device_t *dev, void *handle)
|
static drm_agp_mem_t * drm_agp_lookup_entry(struct drm_device *dev,
|
||||||
|
void *handle)
|
||||||
{
|
{
|
||||||
drm_agp_mem_t *entry;
|
drm_agp_mem_t *entry;
|
||||||
|
|
||||||
|
@ -270,7 +276,7 @@ static drm_agp_mem_t * drm_agp_lookup_entry(drm_device_t *dev, void *handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request)
|
int drm_agp_unbind(struct drm_device *dev, drm_agp_binding_t *request)
|
||||||
{
|
{
|
||||||
drm_agp_mem_t *entry;
|
drm_agp_mem_t *entry;
|
||||||
int retcode;
|
int retcode;
|
||||||
|
@ -292,7 +298,8 @@ int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request)
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_unbind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_agp_binding_t request;
|
drm_agp_binding_t request;
|
||||||
int retcode;
|
int retcode;
|
||||||
|
@ -306,7 +313,7 @@ int drm_agp_unbind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_pr
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request)
|
int drm_agp_bind(struct drm_device *dev, drm_agp_binding_t *request)
|
||||||
{
|
{
|
||||||
drm_agp_mem_t *entry;
|
drm_agp_mem_t *entry;
|
||||||
int retcode;
|
int retcode;
|
||||||
|
@ -332,7 +339,8 @@ int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request)
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_bind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_agp_binding_t request;
|
drm_agp_binding_t request;
|
||||||
int retcode;
|
int retcode;
|
||||||
|
@ -346,7 +354,7 @@ int drm_agp_bind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request)
|
int drm_agp_free(struct drm_device *dev, drm_agp_buffer_t *request)
|
||||||
{
|
{
|
||||||
drm_agp_mem_t *entry;
|
drm_agp_mem_t *entry;
|
||||||
|
|
||||||
|
@ -376,7 +384,8 @@ int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_agp_free_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_agp_free_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_agp_buffer_t request;
|
drm_agp_buffer_t request;
|
||||||
int retcode;
|
int retcode;
|
||||||
|
|
|
@ -43,7 +43,7 @@ static int drm_hash_magic(drm_magic_t magic)
|
||||||
/**
|
/**
|
||||||
* Returns the file private associated with the given magic number.
|
* Returns the file private associated with the given magic number.
|
||||||
*/
|
*/
|
||||||
static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
|
static drm_file_t *drm_find_file(struct drm_device *dev, drm_magic_t magic)
|
||||||
{
|
{
|
||||||
drm_magic_entry_t *pt;
|
drm_magic_entry_t *pt;
|
||||||
int hash = drm_hash_magic(magic);
|
int hash = drm_hash_magic(magic);
|
||||||
|
@ -63,7 +63,8 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
|
||||||
* Inserts the given magic number into the hash table of used magic number
|
* Inserts the given magic number into the hash table of used magic number
|
||||||
* lists.
|
* lists.
|
||||||
*/
|
*/
|
||||||
static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
static int drm_add_magic(struct drm_device *dev, drm_file_t *priv,
|
||||||
|
drm_magic_t magic)
|
||||||
{
|
{
|
||||||
int hash;
|
int hash;
|
||||||
drm_magic_entry_t *entry;
|
drm_magic_entry_t *entry;
|
||||||
|
@ -79,7 +80,6 @@ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||||
entry->priv = priv;
|
entry->priv = priv;
|
||||||
entry->next = NULL;
|
entry->next = NULL;
|
||||||
|
|
||||||
DRM_LOCK();
|
|
||||||
if (dev->magiclist[hash].tail) {
|
if (dev->magiclist[hash].tail) {
|
||||||
dev->magiclist[hash].tail->next = entry;
|
dev->magiclist[hash].tail->next = entry;
|
||||||
dev->magiclist[hash].tail = entry;
|
dev->magiclist[hash].tail = entry;
|
||||||
|
@ -87,7 +87,6 @@ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||||
dev->magiclist[hash].head = entry;
|
dev->magiclist[hash].head = entry;
|
||||||
dev->magiclist[hash].tail = entry;
|
dev->magiclist[hash].tail = entry;
|
||||||
}
|
}
|
||||||
DRM_UNLOCK();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +95,7 @@ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||||
* Removes the given magic number from the hash table of used magic number
|
* Removes the given magic number from the hash table of used magic number
|
||||||
* lists.
|
* lists.
|
||||||
*/
|
*/
|
||||||
static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
|
static int drm_remove_magic(struct drm_device *dev, drm_magic_t magic)
|
||||||
{
|
{
|
||||||
drm_magic_entry_t *prev = NULL;
|
drm_magic_entry_t *prev = NULL;
|
||||||
drm_magic_entry_t *pt;
|
drm_magic_entry_t *pt;
|
||||||
|
@ -134,7 +133,7 @@ static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
|
||||||
* connection that the magic is passed over) to determine if the magic number
|
* connection that the magic is passed over) to determine if the magic number
|
||||||
* should be authenticated.
|
* should be authenticated.
|
||||||
*/
|
*/
|
||||||
int drm_getmagic(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
static drm_magic_t sequence = 0;
|
static drm_magic_t sequence = 0;
|
||||||
drm_auth_t *auth = data;
|
drm_auth_t *auth = data;
|
||||||
|
@ -165,7 +164,8 @@ int drm_getmagic(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
/**
|
/**
|
||||||
* Marks the client associated with the given magic number as authenticated.
|
* Marks the client associated with the given magic number as authenticated.
|
||||||
*/
|
*/
|
||||||
int drm_authmagic(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_authmagic(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_auth_t *auth = data;
|
drm_auth_t *auth = data;
|
||||||
drm_file_t *priv;
|
drm_file_t *priv;
|
||||||
|
|
|
@ -56,7 +56,7 @@ int drm_order(unsigned long size)
|
||||||
* drm_get_resource_*. Note that they are not RF_ACTIVE, so there's no virtual
|
* drm_get_resource_*. Note that they are not RF_ACTIVE, so there's no virtual
|
||||||
* address for accessing them. Cleaned up at unload.
|
* address for accessing them. Cleaned up at unload.
|
||||||
*/
|
*/
|
||||||
static int drm_alloc_resource(drm_device_t *dev, int resource)
|
static int drm_alloc_resource(struct drm_device *dev, int resource)
|
||||||
{
|
{
|
||||||
if (resource >= DRM_MAX_PCI_RESOURCE) {
|
if (resource >= DRM_MAX_PCI_RESOURCE) {
|
||||||
DRM_ERROR("Resource %d too large\n", resource);
|
DRM_ERROR("Resource %d too large\n", resource);
|
||||||
|
@ -82,7 +82,8 @@ static int drm_alloc_resource(drm_device_t *dev, int resource)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource)
|
unsigned long drm_get_resource_start(struct drm_device *dev,
|
||||||
|
unsigned int resource)
|
||||||
{
|
{
|
||||||
if (drm_alloc_resource(dev, resource) != 0)
|
if (drm_alloc_resource(dev, resource) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -90,7 +91,8 @@ unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource)
|
||||||
return rman_get_start(dev->pcir[resource]);
|
return rman_get_start(dev->pcir[resource]);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource)
|
unsigned long drm_get_resource_len(struct drm_device *dev,
|
||||||
|
unsigned int resource)
|
||||||
{
|
{
|
||||||
if (drm_alloc_resource(dev, resource) != 0)
|
if (drm_alloc_resource(dev, resource) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -98,7 +100,8 @@ unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource)
|
||||||
return rman_get_size(dev->pcir[resource]);
|
return rman_get_size(dev->pcir[resource]);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
drm_map_type_t type, drm_map_flags_t flags, drm_local_map_t **map_ptr)
|
||||||
{
|
{
|
||||||
drm_local_map_t *map;
|
drm_local_map_t *map;
|
||||||
|
@ -149,8 +152,10 @@ int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
|
||||||
* initialization necessary.
|
* initialization necessary.
|
||||||
*/
|
*/
|
||||||
map = malloc(sizeof(*map), M_DRM, M_ZERO | M_NOWAIT);
|
map = malloc(sizeof(*map), M_DRM, M_ZERO | M_NOWAIT);
|
||||||
if ( !map )
|
if ( !map ) {
|
||||||
|
DRM_LOCK();
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
map->offset = offset;
|
map->offset = offset;
|
||||||
map->size = size;
|
map->size = size;
|
||||||
|
@ -173,6 +178,7 @@ int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
|
||||||
map->size, drm_order(map->size), map->handle );
|
map->size, drm_order(map->size), map->handle );
|
||||||
if ( !map->handle ) {
|
if ( !map->handle ) {
|
||||||
free(map, M_DRM);
|
free(map, M_DRM);
|
||||||
|
DRM_LOCK();
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
map->offset = (unsigned long)map->handle;
|
map->offset = (unsigned long)map->handle;
|
||||||
|
@ -213,12 +219,14 @@ int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
|
||||||
}
|
}
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
free(map, M_DRM);
|
free(map, M_DRM);
|
||||||
|
DRM_LOCK();
|
||||||
return EACCES;
|
return EACCES;
|
||||||
}*/
|
}*/
|
||||||
break;
|
break;
|
||||||
case _DRM_SCATTER_GATHER:
|
case _DRM_SCATTER_GATHER:
|
||||||
if (!dev->sg) {
|
if (!dev->sg) {
|
||||||
free(map, M_DRM);
|
free(map, M_DRM);
|
||||||
|
DRM_LOCK();
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
map->offset = map->offset + dev->sg->handle;
|
map->offset = map->offset + dev->sg->handle;
|
||||||
|
@ -236,6 +244,7 @@ int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
|
||||||
map->dmah = drm_pci_alloc(dev, map->size, align, 0xfffffffful);
|
map->dmah = drm_pci_alloc(dev, map->size, align, 0xfffffffful);
|
||||||
if (map->dmah == NULL) {
|
if (map->dmah == NULL) {
|
||||||
free(map, M_DRM);
|
free(map, M_DRM);
|
||||||
|
DRM_LOCK();
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
map->handle = map->dmah->vaddr;
|
map->handle = map->dmah->vaddr;
|
||||||
|
@ -244,6 +253,7 @@ int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,
|
||||||
default:
|
default:
|
||||||
DRM_ERROR("Bad map type %d\n", map->type);
|
DRM_ERROR("Bad map type %d\n", map->type);
|
||||||
free(map, M_DRM);
|
free(map, M_DRM);
|
||||||
|
DRM_LOCK();
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +271,8 @@ done:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_addmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_addmap_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_map_t *request = data;
|
drm_map_t *request = data;
|
||||||
drm_local_map_t *map;
|
drm_local_map_t *map;
|
||||||
|
@ -294,7 +305,7 @@ int drm_addmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
|
void drm_rmmap(struct drm_device *dev, drm_local_map_t *map)
|
||||||
{
|
{
|
||||||
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
|
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
|
||||||
|
|
||||||
|
@ -340,7 +351,8 @@ void drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
|
||||||
* isn't in use.
|
* isn't in use.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int drm_rmmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_rmmap_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_local_map_t *map;
|
drm_local_map_t *map;
|
||||||
drm_map_t *request = data;
|
drm_map_t *request = data;
|
||||||
|
@ -366,7 +378,8 @@ int drm_rmmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry)
|
static void drm_cleanup_buf_error(struct drm_device *dev,
|
||||||
|
drm_buf_entry_t *entry)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -389,7 +402,7 @@ static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_do_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request)
|
static int drm_do_addbufs_agp(struct drm_device *dev, drm_buf_desc_t *request)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
drm_buf_entry_t *entry;
|
drm_buf_entry_t *entry;
|
||||||
|
@ -520,7 +533,7 @@ static int drm_do_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_do_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)
|
static int drm_do_addbufs_pci(struct drm_device *dev, drm_buf_desc_t *request)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
int count;
|
int count;
|
||||||
|
@ -667,7 +680,7 @@ static int drm_do_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_do_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request)
|
static int drm_do_addbufs_sg(struct drm_device *dev, drm_buf_desc_t *request)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
drm_buf_entry_t *entry;
|
drm_buf_entry_t *entry;
|
||||||
|
@ -778,12 +791,10 @@ static int drm_do_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request)
|
int drm_addbufs_agp(struct drm_device *dev, drm_buf_desc_t *request)
|
||||||
{
|
{
|
||||||
int order, ret;
|
int order, ret;
|
||||||
|
|
||||||
DRM_SPINLOCK(&dev->dma_lock);
|
|
||||||
|
|
||||||
if (request->count < 0 || request->count > 4096)
|
if (request->count < 0 || request->count > 4096)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
|
@ -791,6 +802,8 @@ int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request)
|
||||||
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
|
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
|
DRM_SPINLOCK(&dev->dma_lock);
|
||||||
|
|
||||||
/* No more allocations after first buffer-using ioctl. */
|
/* No more allocations after first buffer-using ioctl. */
|
||||||
if (dev->buf_use != 0) {
|
if (dev->buf_use != 0) {
|
||||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||||
|
@ -809,18 +822,18 @@ int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request)
|
int drm_addbufs_sg(struct drm_device *dev, drm_buf_desc_t *request)
|
||||||
{
|
{
|
||||||
int order, ret;
|
int order, ret;
|
||||||
|
|
||||||
DRM_SPINLOCK(&dev->dma_lock);
|
|
||||||
|
|
||||||
if (!DRM_SUSER(DRM_CURPROC))
|
if (!DRM_SUSER(DRM_CURPROC))
|
||||||
return EACCES;
|
return EACCES;
|
||||||
|
|
||||||
if (request->count < 0 || request->count > 4096)
|
if (request->count < 0 || request->count > 4096)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
|
DRM_SPINLOCK(&dev->dma_lock);
|
||||||
|
|
||||||
order = drm_order(request->size);
|
order = drm_order(request->size);
|
||||||
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
|
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
@ -843,12 +856,10 @@ int drm_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)
|
int drm_addbufs_pci(struct drm_device *dev, drm_buf_desc_t *request)
|
||||||
{
|
{
|
||||||
int order, ret;
|
int order, ret;
|
||||||
|
|
||||||
DRM_SPINLOCK(&dev->dma_lock);
|
|
||||||
|
|
||||||
if (!DRM_SUSER(DRM_CURPROC))
|
if (!DRM_SUSER(DRM_CURPROC))
|
||||||
return EACCES;
|
return EACCES;
|
||||||
|
|
||||||
|
@ -859,6 +870,8 @@ int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)
|
||||||
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
|
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
|
DRM_SPINLOCK(&dev->dma_lock);
|
||||||
|
|
||||||
/* No more allocations after first buffer-using ioctl. */
|
/* No more allocations after first buffer-using ioctl. */
|
||||||
if (dev->buf_use != 0) {
|
if (dev->buf_use != 0) {
|
||||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||||
|
@ -877,7 +890,8 @@ int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_addbufs_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_addbufs_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_buf_desc_t *request = data;
|
drm_buf_desc_t *request = data;
|
||||||
int err;
|
int err;
|
||||||
|
@ -892,7 +906,7 @@ int drm_addbufs_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_infobufs(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_infobufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
drm_buf_info_t *request = data;
|
drm_buf_info_t *request = data;
|
||||||
|
@ -941,7 +955,7 @@ int drm_infobufs(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_markbufs(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_markbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
drm_buf_desc_t *request = data;
|
drm_buf_desc_t *request = data;
|
||||||
|
@ -960,6 +974,7 @@ int drm_markbufs(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
DRM_SPINLOCK(&dev->dma_lock);
|
DRM_SPINLOCK(&dev->dma_lock);
|
||||||
if (request->low_mark > dma->bufs[order].buf_count ||
|
if (request->low_mark > dma->bufs[order].buf_count ||
|
||||||
request->high_mark > dma->bufs[order].buf_count) {
|
request->high_mark > dma->bufs[order].buf_count) {
|
||||||
|
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -970,7 +985,7 @@ int drm_markbufs(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_freebufs(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_freebufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
drm_buf_free_t *request = data;
|
drm_buf_free_t *request = data;
|
||||||
|
@ -1007,7 +1022,7 @@ int drm_freebufs(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_mapbufs(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
* Context bitmap support
|
* Context bitmap support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle)
|
void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle)
|
||||||
{
|
{
|
||||||
if (ctx_handle < 0 || ctx_handle >= DRM_MAX_CTXBITMAP ||
|
if (ctx_handle < 0 || ctx_handle >= DRM_MAX_CTXBITMAP ||
|
||||||
dev->ctx_bitmap == NULL) {
|
dev->ctx_bitmap == NULL) {
|
||||||
|
@ -54,7 +54,7 @@ void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_ctxbitmap_next(drm_device_t *dev)
|
int drm_ctxbitmap_next(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int bit;
|
int bit;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ int drm_ctxbitmap_next(drm_device_t *dev)
|
||||||
return bit;
|
return bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_ctxbitmap_init(drm_device_t *dev)
|
int drm_ctxbitmap_init(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int temp;
|
int temp;
|
||||||
|
@ -124,7 +124,7 @@ int drm_ctxbitmap_init(drm_device_t *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drm_ctxbitmap_cleanup(drm_device_t *dev)
|
void drm_ctxbitmap_cleanup(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
DRM_LOCK();
|
DRM_LOCK();
|
||||||
if (dev->context_sareas != NULL)
|
if (dev->context_sareas != NULL)
|
||||||
|
@ -137,7 +137,8 @@ void drm_ctxbitmap_cleanup(drm_device_t *dev)
|
||||||
* Per Context SAREA Support
|
* Per Context SAREA Support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int drm_getsareactx( drm_device_t *dev, void *data, struct drm_file *file_priv )
|
int drm_getsareactx(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_ctx_priv_map_t *request = data;
|
drm_ctx_priv_map_t *request = data;
|
||||||
drm_local_map_t *map;
|
drm_local_map_t *map;
|
||||||
|
@ -157,7 +158,8 @@ int drm_getsareactx( drm_device_t *dev, void *data, struct drm_file *file_priv )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_setsareactx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_setsareactx(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_ctx_priv_map_t *request = data;
|
drm_ctx_priv_map_t *request = data;
|
||||||
drm_local_map_t *map = NULL;
|
drm_local_map_t *map = NULL;
|
||||||
|
@ -184,7 +186,7 @@ bad:
|
||||||
* The actual DRM context handling routines
|
* The actual DRM context handling routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int drm_context_switch(drm_device_t *dev, int old, int new)
|
int drm_context_switch(struct drm_device *dev, int old, int new)
|
||||||
{
|
{
|
||||||
if ( test_and_set_bit( 0, &dev->context_flag ) ) {
|
if ( test_and_set_bit( 0, &dev->context_flag ) ) {
|
||||||
DRM_ERROR( "Reentering -- FIXME\n" );
|
DRM_ERROR( "Reentering -- FIXME\n" );
|
||||||
|
@ -201,7 +203,7 @@ int drm_context_switch(drm_device_t *dev, int old, int new)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_context_switch_complete(drm_device_t *dev, int new)
|
int drm_context_switch_complete(struct drm_device *dev, int new)
|
||||||
{
|
{
|
||||||
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
|
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
|
||||||
|
|
||||||
|
@ -217,7 +219,7 @@ int drm_context_switch_complete(drm_device_t *dev, int new)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_resctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_resctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_ctx_res_t *res = data;
|
drm_ctx_res_t *res = data;
|
||||||
drm_ctx_t ctx;
|
drm_ctx_t ctx;
|
||||||
|
@ -237,7 +239,7 @@ int drm_resctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_addctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_addctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_ctx_t *ctx = data;
|
drm_ctx_t *ctx = data;
|
||||||
|
|
||||||
|
@ -262,13 +264,13 @@ int drm_addctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_modctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_modctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
/* This does nothing */
|
/* This does nothing */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_getctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_ctx_t *ctx = data;
|
drm_ctx_t *ctx = data;
|
||||||
|
|
||||||
|
@ -278,7 +280,8 @@ int drm_getctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_switchctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_switchctx(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_ctx_t *ctx = data;
|
drm_ctx_t *ctx = data;
|
||||||
|
|
||||||
|
@ -286,7 +289,7 @@ int drm_switchctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return drm_context_switch(dev, dev->last_context, ctx->handle);
|
return drm_context_switch(dev, dev->last_context, ctx->handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_newctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_newctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_ctx_t *ctx = data;
|
drm_ctx_t *ctx = data;
|
||||||
|
|
||||||
|
@ -296,7 +299,7 @@ int drm_newctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_rmctx(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_rmctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_ctx_t *ctx = data;
|
drm_ctx_t *ctx = data;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
|
|
||||||
int drm_dma_setup(drm_device_t *dev)
|
int drm_dma_setup(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
|
|
||||||
dev->dma = malloc(sizeof(*dev->dma), M_DRM, M_NOWAIT | M_ZERO);
|
dev->dma = malloc(sizeof(*dev->dma), M_DRM, M_NOWAIT | M_ZERO);
|
||||||
|
@ -50,7 +50,7 @@ int drm_dma_setup(drm_device_t *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drm_dma_takedown(drm_device_t *dev)
|
void drm_dma_takedown(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -89,7 +89,7 @@ void drm_dma_takedown(drm_device_t *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf)
|
void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf)
|
||||||
{
|
{
|
||||||
if (!buf) return;
|
if (!buf) return;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf)
|
||||||
buf->used = 0;
|
buf->used = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drm_reclaim_buffers(drm_device_t *dev, struct drm_file *file_priv)
|
void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
int i;
|
int i;
|
||||||
|
@ -122,7 +122,7 @@ void drm_reclaim_buffers(drm_device_t *dev, struct drm_file *file_priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call into the driver-specific DMA handler */
|
/* Call into the driver-specific DMA handler */
|
||||||
int drm_dma(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (dev->driver.dma_ioctl) {
|
if (dev->driver.dma_ioctl) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ RB_GENERATE_STATIC(drawable_tree, bsd_drm_drawable_info, tree,
|
||||||
drm_drawable_compare);
|
drm_drawable_compare);
|
||||||
|
|
||||||
struct drm_drawable_info *
|
struct drm_drawable_info *
|
||||||
drm_get_drawable_info(drm_device_t *dev, int handle)
|
drm_get_drawable_info(struct drm_device *dev, int handle)
|
||||||
{
|
{
|
||||||
struct bsd_drm_drawable_info find, *result;
|
struct bsd_drm_drawable_info find, *result;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ drm_get_drawable_info(drm_device_t *dev, int handle)
|
||||||
return &result->info;
|
return &result->info;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_adddraw(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_draw_t *draw = data;
|
drm_draw_t *draw = data;
|
||||||
struct bsd_drm_drawable_info *info;
|
struct bsd_drm_drawable_info *info;
|
||||||
|
@ -87,7 +87,7 @@ int drm_adddraw(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_rmdraw(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_draw_t *draw = (drm_draw_t *)data;
|
drm_draw_t *draw = (drm_draw_t *)data;
|
||||||
struct drm_drawable_info *info;
|
struct drm_drawable_info *info;
|
||||||
|
@ -108,7 +108,8 @@ int drm_rmdraw(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_update_draw(drm_device_t *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 *info;
|
struct drm_drawable_info *info;
|
||||||
struct drm_update_draw *update = (struct drm_update_draw *)data;
|
struct drm_update_draw *update = (struct drm_update_draw *)data;
|
||||||
|
@ -135,8 +136,10 @@ int drm_update_draw(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
if (info->rects == NULL) {
|
if (info->rects == NULL) {
|
||||||
info->rects = drm_alloc(sizeof(*info->rects) *
|
info->rects = drm_alloc(sizeof(*info->rects) *
|
||||||
update->num, DRM_MEM_DRAWABLE);
|
update->num, DRM_MEM_DRAWABLE);
|
||||||
if (info->rects == NULL)
|
if (info->rects == NULL) {
|
||||||
|
DRM_SPINUNLOCK(&dev->drw_lock);
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
}
|
||||||
info->num_rects = update->num;
|
info->num_rects = update->num;
|
||||||
}
|
}
|
||||||
/* For some reason the pointer arg is unsigned long long. */
|
/* For some reason the pointer arg is unsigned long long. */
|
||||||
|
|
|
@ -45,14 +45,14 @@ int drm_debug_flag = 1;
|
||||||
int drm_debug_flag = 0;
|
int drm_debug_flag = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int drm_load(drm_device_t *dev);
|
static int drm_load(struct drm_device *dev);
|
||||||
static void drm_unload(drm_device_t *dev);
|
static void drm_unload(struct drm_device *dev);
|
||||||
static drm_pci_id_list_t *drm_find_description(int vendor, int device,
|
static drm_pci_id_list_t *drm_find_description(int vendor, int device,
|
||||||
drm_pci_id_list_t *idlist);
|
drm_pci_id_list_t *idlist);
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
#define DRIVER_SOFTC(unit) \
|
#define DRIVER_SOFTC(unit) \
|
||||||
((drm_device_t *)devclass_get_softc(drm_devclass, unit))
|
((struct drm_device *)devclass_get_softc(drm_devclass, unit))
|
||||||
|
|
||||||
MODULE_VERSION(drm, 1);
|
MODULE_VERSION(drm, 1);
|
||||||
MODULE_DEPEND(drm, agp, 1, 1, 1);
|
MODULE_DEPEND(drm, agp, 1, 1, 1);
|
||||||
|
@ -64,7 +64,7 @@ MODULE_DEPEND(drm, mem, 1, 1, 1);
|
||||||
|
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
#define DRIVER_SOFTC(unit) \
|
#define DRIVER_SOFTC(unit) \
|
||||||
((drm_device_t *)device_lookup(&drm_cd, unit))
|
((struct drm_device *)device_lookup(&drm_cd, unit))
|
||||||
#endif /* __NetBSD__ || __OpenBSD__ */
|
#endif /* __NetBSD__ || __OpenBSD__ */
|
||||||
|
|
||||||
static drm_ioctl_desc_t drm_ioctls[256] = {
|
static drm_ioctl_desc_t drm_ioctls[256] = {
|
||||||
|
@ -180,7 +180,7 @@ int drm_probe(device_t dev, drm_pci_id_list_t *idlist)
|
||||||
|
|
||||||
int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist)
|
int drm_attach(device_t nbdev, drm_pci_id_list_t *idlist)
|
||||||
{
|
{
|
||||||
drm_device_t *dev;
|
struct drm_device *dev;
|
||||||
drm_pci_id_list_t *id_entry;
|
drm_pci_id_list_t *id_entry;
|
||||||
int unit;
|
int unit;
|
||||||
|
|
||||||
|
@ -319,14 +319,15 @@ void drm_attach(struct pci_attach_args *pa, dev_t kdev,
|
||||||
drm_pci_id_list_t *idlist)
|
drm_pci_id_list_t *idlist)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
drm_device_t *dev;
|
struct drm_device *dev;
|
||||||
drm_pci_id_list_t *id_entry;
|
drm_pci_id_list_t *id_entry;
|
||||||
|
|
||||||
config_makeroom(kdev, &drm_cd);
|
config_makeroom(kdev, &drm_cd);
|
||||||
drm_cd.cd_devs[(kdev)] = malloc(sizeof(drm_device_t), M_DRM, M_WAITOK);
|
drm_cd.cd_devs[(kdev)] = malloc(sizeof(struct drm_device),
|
||||||
|
M_DRM, M_WAITOK);
|
||||||
dev = DRIVER_SOFTC(kdev);
|
dev = DRIVER_SOFTC(kdev);
|
||||||
|
|
||||||
memset(dev, 0, sizeof(drm_device_t));
|
memset(dev, 0, sizeof(struct drm_device));
|
||||||
memcpy(&dev->pa, pa, sizeof(dev->pa));
|
memcpy(&dev->pa, pa, sizeof(dev->pa));
|
||||||
|
|
||||||
dev->irq = pa->pa_intrline;
|
dev->irq = pa->pa_intrline;
|
||||||
|
@ -346,7 +347,7 @@ void drm_attach(struct pci_attach_args *pa, dev_t kdev,
|
||||||
|
|
||||||
int drm_detach(struct device *self, int flags)
|
int drm_detach(struct device *self, int flags)
|
||||||
{
|
{
|
||||||
drm_unload((drm_device_t *)self);
|
drm_unload((struct drm_device *)self);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +380,7 @@ drm_pci_id_list_t *drm_find_description(int vendor, int device,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_firstopen(drm_device_t *dev)
|
static int drm_firstopen(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
drm_local_map_t *map;
|
drm_local_map_t *map;
|
||||||
int i;
|
int i;
|
||||||
|
@ -425,7 +426,7 @@ static int drm_firstopen(drm_device_t *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_lastclose(drm_device_t *dev)
|
static int drm_lastclose(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
drm_magic_entry_t *pt, *next;
|
drm_magic_entry_t *pt, *next;
|
||||||
drm_local_map_t *map, *mapsave;
|
drm_local_map_t *map, *mapsave;
|
||||||
|
@ -498,7 +499,7 @@ static int drm_lastclose(drm_device_t *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drm_load(drm_device_t *dev)
|
static int drm_load(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int i, retcode;
|
int i, retcode;
|
||||||
|
|
||||||
|
@ -599,7 +600,7 @@ error:
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drm_unload(drm_device_t *dev)
|
static void drm_unload(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -654,7 +655,7 @@ static void drm_unload(drm_device_t *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int drm_version(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_version(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_version_t *version = data;
|
drm_version_t *version = data;
|
||||||
int len;
|
int len;
|
||||||
|
@ -681,7 +682,7 @@ int drm_version(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
|
|
||||||
int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = NULL;
|
struct drm_device *dev = NULL;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
dev = DRIVER_SOFTC(minor(kdev));
|
dev = DRIVER_SOFTC(minor(kdev));
|
||||||
|
@ -706,7 +707,7 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
||||||
|
|
||||||
int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = drm_get_device_from_kdev(kdev);
|
struct drm_device *dev = drm_get_device_from_kdev(kdev);
|
||||||
drm_file_t *file_priv;
|
drm_file_t *file_priv;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
@ -827,10 +828,10 @@ done:
|
||||||
int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
|
int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
|
||||||
DRM_STRUCTPROC *p)
|
DRM_STRUCTPROC *p)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = drm_get_device_from_kdev(kdev);
|
struct drm_device *dev = drm_get_device_from_kdev(kdev);
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
drm_ioctl_desc_t *ioctl;
|
drm_ioctl_desc_t *ioctl;
|
||||||
int (*func)(drm_device_t *dev, void *data, struct drm_file *file_priv);
|
int (*func)(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||||
int nr = DRM_IOCTL_NR(cmd);
|
int nr = DRM_IOCTL_NR(cmd);
|
||||||
int is_driver_ioctl = 0;
|
int is_driver_ioctl = 0;
|
||||||
drm_file_t *file_priv;
|
drm_file_t *file_priv;
|
||||||
|
@ -929,7 +930,7 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_local_map_t *drm_getsarea(drm_device_t *dev)
|
drm_local_map_t *drm_getsarea(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
drm_local_map_t *map;
|
drm_local_map_t *map;
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
|
|
||||||
drm_file_t *drm_find_file_by_proc(drm_device_t *dev, DRM_STRUCTPROC *p)
|
drm_file_t *drm_find_file_by_proc(struct drm_device *dev, DRM_STRUCTPROC *p)
|
||||||
{
|
{
|
||||||
#if __FreeBSD_version >= 500021
|
#if __FreeBSD_version >= 500021
|
||||||
uid_t uid = p->td_ucred->cr_svuid;
|
uid_t uid = p->td_ucred->cr_svuid;
|
||||||
|
@ -57,7 +57,7 @@ drm_file_t *drm_find_file_by_proc(drm_device_t *dev, DRM_STRUCTPROC *p)
|
||||||
|
|
||||||
/* drm_open_helper is called whenever a process opens /dev/drm. */
|
/* drm_open_helper is called whenever a process opens /dev/drm. */
|
||||||
int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
int drm_open_helper(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
||||||
drm_device_t *dev)
|
struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int m = minor(kdev);
|
int m = minor(kdev);
|
||||||
drm_file_t *priv;
|
drm_file_t *priv;
|
||||||
|
|
|
@ -41,7 +41,8 @@
|
||||||
* before setunique has been called. The format for the bus-specific part of
|
* before setunique has been called. The format for the bus-specific part of
|
||||||
* the unique is not defined for any other bus.
|
* the unique is not defined for any other bus.
|
||||||
*/
|
*/
|
||||||
int drm_getunique(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_getunique(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_unique_t *u = data;
|
drm_unique_t *u = data;
|
||||||
|
|
||||||
|
@ -57,7 +58,8 @@ int drm_getunique(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
/* Deprecated in DRM version 1.1, and will return EBUSY when setversion has
|
/* Deprecated in DRM version 1.1, and will return EBUSY when setversion has
|
||||||
* requested version 1.1 or greater.
|
* requested version 1.1 or greater.
|
||||||
*/
|
*/
|
||||||
int drm_setunique(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_setunique(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_unique_t *u = data;
|
drm_unique_t *u = data;
|
||||||
int domain, bus, slot, func, ret;
|
int domain, bus, slot, func, ret;
|
||||||
|
@ -112,7 +114,7 @@ int drm_setunique(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
drm_set_busid(drm_device_t *dev)
|
drm_set_busid(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
|
|
||||||
DRM_LOCK();
|
DRM_LOCK();
|
||||||
|
@ -137,7 +139,7 @@ drm_set_busid(drm_device_t *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_getmap(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_getmap(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_map_t *map = data;
|
drm_map_t *map = data;
|
||||||
drm_local_map_t *mapinlist;
|
drm_local_map_t *mapinlist;
|
||||||
|
@ -173,7 +175,8 @@ int drm_getmap(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_getclient(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_getclient(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_client_t *client = data;
|
drm_client_t *client = data;
|
||||||
drm_file_t *pt;
|
drm_file_t *pt;
|
||||||
|
@ -200,7 +203,7 @@ int drm_getclient(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_getstats(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_getstats(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_stats_t *stats = data;
|
drm_stats_t *stats = data;
|
||||||
int i;
|
int i;
|
||||||
|
@ -229,7 +232,8 @@ int drm_getstats(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
#define DRM_IF_MAJOR 1
|
#define DRM_IF_MAJOR 1
|
||||||
#define DRM_IF_MINOR 2
|
#define DRM_IF_MINOR 2
|
||||||
|
|
||||||
int drm_setversion(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_setversion(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_set_version_t *sv = data;
|
drm_set_version_t *sv = data;
|
||||||
drm_set_version_t ver;
|
drm_set_version_t ver;
|
||||||
|
@ -273,7 +277,7 @@ int drm_setversion(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int drm_noop(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_noop(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
DRM_DEBUG("\n");
|
DRM_DEBUG("\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
|
|
||||||
static void drm_locked_task(void *context, int pending __unused);
|
static void drm_locked_task(void *context, int pending __unused);
|
||||||
|
|
||||||
int drm_irq_by_busid(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_irq_by_busid(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_irq_busid_t *irq = data;
|
drm_irq_busid_t *irq = data;
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ int drm_irq_by_busid(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
static irqreturn_t
|
static irqreturn_t
|
||||||
drm_irq_handler_wrap(DRM_IRQ_ARGS)
|
drm_irq_handler_wrap(DRM_IRQ_ARGS)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = (drm_device_t *)arg;
|
struct drm_device *dev = arg;
|
||||||
|
|
||||||
DRM_SPINLOCK(&dev->irq_lock);
|
DRM_SPINLOCK(&dev->irq_lock);
|
||||||
dev->driver.irq_handler(arg);
|
dev->driver.irq_handler(arg);
|
||||||
|
@ -65,7 +66,7 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int drm_irq_install(drm_device_t *dev)
|
int drm_irq_install(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int retcode;
|
int retcode;
|
||||||
#ifdef __NetBSD__
|
#ifdef __NetBSD__
|
||||||
|
@ -147,7 +148,7 @@ err:
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_irq_uninstall(drm_device_t *dev)
|
int drm_irq_uninstall(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
int irqrid;
|
int irqrid;
|
||||||
|
@ -179,7 +180,7 @@ int drm_irq_uninstall(drm_device_t *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_control(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_control_t *ctl = data;
|
drm_control_t *ctl = data;
|
||||||
int err;
|
int err;
|
||||||
|
@ -207,12 +208,130 @@ int drm_control(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_wait_vblank(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
static void vblank_disable_fn(void *arg)
|
||||||
|
{
|
||||||
|
struct drm_device *dev = (struct drm_device *)arg;
|
||||||
|
unsigned long irqflags;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < dev->num_crtcs; i++) {
|
||||||
|
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
|
||||||
|
if (atomic_read(&dev->vblank_refcount[i]) == 0 &&
|
||||||
|
dev->vblank_enabled[i]) {
|
||||||
|
dev->driver.disable_vblank(dev, i);
|
||||||
|
dev->vblank_enabled[i] = 0;
|
||||||
|
}
|
||||||
|
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 drm_vblank_count(struct drm_device *dev, int crtc)
|
||||||
|
{
|
||||||
|
return atomic_read(&dev->_vblank_count[crtc]) +
|
||||||
|
dev->vblank_offset[crtc];
|
||||||
|
}
|
||||||
|
|
||||||
|
int drm_vblank_get(struct drm_device *dev, int crtc)
|
||||||
|
{
|
||||||
|
unsigned long irqflags;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
|
||||||
|
/* Going from 0->1 means we have to enable interrupts again */
|
||||||
|
atomic_add_acq_int(&dev->vblank_refcount[crtc], 1);
|
||||||
|
if (dev->vblank_refcount[crtc] == 1 &&
|
||||||
|
!dev->vblank_enabled[crtc]) {
|
||||||
|
ret = dev->driver.enable_vblank(dev, crtc);
|
||||||
|
if (ret)
|
||||||
|
atomic_dec(&dev->vblank_refcount[crtc]);
|
||||||
|
else
|
||||||
|
dev->vblank_enabled[crtc] = 1;
|
||||||
|
}
|
||||||
|
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void drm_vblank_put(struct drm_device *dev, int crtc)
|
||||||
|
{
|
||||||
|
/* Last user schedules interrupt disable */
|
||||||
|
atomic_subtract_acq_int(&dev->vblank_refcount[crtc], 1);
|
||||||
|
if (dev->vblank_refcount[crtc] == 0)
|
||||||
|
callout_reset(&dev->vblank_disable_timer, jiffies + 5*DRM_HZ,
|
||||||
|
(timeout_t *)vblank_disable_fn, (void *)dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drm_handle_vblank(struct drm_device *dev, int crtc)
|
||||||
|
{
|
||||||
|
drm_update_vblank_count(dev, crtc);
|
||||||
|
DRM_WAKEUP(&dev->vbl_queue[crtc]);
|
||||||
|
drm_vbl_send_signals(dev, crtc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void drm_update_vblank_count(struct drm_device *dev, int crtc)
|
||||||
|
{
|
||||||
|
unsigned long irqflags;
|
||||||
|
u32 cur_vblank, diff;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Interrupts were disabled prior to this call, so deal with counter
|
||||||
|
* wrap if needed.
|
||||||
|
* NOTE! It's possible we lost a full dev->max_vblank_count events
|
||||||
|
* here if the register is small or we had vblank interrupts off for
|
||||||
|
* a long time.
|
||||||
|
*/
|
||||||
|
cur_vblank = dev->driver.get_vblank_counter(dev, crtc);
|
||||||
|
DRM_SPINLOCK_IRQSAVE(&dev->vbl_lock, irqflags);
|
||||||
|
if (cur_vblank < dev->last_vblank[crtc]) {
|
||||||
|
diff = dev->max_vblank_count -
|
||||||
|
dev->last_vblank[crtc];
|
||||||
|
diff += cur_vblank;
|
||||||
|
} else {
|
||||||
|
diff = cur_vblank - dev->last_vblank[crtc];
|
||||||
|
}
|
||||||
|
dev->last_vblank[crtc] = cur_vblank;
|
||||||
|
DRM_SPINUNLOCK_IRQRESTORE(&dev->vbl_lock, irqflags);
|
||||||
|
|
||||||
|
atomic_add(diff, &dev->_vblank_count[crtc]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int drm_modeset_ctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
|
{
|
||||||
|
struct drm_modeset_ctl *modeset = data;
|
||||||
|
int crtc, ret = 0;
|
||||||
|
u32 new;
|
||||||
|
|
||||||
|
crtc = modeset->crtc;
|
||||||
|
if (crtc >= dev->num_crtcs) {
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (modeset->cmd) {
|
||||||
|
case _DRM_PRE_MODESET:
|
||||||
|
dev->vblank_premodeset[crtc] =
|
||||||
|
dev->driver.get_vblank_counter(dev, crtc);
|
||||||
|
break;
|
||||||
|
case _DRM_POST_MODESET:
|
||||||
|
new = dev->driver.get_vblank_counter(dev, crtc);
|
||||||
|
dev->vblank_offset[crtc] = dev->vblank_premodeset[crtc] - new;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret = -EINVAL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_wait_vblank_t *vblwait = data;
|
drm_wait_vblank_t *vblwait = data;
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int flags, seq;
|
int flags, seq, crtc;
|
||||||
|
|
||||||
if (!dev->irq_enabled)
|
if (!dev->irq_enabled)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
@ -226,12 +345,13 @@ int drm_wait_vblank(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK;
|
flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK;
|
||||||
|
crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0;
|
||||||
|
|
||||||
if ((flags & _DRM_VBLANK_SECONDARY) && !dev->driver.use_vbl_irq2)
|
if (crtc >= dev->num_crtcs)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ?
|
drm_update_vblank_count(dev, crtc);
|
||||||
&dev->vbl_received2 : &dev->vbl_received);
|
seq = drm_vblank_count(dev, crtc);
|
||||||
|
|
||||||
switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {
|
switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {
|
||||||
case _DRM_VBLANK_RELATIVE:
|
case _DRM_VBLANK_RELATIVE:
|
||||||
|
@ -268,16 +388,18 @@ int drm_wait_vblank(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
#endif
|
#endif
|
||||||
ret = EINVAL;
|
ret = EINVAL;
|
||||||
} else {
|
} else {
|
||||||
|
unsigned long cur_vblank;
|
||||||
|
|
||||||
DRM_LOCK();
|
DRM_LOCK();
|
||||||
/* shared code returns -errno */
|
/* shared code returns -errno */
|
||||||
if (flags & _DRM_VBLANK_SECONDARY) {
|
|
||||||
if (dev->driver.vblank_wait2)
|
|
||||||
ret = -dev->driver.vblank_wait2(dev,
|
|
||||||
&vblwait->request.sequence);
|
|
||||||
} else if (dev->driver.vblank_wait)
|
|
||||||
ret = -dev->driver.vblank_wait(dev,
|
|
||||||
&vblwait->request.sequence);
|
|
||||||
|
|
||||||
|
ret = drm_vblank_get(dev, crtc);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
|
||||||
|
(((cur_vblank = drm_vblank_count(dev, crtc))
|
||||||
|
- vblwait->request.sequence) <= (1 << 23)));
|
||||||
|
drm_vblank_put(dev, crtc);
|
||||||
DRM_UNLOCK();
|
DRM_UNLOCK();
|
||||||
|
|
||||||
microtime(&now);
|
microtime(&now);
|
||||||
|
@ -288,12 +410,104 @@ int drm_wait_vblank(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void drm_vbl_send_signals(drm_device_t *dev)
|
static void drm_vblank_cleanup(struct drm_device *dev)
|
||||||
|
{
|
||||||
|
/* Bail if the driver didn't call drm_vblank_init() */
|
||||||
|
if (dev->num_crtcs == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
callout_stop(&dev->vblank_disable_timer);
|
||||||
|
|
||||||
|
vblank_disable_fn((void *)dev);
|
||||||
|
|
||||||
|
drm_free(dev->vbl_queue, sizeof(*dev->vbl_queue) * dev->num_crtcs,
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
drm_free(dev->vbl_sigs, sizeof(*dev->vbl_sigs) * dev->num_crtcs,
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
drm_free(dev->_vblank_count, sizeof(*dev->_vblank_count) *
|
||||||
|
dev->num_crtcs, DRM_MEM_DRIVER);
|
||||||
|
drm_free(dev->vblank_refcount, sizeof(*dev->vblank_refcount) *
|
||||||
|
dev->num_crtcs, DRM_MEM_DRIVER);
|
||||||
|
drm_free(dev->vblank_enabled, sizeof(*dev->vblank_enabled) *
|
||||||
|
dev->num_crtcs, DRM_MEM_DRIVER);
|
||||||
|
drm_free(dev->last_vblank, sizeof(*dev->last_vblank) * dev->num_crtcs,
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
drm_free(dev->vblank_premodeset, sizeof(*dev->vblank_premodeset) *
|
||||||
|
dev->num_crtcs, DRM_MEM_DRIVER);
|
||||||
|
drm_free(dev->vblank_offset, sizeof(*dev->vblank_offset) * dev->num_crtcs,
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
|
||||||
|
dev->num_crtcs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int drm_vblank_init(struct drm_device *dev, int num_crtcs)
|
||||||
|
{
|
||||||
|
int i, ret = -ENOMEM;
|
||||||
|
|
||||||
|
callout_init(&dev->vblank_disable_timer, 0);
|
||||||
|
DRM_SPININIT(&dev->vbl_lock, "drm_vblk");
|
||||||
|
atomic_set(&dev->vbl_signal_pending, 0);
|
||||||
|
dev->num_crtcs = num_crtcs;
|
||||||
|
|
||||||
|
dev->vbl_queue = drm_alloc(sizeof(wait_queue_head_t) * num_crtcs,
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
if (!dev->vbl_queue)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
dev->vbl_sigs = drm_alloc(sizeof(struct drm_vbl_sig) * num_crtcs,
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
if (!dev->vbl_sigs)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
dev->_vblank_count = drm_alloc(sizeof(atomic_t) * num_crtcs,
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
if (!dev->_vblank_count)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
dev->vblank_refcount = drm_alloc(sizeof(atomic_t) * num_crtcs,
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
if (!dev->vblank_refcount)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
dev->vblank_enabled = drm_calloc(num_crtcs, sizeof(int),
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
if (!dev->vblank_enabled)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
dev->last_vblank = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER);
|
||||||
|
if (!dev->last_vblank)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
dev->vblank_premodeset = drm_calloc(num_crtcs, sizeof(u32),
|
||||||
|
DRM_MEM_DRIVER);
|
||||||
|
if (!dev->vblank_premodeset)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
dev->vblank_offset = drm_calloc(num_crtcs, sizeof(u32), DRM_MEM_DRIVER);
|
||||||
|
if (!dev->vblank_offset)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
/* Zero per-crtc vblank stuff */
|
||||||
|
for (i = 0; i < num_crtcs; i++) {
|
||||||
|
DRM_INIT_WAITQUEUE(&dev->vbl_queue[i]);
|
||||||
|
TAILQ_INIT(&dev->vbl_sigs[i]);
|
||||||
|
atomic_set(&dev->_vblank_count[i], 0);
|
||||||
|
atomic_set(&dev->vblank_refcount[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err:
|
||||||
|
drm_vblank_cleanup(dev);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void drm_vbl_send_signals(struct drm_device *dev, int crtc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* disabled */
|
#if 0 /* disabled */
|
||||||
void drm_vbl_send_signals( drm_device_t *dev )
|
void drm_vbl_send_signals(struct drm_device *dev, int crtc )
|
||||||
{
|
{
|
||||||
drm_vbl_sig_t *vbl_sig;
|
drm_vbl_sig_t *vbl_sig;
|
||||||
unsigned int vbl_seq = atomic_read( &dev->vbl_received );
|
unsigned int vbl_seq = atomic_read( &dev->vbl_received );
|
||||||
|
@ -318,7 +532,7 @@ void drm_vbl_send_signals( drm_device_t *dev )
|
||||||
|
|
||||||
static void drm_locked_task(void *context, int pending __unused)
|
static void drm_locked_task(void *context, int pending __unused)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = context;
|
struct drm_device *dev = context;
|
||||||
|
|
||||||
DRM_LOCK();
|
DRM_LOCK();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -352,7 +566,8 @@ static void drm_locked_task(void *context, int pending __unused)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drm_locked_tasklet(drm_device_t *dev, void (*tasklet)(drm_device_t *dev))
|
drm_locked_tasklet(struct drm_device *dev,
|
||||||
|
void (*tasklet)(struct drm_device *dev))
|
||||||
{
|
{
|
||||||
dev->locked_task_call = tasklet;
|
dev->locked_task_call = tasklet;
|
||||||
taskqueue_enqueue(taskqueue_swi, &dev->locked_task);
|
taskqueue_enqueue(taskqueue_swi, &dev->locked_task);
|
||||||
|
|
|
@ -77,7 +77,7 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
|
||||||
|
|
||||||
/* This takes a lock forcibly and hands it to context. Should ONLY be used
|
/* This takes a lock forcibly and hands it to context. Should ONLY be used
|
||||||
inside *_unlock to give lock to kernel before calling *_dma_schedule. */
|
inside *_unlock to give lock to kernel before calling *_dma_schedule. */
|
||||||
int drm_lock_transfer(drm_device_t *dev,
|
int drm_lock_transfer(struct drm_device *dev,
|
||||||
__volatile__ unsigned int *lock, unsigned int context)
|
__volatile__ unsigned int *lock, unsigned int context)
|
||||||
{
|
{
|
||||||
unsigned int old, new;
|
unsigned int old, new;
|
||||||
|
@ -91,7 +91,7 @@ int drm_lock_transfer(drm_device_t *dev,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_lock_free(drm_device_t *dev,
|
int drm_lock_free(struct drm_device *dev,
|
||||||
__volatile__ unsigned int *lock, unsigned int context)
|
__volatile__ unsigned int *lock, unsigned int context)
|
||||||
{
|
{
|
||||||
unsigned int old, new;
|
unsigned int old, new;
|
||||||
|
@ -111,7 +111,7 @@ int drm_lock_free(drm_device_t *dev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_lock(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_lock_t *lock = data;
|
drm_lock_t *lock = data;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -164,7 +164,7 @@ int drm_lock(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_unlock(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_lock_t *lock = data;
|
drm_lock_t *lock = data;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ void drm_free(void *pt, size_t size, int area)
|
||||||
free(pt, M_DRM);
|
free(pt, M_DRM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *drm_ioremap(drm_device_t *dev, drm_local_map_t *map)
|
void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map)
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
return pmap_mapdev(map->offset, map->size);
|
return pmap_mapdev(map->offset, map->size);
|
||||||
|
|
|
@ -53,7 +53,8 @@ drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error
|
||||||
* memory block.
|
* memory block.
|
||||||
*/
|
*/
|
||||||
drm_dma_handle_t *
|
drm_dma_handle_t *
|
||||||
drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr)
|
drm_pci_alloc(struct drm_device *dev, size_t size,
|
||||||
|
size_t align, dma_addr_t maxaddr)
|
||||||
{
|
{
|
||||||
drm_dma_handle_t *dmah;
|
drm_dma_handle_t *dmah;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -123,7 +124,7 @@ drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr)
|
||||||
* \brief Free a DMA-accessible consistent memory block.
|
* \brief Free a DMA-accessible consistent memory block.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah)
|
drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah)
|
||||||
{
|
{
|
||||||
if (dmah == NULL)
|
if (dmah == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -45,7 +45,7 @@ void drm_sg_cleanup(drm_sg_mem_t *entry)
|
||||||
free(entry, M_DRM);
|
free(entry, M_DRM);
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_sg_alloc(drm_device_t * dev, drm_scatter_gather_t * request)
|
int drm_sg_alloc(struct drm_device * dev, drm_scatter_gather_t * request)
|
||||||
{
|
{
|
||||||
drm_sg_mem_t *entry;
|
drm_sg_mem_t *entry;
|
||||||
unsigned long pages;
|
unsigned long pages;
|
||||||
|
@ -98,7 +98,8 @@ int drm_sg_alloc(drm_device_t * dev, drm_scatter_gather_t * request)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_sg_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_scatter_gather_t *request = data;
|
drm_scatter_gather_t *request = data;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -109,7 +110,7 @@ int drm_sg_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_sg_free(drm_device_t *dev, void *data, struct drm_file *file_priv)
|
int drm_sg_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
drm_scatter_gather_t *request = data;
|
drm_scatter_gather_t *request = data;
|
||||||
drm_sg_mem_t *entry;
|
drm_sg_mem_t *entry;
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct drm_sysctl_info {
|
||||||
char name[2];
|
char name[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
int drm_sysctl_init(drm_device_t *dev)
|
int drm_sysctl_init(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct drm_sysctl_info *info;
|
struct drm_sysctl_info *info;
|
||||||
struct sysctl_oid *oid;
|
struct sysctl_oid *oid;
|
||||||
|
@ -106,7 +106,7 @@ int drm_sysctl_init(drm_device_t *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drm_sysctl_cleanup(drm_device_t *dev)
|
int drm_sysctl_cleanup(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
error = sysctl_ctx_free( &dev->sysctl->ctx );
|
error = sysctl_ctx_free( &dev->sysctl->ctx );
|
||||||
|
@ -127,7 +127,7 @@ do { \
|
||||||
|
|
||||||
static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
|
static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
|
||||||
{
|
{
|
||||||
drm_device_t *dev = arg1;
|
struct drm_device *dev = arg1;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int retcode;
|
int retcode;
|
||||||
int hasunique = 0;
|
int hasunique = 0;
|
||||||
|
@ -152,7 +152,7 @@ done:
|
||||||
|
|
||||||
static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
|
static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
|
||||||
{
|
{
|
||||||
drm_device_t *dev = arg1;
|
struct drm_device *dev = arg1;
|
||||||
drm_local_map_t *map, *tempmaps;
|
drm_local_map_t *map, *tempmaps;
|
||||||
const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
|
const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
|
||||||
const char *type, *yesno;
|
const char *type, *yesno;
|
||||||
|
@ -211,7 +211,7 @@ done:
|
||||||
|
|
||||||
static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
|
static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
|
||||||
{
|
{
|
||||||
drm_device_t *dev = arg1;
|
struct drm_device *dev = arg1;
|
||||||
drm_device_dma_t *dma = dev->dma;
|
drm_device_dma_t *dma = dev->dma;
|
||||||
drm_device_dma_t tempdma;
|
drm_device_dma_t tempdma;
|
||||||
int *templists;
|
int *templists;
|
||||||
|
@ -267,7 +267,7 @@ done:
|
||||||
|
|
||||||
static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
|
static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
|
||||||
{
|
{
|
||||||
drm_device_t *dev = arg1;
|
struct drm_device *dev = arg1;
|
||||||
drm_file_t *priv, *tempprivs;
|
drm_file_t *priv, *tempprivs;
|
||||||
char buf[128];
|
char buf[128];
|
||||||
int retcode;
|
int retcode;
|
||||||
|
|
|
@ -37,7 +37,7 @@ int drm_mmap(dev_t kdev, vm_offset_t offset, int prot)
|
||||||
paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
drm_device_t *dev = drm_get_device_from_kdev(kdev);
|
struct drm_device *dev = drm_get_device_from_kdev(kdev);
|
||||||
drm_local_map_t *map;
|
drm_local_map_t *map;
|
||||||
drm_file_t *priv;
|
drm_file_t *priv;
|
||||||
drm_map_type_t type;
|
drm_map_type_t type;
|
||||||
|
@ -67,9 +67,9 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
||||||
unsigned long page = offset >> PAGE_SHIFT;
|
unsigned long page = offset >> PAGE_SHIFT;
|
||||||
unsigned long phys = dma->pagelist[page];
|
unsigned long phys = dma->pagelist[page];
|
||||||
|
|
||||||
|
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||||
#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
|
#if defined(__FreeBSD__) && __FreeBSD_version >= 500102
|
||||||
*paddr = phys;
|
*paddr = phys;
|
||||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
return atop(phys);
|
return atop(phys);
|
||||||
|
@ -78,7 +78,6 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
|
||||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
DRM_SPINUNLOCK(&dev->dma_lock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DRM_SPINUNLOCK(&dev->dma_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A sequential search of a linked list is
|
/* A sequential search of a linked list is
|
||||||
|
|
|
@ -40,15 +40,16 @@ static drm_pci_id_list_t i915_pciidlist[] = {
|
||||||
i915_PCI_IDS
|
i915_PCI_IDS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void i915_configure(drm_device_t *dev)
|
static void i915_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = 1; /* No dev_priv */
|
dev->driver.buf_priv_size = 1; /* No dev_priv */
|
||||||
dev->driver.load = i915_driver_load;
|
dev->driver.load = i915_driver_load;
|
||||||
dev->driver.preclose = i915_driver_preclose;
|
dev->driver.preclose = i915_driver_preclose;
|
||||||
dev->driver.lastclose = i915_driver_lastclose;
|
dev->driver.lastclose = i915_driver_lastclose;
|
||||||
dev->driver.device_is_agp = i915_driver_device_is_agp;
|
dev->driver.device_is_agp = i915_driver_device_is_agp;
|
||||||
dev->driver.vblank_wait = i915_driver_vblank_wait;
|
dev->driver.get_vblank_counter = i915_get_vblank_counter;
|
||||||
dev->driver.vblank_wait2 = i915_driver_vblank_wait2;
|
dev->driver.enable_vblank = i915_enable_vblank;
|
||||||
|
dev->driver.disable_vblank = i915_disable_vblank;
|
||||||
dev->driver.irq_preinstall = i915_driver_irq_preinstall;
|
dev->driver.irq_preinstall = i915_driver_irq_preinstall;
|
||||||
dev->driver.irq_postinstall = i915_driver_irq_postinstall;
|
dev->driver.irq_postinstall = i915_driver_irq_postinstall;
|
||||||
dev->driver.irq_uninstall = i915_driver_irq_uninstall;
|
dev->driver.irq_uninstall = i915_driver_irq_uninstall;
|
||||||
|
@ -82,9 +83,9 @@ i915_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
i915_attach(device_t nbdev)
|
i915_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
i915_configure(dev);
|
i915_configure(dev);
|
||||||
return drm_attach(nbdev, i915_pciidlist);
|
return drm_attach(nbdev, i915_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,7 @@ static driver_t i915_driver = {
|
||||||
"drmsub",
|
"drmsub",
|
||||||
#endif
|
#endif
|
||||||
i915_methods,
|
i915_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
|
|
@ -44,11 +44,13 @@ static drm_pci_id_list_t mach64_pciidlist[] = {
|
||||||
mach64_PCI_IDS
|
mach64_PCI_IDS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void mach64_configure(drm_device_t *dev)
|
static void mach64_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = 1; /* No dev_priv */
|
dev->driver.buf_priv_size = 1; /* No dev_priv */
|
||||||
dev->driver.lastclose = mach64_driver_lastclose;
|
dev->driver.lastclose = mach64_driver_lastclose;
|
||||||
dev->driver.vblank_wait = mach64_driver_vblank_wait;
|
dev->driver.get_vblank_counter = mach64_get_vblank_counter;
|
||||||
|
dev->driver.enable_vblank = mach64_enable_vblank;
|
||||||
|
dev->driver.disable_vblank = mach64_disable_vblank;
|
||||||
dev->driver.irq_preinstall = mach64_driver_irq_preinstall;
|
dev->driver.irq_preinstall = mach64_driver_irq_preinstall;
|
||||||
dev->driver.irq_postinstall = mach64_driver_irq_postinstall;
|
dev->driver.irq_postinstall = mach64_driver_irq_postinstall;
|
||||||
dev->driver.irq_uninstall = mach64_driver_irq_uninstall;
|
dev->driver.irq_uninstall = mach64_driver_irq_uninstall;
|
||||||
|
@ -83,9 +85,9 @@ mach64_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
mach64_attach(device_t nbdev)
|
mach64_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
mach64_configure(dev);
|
mach64_configure(dev);
|
||||||
return drm_attach(nbdev, mach64_pciidlist);
|
return drm_attach(nbdev, mach64_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +104,7 @@ static device_method_t mach64_methods[] = {
|
||||||
static driver_t mach64_driver = {
|
static driver_t mach64_driver = {
|
||||||
"drm",
|
"drm",
|
||||||
mach64_methods,
|
mach64_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
|
|
@ -59,7 +59,7 @@ static drm_pci_id_list_t mga_pciidlist[] = {
|
||||||
* This function needs to be filled in! The implementation in
|
* This function needs to be filled in! The implementation in
|
||||||
* linux-core/mga_drv.c shows what needs to be done.
|
* linux-core/mga_drv.c shows what needs to be done.
|
||||||
*/
|
*/
|
||||||
static int mga_driver_device_is_agp(drm_device_t * dev)
|
static int mga_driver_device_is_agp(struct drm_device * dev)
|
||||||
{
|
{
|
||||||
device_t bus;
|
device_t bus;
|
||||||
|
|
||||||
|
@ -84,13 +84,15 @@ static int mga_driver_device_is_agp(drm_device_t * dev)
|
||||||
return DRM_MIGHT_BE_AGP;
|
return DRM_MIGHT_BE_AGP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mga_configure(drm_device_t *dev)
|
static void mga_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = sizeof(drm_mga_buf_priv_t);
|
dev->driver.buf_priv_size = sizeof(drm_mga_buf_priv_t);
|
||||||
dev->driver.load = mga_driver_load;
|
dev->driver.load = mga_driver_load;
|
||||||
dev->driver.unload = mga_driver_unload;
|
dev->driver.unload = mga_driver_unload;
|
||||||
dev->driver.lastclose = mga_driver_lastclose;
|
dev->driver.lastclose = mga_driver_lastclose;
|
||||||
dev->driver.vblank_wait = mga_driver_vblank_wait;
|
dev->driver.get_vblank_counter = mga_get_vblank_counter;
|
||||||
|
dev->driver.enable_vblank = mga_enable_vblank;
|
||||||
|
dev->driver.disable_vblank = mga_disable_vblank;
|
||||||
dev->driver.irq_preinstall = mga_driver_irq_preinstall;
|
dev->driver.irq_preinstall = mga_driver_irq_preinstall;
|
||||||
dev->driver.irq_postinstall = mga_driver_irq_postinstall;
|
dev->driver.irq_postinstall = mga_driver_irq_postinstall;
|
||||||
dev->driver.irq_uninstall = mga_driver_irq_uninstall;
|
dev->driver.irq_uninstall = mga_driver_irq_uninstall;
|
||||||
|
@ -129,9 +131,9 @@ mga_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
mga_attach(device_t nbdev)
|
mga_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
mga_configure(dev);
|
mga_configure(dev);
|
||||||
return drm_attach(nbdev, mga_pciidlist);
|
return drm_attach(nbdev, mga_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +150,7 @@ static device_method_t mga_methods[] = {
|
||||||
static driver_t mga_driver = {
|
static driver_t mga_driver = {
|
||||||
"drm",
|
"drm",
|
||||||
mga_methods,
|
mga_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
@ -163,7 +165,7 @@ MODULE_DEPEND(mga, drm, 1, 1, 1);
|
||||||
#ifdef _LKM
|
#ifdef _LKM
|
||||||
CFDRIVER_DECL(mga, DV_TTY, NULL);
|
CFDRIVER_DECL(mga, DV_TTY, NULL);
|
||||||
#else
|
#else
|
||||||
CFATTACH_DECL(mga, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
CFATTACH_DECL(mga, sizeof(struct drm_device), drm_probe, drm_attach, drm_detach,
|
||||||
drm_activate);
|
drm_activate);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,12 +42,14 @@ static drm_pci_id_list_t r128_pciidlist[] = {
|
||||||
r128_PCI_IDS
|
r128_PCI_IDS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void r128_configure(drm_device_t *dev)
|
static void r128_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = sizeof(drm_r128_buf_priv_t);
|
dev->driver.buf_priv_size = sizeof(drm_r128_buf_priv_t);
|
||||||
dev->driver.preclose = r128_driver_preclose;
|
dev->driver.preclose = r128_driver_preclose;
|
||||||
dev->driver.lastclose = r128_driver_lastclose;
|
dev->driver.lastclose = r128_driver_lastclose;
|
||||||
dev->driver.vblank_wait = r128_driver_vblank_wait;
|
dev->driver.get_vblank_counter = r128_get_vblank_counter;
|
||||||
|
dev->driver.enable_vblank = r128_enable_vblank;
|
||||||
|
dev->driver.disable_vblank = r128_disable_vblank;
|
||||||
dev->driver.irq_preinstall = r128_driver_irq_preinstall;
|
dev->driver.irq_preinstall = r128_driver_irq_preinstall;
|
||||||
dev->driver.irq_postinstall = r128_driver_irq_postinstall;
|
dev->driver.irq_postinstall = r128_driver_irq_postinstall;
|
||||||
dev->driver.irq_uninstall = r128_driver_irq_uninstall;
|
dev->driver.irq_uninstall = r128_driver_irq_uninstall;
|
||||||
|
@ -83,9 +85,9 @@ r128_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
r128_attach(device_t nbdev)
|
r128_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
r128_configure(dev);
|
r128_configure(dev);
|
||||||
return drm_attach(nbdev, r128_pciidlist);
|
return drm_attach(nbdev, r128_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +104,7 @@ static device_method_t r128_methods[] = {
|
||||||
static driver_t r128_driver = {
|
static driver_t r128_driver = {
|
||||||
"drm",
|
"drm",
|
||||||
r128_methods,
|
r128_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
@ -117,7 +119,7 @@ MODULE_DEPEND(r128, drm, 1, 1, 1);
|
||||||
#ifdef _LKM
|
#ifdef _LKM
|
||||||
CFDRIVER_DECL(r128, DV_TTY, NULL);
|
CFDRIVER_DECL(r128, DV_TTY, NULL);
|
||||||
#else
|
#else
|
||||||
CFATTACH_DECL(r128, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
CFATTACH_DECL(r128, sizeof(struct drm_device), drm_probe, drm_attach,
|
||||||
drm_activate);
|
drm_detach, drm_activate);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,7 +42,7 @@ static drm_pci_id_list_t radeon_pciidlist[] = {
|
||||||
radeon_PCI_IDS
|
radeon_PCI_IDS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void radeon_configure(drm_device_t *dev)
|
static void radeon_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = sizeof(drm_radeon_buf_priv_t);
|
dev->driver.buf_priv_size = sizeof(drm_radeon_buf_priv_t);
|
||||||
dev->driver.load = radeon_driver_load;
|
dev->driver.load = radeon_driver_load;
|
||||||
|
@ -52,8 +52,9 @@ static void radeon_configure(drm_device_t *dev)
|
||||||
dev->driver.preclose = radeon_driver_preclose;
|
dev->driver.preclose = radeon_driver_preclose;
|
||||||
dev->driver.postclose = radeon_driver_postclose;
|
dev->driver.postclose = radeon_driver_postclose;
|
||||||
dev->driver.lastclose = radeon_driver_lastclose;
|
dev->driver.lastclose = radeon_driver_lastclose;
|
||||||
dev->driver.vblank_wait = radeon_driver_vblank_wait;
|
dev->driver.get_vblank_counter = radeon_get_vblank_counter;
|
||||||
dev->driver.vblank_wait2 = radeon_driver_vblank_wait2;
|
dev->driver.enable_vblank = radeon_enable_vblank;
|
||||||
|
dev->driver.disable_vblank = radeon_disable_vblank;
|
||||||
dev->driver.irq_preinstall = radeon_driver_irq_preinstall;
|
dev->driver.irq_preinstall = radeon_driver_irq_preinstall;
|
||||||
dev->driver.irq_postinstall = radeon_driver_irq_postinstall;
|
dev->driver.irq_postinstall = radeon_driver_irq_postinstall;
|
||||||
dev->driver.irq_uninstall = radeon_driver_irq_uninstall;
|
dev->driver.irq_uninstall = radeon_driver_irq_uninstall;
|
||||||
|
@ -90,9 +91,9 @@ radeon_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
radeon_attach(device_t nbdev)
|
radeon_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
radeon_configure(dev);
|
radeon_configure(dev);
|
||||||
return drm_attach(nbdev, radeon_pciidlist);
|
return drm_attach(nbdev, radeon_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -109,7 +110,7 @@ static device_method_t radeon_methods[] = {
|
||||||
static driver_t radeon_driver = {
|
static driver_t radeon_driver = {
|
||||||
"drm",
|
"drm",
|
||||||
radeon_methods,
|
radeon_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
@ -124,7 +125,7 @@ MODULE_DEPEND(radeon, drm, 1, 1, 1);
|
||||||
#ifdef _LKM
|
#ifdef _LKM
|
||||||
CFDRIVER_DECL(radeon, DV_TTY, NULL);
|
CFDRIVER_DECL(radeon, DV_TTY, NULL);
|
||||||
#else
|
#else
|
||||||
CFATTACH_DECL(radeon, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
CFATTACH_DECL(radeon, sizeof(struct drm_device), drm_probe, drm_attach,
|
||||||
drm_activate);
|
drm_detach, drm_activate);
|
||||||
#endif
|
#endif
|
||||||
#endif /* __FreeBSD__ */
|
#endif /* __FreeBSD__ */
|
||||||
|
|
|
@ -37,7 +37,7 @@ static drm_pci_id_list_t savage_pciidlist[] = {
|
||||||
savage_PCI_IDS
|
savage_PCI_IDS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void savage_configure(drm_device_t *dev)
|
static void savage_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = sizeof(drm_savage_buf_priv_t);
|
dev->driver.buf_priv_size = sizeof(drm_savage_buf_priv_t);
|
||||||
dev->driver.load = savage_driver_load;
|
dev->driver.load = savage_driver_load;
|
||||||
|
@ -73,9 +73,9 @@ savage_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
savage_attach(device_t nbdev)
|
savage_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
savage_configure(dev);
|
savage_configure(dev);
|
||||||
return drm_attach(nbdev, savage_pciidlist);
|
return drm_attach(nbdev, savage_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ static device_method_t savage_methods[] = {
|
||||||
static driver_t savage_driver = {
|
static driver_t savage_driver = {
|
||||||
"drm",
|
"drm",
|
||||||
savage_methods,
|
savage_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
|
|
@ -36,7 +36,7 @@ static drm_pci_id_list_t sis_pciidlist[] = {
|
||||||
sis_PCI_IDS
|
sis_PCI_IDS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void sis_configure(drm_device_t *dev)
|
static void sis_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = 1; /* No dev_priv */
|
dev->driver.buf_priv_size = 1; /* No dev_priv */
|
||||||
dev->driver.context_ctor = sis_init_context;
|
dev->driver.context_ctor = sis_init_context;
|
||||||
|
@ -66,9 +66,9 @@ sis_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
sis_attach(device_t nbdev)
|
sis_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
sis_configure(dev);
|
sis_configure(dev);
|
||||||
return drm_attach(nbdev, sis_pciidlist);
|
return drm_attach(nbdev, sis_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ static device_method_t sis_methods[] = {
|
||||||
static driver_t sis_driver = {
|
static driver_t sis_driver = {
|
||||||
"drm",
|
"drm",
|
||||||
sis_methods,
|
sis_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
@ -100,7 +100,7 @@ MODULE_DEPEND(sisdrm, drm, 1, 1, 1);
|
||||||
#ifdef _LKM
|
#ifdef _LKM
|
||||||
CFDRIVER_DECL(sis, DV_TTY, NULL);
|
CFDRIVER_DECL(sis, DV_TTY, NULL);
|
||||||
#else
|
#else
|
||||||
CFATTACH_DECL(sis, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
CFATTACH_DECL(sis, sizeof(struct drm_device), drm_probe, drm_attach, drm_detach,
|
||||||
drm_activate);
|
drm_activate);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,7 +41,7 @@ static drm_pci_id_list_t tdfx_pciidlist[] = {
|
||||||
tdfx_PCI_IDS
|
tdfx_PCI_IDS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void tdfx_configure(drm_device_t *dev)
|
static void tdfx_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = 1; /* No dev_priv */
|
dev->driver.buf_priv_size = 1; /* No dev_priv */
|
||||||
|
|
||||||
|
@ -67,9 +67,9 @@ tdfx_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
tdfx_attach(device_t nbdev)
|
tdfx_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
tdfx_configure(dev);
|
tdfx_configure(dev);
|
||||||
return drm_attach(nbdev, tdfx_pciidlist);
|
return drm_attach(nbdev, tdfx_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ static device_method_t tdfx_methods[] = {
|
||||||
static driver_t tdfx_driver = {
|
static driver_t tdfx_driver = {
|
||||||
"drm",
|
"drm",
|
||||||
tdfx_methods,
|
tdfx_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
@ -101,7 +101,7 @@ MODULE_DEPEND(tdfx, drm, 1, 1, 1);
|
||||||
#ifdef _LKM
|
#ifdef _LKM
|
||||||
CFDRIVER_DECL(tdfx, DV_TTY, NULL);
|
CFDRIVER_DECL(tdfx, DV_TTY, NULL);
|
||||||
#else
|
#else
|
||||||
CFATTACH_DECL(tdfx, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
CFATTACH_DECL(tdfx, sizeof(struct drm_device), drm_probe, drm_attach,
|
||||||
drm_activate);
|
drm_detach, drm_activate);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,7 +39,7 @@ static drm_pci_id_list_t via_pciidlist[] = {
|
||||||
viadrv_PCI_IDS
|
viadrv_PCI_IDS
|
||||||
};
|
};
|
||||||
|
|
||||||
static void via_configure(drm_device_t *dev)
|
static void via_configure(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
dev->driver.buf_priv_size = 1;
|
dev->driver.buf_priv_size = 1;
|
||||||
dev->driver.load = via_driver_load;
|
dev->driver.load = via_driver_load;
|
||||||
|
@ -79,9 +79,9 @@ via_probe(device_t dev)
|
||||||
static int
|
static int
|
||||||
via_attach(device_t nbdev)
|
via_attach(device_t nbdev)
|
||||||
{
|
{
|
||||||
drm_device_t *dev = device_get_softc(nbdev);
|
struct drm_device *dev = device_get_softc(nbdev);
|
||||||
|
|
||||||
bzero(dev, sizeof(drm_device_t));
|
bzero(dev, sizeof(struct drm_device));
|
||||||
via_configure(dev);
|
via_configure(dev);
|
||||||
return drm_attach(nbdev, via_pciidlist);
|
return drm_attach(nbdev, via_pciidlist);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ static device_method_t via_methods[] = {
|
||||||
static driver_t via_driver = {
|
static driver_t via_driver = {
|
||||||
"drm",
|
"drm",
|
||||||
via_methods,
|
via_methods,
|
||||||
sizeof(drm_device_t)
|
sizeof(struct drm_device)
|
||||||
};
|
};
|
||||||
|
|
||||||
extern devclass_t drm_devclass;
|
extern devclass_t drm_devclass;
|
||||||
|
@ -109,7 +109,7 @@ MODULE_DEPEND(via, drm, 1, 1, 1);
|
||||||
#ifdef _LKM
|
#ifdef _LKM
|
||||||
CFDRIVER_DECL(via, DV_TTY, NULL);
|
CFDRIVER_DECL(via, DV_TTY, NULL);
|
||||||
#else
|
#else
|
||||||
CFATTACH_DECL(via, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach,
|
CFATTACH_DECL(via, sizeof(struct drm_device), drm_probe, drm_attach, drm_detach,
|
||||||
drm_activate);
|
drm_activate);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -34,6 +34,11 @@
|
||||||
#include "drmP.h"
|
#include "drmP.h"
|
||||||
|
|
||||||
# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */
|
# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */
|
||||||
|
# define ATI_PCIGART_PAGE_MASK (~(ATI_PCIGART_PAGE_SIZE-1))
|
||||||
|
|
||||||
|
#define ATI_PCIE_WRITE 0x4
|
||||||
|
#define ATI_PCIE_READ 0x8
|
||||||
|
|
||||||
static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
|
static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
|
||||||
struct drm_ati_pcigart_info *gart_info)
|
struct drm_ati_pcigart_info *gart_info)
|
||||||
{
|
{
|
||||||
|
@ -103,6 +108,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
|
||||||
dma_addr_t bus_address = 0;
|
dma_addr_t bus_address = 0;
|
||||||
int i, j, ret = 0;
|
int i, j, ret = 0;
|
||||||
int max_pages;
|
int max_pages;
|
||||||
|
dma_addr_t entry_addr;
|
||||||
|
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
DRM_ERROR("no scatter/gather memory!\n");
|
DRM_ERROR("no scatter/gather memory!\n");
|
||||||
|
@ -148,23 +154,27 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
|
||||||
bus_address = 0;
|
bus_address = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
page_base = (u32) entry->busaddr[i];
|
|
||||||
|
|
||||||
|
entry_addr = entry->busaddr[i];
|
||||||
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
|
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
|
||||||
|
page_base = (u32) entry_addr & ATI_PCIGART_PAGE_MASK;
|
||||||
switch(gart_info->gart_reg_if) {
|
switch(gart_info->gart_reg_if) {
|
||||||
case DRM_ATI_GART_IGP:
|
case DRM_ATI_GART_IGP:
|
||||||
*pci_gart = cpu_to_le32((page_base) | 0xc);
|
page_base |= (upper_32_bits(entry_addr) & 0xff) << 4;
|
||||||
|
page_base |= 0xc;
|
||||||
break;
|
break;
|
||||||
case DRM_ATI_GART_PCIE:
|
case DRM_ATI_GART_PCIE:
|
||||||
*pci_gart = cpu_to_le32((page_base >> 8) | 0xc);
|
page_base >>= 8;
|
||||||
|
page_base |= (upper_32_bits(entry_addr) & 0xff) << 24;
|
||||||
|
page_base |= ATI_PCIE_READ | ATI_PCIE_WRITE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case DRM_ATI_GART_PCI:
|
case DRM_ATI_GART_PCI:
|
||||||
*pci_gart = cpu_to_le32(page_base);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*pci_gart = cpu_to_le32(page_base);
|
||||||
pci_gart++;
|
pci_gart++;
|
||||||
page_base += ATI_PCIGART_PAGE_SIZE;
|
entry_addr += ATI_PCIGART_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
../shared-core/radeon_microcode.h
|
|
@ -103,20 +103,18 @@
|
||||||
0x1002 0x5653 CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP "ATI Radeon Mobility X700 M26"
|
0x1002 0x5653 CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP "ATI Radeon Mobility X700 M26"
|
||||||
0x1002 0x5834 CHIP_RS300|RADEON_IS_IGP "ATI Radeon RS300 9100 IGP"
|
0x1002 0x5834 CHIP_RS300|RADEON_IS_IGP "ATI Radeon RS300 9100 IGP"
|
||||||
0x1002 0x5835 CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY "ATI Radeon RS300 Mobility IGP"
|
0x1002 0x5835 CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY "ATI Radeon RS300 Mobility IGP"
|
||||||
0x1002 0x5954 CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI RS480 XPRESS 200G"
|
0x1002 0x5954 CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI RS480 XPRESS 200G"
|
||||||
0x1002 0x5955 CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon XPRESS 200M 5955"
|
0x1002 0x5955 CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon XPRESS 200M 5955"
|
||||||
0x1002 0x5974 CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RS482 XPRESS 200"
|
0x1002 0x5974 CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RS482 XPRESS 200"
|
||||||
0x1002 0x5975 CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RS485 XPRESS 1100 IGP"
|
0x1002 0x5975 CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RS485 XPRESS 1100 IGP"
|
||||||
0x1002 0x5960 CHIP_RV280 "ATI Radeon RV280 9250"
|
0x1002 0x5960 CHIP_RV280 "ATI Radeon RV280 9250"
|
||||||
0x1002 0x5961 CHIP_RV280 "ATI Radeon RV280 9200"
|
0x1002 0x5961 CHIP_RV280 "ATI Radeon RV280 9200"
|
||||||
0x1002 0x5962 CHIP_RV280 "ATI Radeon RV280 9200"
|
0x1002 0x5962 CHIP_RV280 "ATI Radeon RV280 9200"
|
||||||
0x1002 0x5964 CHIP_RV280 "ATI Radeon RV280 9200 SE"
|
0x1002 0x5964 CHIP_RV280 "ATI Radeon RV280 9200 SE"
|
||||||
0x1002 0x5965 CHIP_RV280 "ATI FireMV 2200 PCI"
|
0x1002 0x5965 CHIP_RV280 "ATI FireMV 2200 PCI"
|
||||||
0x1002 0x5969 CHIP_RV100 "ATI ES1000 RN50"
|
0x1002 0x5969 CHIP_RV100 "ATI ES1000 RN50"
|
||||||
0x1002 0x5a41 CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RS400 XPRESS 200"
|
0x1002 0x5a61 CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RC410 XPRESS 200"
|
||||||
0x1002 0x5a42 CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RS400 XPRESS 200M"
|
0x1002 0x5a62 CHIP_RS480|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RC410 XPRESS 200M"
|
||||||
0x1002 0x5a61 CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RC410 XPRESS 200"
|
|
||||||
0x1002 0x5a62 CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART "ATI Radeon RC410 XPRESS 200M"
|
|
||||||
0x1002 0x5b60 CHIP_RV380|RADEON_NEW_MEMMAP "ATI Radeon RV370 X300 SE"
|
0x1002 0x5b60 CHIP_RV380|RADEON_NEW_MEMMAP "ATI Radeon RV370 X300 SE"
|
||||||
0x1002 0x5b62 CHIP_RV380|RADEON_NEW_MEMMAP "ATI Radeon RV370 X600 Pro"
|
0x1002 0x5b62 CHIP_RV380|RADEON_NEW_MEMMAP "ATI Radeon RV370 X600 Pro"
|
||||||
0x1002 0x5b63 CHIP_RV380|RADEON_NEW_MEMMAP "ATI Radeon RV370 X550"
|
0x1002 0x5b63 CHIP_RV380|RADEON_NEW_MEMMAP "ATI Radeon RV370 X550"
|
||||||
|
|
|
@ -117,7 +117,7 @@ int i915_dma_cleanup(struct drm_device * dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(I915_HAVE_BUFFER)
|
||||||
#define DRI2_SAREA_BLOCK_TYPE(b) ((b) >> 16)
|
#define DRI2_SAREA_BLOCK_TYPE(b) ((b) >> 16)
|
||||||
#define DRI2_SAREA_BLOCK_SIZE(b) ((b) & 0xffff)
|
#define DRI2_SAREA_BLOCK_SIZE(b) ((b) & 0xffff)
|
||||||
#define DRI2_SAREA_BLOCK_NEXT(p) \
|
#define DRI2_SAREA_BLOCK_NEXT(p) \
|
||||||
|
@ -176,7 +176,7 @@ setup_dri2_sarea(struct drm_device * dev,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int i915_initialize(struct drm_device * dev,
|
static int i915_initialize(struct drm_device * dev,
|
||||||
struct drm_file *file_priv,
|
struct drm_file *file_priv,
|
||||||
|
@ -268,7 +268,7 @@ static int i915_initialize(struct drm_device * dev,
|
||||||
mutex_init(&dev_priv->cmdbuf_mutex);
|
mutex_init(&dev_priv->cmdbuf_mutex);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(I915_HAVE_BUFFER)
|
||||||
if (init->func == I915_INIT_DMA2) {
|
if (init->func == I915_INIT_DMA2) {
|
||||||
int ret = setup_dri2_sarea(dev, file_priv, init);
|
int ret = setup_dri2_sarea(dev, file_priv, init);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -277,6 +277,7 @@ static int i915_initialize(struct drm_device * dev,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -794,7 +795,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DRM_DEBUG_CODE
|
#if defined(DRM_DEBUG_CODE)
|
||||||
#define DRM_DEBUG_RELOCATION (drm_debug != 0)
|
#define DRM_DEBUG_RELOCATION (drm_debug != 0)
|
||||||
#else
|
#else
|
||||||
#define DRM_DEBUG_RELOCATION 0
|
#define DRM_DEBUG_RELOCATION 0
|
||||||
|
|
|
@ -176,6 +176,7 @@ struct drm_i915_private {
|
||||||
struct drm_display_mode *panel_fixed_mode;
|
struct drm_display_mode *panel_fixed_mode;
|
||||||
struct drm_display_mode *vbt_mode; /* if any */
|
struct drm_display_mode *vbt_mode; /* if any */
|
||||||
|
|
||||||
|
#if defined(I915_HAVE_BUFFER)
|
||||||
/* DRI2 sarea */
|
/* DRI2 sarea */
|
||||||
struct drm_buffer_object *sarea_bo;
|
struct drm_buffer_object *sarea_bo;
|
||||||
struct drm_bo_kmap_obj sarea_kmap;
|
struct drm_bo_kmap_obj sarea_kmap;
|
||||||
|
@ -185,6 +186,7 @@ struct drm_i915_private {
|
||||||
int lvds_dither:1;
|
int lvds_dither:1;
|
||||||
int lvds_vbt:1;
|
int lvds_vbt:1;
|
||||||
int int_crt_support:1;
|
int int_crt_support:1;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Register state */
|
/* Register state */
|
||||||
u8 saveLBB;
|
u8 saveLBB;
|
||||||
|
@ -588,7 +590,6 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
|
||||||
#define HEAD_WRAP_COUNT 0xFFE00000
|
#define HEAD_WRAP_COUNT 0xFFE00000
|
||||||
#define HEAD_WRAP_ONE 0x00200000
|
#define HEAD_WRAP_ONE 0x00200000
|
||||||
#define HEAD_ADDR 0x001FFFFC
|
#define HEAD_ADDR 0x001FFFFC
|
||||||
#define START_ADDR 0x0xFFFFF000
|
|
||||||
#define RING_NR_PAGES 0x001FF000
|
#define RING_NR_PAGES 0x001FF000
|
||||||
#define RING_REPORT_MASK 0x00000006
|
#define RING_REPORT_MASK 0x00000006
|
||||||
#define RING_REPORT_64K 0x00000002
|
#define RING_REPORT_64K 0x00000002
|
||||||
|
@ -734,8 +735,85 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
|
||||||
#define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
|
#define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
|
||||||
#define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
|
#define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
|
||||||
/*
|
/*
|
||||||
* The i830 generation, in DAC/serial mode, defines p1 as two plus this
|
* Pixel within the current frame is counted in the PIPEAFRAMEPIXEL register
|
||||||
* bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
|
* and is 24 bits wide.
|
||||||
|
*/
|
||||||
|
#define PIPE_PIXEL_MASK 0x00ffffff
|
||||||
|
#define PIPE_PIXEL_SHIFT 0
|
||||||
|
|
||||||
|
#define I915_FIFO_UNDERRUN_STATUS (1UL<<31)
|
||||||
|
#define I915_CRC_ERROR_ENABLE (1UL<<29)
|
||||||
|
#define I915_CRC_DONE_ENABLE (1UL<<28)
|
||||||
|
#define I915_GMBUS_EVENT_ENABLE (1UL<<27)
|
||||||
|
#define I915_VSYNC_INTERRUPT_ENABLE (1UL<<25)
|
||||||
|
#define I915_DISPLAY_LINE_COMPARE_ENABLE (1UL<<24)
|
||||||
|
#define I915_DPST_EVENT_ENABLE (1UL<<23)
|
||||||
|
#define I915_LEGACY_BLC_EVENT_ENABLE (1UL<<22)
|
||||||
|
#define I915_ODD_FIELD_INTERRUPT_ENABLE (1UL<<21)
|
||||||
|
#define I915_EVEN_FIELD_INTERRUPT_ENABLE (1UL<<20)
|
||||||
|
#define I915_START_VBLANK_INTERRUPT_ENABLE (1UL<<18) /* 965 or later */
|
||||||
|
#define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
|
||||||
|
#define I915_OVERLAY_UPDATED_ENABLE (1UL<<16)
|
||||||
|
#define I915_CRC_ERROR_INTERRUPT_STATUS (1UL<<13)
|
||||||
|
#define I915_CRC_DONE_INTERRUPT_STATUS (1UL<<12)
|
||||||
|
#define I915_GMBUS_INTERRUPT_STATUS (1UL<<11)
|
||||||
|
#define I915_VSYNC_INTERRUPT_STATUS (1UL<<9)
|
||||||
|
#define I915_DISPLAY_LINE_COMPARE_STATUS (1UL<<8)
|
||||||
|
#define I915_DPST_EVENT_STATUS (1UL<<7)
|
||||||
|
#define I915_LEGACY_BLC_EVENT_STATUS (1UL<<6)
|
||||||
|
#define I915_ODD_FIELD_INTERRUPT_STATUS (1UL<<5)
|
||||||
|
#define I915_EVEN_FIELD_INTERRUPT_STATUS (1UL<<4)
|
||||||
|
#define I915_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
|
||||||
|
#define I915_VBLANK_INTERRUPT_STATUS (1UL<<1)
|
||||||
|
#define I915_OVERLAY_UPDATED_STATUS (1UL<<0)
|
||||||
|
|
||||||
|
#define SRX_INDEX 0x3c4
|
||||||
|
#define SRX_DATA 0x3c5
|
||||||
|
#define SR01 1
|
||||||
|
#define SR01_SCREEN_OFF (1<<5)
|
||||||
|
|
||||||
|
#define PPCR 0x61204
|
||||||
|
#define PPCR_ON (1<<0)
|
||||||
|
|
||||||
|
#define DVOB 0x61140
|
||||||
|
#define DVOB_ON (1<<31)
|
||||||
|
#define DVOC 0x61160
|
||||||
|
#define DVOC_ON (1<<31)
|
||||||
|
#define LVDS 0x61180
|
||||||
|
#define LVDS_ON (1<<31)
|
||||||
|
|
||||||
|
#define ADPA 0x61100
|
||||||
|
#define ADPA_DPMS_MASK (~(3<<10))
|
||||||
|
#define ADPA_DPMS_ON (0<<10)
|
||||||
|
#define ADPA_DPMS_SUSPEND (1<<10)
|
||||||
|
#define ADPA_DPMS_STANDBY (2<<10)
|
||||||
|
#define ADPA_DPMS_OFF (3<<10)
|
||||||
|
|
||||||
|
#define LP_RING 0x2030
|
||||||
|
#define HP_RING 0x2040
|
||||||
|
/* The binner has its own ring buffer:
|
||||||
|
*/
|
||||||
|
#define HWB_RING 0x2400
|
||||||
|
|
||||||
|
#define RING_TAIL 0x00
|
||||||
|
#define TAIL_ADDR 0x001FFFF8
|
||||||
|
#define RING_HEAD 0x04
|
||||||
|
#define HEAD_WRAP_COUNT 0xFFE00000
|
||||||
|
#define HEAD_WRAP_ONE 0x00200000
|
||||||
|
#define HEAD_ADDR 0x001FFFFC
|
||||||
|
#define RING_START 0x08
|
||||||
|
#define START_ADDR 0xFFFFF000
|
||||||
|
#define RING_LEN 0x0C
|
||||||
|
#define RING_NR_PAGES 0x001FF000
|
||||||
|
#define RING_REPORT_MASK 0x00000006
|
||||||
|
#define RING_REPORT_64K 0x00000002
|
||||||
|
#define RING_REPORT_128K 0x00000004
|
||||||
|
#define RING_NO_REPORT 0x00000000
|
||||||
|
#define RING_VALID_MASK 0x00000001
|
||||||
|
#define RING_VALID 0x00000001
|
||||||
|
#define RING_INVALID 0x00000000
|
||||||
|
|
||||||
|
/* Scratch pad debug 0 reg:
|
||||||
*/
|
*/
|
||||||
#define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
|
#define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -401,8 +401,7 @@ u32 i915_get_vblank_counter(struct drm_device *dev, int plane)
|
||||||
low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL;
|
low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL;
|
||||||
|
|
||||||
if (!i915_pipe_enabled(dev, pipe)) {
|
if (!i915_pipe_enabled(dev, pipe)) {
|
||||||
printk(KERN_ERR "trying to get vblank count for disabled "
|
DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe);
|
||||||
"pipe %d\n", pipe);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -615,7 +615,7 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data, struct drm_file *
|
||||||
break;
|
break;
|
||||||
case NOUVEAU_GETPARAM_PCI_PHYSICAL:
|
case NOUVEAU_GETPARAM_PCI_PHYSICAL:
|
||||||
if ( dev -> sg )
|
if ( dev -> sg )
|
||||||
getparam->value=(uint64_t) dev->sg->virtual;
|
getparam->value=(unsigned long)dev->sg->virtual;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DRM_ERROR("Requested PCIGART address, while no PCIGART was created\n");
|
DRM_ERROR("Requested PCIGART address, while no PCIGART was created\n");
|
||||||
|
|
|
@ -235,9 +235,14 @@ void r300_init_reg_flags(struct drm_device *dev)
|
||||||
ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8);
|
ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8);
|
||||||
|
|
||||||
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) {
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) {
|
||||||
|
ADD_RANGE(R500_VAP_INDEX_OFFSET, 1);
|
||||||
ADD_RANGE(R500_US_CONFIG, 2);
|
ADD_RANGE(R500_US_CONFIG, 2);
|
||||||
|
ADD_RANGE(R500_US_CODE_ADDR, 3);
|
||||||
|
ADD_RANGE(R500_US_FC_CTRL, 1);
|
||||||
ADD_RANGE(R500_RS_IP_0, 16);
|
ADD_RANGE(R500_RS_IP_0, 16);
|
||||||
ADD_RANGE(R500_RS_INST_0, 16);
|
ADD_RANGE(R500_RS_INST_0, 16);
|
||||||
|
ADD_RANGE(R500_RB3D_COLOR_CLEAR_VALUE_AR, 2);
|
||||||
|
ADD_RANGE(R500_RB3D_CONSTANT_COLOR_AR, 2);
|
||||||
} else {
|
} else {
|
||||||
ADD_RANGE(R300_PFS_CNTL_0, 3);
|
ADD_RANGE(R300_PFS_CNTL_0, 3);
|
||||||
ADD_RANGE(R300_PFS_NODE_0, 4);
|
ADD_RANGE(R300_PFS_NODE_0, 4);
|
||||||
|
|
|
@ -1349,7 +1349,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
/* Guess by Vladimir.
|
/* Guess by Vladimir.
|
||||||
* Set to 0A before 3D operations, set to 02 afterwards.
|
* Set to 0A before 3D operations, set to 02 afterwards.
|
||||||
*/
|
*/
|
||||||
#define R300_RB3D_DSTCACHE_CTLSTAT 0x4E4C
|
/*#define R300_RB3D_DSTCACHE_CTLSTAT 0x4E4C*/
|
||||||
# define R300_RB3D_DSTCACHE_UNKNOWN_02 0x00000002
|
# define R300_RB3D_DSTCACHE_UNKNOWN_02 0x00000002
|
||||||
# define R300_RB3D_DSTCACHE_UNKNOWN_0A 0x0000000A
|
# define R300_RB3D_DSTCACHE_UNKNOWN_0A 0x0000000A
|
||||||
|
|
||||||
|
@ -1626,6 +1626,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#define R300_CP_CMD_BITBLT_MULTI 0xC0009B00
|
#define R300_CP_CMD_BITBLT_MULTI 0xC0009B00
|
||||||
|
|
||||||
|
#define R500_VAP_INDEX_OFFSET 0x208c
|
||||||
|
|
||||||
#define R500_GA_US_VECTOR_INDEX 0x4250
|
#define R500_GA_US_VECTOR_INDEX 0x4250
|
||||||
#define R500_GA_US_VECTOR_DATA 0x4254
|
#define R500_GA_US_VECTOR_DATA 0x4254
|
||||||
|
|
||||||
|
@ -1634,6 +1636,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#define R500_US_CONFIG 0x4600
|
#define R500_US_CONFIG 0x4600
|
||||||
|
|
||||||
|
#define R500_US_FC_CTRL 0x4624
|
||||||
|
#define R500_US_CODE_ADDR 0x4630
|
||||||
|
|
||||||
|
#define R500_RB3D_COLOR_CLEAR_VALUE_AR 0x46c0
|
||||||
|
#define R500_RB3D_CONSTANT_COLOR_AR 0x4ef8
|
||||||
|
|
||||||
#endif /* _R300_REG_H */
|
#endif /* _R300_REG_H */
|
||||||
|
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
16383
shared-core/radeon_cp.c
16383
shared-core/radeon_cp.c
File diff suppressed because it is too large
Load Diff
|
@ -685,6 +685,7 @@ typedef struct drm_radeon_indirect {
|
||||||
#define RADEON_PARAM_CARD_TYPE 12
|
#define RADEON_PARAM_CARD_TYPE 12
|
||||||
#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
|
#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
|
||||||
#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
|
#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
|
||||||
|
#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
|
||||||
|
|
||||||
typedef struct drm_radeon_getparam {
|
typedef struct drm_radeon_getparam {
|
||||||
int param;
|
int param;
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#define DRIVER_NAME "radeon"
|
#define DRIVER_NAME "radeon"
|
||||||
#define DRIVER_DESC "ATI Radeon"
|
#define DRIVER_DESC "ATI Radeon"
|
||||||
#define DRIVER_DATE "20060524"
|
#define DRIVER_DATE "20080528"
|
||||||
|
|
||||||
/* Interface history:
|
/* Interface history:
|
||||||
*
|
*
|
||||||
|
@ -98,10 +98,11 @@
|
||||||
* 1.26- Add support for variable size PCI(E) gart aperture
|
* 1.26- Add support for variable size PCI(E) gart aperture
|
||||||
* 1.27- Add support for IGP GART
|
* 1.27- Add support for IGP GART
|
||||||
* 1.28- Add support for VBL on CRTC2
|
* 1.28- Add support for VBL on CRTC2
|
||||||
|
* 1.29- R500 3D cmd buffer support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DRIVER_MAJOR 1
|
#define DRIVER_MAJOR 1
|
||||||
#define DRIVER_MINOR 28
|
#define DRIVER_MINOR 29
|
||||||
#define DRIVER_PATCHLEVEL 0
|
#define DRIVER_PATCHLEVEL 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -123,7 +124,7 @@ enum radeon_family {
|
||||||
CHIP_RV380,
|
CHIP_RV380,
|
||||||
CHIP_R420,
|
CHIP_R420,
|
||||||
CHIP_RV410,
|
CHIP_RV410,
|
||||||
CHIP_RS400,
|
CHIP_RS480,
|
||||||
CHIP_RS690,
|
CHIP_RS690,
|
||||||
CHIP_RV515,
|
CHIP_RV515,
|
||||||
CHIP_R520,
|
CHIP_R520,
|
||||||
|
@ -296,6 +297,7 @@ typedef struct drm_radeon_private {
|
||||||
int vblank_crtc;
|
int vblank_crtc;
|
||||||
uint32_t irq_enable_reg;
|
uint32_t irq_enable_reg;
|
||||||
int irq_enabled;
|
int irq_enabled;
|
||||||
|
uint32_t r500_disp_irq_reg;
|
||||||
|
|
||||||
struct radeon_surface surfaces[RADEON_MAX_SURFACES];
|
struct radeon_surface surfaces[RADEON_MAX_SURFACES];
|
||||||
struct radeon_virt_surface virt_surfaces[2 * RADEON_MAX_SURFACES];
|
struct radeon_virt_surface virt_surfaces[2 * RADEON_MAX_SURFACES];
|
||||||
|
@ -313,6 +315,7 @@ typedef struct drm_radeon_private {
|
||||||
uint32_t flags; /* see radeon_chip_flags */
|
uint32_t flags; /* see radeon_chip_flags */
|
||||||
unsigned long fb_aper_offset;
|
unsigned long fb_aper_offset;
|
||||||
|
|
||||||
|
int num_gb_pipes;
|
||||||
} drm_radeon_private_t;
|
} drm_radeon_private_t;
|
||||||
|
|
||||||
typedef struct drm_radeon_buf_priv {
|
typedef struct drm_radeon_buf_priv {
|
||||||
|
@ -379,7 +382,6 @@ extern void radeon_do_release(struct drm_device * dev);
|
||||||
extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc);
|
extern u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc);
|
||||||
extern int radeon_enable_vblank(struct drm_device *dev, int crtc);
|
extern int radeon_enable_vblank(struct drm_device *dev, int crtc);
|
||||||
extern void radeon_disable_vblank(struct drm_device *dev, int crtc);
|
extern void radeon_disable_vblank(struct drm_device *dev, int crtc);
|
||||||
extern void radeon_do_release(struct drm_device * dev);
|
|
||||||
extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS);
|
extern irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS);
|
||||||
extern void radeon_driver_irq_preinstall(struct drm_device * dev);
|
extern void radeon_driver_irq_preinstall(struct drm_device * dev);
|
||||||
extern int radeon_driver_irq_postinstall(struct drm_device * dev);
|
extern int radeon_driver_irq_postinstall(struct drm_device * dev);
|
||||||
|
@ -448,13 +450,13 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev,
|
||||||
#define RADEON_PCIE_DATA 0x0034
|
#define RADEON_PCIE_DATA 0x0034
|
||||||
#define RADEON_PCIE_TX_GART_CNTL 0x10
|
#define RADEON_PCIE_TX_GART_CNTL 0x10
|
||||||
# define RADEON_PCIE_TX_GART_EN (1 << 0)
|
# define RADEON_PCIE_TX_GART_EN (1 << 0)
|
||||||
# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_PASS_THRU (0<<1)
|
# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_PASS_THRU (0 << 1)
|
||||||
# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_CLAMP_LO (1<<1)
|
# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_CLAMP_LO (1 << 1)
|
||||||
# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD (3<<1)
|
# define RADEON_PCIE_TX_GART_UNMAPPED_ACCESS_DISCARD (3 << 1)
|
||||||
# define RADEON_PCIE_TX_GART_MODE_32_128_CACHE (0<<3)
|
# define RADEON_PCIE_TX_GART_MODE_32_128_CACHE (0 << 3)
|
||||||
# define RADEON_PCIE_TX_GART_MODE_8_4_128_CACHE (1<<3)
|
# define RADEON_PCIE_TX_GART_MODE_8_4_128_CACHE (1 << 3)
|
||||||
# define RADEON_PCIE_TX_GART_CHK_RW_VALID_EN (1<<5)
|
# define RADEON_PCIE_TX_GART_CHK_RW_VALID_EN (1 << 5)
|
||||||
# define RADEON_PCIE_TX_GART_INVALIDATE_TLB (1<<8)
|
# define RADEON_PCIE_TX_GART_INVALIDATE_TLB (1 << 8)
|
||||||
#define RADEON_PCIE_TX_DISCARD_RD_ADDR_LO 0x11
|
#define RADEON_PCIE_TX_DISCARD_RD_ADDR_LO 0x11
|
||||||
#define RADEON_PCIE_TX_DISCARD_RD_ADDR_HI 0x12
|
#define RADEON_PCIE_TX_DISCARD_RD_ADDR_HI 0x12
|
||||||
#define RADEON_PCIE_TX_GART_BASE 0x13
|
#define RADEON_PCIE_TX_GART_BASE 0x13
|
||||||
|
@ -463,14 +465,9 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev,
|
||||||
#define RADEON_PCIE_TX_GART_END_LO 0x16
|
#define RADEON_PCIE_TX_GART_END_LO 0x16
|
||||||
#define RADEON_PCIE_TX_GART_END_HI 0x17
|
#define RADEON_PCIE_TX_GART_END_HI 0x17
|
||||||
|
|
||||||
#define RADEON_IGPGART_INDEX 0x168
|
#define RS480_NB_MC_INDEX 0x168
|
||||||
#define RADEON_IGPGART_DATA 0x16c
|
# define RS480_NB_MC_IND_WR_EN (1 << 8)
|
||||||
#define RADEON_IGPGART_UNK_18 0x18
|
#define RS480_NB_MC_DATA 0x16c
|
||||||
#define RADEON_IGPGART_CTRL 0x2b
|
|
||||||
#define RADEON_IGPGART_BASE_ADDR 0x2c
|
|
||||||
#define RADEON_IGPGART_FLUSH 0x2e
|
|
||||||
#define RADEON_IGPGART_ENABLE 0x38
|
|
||||||
#define RADEON_IGPGART_UNK_39 0x39
|
|
||||||
|
|
||||||
#define RS690_MC_INDEX 0x78
|
#define RS690_MC_INDEX 0x78
|
||||||
# define RS690_MC_INDEX_MASK 0x1ff
|
# define RS690_MC_INDEX_MASK 0x1ff
|
||||||
|
@ -478,33 +475,51 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev,
|
||||||
# define RS690_MC_INDEX_WR_ACK 0x7f
|
# define RS690_MC_INDEX_WR_ACK 0x7f
|
||||||
#define RS690_MC_DATA 0x7c
|
#define RS690_MC_DATA 0x7c
|
||||||
|
|
||||||
#define RS690_MC_MISC_CNTL 0x18
|
/* MC indirect registers */
|
||||||
#define RS690_MC_GART_FEATURE_ID 0x2b
|
#define RS480_MC_MISC_CNTL 0x18
|
||||||
#define RS690_MC_GART_BASE 0x2c
|
# define RS480_DISABLE_GTW (1 << 1)
|
||||||
#define RS690_MC_GART_CACHE_CNTL 0x2e
|
/* switch between MCIND GART and MM GART registers. 0 = mmgart, 1 = mcind gart */
|
||||||
# define RS690_MC_GART_CC_NO_CHANGE 0x0
|
# define RS480_GART_INDEX_REG_EN (1 << 12)
|
||||||
# define RS690_MC_GART_CC_CLEAR 0x1
|
# define RS690_BLOCK_GFX_D3_EN (1 << 14)
|
||||||
# define RS690_MC_GART_CLEAR_STATUS (1 << 1)
|
#define RS480_K8_FB_LOCATION 0x1e
|
||||||
# define RS690_MC_GART_CLEAR_DONE (0 << 1)
|
#define RS480_GART_FEATURE_ID 0x2b
|
||||||
# define RS690_MC_GART_CLEAR_PENDING (1 << 1)
|
# define RS480_HANG_EN (1 << 11)
|
||||||
#define RS690_MC_AGP_SIZE 0x38
|
# define RS480_TLB_ENABLE (1 << 18)
|
||||||
# define RS690_MC_GART_DIS 0x0
|
# define RS480_P2P_ENABLE (1 << 19)
|
||||||
# define RS690_MC_GART_EN 0x1
|
# define RS480_GTW_LAC_EN (1 << 25)
|
||||||
# define RS690_MC_AGP_SIZE_32MB (0 << 1)
|
# define RS480_2LEVEL_GART (0 << 30)
|
||||||
# define RS690_MC_AGP_SIZE_64MB (1 << 1)
|
# define RS480_1LEVEL_GART (1 << 30)
|
||||||
# define RS690_MC_AGP_SIZE_128MB (2 << 1)
|
# define RS480_PDC_EN (1 << 31)
|
||||||
# define RS690_MC_AGP_SIZE_256MB (3 << 1)
|
#define RS480_GART_BASE 0x2c
|
||||||
# define RS690_MC_AGP_SIZE_512MB (4 << 1)
|
#define RS480_GART_CACHE_CNTRL 0x2e
|
||||||
# define RS690_MC_AGP_SIZE_1GB (5 << 1)
|
# define RS480_GART_CACHE_INVALIDATE (1 << 0) /* wait for it to clear */
|
||||||
# define RS690_MC_AGP_SIZE_2GB (6 << 1)
|
#define RS480_AGP_ADDRESS_SPACE_SIZE 0x38
|
||||||
#define RS690_MC_AGP_MODE_CONTROL 0x39
|
# define RS480_GART_EN (1 << 0)
|
||||||
|
# define RS480_VA_SIZE_32MB (0 << 1)
|
||||||
|
# define RS480_VA_SIZE_64MB (1 << 1)
|
||||||
|
# define RS480_VA_SIZE_128MB (2 << 1)
|
||||||
|
# define RS480_VA_SIZE_256MB (3 << 1)
|
||||||
|
# define RS480_VA_SIZE_512MB (4 << 1)
|
||||||
|
# define RS480_VA_SIZE_1GB (5 << 1)
|
||||||
|
# define RS480_VA_SIZE_2GB (6 << 1)
|
||||||
|
#define RS480_AGP_MODE_CNTL 0x39
|
||||||
|
# define RS480_POST_GART_Q_SIZE (1 << 18)
|
||||||
|
# define RS480_NONGART_SNOOP (1 << 19)
|
||||||
|
# define RS480_AGP_RD_BUF_SIZE (1 << 20)
|
||||||
|
# define RS480_REQ_TYPE_SNOOP_SHIFT 22
|
||||||
|
# define RS480_REQ_TYPE_SNOOP_MASK 0x3
|
||||||
|
# define RS480_REQ_TYPE_SNOOP_DIS (1 << 24)
|
||||||
|
#define RS480_MC_MISC_UMA_CNTL 0x5f
|
||||||
|
#define RS480_MC_MCLK_CNTL 0x7a
|
||||||
|
#define RS480_MC_UMA_DUALCH_CNTL 0x86
|
||||||
|
|
||||||
#define RS690_MC_FB_LOCATION 0x100
|
#define RS690_MC_FB_LOCATION 0x100
|
||||||
#define RS690_MC_AGP_LOCATION 0x101
|
#define RS690_MC_AGP_LOCATION 0x101
|
||||||
#define RS690_MC_AGP_BASE 0x102
|
#define RS690_MC_AGP_BASE 0x102
|
||||||
#define RS690_MC_AGP_BASE_2 0x103
|
#define RS690_MC_AGP_BASE_2 0x103
|
||||||
|
|
||||||
#define R520_MC_IND_INDEX 0x70
|
#define R520_MC_IND_INDEX 0x70
|
||||||
#define R520_MC_IND_WR_EN (1<<24)
|
#define R520_MC_IND_WR_EN (1 << 24)
|
||||||
#define R520_MC_IND_DATA 0x74
|
#define R520_MC_IND_DATA 0x74
|
||||||
|
|
||||||
#define RV515_MC_FB_LOCATION 0x01
|
#define RV515_MC_FB_LOCATION 0x01
|
||||||
|
@ -516,8 +531,31 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev,
|
||||||
#define RADEON_MPP_TB_CONFIG 0x01c0
|
#define RADEON_MPP_TB_CONFIG 0x01c0
|
||||||
#define RADEON_MEM_CNTL 0x0140
|
#define RADEON_MEM_CNTL 0x0140
|
||||||
#define RADEON_MEM_SDRAM_MODE_REG 0x0158
|
#define RADEON_MEM_SDRAM_MODE_REG 0x0158
|
||||||
|
#define RADEON_AGP_BASE_2 0x015c /* r200+ only */
|
||||||
|
#define RS480_AGP_BASE_2 0x0164
|
||||||
#define RADEON_AGP_BASE 0x0170
|
#define RADEON_AGP_BASE 0x0170
|
||||||
|
|
||||||
|
/* pipe config regs */
|
||||||
|
#define R400_GB_PIPE_SELECT 0x402c
|
||||||
|
#define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */
|
||||||
|
#define R500_SU_REG_DEST 0x42c8
|
||||||
|
#define R300_GB_TILE_CONFIG 0x4018
|
||||||
|
# define R300_ENABLE_TILING (1 << 0)
|
||||||
|
# define R300_PIPE_COUNT_RV350 (0 << 1)
|
||||||
|
# define R300_PIPE_COUNT_R300 (3 << 1)
|
||||||
|
# define R300_PIPE_COUNT_R420_3P (6 << 1)
|
||||||
|
# define R300_PIPE_COUNT_R420 (7 << 1)
|
||||||
|
# define R300_TILE_SIZE_8 (0 << 4)
|
||||||
|
# define R300_TILE_SIZE_16 (1 << 4)
|
||||||
|
# define R300_TILE_SIZE_32 (2 << 4)
|
||||||
|
# define R300_SUBPIXEL_1_12 (0 << 16)
|
||||||
|
# define R300_SUBPIXEL_1_16 (1 << 16)
|
||||||
|
#define R300_DST_PIPE_CONFIG 0x170c
|
||||||
|
# define R300_PIPE_AUTO_CONFIG (1 << 31)
|
||||||
|
#define R300_RB2D_DSTCACHE_MODE 0x3428
|
||||||
|
# define R300_DC_AUTOFLUSH_ENABLE (1 << 8)
|
||||||
|
# define R300_DC_DC_DISABLE_IGNORE_PE (1 << 17)
|
||||||
|
|
||||||
#define RADEON_RB3D_COLOROFFSET 0x1c40
|
#define RADEON_RB3D_COLOROFFSET 0x1c40
|
||||||
#define RADEON_RB3D_COLORPITCH 0x1c48
|
#define RADEON_RB3D_COLORPITCH 0x1c48
|
||||||
|
|
||||||
|
@ -584,6 +622,8 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev,
|
||||||
# define RADEON_SW_INT_TEST (1 << 25)
|
# define RADEON_SW_INT_TEST (1 << 25)
|
||||||
# define RADEON_SW_INT_TEST_ACK (1 << 25)
|
# define RADEON_SW_INT_TEST_ACK (1 << 25)
|
||||||
# define RADEON_SW_INT_FIRE (1 << 26)
|
# define RADEON_SW_INT_FIRE (1 << 26)
|
||||||
|
# define R500_DISPLAY_INT_STATUS (1 << 0)
|
||||||
|
|
||||||
|
|
||||||
#define RADEON_HOST_PATH_CNTL 0x0130
|
#define RADEON_HOST_PATH_CNTL 0x0130
|
||||||
# define RADEON_HDP_SOFT_RESET (1 << 26)
|
# define RADEON_HDP_SOFT_RESET (1 << 26)
|
||||||
|
@ -654,11 +694,18 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev,
|
||||||
# define RADEON_RB3D_ZC_FREE (1 << 2)
|
# define RADEON_RB3D_ZC_FREE (1 << 2)
|
||||||
# define RADEON_RB3D_ZC_FLUSH_ALL 0x5
|
# define RADEON_RB3D_ZC_FLUSH_ALL 0x5
|
||||||
# define RADEON_RB3D_ZC_BUSY (1 << 31)
|
# define RADEON_RB3D_ZC_BUSY (1 << 31)
|
||||||
|
#define R300_ZB_ZCACHE_CTLSTAT 0x4f18
|
||||||
|
# define R300_ZC_FLUSH (1 << 0)
|
||||||
|
# define R300_ZC_FREE (1 << 1)
|
||||||
|
# define R300_ZC_FLUSH_ALL 0x3
|
||||||
|
# define R300_ZC_BUSY (1 << 31)
|
||||||
#define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c
|
#define RADEON_RB3D_DSTCACHE_CTLSTAT 0x325c
|
||||||
# define RADEON_RB3D_DC_FLUSH (3 << 0)
|
# define RADEON_RB3D_DC_FLUSH (3 << 0)
|
||||||
# define RADEON_RB3D_DC_FREE (3 << 2)
|
# define RADEON_RB3D_DC_FREE (3 << 2)
|
||||||
# define RADEON_RB3D_DC_FLUSH_ALL 0xf
|
# define RADEON_RB3D_DC_FLUSH_ALL 0xf
|
||||||
# define RADEON_RB3D_DC_BUSY (1 << 31)
|
# define RADEON_RB3D_DC_BUSY (1 << 31)
|
||||||
|
#define R300_RB3D_DSTCACHE_CTLSTAT 0x4e4c
|
||||||
|
# define R300_RB3D_DC_FINISH (1 << 4)
|
||||||
#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c
|
#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c
|
||||||
# define RADEON_Z_TEST_MASK (7 << 4)
|
# define RADEON_Z_TEST_MASK (7 << 4)
|
||||||
# define RADEON_Z_TEST_ALWAYS (7 << 4)
|
# define RADEON_Z_TEST_ALWAYS (7 << 4)
|
||||||
|
@ -1096,7 +1143,30 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev,
|
||||||
#define RADEON_VHA_BACKFRAME0_OFF_V_2 0x1894
|
#define RADEON_VHA_BACKFRAME0_OFF_V_2 0x1894
|
||||||
#define RADEON_VHA_BACKFRAME1_OFF_PITCH_V_2 0x1898
|
#define RADEON_VHA_BACKFRAME1_OFF_PITCH_V_2 0x1898
|
||||||
|
|
||||||
|
#define R500_D1CRTC_STATUS 0x609c
|
||||||
|
#define R500_D2CRTC_STATUS 0x689c
|
||||||
|
#define R500_CRTC_V_BLANK (1<<0)
|
||||||
|
|
||||||
|
#define R500_D1CRTC_FRAME_COUNT 0x60a4
|
||||||
|
#define R500_D2CRTC_FRAME_COUNT 0x68a4
|
||||||
|
|
||||||
|
#define R500_D1MODE_V_COUNTER 0x6530
|
||||||
|
#define R500_D2MODE_V_COUNTER 0x6d30
|
||||||
|
|
||||||
|
#define R500_D1MODE_VBLANK_STATUS 0x6534
|
||||||
|
#define R500_D2MODE_VBLANK_STATUS 0x6d34
|
||||||
|
#define R500_VBLANK_OCCURED (1<<0)
|
||||||
|
#define R500_VBLANK_ACK (1<<4)
|
||||||
|
#define R500_VBLANK_STAT (1<<12)
|
||||||
|
#define R500_VBLANK_INT (1<<16)
|
||||||
|
|
||||||
|
#define R500_DxMODE_INT_MASK 0x6540
|
||||||
|
#define R500_D1MODE_INT_MASK (1<<0)
|
||||||
|
#define R500_D2MODE_INT_MASK (1<<8)
|
||||||
|
|
||||||
|
#define R500_DISP_INTERRUPT_STATUS 0x7edc
|
||||||
|
#define R500_D1_VBLANK_INTERRUPT (1 << 4)
|
||||||
|
#define R500_D2_VBLANK_INTERRUPT (1 << 5)
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */
|
#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */
|
||||||
|
@ -1126,14 +1196,6 @@ do { \
|
||||||
RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \
|
RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RADEON_WRITE_IGPGART( addr, val ) \
|
|
||||||
do { \
|
|
||||||
RADEON_WRITE( RADEON_IGPGART_INDEX, \
|
|
||||||
((addr) & 0x7f) | (1 << 8)); \
|
|
||||||
RADEON_WRITE( RADEON_IGPGART_DATA, (val) ); \
|
|
||||||
RADEON_WRITE( RADEON_IGPGART_INDEX, 0x7f ); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define RADEON_WRITE_PCIE( addr, val ) \
|
#define RADEON_WRITE_PCIE( addr, val ) \
|
||||||
do { \
|
do { \
|
||||||
RADEON_WRITE8( RADEON_PCIE_INDEX, \
|
RADEON_WRITE8( RADEON_PCIE_INDEX, \
|
||||||
|
@ -1141,12 +1203,20 @@ do { \
|
||||||
RADEON_WRITE( RADEON_PCIE_DATA, (val) ); \
|
RADEON_WRITE( RADEON_PCIE_DATA, (val) ); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RADEON_WRITE_MCIND( addr, val ) \
|
#define R500_WRITE_MCIND( addr, val ) \
|
||||||
do { \
|
do { \
|
||||||
RADEON_WRITE(R520_MC_IND_INDEX, 0xff0000 | ((addr) & 0xff)); \
|
RADEON_WRITE(R520_MC_IND_INDEX, 0xff0000 | ((addr) & 0xff)); \
|
||||||
RADEON_WRITE(R520_MC_IND_DATA, (val)); \
|
RADEON_WRITE(R520_MC_IND_DATA, (val)); \
|
||||||
RADEON_WRITE(R520_MC_IND_INDEX, 0); \
|
RADEON_WRITE(R520_MC_IND_INDEX, 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define RS480_WRITE_MCIND( addr, val ) \
|
||||||
|
do { \
|
||||||
|
RADEON_WRITE( RS480_NB_MC_INDEX, \
|
||||||
|
((addr) & 0xff) | RS480_NB_MC_IND_WR_EN); \
|
||||||
|
RADEON_WRITE( RS480_NB_MC_DATA, (val) ); \
|
||||||
|
RADEON_WRITE( RS480_NB_MC_INDEX, 0xff ); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define RS690_WRITE_MCIND( addr, val ) \
|
#define RS690_WRITE_MCIND( addr, val ) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -1155,6 +1225,14 @@ do { \
|
||||||
RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); \
|
RADEON_WRITE(RS690_MC_INDEX, RS690_MC_INDEX_WR_ACK); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define IGP_WRITE_MCIND( addr, val ) \
|
||||||
|
do { \
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) \
|
||||||
|
RS690_WRITE_MCIND( addr, val ); \
|
||||||
|
else \
|
||||||
|
RS480_WRITE_MCIND( addr, val ); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define CP_PACKET0( reg, n ) \
|
#define CP_PACKET0( reg, n ) \
|
||||||
(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
|
(RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
|
||||||
#define CP_PACKET0_TABLE( reg, n ) \
|
#define CP_PACKET0_TABLE( reg, n ) \
|
||||||
|
@ -1195,23 +1273,43 @@ do { \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RADEON_FLUSH_CACHE() do { \
|
#define RADEON_FLUSH_CACHE() do { \
|
||||||
OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \
|
||||||
OUT_RING( RADEON_RB3D_DC_FLUSH ); \
|
OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \
|
||||||
|
OUT_RING( RADEON_RB3D_DC_FLUSH ); \
|
||||||
|
} else { \
|
||||||
|
OUT_RING( CP_PACKET0( R300_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \
|
||||||
|
OUT_RING( RADEON_RB3D_DC_FLUSH ); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RADEON_PURGE_CACHE() do { \
|
#define RADEON_PURGE_CACHE() do { \
|
||||||
OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \
|
||||||
OUT_RING( RADEON_RB3D_DC_FLUSH_ALL ); \
|
OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \
|
||||||
|
OUT_RING( RADEON_RB3D_DC_FLUSH_ALL ); \
|
||||||
|
} else { \
|
||||||
|
OUT_RING( CP_PACKET0( R300_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \
|
||||||
|
OUT_RING( RADEON_RB3D_DC_FLUSH_ALL ); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RADEON_FLUSH_ZCACHE() do { \
|
#define RADEON_FLUSH_ZCACHE() do { \
|
||||||
OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \
|
||||||
OUT_RING( RADEON_RB3D_ZC_FLUSH ); \
|
OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \
|
||||||
|
OUT_RING( RADEON_RB3D_ZC_FLUSH ); \
|
||||||
|
} else { \
|
||||||
|
OUT_RING( CP_PACKET0( R300_ZB_ZCACHE_CTLSTAT, 0 ) ); \
|
||||||
|
OUT_RING( R300_ZC_FLUSH ); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RADEON_PURGE_ZCACHE() do { \
|
#define RADEON_PURGE_ZCACHE() do { \
|
||||||
OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) <= CHIP_RV280) { \
|
||||||
OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \
|
OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \
|
||||||
|
OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \
|
||||||
|
} else { \
|
||||||
|
OUT_RING( CP_PACKET0( R300_RB3D_DSTCACHE_CTLSTAT, 0 ) ); \
|
||||||
|
OUT_RING( R300_ZC_FLUSH_ALL ); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* ================================================================
|
/* ================================================================
|
||||||
|
|
|
@ -47,19 +47,48 @@ static void radeon_irq_set_state(struct drm_device *dev, u32 mask, int state)
|
||||||
RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg);
|
RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void r500_vbl_irq_set_state(struct drm_device *dev, u32 mask, int state)
|
||||||
|
{
|
||||||
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
||||||
|
|
||||||
|
if (state)
|
||||||
|
dev_priv->r500_disp_irq_reg |= mask;
|
||||||
|
else
|
||||||
|
dev_priv->r500_disp_irq_reg &= ~mask;
|
||||||
|
|
||||||
|
RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg);
|
||||||
|
}
|
||||||
|
|
||||||
int radeon_enable_vblank(struct drm_device *dev, int crtc)
|
int radeon_enable_vblank(struct drm_device *dev, int crtc)
|
||||||
{
|
{
|
||||||
switch (crtc) {
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
||||||
case 0:
|
|
||||||
radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 1);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690) {
|
||||||
break;
|
switch (crtc) {
|
||||||
case 1:
|
case 0:
|
||||||
radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 1);
|
r500_vbl_irq_set_state(dev, R500_D1MODE_INT_MASK, 1);
|
||||||
break;
|
break;
|
||||||
default:
|
case 1:
|
||||||
DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
|
r500_vbl_irq_set_state(dev, R500_D2MODE_INT_MASK, 1);
|
||||||
crtc);
|
break;
|
||||||
return EINVAL;
|
default:
|
||||||
|
DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
|
||||||
|
crtc);
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (crtc) {
|
||||||
|
case 0:
|
||||||
|
radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 1);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
|
||||||
|
crtc);
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -67,25 +96,65 @@ int radeon_enable_vblank(struct drm_device *dev, int crtc)
|
||||||
|
|
||||||
void radeon_disable_vblank(struct drm_device *dev, int crtc)
|
void radeon_disable_vblank(struct drm_device *dev, int crtc)
|
||||||
{
|
{
|
||||||
switch (crtc) {
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
||||||
case 0:
|
|
||||||
radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 0);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690) {
|
||||||
break;
|
switch (crtc) {
|
||||||
case 1:
|
case 0:
|
||||||
radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 0);
|
r500_vbl_irq_set_state(dev, R500_D1MODE_INT_MASK, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
case 1:
|
||||||
DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
|
r500_vbl_irq_set_state(dev, R500_D2MODE_INT_MASK, 0);
|
||||||
crtc);
|
break;
|
||||||
break;
|
default:
|
||||||
|
DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
|
||||||
|
crtc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (crtc) {
|
||||||
|
case 0:
|
||||||
|
radeon_irq_set_state(dev, RADEON_CRTC_VBLANK_MASK, 0);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
radeon_irq_set_state(dev, RADEON_CRTC2_VBLANK_MASK, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DRM_ERROR("tried to enable vblank on non-existent crtc %d\n",
|
||||||
|
crtc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv)
|
static __inline__ u32 radeon_acknowledge_irqs(drm_radeon_private_t * dev_priv, u32 *r500_disp_int)
|
||||||
{
|
{
|
||||||
u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS) &
|
u32 irqs = RADEON_READ(RADEON_GEN_INT_STATUS);
|
||||||
(RADEON_SW_INT_TEST | RADEON_CRTC_VBLANK_STAT |
|
u32 irq_mask = RADEON_SW_INT_TEST;
|
||||||
RADEON_CRTC2_VBLANK_STAT);
|
|
||||||
|
*r500_disp_int = 0;
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690) {
|
||||||
|
/* vbl interrupts in a different place */
|
||||||
|
|
||||||
|
if (irqs & R500_DISPLAY_INT_STATUS) {
|
||||||
|
/* if a display interrupt */
|
||||||
|
u32 disp_irq;
|
||||||
|
|
||||||
|
disp_irq = RADEON_READ(R500_DISP_INTERRUPT_STATUS);
|
||||||
|
|
||||||
|
*r500_disp_int = disp_irq;
|
||||||
|
if (disp_irq & R500_D1_VBLANK_INTERRUPT) {
|
||||||
|
RADEON_WRITE(R500_D1MODE_VBLANK_STATUS, R500_VBLANK_ACK);
|
||||||
|
}
|
||||||
|
if (disp_irq & R500_D2_VBLANK_INTERRUPT) {
|
||||||
|
RADEON_WRITE(R500_D2MODE_VBLANK_STATUS, R500_VBLANK_ACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
irq_mask |= R500_DISPLAY_INT_STATUS;
|
||||||
|
} else
|
||||||
|
irq_mask |= RADEON_CRTC_VBLANK_STAT | RADEON_CRTC2_VBLANK_STAT;
|
||||||
|
|
||||||
|
irqs &= irq_mask;
|
||||||
|
|
||||||
if (irqs)
|
if (irqs)
|
||||||
RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs);
|
RADEON_WRITE(RADEON_GEN_INT_STATUS, irqs);
|
||||||
|
@ -117,11 +186,12 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
|
||||||
drm_radeon_private_t *dev_priv =
|
drm_radeon_private_t *dev_priv =
|
||||||
(drm_radeon_private_t *) dev->dev_private;
|
(drm_radeon_private_t *) dev->dev_private;
|
||||||
u32 stat;
|
u32 stat;
|
||||||
|
u32 r500_disp_int;
|
||||||
|
|
||||||
/* Only consider the bits we're interested in - others could be used
|
/* Only consider the bits we're interested in - others could be used
|
||||||
* outside the DRM
|
* outside the DRM
|
||||||
*/
|
*/
|
||||||
stat = radeon_acknowledge_irqs(dev_priv);
|
stat = radeon_acknowledge_irqs(dev_priv, &r500_disp_int);
|
||||||
if (!stat)
|
if (!stat)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
|
@ -132,11 +202,17 @@ irqreturn_t radeon_driver_irq_handler(DRM_IRQ_ARGS)
|
||||||
DRM_WAKEUP(&dev_priv->swi_queue);
|
DRM_WAKEUP(&dev_priv->swi_queue);
|
||||||
|
|
||||||
/* VBLANK interrupt */
|
/* VBLANK interrupt */
|
||||||
if (stat & RADEON_CRTC_VBLANK_STAT)
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690) {
|
||||||
drm_handle_vblank(dev, 0);
|
if (r500_disp_int & R500_D1_VBLANK_INTERRUPT)
|
||||||
if (stat & RADEON_CRTC2_VBLANK_STAT)
|
drm_handle_vblank(dev, 0);
|
||||||
drm_handle_vblank(dev, 1);
|
if (r500_disp_int & R500_D2_VBLANK_INTERRUPT)
|
||||||
|
drm_handle_vblank(dev, 1);
|
||||||
|
} else {
|
||||||
|
if (stat & RADEON_CRTC_VBLANK_STAT)
|
||||||
|
drm_handle_vblank(dev, 0);
|
||||||
|
if (stat & RADEON_CRTC2_VBLANK_STAT)
|
||||||
|
drm_handle_vblank(dev, 1);
|
||||||
|
}
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,17 +261,29 @@ u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crtc == 0) {
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690) {
|
||||||
crtc_cnt_reg = RADEON_CRTC_CRNT_FRAME;
|
if (crtc == 0) {
|
||||||
crtc_status_reg = RADEON_CRTC_STATUS;
|
crtc_cnt_reg = R500_D1CRTC_FRAME_COUNT;
|
||||||
} else if (crtc == 1) {
|
crtc_status_reg = R500_D1CRTC_STATUS;
|
||||||
crtc_cnt_reg = RADEON_CRTC2_CRNT_FRAME;
|
} else if (crtc == 1) {
|
||||||
crtc_status_reg = RADEON_CRTC2_STATUS;
|
crtc_cnt_reg = R500_D2CRTC_FRAME_COUNT;
|
||||||
} else {
|
crtc_status_reg = R500_D2CRTC_STATUS;
|
||||||
return -EINVAL;
|
} else
|
||||||
}
|
return -EINVAL;
|
||||||
|
return RADEON_READ(crtc_cnt_reg) + (RADEON_READ(crtc_status_reg) & 1);
|
||||||
|
|
||||||
return RADEON_READ(crtc_cnt_reg) + (RADEON_READ(crtc_status_reg) & 1);
|
} else {
|
||||||
|
if (crtc == 0) {
|
||||||
|
crtc_cnt_reg = RADEON_CRTC_CRNT_FRAME;
|
||||||
|
crtc_status_reg = RADEON_CRTC_STATUS;
|
||||||
|
} else if (crtc == 1) {
|
||||||
|
crtc_cnt_reg = RADEON_CRTC2_CRNT_FRAME;
|
||||||
|
crtc_status_reg = RADEON_CRTC2_STATUS;
|
||||||
|
} else {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
return RADEON_READ(crtc_cnt_reg) + (RADEON_READ(crtc_status_reg) & 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Needs the lock as it touches the ring.
|
/* Needs the lock as it touches the ring.
|
||||||
|
@ -244,12 +332,15 @@ void radeon_driver_irq_preinstall(struct drm_device * dev)
|
||||||
{
|
{
|
||||||
drm_radeon_private_t *dev_priv =
|
drm_radeon_private_t *dev_priv =
|
||||||
(drm_radeon_private_t *) dev->dev_private;
|
(drm_radeon_private_t *) dev->dev_private;
|
||||||
|
u32 dummy;
|
||||||
|
|
||||||
/* Disable *all* interrupts */
|
/* Disable *all* interrupts */
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
|
||||||
|
RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
|
||||||
RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
|
RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
|
||||||
|
|
||||||
/* Clear bits if they're already high */
|
/* Clear bits if they're already high */
|
||||||
radeon_acknowledge_irqs(dev_priv);
|
radeon_acknowledge_irqs(dev_priv, &dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
int radeon_driver_irq_postinstall(struct drm_device * dev)
|
int radeon_driver_irq_postinstall(struct drm_device * dev)
|
||||||
|
@ -281,6 +372,8 @@ void radeon_driver_irq_uninstall(struct drm_device * dev)
|
||||||
|
|
||||||
dev_priv->irq_enabled = 0;
|
dev_priv->irq_enabled = 0;
|
||||||
|
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690)
|
||||||
|
RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
|
||||||
/* Disable *all* interrupts */
|
/* Disable *all* interrupts */
|
||||||
RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
|
RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
|
||||||
}
|
}
|
||||||
|
@ -292,14 +385,23 @@ int radeon_vblank_crtc_get(struct drm_device *dev)
|
||||||
u32 flag;
|
u32 flag;
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
flag = RADEON_READ(RADEON_GEN_INT_CNTL);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690) {
|
||||||
value = 0;
|
flag = RADEON_READ(R500_DxMODE_INT_MASK);
|
||||||
|
value = 0;
|
||||||
|
if (flag & R500_D1MODE_INT_MASK)
|
||||||
|
value |= DRM_RADEON_VBLANK_CRTC1;
|
||||||
|
|
||||||
if (flag & RADEON_CRTC_VBLANK_MASK)
|
if (flag & R500_D2MODE_INT_MASK)
|
||||||
value |= DRM_RADEON_VBLANK_CRTC1;
|
value |= DRM_RADEON_VBLANK_CRTC2;
|
||||||
|
} else {
|
||||||
|
flag = RADEON_READ(RADEON_GEN_INT_CNTL);
|
||||||
|
value = 0;
|
||||||
|
if (flag & RADEON_CRTC_VBLANK_MASK)
|
||||||
|
value |= DRM_RADEON_VBLANK_CRTC1;
|
||||||
|
|
||||||
if (flag & RADEON_CRTC2_VBLANK_MASK)
|
if (flag & RADEON_CRTC2_VBLANK_MASK)
|
||||||
value |= DRM_RADEON_VBLANK_CRTC2;
|
value |= DRM_RADEON_VBLANK_CRTC2;
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3091,6 +3091,9 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
|
||||||
case RADEON_PARAM_FB_LOCATION:
|
case RADEON_PARAM_FB_LOCATION:
|
||||||
value = radeon_read_fb_location(dev_priv);
|
value = radeon_read_fb_location(dev_priv);
|
||||||
break;
|
break;
|
||||||
|
case RADEON_PARAM_NUM_GB_PIPES:
|
||||||
|
value = dev_priv->num_gb_pipes;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
DRM_DEBUG( "Invalid parameter %d\n", param->param );
|
DRM_DEBUG( "Invalid parameter %d\n", param->param );
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in New Issue