diff options
Diffstat (limited to 'bsd-core')
| -rw-r--r-- | bsd-core/ati_pcigart.c | 6 | ||||
| -rw-r--r-- | bsd-core/drmP.h | 333 | ||||
| -rw-r--r-- | bsd-core/drm_agpsupport.c | 49 | ||||
| -rw-r--r-- | bsd-core/drm_auth.c | 14 | ||||
| -rw-r--r-- | bsd-core/drm_bufs.c | 71 | ||||
| -rw-r--r-- | bsd-core/drm_context.c | 33 | ||||
| -rw-r--r-- | bsd-core/drm_dma.c | 10 | ||||
| -rw-r--r-- | bsd-core/drm_drawable.c | 13 | ||||
| -rw-r--r-- | bsd-core/drm_drv.c | 39 | ||||
| -rw-r--r-- | bsd-core/drm_fops.c | 4 | ||||
| -rw-r--r-- | bsd-core/drm_ioctl.c | 20 | ||||
| -rw-r--r-- | bsd-core/drm_irq.c | 259 | ||||
| -rw-r--r-- | bsd-core/drm_lock.c | 8 | ||||
| -rw-r--r-- | bsd-core/drm_memory.c | 2 | ||||
| -rw-r--r-- | bsd-core/drm_pci.c | 5 | ||||
| -rw-r--r-- | bsd-core/drm_scatter.c | 7 | ||||
| -rw-r--r-- | bsd-core/drm_sysctl.c | 12 | ||||
| -rw-r--r-- | bsd-core/drm_vm.c | 5 | ||||
| -rw-r--r-- | bsd-core/i915_drv.c | 13 | ||||
| -rw-r--r-- | bsd-core/mach64_drv.c | 12 | ||||
| -rw-r--r-- | bsd-core/mga_drv.c | 16 | ||||
| -rw-r--r-- | bsd-core/r128_drv.c | 16 | ||||
| -rw-r--r-- | bsd-core/radeon_drv.c | 17 | ||||
| -rw-r--r-- | bsd-core/savage_drv.c | 8 | ||||
| -rw-r--r-- | bsd-core/sis_drv.c | 10 | ||||
| -rw-r--r-- | bsd-core/tdfx_drv.c | 12 | ||||
| -rw-r--r-- | bsd-core/via_drv.c | 10 | 
27 files changed, 677 insertions, 327 deletions
| diff --git a/bsd-core/ati_pcigart.c b/bsd-core/ati_pcigart.c index bb0c46e2..2b511ada 100644 --- a/bsd-core/ati_pcigart.c +++ b/bsd-core/ati_pcigart.c @@ -35,7 +35,8 @@  #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;  	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;  } -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) {  		DRM_ERROR( "no scatter/gather memory!\n" ); diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index 99457bf8..4c35cdb2 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -36,7 +36,7 @@  #if defined(_KERNEL) || defined(__KERNEL__) -typedef struct drm_device drm_device_t; +struct drm_device;  typedef struct drm_file drm_file_t;  #include <sys/param.h> @@ -265,7 +265,7 @@ enum {  #define DRM_MTRR_WC		MTRR_TYPE_WC  #define jiffies			hardclock_ticks -typedef drm_device_t *device_t; +typedef struct drm_device *device_t;  extern struct cfdriver drm_cd;  #endif /* !__FreeBSD__ */ @@ -430,7 +430,8 @@ typedef struct drm_pci_id_list  #define DRM_ROOT_ONLY	0x4  typedef struct drm_ioctl_desc {  	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;  } drm_ioctl_desc_t;  /** @@ -528,7 +529,8 @@ typedef struct drm_lock_data {  	unsigned long	  lock_time;	/* Time of last lock in jiffies	   */  } drm_lock_data_t; -/* This structure, in the drm_device_t, is always initialized while the device +/* This structure, in the struct drm_device, is always initialized while the + * device   * is open.  dev->dma_lock protects the incrementing of dev->buf_use, which   * when set marks that no further bufs may be allocated until device teardown   * occurs (when the last open of the device has closed).  The high/low @@ -619,10 +621,19 @@ struct drm_ati_pcigart_info {  	int gart_reg_if;  	void *addr;  	dma_addr_t bus_addr; +	dma_addr_t table_mask; +	dma_addr_t member_mask; +	struct drm_dma_handle *table_handle;  	drm_local_map_t mapping;  	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 {  	int	(*load)(struct drm_device *, unsigned long flags);  	int	(*firstopen)(struct drm_device *); @@ -633,7 +644,8 @@ struct drm_driver_info {  	int	(*unload)(struct drm_device *);  	void	(*reclaim_buffers_locked)(struct drm_device *,  					  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 *);  	int	(*dma_quiescent)(struct drm_device *);  	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 new);  	int	(*kernel_context_switch_unlock)(struct drm_device *dev); -	void	(*irq_preinstall)(drm_device_t *dev); -	void	(*irq_postinstall)(drm_device_t *dev); -	void	(*irq_uninstall)(drm_device_t *dev); +	void	(*irq_preinstall)(struct drm_device *dev); +	int	(*irq_postinstall)(struct drm_device *dev); +	void	(*irq_uninstall)(struct drm_device *dev);  	void	(*irq_handler)(DRM_IRQ_ARGS); -	int	(*vblank_wait)(drm_device_t *dev, unsigned int *sequence); -	int	(*vblank_wait2)(drm_device_t *dev, unsigned int *sequence); +	u32	(*get_vblank_counter)(struct drm_device *dev, int crtc); +	int	(*enable_vblank)(struct drm_device *dev, int crtc); +	void	(*disable_vblank)(struct drm_device *dev, int crtc);  	drm_pci_id_list_t *id_entry;	/* PCI ID, name, and chipset private */ @@ -772,9 +785,25 @@ struct drm_device {  	atomic_t	  context_flag;	/* Context swapping flag	   */  	int		  last_context;	/* Last current context		   */ -   	int		  vbl_queue;	/* vbl wait channel */ -   	atomic_t          vbl_received; -   	atomic_t          vbl_received2; +	wait_queue_head_t *vbl_queue;	/* vblank wait queue */ +	atomic_t	  *_vblank_count;	/* number of VBLANK interrupts */ +						/* (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__  	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;  	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; @@ -823,18 +852,20 @@ dev_type_read(drm_read);  dev_type_poll(drm_poll);  dev_type_mmap(drm_mmap);  #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) */  #ifdef __FreeBSD__ -extern int		drm_open_helper(struct cdev *kdev, int flags, int fmt,  -					 DRM_STRUCTPROC *p, drm_device_t *dev); -extern drm_file_t	*drm_find_file_by_proc(drm_device_t *dev,  -					 DRM_STRUCTPROC *p); +extern int		drm_open_helper(struct cdev *kdev, int flags, int fmt, +					 DRM_STRUCTPROC *p, +					struct drm_device *dev); +extern drm_file_t	*drm_find_file_by_proc(struct drm_device *dev, +					       DRM_STRUCTPROC *p);  #elif defined(__NetBSD__) || defined(__OpenBSD__) -extern int		drm_open_helper(dev_t kdev, int flags, int fmt,  -					DRM_STRUCTPROC *p, drm_device_t *dev); -extern drm_file_t	*drm_find_file_by_proc(drm_device_t *dev,  +extern int		drm_open_helper(dev_t kdev, int flags, int fmt, +					DRM_STRUCTPROC *p, +					struct drm_device *dev); +extern drm_file_t	*drm_find_file_by_proc(struct drm_device *dev,  					       DRM_STRUCTPROC *p);  #endif /* __NetBSD__ || __OpenBSD__ */ @@ -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,  				   int area);  void	drm_free(void *pt, size_t size, int area); -void	*drm_ioremap(drm_device_t *dev, drm_local_map_t *map); +void	*drm_ioremap(struct drm_device *dev, drm_local_map_t *map);  void	drm_ioremapfree(drm_local_map_t *map);  int	drm_mtrr_add(unsigned long offset, size_t size, int flags);  int	drm_mtrr_del(int handle, unsigned long offset, size_t size, int flags); -int	drm_context_switch(drm_device_t *dev, int old, int new); -int	drm_context_switch_complete(drm_device_t *dev, int new); +int	drm_context_switch(struct drm_device *dev, int old, int new); +int	drm_context_switch_complete(struct drm_device *dev, int new); -int	drm_ctxbitmap_init(drm_device_t *dev); -void	drm_ctxbitmap_cleanup(drm_device_t *dev); -void	drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle); -int	drm_ctxbitmap_next(drm_device_t *dev); +int	drm_ctxbitmap_init(struct drm_device *dev); +void	drm_ctxbitmap_cleanup(struct drm_device *dev); +void	drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle); +int	drm_ctxbitmap_next(struct drm_device *dev);  /* Locking IOCTL support (drm_lock.c) */  int	drm_lock_take(__volatile__ unsigned int *lock,  				    unsigned int context); -int	drm_lock_transfer(drm_device_t *dev, -					__volatile__ unsigned int *lock, -					unsigned int context); -int	drm_lock_free(drm_device_t *dev, -				    __volatile__ unsigned int *lock, -				    unsigned int context); +int	drm_lock_transfer(struct drm_device *dev, +			  __volatile__ unsigned int *lock, +			  unsigned int context); +int	drm_lock_free(struct drm_device *dev, +		      __volatile__ unsigned int *lock, +		      unsigned int context);  /* Buffer management support (drm_bufs.c) */ -unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource); -unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource); -void	drm_rmmap(drm_device_t *dev, drm_local_map_t *map); +unsigned long drm_get_resource_start(struct drm_device *dev, +				     unsigned int resource); +unsigned long drm_get_resource_len(struct drm_device *dev, +				   unsigned int resource); +void	drm_rmmap(struct drm_device *dev, drm_local_map_t *map);  int	drm_order(unsigned long size); -int	drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size, +int	drm_addmap(struct drm_device *dev, unsigned long offset, +		   unsigned long size,  		   drm_map_type_t type, drm_map_flags_t flags,  		   drm_local_map_t **map_ptr); -int	drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request); -int	drm_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request); -int	drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request); +int	drm_addbufs_pci(struct drm_device *dev, drm_buf_desc_t *request); +int	drm_addbufs_sg(struct drm_device *dev, drm_buf_desc_t *request); +int	drm_addbufs_agp(struct drm_device *dev, drm_buf_desc_t *request);  /* DMA support (drm_dma.c) */ -int	drm_dma_setup(drm_device_t *dev); -void	drm_dma_takedown(drm_device_t *dev); -void	drm_free_buffer(drm_device_t *dev, drm_buf_t *buf); -void	drm_reclaim_buffers(drm_device_t *dev, struct drm_file *file_priv); +int	drm_dma_setup(struct drm_device *dev); +void	drm_dma_takedown(struct drm_device *dev); +void	drm_free_buffer(struct drm_device *dev, drm_buf_t *buf); +void	drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv);  #define drm_core_reclaim_buffers drm_reclaim_buffers  /* IRQ support (drm_irq.c) */ -int	drm_irq_install(drm_device_t *dev); -int	drm_irq_uninstall(drm_device_t *dev); +int	drm_irq_install(struct drm_device *dev); +int	drm_irq_uninstall(struct drm_device *dev);  irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); -void	drm_driver_irq_preinstall(drm_device_t *dev); -void	drm_driver_irq_postinstall(drm_device_t *dev); -void	drm_driver_irq_uninstall(drm_device_t *dev); -int	drm_vblank_wait(drm_device_t *dev, unsigned int *vbl_seq); -void	drm_vbl_send_signals(drm_device_t *dev); +void	drm_driver_irq_preinstall(struct drm_device *dev); +void	drm_driver_irq_postinstall(struct drm_device *dev); +void	drm_driver_irq_uninstall(struct drm_device *dev); +void	drm_handle_vblank(struct drm_device *dev, int crtc); +u32	drm_vblank_count(struct drm_device *dev, int crtc); +int	drm_vblank_get(struct drm_device *dev, int crtc); +void	drm_vblank_put(struct drm_device *dev, int crtc); +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) */ -int	drm_device_is_agp(drm_device_t *dev); -int	drm_device_is_pcie(drm_device_t *dev); +int	drm_device_is_agp(struct drm_device *dev); +int	drm_device_is_pcie(struct drm_device *dev);  drm_agp_head_t *drm_agp_init(void); -int	drm_agp_acquire(drm_device_t *dev); -int	drm_agp_release(drm_device_t *dev); -int	drm_agp_info(drm_device_t * dev, drm_agp_info_t *info); -int	drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode); +int	drm_agp_acquire(struct drm_device *dev); +int	drm_agp_release(struct drm_device *dev); +int	drm_agp_info(struct drm_device * dev, drm_agp_info_t *info); +int	drm_agp_enable(struct drm_device *dev, drm_agp_mode_t mode);  void	*drm_agp_allocate_memory(size_t pages, u32 type);  int	drm_agp_free_memory(void *handle);  int	drm_agp_bind_memory(void *handle, off_t start);  int	drm_agp_unbind_memory(void *handle); -int	drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request); -int	drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request); -int	drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request); -int	drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request); +int	drm_agp_alloc(struct drm_device *dev, drm_agp_buffer_t *request); +int	drm_agp_free(struct drm_device *dev, drm_agp_buffer_t *request); +int	drm_agp_bind(struct drm_device *dev, drm_agp_binding_t *request); +int	drm_agp_unbind(struct drm_device *dev, drm_agp_binding_t *request);  /* Scatter Gather Support (drm_scatter.c) */  void	drm_sg_cleanup(drm_sg_mem_t *entry); -int	drm_sg_alloc(drm_device_t * dev, drm_scatter_gather_t * request); +int	drm_sg_alloc(struct drm_device *dev, drm_scatter_gather_t * request);  #ifdef __FreeBSD__  /* sysctl support (drm_sysctl.h) */ -extern int		drm_sysctl_init(drm_device_t *dev); -extern int		drm_sysctl_cleanup(drm_device_t *dev); +extern int		drm_sysctl_init(struct drm_device *dev); +extern int		drm_sysctl_cleanup(struct drm_device *dev);  #endif /* __FreeBSD__ */  /* ATI PCIGART support (ati_pcigart.c) */ -int	drm_ati_pcigart_init(drm_device_t *dev, +int	drm_ati_pcigart_init(struct drm_device *dev,  				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);  /* Locking IOCTL support (drm_drv.c) */ -int	drm_lock(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_unlock(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_version(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_setversion(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); +int	drm_unlock(struct drm_device *dev, void *data, +		   struct drm_file *file_priv); +int	drm_version(struct drm_device *dev, void *data, +		    struct drm_file *file_priv); +int	drm_setversion(struct drm_device *dev, void *data, +		       struct drm_file *file_priv);  /* Misc. IOCTL support (drm_ioctl.c) */ -int	drm_irq_by_busid(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_getunique(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_setunique(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_getmap(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_getclient(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_getstats(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_irq_by_busid(struct drm_device *dev, void *data, +			 struct drm_file *file_priv); +int	drm_getunique(struct drm_device *dev, void *data, +		      struct drm_file *file_priv); +int	drm_setunique(struct drm_device *dev, void *data, +		      struct drm_file *file_priv); +int	drm_getmap(struct drm_device *dev, void *data, +		   struct drm_file *file_priv); +int	drm_getclient(struct drm_device *dev, void *data, +		      struct drm_file *file_priv); +int	drm_getstats(struct drm_device *dev, void *data, +		     struct drm_file *file_priv); +int	drm_noop(struct drm_device *dev, void *data, +		 struct drm_file *file_priv);  /* Context IOCTL support (drm_context.c) */ -int	drm_resctx(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_addctx(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_modctx(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_getctx(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_switchctx(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_newctx(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_rmctx(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_setsareactx(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_getsareactx(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); +int	drm_addctx(struct drm_device *dev, void *data, +struct drm_file *file_priv); +int	drm_modctx(struct drm_device *dev, void *data, +		   struct drm_file *file_priv); +int	drm_getctx(struct drm_device *dev, void *data, +		   struct drm_file *file_priv); +int	drm_switchctx(struct drm_device *dev, void *data, +		      struct drm_file *file_priv); +int	drm_newctx(struct drm_device *dev, void *data, +		   struct drm_file *file_priv); +int	drm_rmctx(struct drm_device *dev, void *data, +		  struct drm_file *file_priv); +int	drm_setsareactx(struct drm_device *dev, void *data, +			struct drm_file *file_priv); +int	drm_getsareactx(struct drm_device *dev, void *data, +			struct drm_file *file_priv);  /* Drawable IOCTL support (drm_drawable.c) */ -int	drm_adddraw(drm_device_t *dev, void *data, struct drm_file *file_priv); -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); -struct drm_drawable_info *drm_get_drawable_info(drm_device_t *dev, int handle); +int	drm_adddraw(struct drm_device *dev, void *data, +		    struct drm_file *file_priv); +int	drm_rmdraw(struct drm_device *dev, void *data, +		   struct drm_file *file_priv); +int	drm_update_draw(struct drm_device *dev, void *data, +			struct drm_file *file_priv); +struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, +						int handle);  /* Authentication IOCTL support (drm_auth.c) */ -int	drm_getmagic(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_authmagic(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); +int	drm_authmagic(struct drm_device *dev, void *data, +		      struct drm_file *file_priv);  /* Buffer management support (drm_bufs.c) */ -int	drm_addmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_rmmap_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_addbufs_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_infobufs(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_markbufs(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_freebufs(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_mapbufs(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); +int	drm_rmmap_ioctl(struct drm_device *dev, void *data, +			struct drm_file *file_priv); +int	drm_addbufs_ioctl(struct drm_device *dev, void *data, +			  struct drm_file *file_priv); +int	drm_infobufs(struct drm_device *dev, void *data, +		     struct drm_file *file_priv); +int	drm_markbufs(struct drm_device *dev, void *data, +		     struct drm_file *file_priv); +int	drm_freebufs(struct drm_device *dev, void *data, +		     struct drm_file *file_priv); +int	drm_mapbufs(struct drm_device *dev, void *data, +		    struct drm_file *file_priv);  /* DMA support (drm_dma.c) */ -int	drm_dma(drm_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) */ -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); -void	drm_locked_tasklet(drm_device_t *dev, -			   void (*tasklet)(drm_device_t *dev)); +int	drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv); +int	drm_wait_vblank(struct drm_device *dev, void *data, +			struct drm_file *file_priv); +void	drm_locked_tasklet(struct drm_device *dev, +			   void (*tasklet)(struct drm_device *dev));  /* AGP/GART support (drm_agpsupport.c) */ -int	drm_agp_acquire_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_agp_release_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_agp_enable_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_agp_info_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_agp_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_agp_free_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_agp_unbind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_agp_bind_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); +int	drm_agp_release_ioctl(struct drm_device *dev, void *data, +			      struct drm_file *file_priv); +int	drm_agp_enable_ioctl(struct drm_device *dev, void *data, +			     struct drm_file *file_priv); +int	drm_agp_info_ioctl(struct drm_device *dev, void *data, +			   struct drm_file *file_priv); +int	drm_agp_alloc_ioctl(struct drm_device *dev, void *data, +			    struct drm_file *file_priv); +int	drm_agp_free_ioctl(struct drm_device *dev, void *data, +			   struct drm_file *file_priv); +int	drm_agp_unbind_ioctl(struct drm_device *dev, void *data, +			     struct drm_file *file_priv); +int	drm_agp_bind_ioctl(struct drm_device *dev, void *data, +			   struct drm_file *file_priv);  /* Scatter Gather Support (drm_scatter.c) */ -int	drm_sg_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv); -int	drm_sg_free(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); +int	drm_sg_free(struct drm_device *dev, void *data, +		    struct drm_file *file_priv);  /* consistent PCI memory functions (drm_pci.c) */ -drm_dma_handle_t *drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, -				dma_addr_t maxaddr); -void	drm_pci_free(drm_device_t *dev, drm_dma_handle_t *dmah); +drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, +				size_t align, dma_addr_t maxaddr); +void	drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);  /* Inline replacements for DRM_IOREMAP macros */ -static __inline__ void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev) +static __inline__ void +drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)  {  	map->handle = drm_ioremap(dev, map);  } -static __inline__ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev) +static __inline__ void +drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)  {  	if ( map->handle && map->size )  		drm_ioremapfree(map);  } -static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, unsigned long offset) +static __inline__ struct drm_local_map * +drm_core_findmap(struct drm_device *dev, unsigned long offset)  {  	drm_local_map_t *map; diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c index 4b921322..97613d21 100644 --- a/bsd-core/drm_agpsupport.c +++ b/bsd-core/drm_agpsupport.c @@ -46,7 +46,7 @@  /* Returns 1 if AGP or 0 if not. */  static int -drm_device_find_capability(drm_device_t *dev, int cap) +drm_device_find_capability(struct drm_device *dev, int cap)  {  #ifdef __FreeBSD__  #if __FreeBSD_version >= 602102 @@ -88,7 +88,7 @@ drm_device_find_capability(drm_device_t *dev, int cap)  #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) {  		int ret; @@ -104,12 +104,12 @@ int drm_device_is_agp(drm_device_t *dev)  	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));  } -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; @@ -131,7 +131,8 @@ int drm_agp_info(drm_device_t * dev, drm_agp_info_t *info)  	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;  	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;  } -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);  } -int drm_agp_acquire(drm_device_t *dev) +int drm_agp_acquire(struct drm_device *dev)  {  	int retcode; @@ -165,13 +167,14 @@ int drm_agp_acquire(drm_device_t *dev)  	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);  } -int drm_agp_release(drm_device_t * dev) +int drm_agp_release(struct drm_device * dev)  {  	if (!dev->agp || !dev->agp->acquired)  		return EINVAL; @@ -180,7 +183,7 @@ int drm_agp_release(drm_device_t * dev)  	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) @@ -192,7 +195,8 @@ int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode)  	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; @@ -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);  } -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;  	void	         *handle; @@ -244,7 +248,8 @@ int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request)  	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;  	int retcode; @@ -260,7 +265,8 @@ int drm_agp_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_pri  	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; @@ -270,7 +276,7 @@ static drm_agp_mem_t * drm_agp_lookup_entry(drm_device_t *dev, void *handle)  	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;  	int retcode; @@ -292,7 +298,8 @@ int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request)  	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;  	int retcode; @@ -306,7 +313,7 @@ int drm_agp_unbind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_pr  	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;  	int               retcode; @@ -332,7 +339,8 @@ int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request)  	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;  	int retcode; @@ -346,7 +354,7 @@ int drm_agp_bind_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv  	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; @@ -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;  	int retcode; diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c index aa8238c4..f3aafe44 100644 --- a/bsd-core/drm_auth.c +++ b/bsd-core/drm_auth.c @@ -43,7 +43,7 @@ static int drm_hash_magic(drm_magic_t magic)  /**   * 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;  	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   * 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;  	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->next  = NULL; -	DRM_LOCK();  	if (dev->magiclist[hash].tail) {  		dev->magiclist[hash].tail->next = 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].tail	= entry;  	} -	DRM_UNLOCK();  	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   * 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 *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   * 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;  	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.   */ -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_file_t *priv; diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c index 9b58c593..3508331a 100644 --- a/bsd-core/drm_bufs.c +++ b/bsd-core/drm_bufs.c @@ -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   * 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) {  		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;  } -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)  		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]);  } -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)  		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]);  } -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_local_map_t *map; @@ -149,8 +152,10 @@ int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,  	 * initialization necessary.  	 */  	map = malloc(sizeof(*map), M_DRM, M_ZERO | M_NOWAIT); -	if ( !map ) +	if ( !map ) { +		DRM_LOCK();  		return ENOMEM; +	}  	map->offset = offset;  	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 );  		if ( !map->handle ) {  			free(map, M_DRM); +			DRM_LOCK();  			return ENOMEM;  		}  		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) {  			free(map, M_DRM); +			DRM_LOCK();  			return EACCES;  		}*/  		break;  	case _DRM_SCATTER_GATHER:  		if (!dev->sg) {  			free(map, M_DRM); +			DRM_LOCK();  			return EINVAL;  		}  		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);  		if (map->dmah == NULL) {  			free(map, M_DRM); +			DRM_LOCK();  			return ENOMEM;  		}  		map->handle = map->dmah->vaddr; @@ -244,6 +253,7 @@ int drm_addmap(drm_device_t * dev, unsigned long offset, unsigned long size,  	default:  		DRM_ERROR("Bad map type %d\n", map->type);  		free(map, M_DRM); +		DRM_LOCK();  		return EINVAL;  	} @@ -261,7 +271,8 @@ done:  	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_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;  } -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); @@ -340,7 +351,8 @@ void drm_rmmap(drm_device_t *dev, drm_local_map_t *map)   * 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_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; @@ -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_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;  } -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;  	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_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;  } -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; -	DRM_SPINLOCK(&dev->dma_lock); -  	if (request->count < 0 || request->count > 4096)  		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)  		return EINVAL; +	DRM_SPINLOCK(&dev->dma_lock); +  	/* No more allocations after first buffer-using ioctl. */  	if (dev->buf_use != 0) {  		DRM_SPINUNLOCK(&dev->dma_lock); @@ -809,18 +822,18 @@ int drm_addbufs_agp(drm_device_t *dev, drm_buf_desc_t *request)  	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; -	DRM_SPINLOCK(&dev->dma_lock); -  	if (!DRM_SUSER(DRM_CURPROC))  		return EACCES;  	if (request->count < 0 || request->count > 4096)  		return EINVAL; -	 + +	DRM_SPINLOCK(&dev->dma_lock); +  	order = drm_order(request->size);  	if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)  		return EINVAL; @@ -843,22 +856,22 @@ int drm_addbufs_sg(drm_device_t *dev, drm_buf_desc_t *request)  	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; -	DRM_SPINLOCK(&dev->dma_lock); -  	if (!DRM_SUSER(DRM_CURPROC))  		return EACCES;  	if (request->count < 0 || request->count > 4096)  		return EINVAL; -	 +  	order = drm_order(request->size);  	if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)  		return EINVAL; +	DRM_SPINLOCK(&dev->dma_lock); +  	/* No more allocations after first buffer-using ioctl. */  	if (dev->buf_use != 0) {  		DRM_SPINUNLOCK(&dev->dma_lock); @@ -877,7 +890,8 @@ int drm_addbufs_pci(drm_device_t *dev, drm_buf_desc_t *request)  	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;  	int err; @@ -892,7 +906,7 @@ int drm_addbufs_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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_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;  } -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_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);  	if (request->low_mark > dma->bufs[order].buf_count ||  	    request->high_mark > dma->bufs[order].buf_count) { +		DRM_SPINUNLOCK(&dev->dma_lock);  		return EINVAL;  	} @@ -970,7 +985,7 @@ int drm_markbufs(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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_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;  } -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;  	int retcode = 0; diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c index 4155ee92..6d44fbec 100644 --- a/bsd-core/drm_context.c +++ b/bsd-core/drm_context.c @@ -38,7 +38,7 @@   * 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 ||   	    dev->ctx_bitmap == NULL) { @@ -54,7 +54,7 @@ void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle)  	return;  } -int drm_ctxbitmap_next(drm_device_t *dev) +int drm_ctxbitmap_next(struct drm_device *dev)  {  	int bit; @@ -101,7 +101,7 @@ int drm_ctxbitmap_next(drm_device_t *dev)  	return bit;  } -int drm_ctxbitmap_init(drm_device_t *dev) +int drm_ctxbitmap_init(struct drm_device *dev)  {  	int i;     	int temp; @@ -124,7 +124,7 @@ int drm_ctxbitmap_init(drm_device_t *dev)  	return 0;  } -void drm_ctxbitmap_cleanup(drm_device_t *dev) +void drm_ctxbitmap_cleanup(struct drm_device *dev)  {  	DRM_LOCK();  	if (dev->context_sareas != NULL) @@ -137,7 +137,8 @@ void drm_ctxbitmap_cleanup(drm_device_t *dev)   * 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_local_map_t *map; @@ -157,7 +158,8 @@ int drm_getsareactx( drm_device_t *dev, void *data, struct drm_file *file_priv )  	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_local_map_t *map = NULL; @@ -184,7 +186,7 @@ bad:   * 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 ) ) {                  DRM_ERROR( "Reentering -- FIXME\n" ); @@ -201,7 +203,7 @@ int drm_context_switch(drm_device_t *dev, int old, int new)          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. */ @@ -217,7 +219,7 @@ int drm_context_switch_complete(drm_device_t *dev, int new)          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_t ctx; @@ -237,7 +239,7 @@ int drm_resctx(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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; @@ -262,13 +264,13 @@ int drm_addctx(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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 */  	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; @@ -278,7 +280,8 @@ int drm_getctx(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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; @@ -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);  } -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; @@ -296,7 +299,7 @@ int drm_newctx(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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; diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c index 71ef845b..c2586fa0 100644 --- a/bsd-core/drm_dma.c +++ b/bsd-core/drm_dma.c @@ -38,7 +38,7 @@  #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); @@ -50,7 +50,7 @@ int drm_dma_setup(drm_device_t *dev)  	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;  	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; @@ -98,7 +98,7 @@ void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf)  	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;  	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 */ -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) { diff --git a/bsd-core/drm_drawable.c b/bsd-core/drm_drawable.c index fb318d47..268b956c 100644 --- a/bsd-core/drm_drawable.c +++ b/bsd-core/drm_drawable.c @@ -56,7 +56,7 @@ RB_GENERATE_STATIC(drawable_tree, bsd_drm_drawable_info, tree,      drm_drawable_compare);  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; @@ -66,7 +66,7 @@ drm_get_drawable_info(drm_device_t *dev, int handle)  	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;  	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;  } -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;  	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_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) {  			info->rects = drm_alloc(sizeof(*info->rects) *  			    update->num, DRM_MEM_DRAWABLE); -			if (info->rects == NULL) +			if (info->rects == NULL) { +				DRM_SPINUNLOCK(&dev->drw_lock);  				return ENOMEM; +			}  			info->num_rects = update->num;  		}  		/* For some reason the pointer arg is unsigned long long. */ diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index 8466ce33..9924ac34 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -45,14 +45,14 @@ int drm_debug_flag = 1;  int drm_debug_flag = 0;  #endif -static int drm_load(drm_device_t *dev); -static void drm_unload(drm_device_t *dev); +static int drm_load(struct drm_device *dev); +static void drm_unload(struct drm_device *dev);  static drm_pci_id_list_t *drm_find_description(int vendor, int device,      drm_pci_id_list_t *idlist);  #ifdef __FreeBSD__  #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_DEPEND(drm, agp, 1, 1, 1); @@ -64,7 +64,7 @@ MODULE_DEPEND(drm, mem, 1, 1, 1);  #if defined(__NetBSD__) || defined(__OpenBSD__)  #define DRIVER_SOFTC(unit) \ -	((drm_device_t *)device_lookup(&drm_cd, unit)) +	((struct drm_device *)device_lookup(&drm_cd, unit))  #endif /* __NetBSD__ || __OpenBSD__ */  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)  { -	drm_device_t *dev; +	struct drm_device *dev;  	drm_pci_id_list_t *id_entry;  	int unit; @@ -319,14 +319,15 @@ void drm_attach(struct pci_attach_args *pa, dev_t kdev,      drm_pci_id_list_t *idlist)  {  	int i; -	drm_device_t *dev; +	struct drm_device *dev;  	drm_pci_id_list_t *id_entry;  	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); -	memset(dev, 0, sizeof(drm_device_t)); +	memset(dev, 0, sizeof(struct drm_device));  	memcpy(&dev->pa, pa, sizeof(dev->pa));  	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)  { -	drm_unload((drm_device_t *)self); +	drm_unload((struct drm_device *)self);  	return 0;  } @@ -379,7 +380,7 @@ drm_pci_id_list_t *drm_find_description(int vendor, int device,  	return NULL;  } -static int drm_firstopen(drm_device_t *dev) +static int drm_firstopen(struct drm_device *dev)  {  	drm_local_map_t *map;  	int i; @@ -425,7 +426,7 @@ static int drm_firstopen(drm_device_t *dev)  	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_local_map_t *map, *mapsave; @@ -498,7 +499,7 @@ static int drm_lastclose(drm_device_t *dev)  	return 0;  } -static int drm_load(drm_device_t *dev) +static int drm_load(struct drm_device *dev)  {  	int i, retcode; @@ -599,7 +600,7 @@ error:  	return retcode;  } -static void drm_unload(drm_device_t *dev) +static void drm_unload(struct drm_device *dev)  {  	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;  	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)  { -	drm_device_t *dev = NULL; +	struct drm_device *dev = NULL;  	int retcode = 0;  	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)  { -	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;  	int retcode = 0; @@ -827,10 +828,10 @@ done:  int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,       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;  	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 is_driver_ioctl = 0;  	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;  } -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; diff --git a/bsd-core/drm_fops.c b/bsd-core/drm_fops.c index 20bae8d7..062b1d59 100644 --- a/bsd-core/drm_fops.c +++ b/bsd-core/drm_fops.c @@ -36,7 +36,7 @@  #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  	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. */  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);  	drm_file_t   *priv; diff --git a/bsd-core/drm_ioctl.c b/bsd-core/drm_ioctl.c index ce78bb8f..c00e63c2 100644 --- a/bsd-core/drm_ioctl.c +++ b/bsd-core/drm_ioctl.c @@ -41,7 +41,8 @@   * before setunique has been called.  The format for the bus-specific part of   * 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; @@ -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   * 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;  	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 -drm_set_busid(drm_device_t *dev) +drm_set_busid(struct drm_device *dev)  {  	DRM_LOCK(); @@ -137,7 +139,7 @@ drm_set_busid(drm_device_t *dev)  	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_local_map_t    *mapinlist; @@ -173,7 +175,8 @@ int drm_getmap(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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_file_t   *pt; @@ -200,7 +203,7 @@ int drm_getclient(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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;  	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_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 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");  	return 0; diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c index 40d0b71f..592e2ea8 100644 --- a/bsd-core/drm_irq.c +++ b/bsd-core/drm_irq.c @@ -35,7 +35,8 @@  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; @@ -57,7 +58,7 @@ int drm_irq_by_busid(drm_device_t *dev, void *data, struct drm_file *file_priv)  static irqreturn_t  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);  	dev->driver.irq_handler(arg); @@ -65,7 +66,7 @@ drm_irq_handler_wrap(DRM_IRQ_ARGS)  }  #endif -int drm_irq_install(drm_device_t *dev) +int drm_irq_install(struct drm_device *dev)  {  	int retcode;  #ifdef __NetBSD__ @@ -147,7 +148,7 @@ err:  	return retcode;  } -int drm_irq_uninstall(drm_device_t *dev) +int drm_irq_uninstall(struct drm_device *dev)  {  #ifdef __FreeBSD__  	int irqrid; @@ -179,7 +180,7 @@ int drm_irq_uninstall(drm_device_t *dev)  	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;  	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;  	struct timeval now;  	int ret = 0; -	int flags, seq; +	int flags, seq, crtc;  	if (!dev->irq_enabled)  		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; +	crtc = flags & _DRM_VBLANK_SECONDARY ? 1 : 0; -	if ((flags & _DRM_VBLANK_SECONDARY) && !dev->driver.use_vbl_irq2) +	if (crtc >= dev->num_crtcs)  		return EINVAL; -	 -	seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? -	    &dev->vbl_received2 : &dev->vbl_received); + +	drm_update_vblank_count(dev, crtc); +	seq = drm_vblank_count(dev, crtc);  	switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {  	case _DRM_VBLANK_RELATIVE: @@ -268,16 +388,18 @@ int drm_wait_vblank(drm_device_t *dev, void *data, struct drm_file *file_priv)  #endif  		ret = EINVAL;  	} else { +		unsigned long cur_vblank; +  		DRM_LOCK();  		/* 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();  		microtime(&now); @@ -288,12 +410,104 @@ int drm_wait_vblank(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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 */ -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;  	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)  { -	drm_device_t *dev = context; +	struct drm_device *dev = context;  	DRM_LOCK();  	for (;;) { @@ -352,7 +566,8 @@ static void drm_locked_task(void *context, int pending __unused)  }  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;  	taskqueue_enqueue(taskqueue_swi, &dev->locked_task); diff --git a/bsd-core/drm_lock.c b/bsd-core/drm_lock.c index 9731ff92..9101dec8 100644 --- a/bsd-core/drm_lock.c +++ b/bsd-core/drm_lock.c @@ -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     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)  {  	unsigned int old, new; @@ -91,7 +91,7 @@ int drm_lock_transfer(drm_device_t *dev,  	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)  {  	unsigned int old, new; @@ -111,7 +111,7 @@ int drm_lock_free(drm_device_t *dev,  	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;          int ret = 0; @@ -164,7 +164,7 @@ int drm_lock(drm_device_t *dev, void *data, struct drm_file *file_priv)  	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; diff --git a/bsd-core/drm_memory.c b/bsd-core/drm_memory.c index 1f1f7f4b..05343f3f 100644 --- a/bsd-core/drm_memory.c +++ b/bsd-core/drm_memory.c @@ -80,7 +80,7 @@ void drm_free(void *pt, size_t size, int area)  	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__  	return pmap_mapdev(map->offset, map->size); diff --git a/bsd-core/drm_pci.c b/bsd-core/drm_pci.c index 6ec6b983..6b411abb 100644 --- a/bsd-core/drm_pci.c +++ b/bsd-core/drm_pci.c @@ -53,7 +53,8 @@ drm_pci_busdma_callback(void *arg, bus_dma_segment_t *segs, int nsegs, int error   * memory block.   */  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;  	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.   */  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)  		return; diff --git a/bsd-core/drm_scatter.c b/bsd-core/drm_scatter.c index 92e715e0..3ebd4628 100644 --- a/bsd-core/drm_scatter.c +++ b/bsd-core/drm_scatter.c @@ -45,7 +45,7 @@ void drm_sg_cleanup(drm_sg_mem_t *entry)  	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;  	unsigned long pages; @@ -98,7 +98,8 @@ int drm_sg_alloc(drm_device_t * dev, drm_scatter_gather_t * request)  	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;  	int ret; @@ -109,7 +110,7 @@ int drm_sg_alloc_ioctl(drm_device_t *dev, void *data, struct drm_file *file_priv  	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_sg_mem_t *entry; diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c index 3de5b8ae..a6adf0fc 100644 --- a/bsd-core/drm_sysctl.c +++ b/bsd-core/drm_sysctl.c @@ -52,7 +52,7 @@ struct drm_sysctl_info {  	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 sysctl_oid *oid; @@ -106,7 +106,7 @@ int drm_sysctl_init(drm_device_t *dev)  	return 0;  } -int drm_sysctl_cleanup(drm_device_t *dev) +int drm_sysctl_cleanup(struct drm_device *dev)  {  	int error;  	error = sysctl_ctx_free( &dev->sysctl->ctx ); @@ -127,7 +127,7 @@ do {								\  static int drm_name_info DRM_SYSCTL_HANDLER_ARGS  { -	drm_device_t *dev = arg1; +	struct drm_device *dev = arg1;  	char buf[128];  	int retcode;  	int hasunique = 0; @@ -152,7 +152,7 @@ done:  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;  	const char   *types[] = { "FB", "REG", "SHM", "AGP", "SG" };  	const char *type, *yesno; @@ -211,7 +211,7 @@ done:  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 tempdma;  	int *templists; @@ -267,7 +267,7 @@ done:  static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS  { -	drm_device_t *dev = arg1; +	struct drm_device *dev = arg1;  	drm_file_t *priv, *tempprivs;  	char buf[128];  	int retcode; diff --git a/bsd-core/drm_vm.c b/bsd-core/drm_vm.c index fea31f52..9950c37e 100644 --- a/bsd-core/drm_vm.c +++ b/bsd-core/drm_vm.c @@ -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)  #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_file_t *priv;  	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 phys = dma->pagelist[page]; +			DRM_SPINUNLOCK(&dev->dma_lock);  #if defined(__FreeBSD__) && __FreeBSD_version >= 500102  			*paddr = phys; -			DRM_SPINUNLOCK(&dev->dma_lock);  			return 0;  #else  			return atop(phys); @@ -78,7 +78,6 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)  			DRM_SPINUNLOCK(&dev->dma_lock);  			return -1;  		} -		DRM_SPINUNLOCK(&dev->dma_lock);  	}  				/* A sequential search of a linked list is diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c index e8897fbe..e6769d17 100644 --- a/bsd-core/i915_drv.c +++ b/bsd-core/i915_drv.c @@ -40,15 +40,16 @@ static drm_pci_id_list_t i915_pciidlist[] = {  	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.load		= i915_driver_load;  	dev->driver.preclose		= i915_driver_preclose;  	dev->driver.lastclose		= i915_driver_lastclose;  	dev->driver.device_is_agp	= i915_driver_device_is_agp; -	dev->driver.vblank_wait		= i915_driver_vblank_wait; -	dev->driver.vblank_wait2	= i915_driver_vblank_wait2; +	dev->driver.get_vblank_counter	= i915_get_vblank_counter; +	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_postinstall	= i915_driver_irq_postinstall;  	dev->driver.irq_uninstall	= i915_driver_irq_uninstall; @@ -82,9 +83,9 @@ i915_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, i915_pciidlist);  } @@ -105,7 +106,7 @@ static driver_t i915_driver = {  	"drmsub",  #endif  	i915_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c index 31c45e53..06e0133d 100644 --- a/bsd-core/mach64_drv.c +++ b/bsd-core/mach64_drv.c @@ -44,11 +44,13 @@ static drm_pci_id_list_t mach64_pciidlist[] = {  	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.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_postinstall	= mach64_driver_irq_postinstall;  	dev->driver.irq_uninstall	= mach64_driver_irq_uninstall; @@ -83,9 +85,9 @@ mach64_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, mach64_pciidlist);  } @@ -102,7 +104,7 @@ static device_method_t mach64_methods[] = {  static driver_t mach64_driver = {  	"drm",  	mach64_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c index 5dc7efea..15d8175c 100644 --- a/bsd-core/mga_drv.c +++ b/bsd-core/mga_drv.c @@ -59,7 +59,7 @@ static drm_pci_id_list_t mga_pciidlist[] = {   * This function needs to be filled in!  The implementation in   * 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; @@ -84,13 +84,15 @@ static int mga_driver_device_is_agp(drm_device_t * dev)  		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.load		= mga_driver_load;  	dev->driver.unload		= mga_driver_unload;  	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_postinstall	= mga_driver_irq_postinstall;  	dev->driver.irq_uninstall	= mga_driver_irq_uninstall; @@ -129,9 +131,9 @@ mga_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, mga_pciidlist);  } @@ -148,7 +150,7 @@ static device_method_t mga_methods[] = {  static driver_t mga_driver = {  	"drm",  	mga_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; @@ -163,7 +165,7 @@ MODULE_DEPEND(mga, drm, 1, 1, 1);  #ifdef _LKM  CFDRIVER_DECL(mga, DV_TTY, NULL);  #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);  #endif  #endif diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c index fbc8c041..b149d512 100644 --- a/bsd-core/r128_drv.c +++ b/bsd-core/r128_drv.c @@ -42,12 +42,14 @@ static drm_pci_id_list_t r128_pciidlist[] = {  	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.preclose		= r128_driver_preclose;  	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_postinstall	= r128_driver_irq_postinstall;  	dev->driver.irq_uninstall	= r128_driver_irq_uninstall; @@ -83,9 +85,9 @@ r128_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, r128_pciidlist);  } @@ -102,7 +104,7 @@ static device_method_t r128_methods[] = {  static driver_t r128_driver = {  	"drm",  	r128_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; @@ -117,7 +119,7 @@ MODULE_DEPEND(r128, drm, 1, 1, 1);  #ifdef _LKM  CFDRIVER_DECL(r128, DV_TTY, NULL);  #else -CFATTACH_DECL(r128, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach, -    drm_activate); +CFATTACH_DECL(r128, sizeof(struct drm_device), drm_probe, drm_attach, +    drm_detach, drm_activate);  #endif  #endif diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c index 93f875c5..0b4dba18 100644 --- a/bsd-core/radeon_drv.c +++ b/bsd-core/radeon_drv.c @@ -42,7 +42,7 @@ static drm_pci_id_list_t radeon_pciidlist[] = {  	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.load		= radeon_driver_load; @@ -52,8 +52,9 @@ static void radeon_configure(drm_device_t *dev)  	dev->driver.preclose		= radeon_driver_preclose;  	dev->driver.postclose		= radeon_driver_postclose;  	dev->driver.lastclose		= radeon_driver_lastclose; -	dev->driver.vblank_wait		= radeon_driver_vblank_wait; -	dev->driver.vblank_wait2	= radeon_driver_vblank_wait2; +	dev->driver.get_vblank_counter	= radeon_get_vblank_counter; +	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_postinstall	= radeon_driver_irq_postinstall;  	dev->driver.irq_uninstall	= radeon_driver_irq_uninstall; @@ -90,9 +91,9 @@ radeon_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, radeon_pciidlist);  } @@ -109,7 +110,7 @@ static device_method_t radeon_methods[] = {  static driver_t radeon_driver = {  	"drm",  	radeon_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; @@ -124,7 +125,7 @@ MODULE_DEPEND(radeon, drm, 1, 1, 1);  #ifdef _LKM  CFDRIVER_DECL(radeon, DV_TTY, NULL);  #else -CFATTACH_DECL(radeon, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach, -    drm_activate); +CFATTACH_DECL(radeon, sizeof(struct drm_device), drm_probe, drm_attach, +    drm_detach, drm_activate);  #endif  #endif /* __FreeBSD__ */ diff --git a/bsd-core/savage_drv.c b/bsd-core/savage_drv.c index f4fa22b6..6235bcd1 100644 --- a/bsd-core/savage_drv.c +++ b/bsd-core/savage_drv.c @@ -37,7 +37,7 @@ static drm_pci_id_list_t savage_pciidlist[] = {  	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.load		= savage_driver_load; @@ -73,9 +73,9 @@ savage_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, savage_pciidlist);  } @@ -92,7 +92,7 @@ static device_method_t savage_methods[] = {  static driver_t savage_driver = {  	"drm",  	savage_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c index 5b87d3a9..9f76a689 100644 --- a/bsd-core/sis_drv.c +++ b/bsd-core/sis_drv.c @@ -36,7 +36,7 @@ static drm_pci_id_list_t sis_pciidlist[] = {  	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.context_ctor	= sis_init_context; @@ -66,9 +66,9 @@ sis_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, sis_pciidlist);  } @@ -85,7 +85,7 @@ static device_method_t sis_methods[] = {  static driver_t sis_driver = {  	"drm",  	sis_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; @@ -100,7 +100,7 @@ MODULE_DEPEND(sisdrm, drm, 1, 1, 1);  #ifdef _LKM  CFDRIVER_DECL(sis, DV_TTY, NULL);  #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);  #endif  #endif diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c index 5eb56f83..6d4e74b0 100644 --- a/bsd-core/tdfx_drv.c +++ b/bsd-core/tdfx_drv.c @@ -41,7 +41,7 @@ static drm_pci_id_list_t tdfx_pciidlist[] = {  	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 */ @@ -67,9 +67,9 @@ tdfx_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, tdfx_pciidlist);  } @@ -86,7 +86,7 @@ static device_method_t tdfx_methods[] = {  static driver_t tdfx_driver = {  	"drm",  	tdfx_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; @@ -101,7 +101,7 @@ MODULE_DEPEND(tdfx, drm, 1, 1, 1);  #ifdef _LKM  CFDRIVER_DECL(tdfx, DV_TTY, NULL);  #else -CFATTACH_DECL(tdfx, sizeof(drm_device_t), drm_probe, drm_attach, drm_detach, -    drm_activate); +CFATTACH_DECL(tdfx, sizeof(struct drm_device), drm_probe, drm_attach, +    drm_detach, drm_activate);  #endif  #endif diff --git a/bsd-core/via_drv.c b/bsd-core/via_drv.c index e12e1e99..1d784eed 100644 --- a/bsd-core/via_drv.c +++ b/bsd-core/via_drv.c @@ -39,7 +39,7 @@ static drm_pci_id_list_t via_pciidlist[] = {  	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.load		= via_driver_load; @@ -79,9 +79,9 @@ via_probe(device_t dev)  static int  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);  	return drm_attach(nbdev, via_pciidlist);  } @@ -98,7 +98,7 @@ static device_method_t via_methods[] = {  static driver_t via_driver = {  	"drm",  	via_methods, -	sizeof(drm_device_t) +	sizeof(struct drm_device)  };  extern devclass_t drm_devclass; @@ -109,7 +109,7 @@ MODULE_DEPEND(via, drm, 1, 1, 1);  #ifdef _LKM  CFDRIVER_DECL(via, DV_TTY, NULL);  #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);  #endif  #endif | 
