📄 drmp.h
字号:
void *dev_private; /**< device private data */ drm_sigdata_t sigdata; /**< For block_all_signals */ sigset_t sigmask; struct drm_driver *driver; drm_local_map_t *agp_buffer_map; unsigned int agp_buffer_token; drm_head_t primary; /**< primary screen head */} drm_device_t;static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature){ return ((dev->driver->driver_features & feature) ? 1 : 0);}#if __OS_HAS_AGPstatic inline int drm_core_has_AGP(struct drm_device *dev){ return drm_core_check_feature(dev, DRIVER_USE_AGP);}#else#define drm_core_has_AGP(dev) (0)#endif#if __OS_HAS_MTRRstatic inline int drm_core_has_MTRR(struct drm_device *dev){ return drm_core_check_feature(dev, DRIVER_USE_MTRR);}#else#define drm_core_has_MTRR(dev) (0)#endif/******************************************************************//** \name Internal function definitions *//*@{*/ /* Misc. support (drm_init.h) */extern int drm_flags;extern void drm_parse_options(char *s);extern int drm_cpu_valid(void); /* Driver support (drm_drv.h) */extern int drm_init(struct drm_driver *driver);extern void drm_exit(struct drm_driver *driver);extern int drm_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_takedown(drm_device_t * dev); /* Device support (drm_fops.h) */extern int drm_open(struct inode *inode, struct file *filp);extern int drm_stub_open(struct inode *inode, struct file *filp);extern int drm_flush(struct file *filp);extern int drm_fasync(int fd, struct file *filp, int on);extern int drm_release(struct inode *inode, struct file *filp); /* Mapping support (drm_vm.h) */extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); /* Memory management support (drm_memory.h) */#include "drm_memory.h"extern void drm_mem_init(void);extern int drm_mem_info(char *buf, char **start, off_t offset, int request, int *eof, void *data);extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);extern unsigned long drm_alloc_pages(int order, int area);extern void drm_free_pages(unsigned long address, int order, int area);extern void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t * dev);extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, drm_device_t * dev);extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t * dev);extern DRM_AGP_MEM *drm_alloc_agp(drm_device_t * dev, int pages, u32 type);extern int drm_free_agp(DRM_AGP_MEM * handle, int pages);extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);extern int drm_unbind_agp(DRM_AGP_MEM * handle); /* Misc. IOCTL support (drm_ioctl.h) */extern int drm_irq_by_busid(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_getunique(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_setunique(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_getmap(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_getclient(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_getstats(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_setversion(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Context IOCTL support (drm_context.h) */extern int drm_resctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_addctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_modctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_getctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_newctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_ctxbitmap_init(drm_device_t * dev);extern void drm_ctxbitmap_cleanup(drm_device_t * dev);extern void drm_ctxbitmap_free(drm_device_t * dev, int ctx_handle);extern int drm_setsareactx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_getsareactx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Drawable IOCTL support (drm_drawable.h) */extern int drm_adddraw(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_rmdraw(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Authentication IOCTL support (drm_auth.h) */extern int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_authmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Placeholder for ioctls past */extern int drm_noop(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Locking IOCTL support (drm_lock.h) */extern int drm_lock(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_unlock(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context);extern int drm_lock_free(drm_device_t * dev, __volatile__ unsigned int *lock, unsigned int context); /* Buffer management support (drm_bufs.h) */extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request);extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request);extern int drm_addmap(drm_device_t * dev, unsigned int offset, unsigned int size, drm_map_type_t type, drm_map_flags_t flags, drm_local_map_t ** map_ptr);extern int drm_addmap_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_rmmap(drm_device_t * dev, drm_local_map_t * map);extern int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map);extern int drm_rmmap_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_order(unsigned long size);extern int drm_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_infobufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_markbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_freebufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern unsigned long drm_get_resource_start(drm_device_t * dev, unsigned int resource);extern unsigned long drm_get_resource_len(drm_device_t * dev, unsigned int resource); /* DMA support (drm_dma.h) */extern int drm_dma_setup(drm_device_t * dev);extern void drm_dma_takedown(drm_device_t * dev);extern void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf);extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp); /* IRQ support (drm_irq.h) */extern int drm_control(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_irq_uninstall(drm_device_t * dev);extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);extern void drm_driver_irq_preinstall(drm_device_t * dev);extern void drm_driver_irq_postinstall(drm_device_t * dev);extern void drm_driver_irq_uninstall(drm_device_t * dev);extern int drm_wait_vblank(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_vblank_wait(drm_device_t * dev, unsigned int *vbl_seq);extern void drm_vbl_send_signals(drm_device_t * dev); /* AGP/GART support (drm_agpsupport.h) */extern drm_agp_head_t *drm_agp_init(drm_device_t * dev);extern int drm_agp_acquire(drm_device_t * dev);extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_agp_release(drm_device_t * dev);extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode);extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info);extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type);extern int drm_agp_free_memory(DRM_AGP_MEM * handle);extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle); /* Stub support (drm_stub.h) */extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver);extern int drm_put_dev(drm_device_t * dev);extern int drm_put_head(drm_head_t * head);extern unsigned int drm_debug;extern unsigned int drm_cards_limit;extern drm_head_t **drm_heads;extern struct drm_sysfs_class *drm_class;extern struct proc_dir_entry *drm_proc_root; /* Proc support (drm_proc.h) */extern int drm_proc_init(drm_device_t * dev, int minor, struct proc_dir_entry *root, struct proc_dir_entry **dev_root);extern int drm_proc_cleanup(int minor, struct proc_dir_entry *root, struct proc_dir_entry *dev_root); /* Scatter Gather Support (drm_scatter.h) */extern void drm_sg_cleanup(drm_sg_mem_t * entry);extern int drm_sg_alloc(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);extern int drm_sg_free(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* ATI PCIGART support (ati_pcigart.h) */extern int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info);extern int drm_ati_pcigart_cleanup(drm_device_t * dev, drm_ati_pcigart_info * gart_info);extern drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align, dma_addr_t maxaddr);extern void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah);extern void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah); /* sysfs support (drm_sysfs.c) */struct drm_sysfs_class;extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner, char *name);extern void drm_sysfs_destroy(struct drm_sysfs_class *cs);extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, dev_t dev, struct device *device, const char *fmt, ...);extern void drm_sysfs_device_remove(dev_t dev);/* Inline replacements for DRM_IOREMAP macros */static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev){ map->handle = drm_ioremap(map->offset, map->size, dev);}static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev){ map->handle = drm_ioremap_nocache(map->offset, map->size, dev);}static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev){ if (map->handle && map->size) drm_ioremapfree(map->handle, map->size, dev);}static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned int token){ drm_map_list_t *_entry; list_for_each_entry(_entry, &dev->maplist->head, head) if (_entry->user_token == token) return _entry->map; return NULL;}static __inline__ int drm_device_is_agp(drm_device_t * dev){ if (dev->driver->device_is_agp != NULL) { int err = (*dev->driver->device_is_agp) (dev); if (err != 2) { return err; } } return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);}static __inline__ int drm_device_is_pcie(drm_device_t * dev){ return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);}static __inline__ void drm_core_dropmap(struct drm_map *map){}#ifndef DEBUG_MEMORY/** Wrapper around kmalloc() */static __inline__ void *drm_alloc(size_t size, int area){ return kmalloc(size, GFP_KERNEL);}/** Wrapper around kfree() */static __inline__ void drm_free(void *pt, size_t size, int area){ kfree(pt);}/** Wrapper around kcalloc() */static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area){ return kcalloc(nmemb, size, GFP_KERNEL);}#elseextern void *drm_alloc(size_t size, int area);extern void drm_free(void *pt, size_t size, int area);extern void *drm_calloc(size_t nmemb, size_t size, int area);#endif/*@}*/extern unsigned long drm_core_get_map_ofs(drm_map_t * map);extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);#ifndef pci_pretty_name#define pci_pretty_name(dev) ""#endif#endif /* __KERNEL__ */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -