]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/char/drm/drmP.h
drm: remove a bunch of typedefs on the userspace interface
[karo-tx-linux.git] / drivers / char / drm / drmP.h
index 6dcdceb812033aeb05693fdd3dbb76fcd767a9ff..a785f3e79b1c7aaa14d2876783eb3d7e7cf609b8 100644 (file)
@@ -279,20 +279,15 @@ typedef struct drm_devstate {
 } drm_devstate_t;
 
 typedef struct drm_magic_entry {
-       drm_hash_item_t hash_item;
        struct list_head head;
+       drm_hash_item_t hash_item;
        struct drm_file *priv;
        struct drm_magic_entry *next;
 } drm_magic_entry_t;
 
-typedef struct drm_magic_head {
-       struct drm_magic_entry *head;
-       struct drm_magic_entry *tail;
-} drm_magic_head_t;
-
 typedef struct drm_vma_entry {
+       struct list_head head;
        struct vm_area_struct *vma;
-       struct drm_vma_entry *next;
        pid_t pid;
 } drm_vma_entry_t;
 
@@ -379,8 +374,7 @@ typedef struct drm_file {
        uid_t uid;
        drm_magic_t magic;
        unsigned long ioctl_count;
-       struct drm_file *next;
-       struct drm_file *prev;
+       struct list_head lhead;
        struct drm_head *head;
        int remove_auth_on_close;
        unsigned long lock_count;
@@ -401,7 +395,7 @@ typedef struct drm_queue {
        atomic_t total_flushed;         /**< Total flushes statistic */
        atomic_t total_locks;           /**< Total locks statistics */
 #endif
-       drm_ctx_flags_t flags;          /**< Context preserving and 2D-only */
+       enum drm_ctx_flags flags;       /**< Context preserving and 2D-only */
        drm_waitlist_t waitlist;        /**< Pending buffers */
        wait_queue_head_t flush_queue;  /**< Processes waiting until flush */
 } drm_queue_t;
@@ -410,10 +404,14 @@ typedef struct drm_queue {
  * Lock data.
  */
 typedef struct drm_lock_data {
-       drm_hw_lock_t *hw_lock;         /**< Hardware lock */
+       struct drm_hw_lock *hw_lock;    /**< Hardware lock */
        struct file *filp;              /**< File descr of lock holder (0=kernel) */
        wait_queue_head_t lock_queue;   /**< Queue of blocked processes */
        unsigned long lock_time;        /**< Time of last lock in jiffies */
+       spinlock_t spinlock;
+       uint32_t kernel_waiters;
+       uint32_t user_waiters;
+       int idle_has_lock;
 } drm_lock_data_t;
 
 /**
@@ -445,8 +443,7 @@ typedef struct drm_agp_mem {
        DRM_AGP_MEM *memory;
        unsigned long bound;            /**< address */
        int pages;
-       struct drm_agp_mem *prev;       /**< previous entry */
-       struct drm_agp_mem *next;       /**< next entry */
+       struct list_head head;
 } drm_agp_mem_t;
 
 /**
@@ -456,7 +453,7 @@ typedef struct drm_agp_mem {
  */
 typedef struct drm_agp_head {
        DRM_AGP_KERN agp_info;          /**< AGP device information */
-       drm_agp_mem_t *memory;          /**< memory entries */
+       struct list_head memory;
        unsigned long mode;             /**< AGP mode */
        struct agp_bridge_data *bridge;
        int enabled;                    /**< whether the AGP bus as been enabled */
@@ -480,7 +477,7 @@ typedef struct drm_sg_mem {
 
 typedef struct drm_sigdata {
        int context;
-       drm_hw_lock_t *lock;
+       struct drm_hw_lock *lock;
 } drm_sigdata_t;
 
 /**
@@ -489,11 +486,11 @@ typedef struct drm_sigdata {
 typedef struct drm_map_list {
        struct list_head head;          /**< list head */
        drm_hash_item_t hash;
-       drm_map_t *map;                 /**< mapping */
+       struct drm_map *map;                    /**< mapping */
        unsigned int user_token;
 } drm_map_list_t;
 
-typedef drm_map_t drm_local_map_t;
+typedef struct drm_map drm_local_map_t;
 
 /**
  * Context handle list
@@ -515,12 +512,17 @@ typedef struct drm_vbl_sig {
 #define DRM_ATI_GART_MAIN 1
 #define DRM_ATI_GART_FB   2
 
+#define DRM_ATI_GART_PCI 1
+#define DRM_ATI_GART_PCIE 2
+#define DRM_ATI_GART_IGP 3
+
 typedef struct ati_pcigart_info {
        int gart_table_location;
-       int is_pcie;
+       int gart_reg_if;
        void *addr;
        dma_addr_t bus_addr;
        drm_local_map_t mapping;
+       int table_size;
 } drm_ati_pcigart_info;
 
 /*
@@ -532,11 +534,13 @@ typedef struct drm_mm_node {
        int free;
        unsigned long start;
        unsigned long size;
+       struct drm_mm *mm;
        void *private;
 } drm_mm_node_t;
 
 typedef struct drm_mm {
-       drm_mm_node_t root_node;
+       struct list_head fl_entry;
+       struct list_head ml_entry;
 } drm_mm_t;
 
 /**
@@ -588,9 +592,12 @@ struct drm_driver {
        void (*reclaim_buffers) (struct drm_device * dev, struct file * filp);
        void (*reclaim_buffers_locked) (struct drm_device *dev,
                                        struct file *filp);
-       unsigned long (*get_map_ofs) (drm_map_t * map);
+       void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
+                                       struct file * filp);
+       unsigned long (*get_map_ofs) (struct drm_map * map);
        unsigned long (*get_reg_ofs) (struct drm_device * dev);
-       void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
+       void (*set_version) (struct drm_device * dev,
+                            struct drm_set_version *sv);
 
        int major;
        int minor;
@@ -650,34 +657,33 @@ typedef struct drm_device {
        /** \name Performance counters */
        /*@{ */
        unsigned long counters;
-       drm_stat_type_t types[15];
+       enum drm_stat_type types[15];
        atomic_t counts[15];
        /*@} */
 
        /** \name Authentication */
        /*@{ */
-       drm_file_t *file_first;         /**< file list head */
-       drm_file_t *file_last;          /**< file list tail */
+       struct list_head filelist;
        drm_open_hash_t magiclist;      /**< magic hash table */
        struct list_head magicfree;
        /*@} */
 
        /** \name Memory management */
        /*@{ */
-       drm_map_list_t *maplist;        /**< Linked list of regions */
+       struct list_head maplist;       /**< Linked list of regions */
        int map_count;                  /**< Number of mappable regions */
        drm_open_hash_t map_hash;       /**< User token hash table for maps */
 
        /** \name Context handle management */
        /*@{ */
-       drm_ctx_list_t *ctxlist;        /**< Linked list of context handles */
+       struct list_head ctxlist;       /**< Linked list of context handles */
        int ctx_count;                  /**< Number of context handles */
        struct mutex ctxlist_mutex;     /**< For ctxlist */
 
-       drm_map_t **context_sareas;         /**< per-context SAREA's */
+       struct drm_map **context_sareas;            /**< per-context SAREA's */
        int max_context;
 
-       drm_vma_entry_t *vmalist;       /**< List of vmas (for debugging) */
+       struct list_head vmalist;       /**< List of vmas (for debugging) */
        drm_lock_data_t lock;           /**< Information on hardware lock */
        /*@} */
 
@@ -712,8 +718,8 @@ typedef struct drm_device {
        atomic_t vbl_received;
        atomic_t vbl_received2;         /**< number of secondary VBLANK interrupts */
        spinlock_t vbl_lock;
-       drm_vbl_sig_t vbl_sigs;         /**< signal list to send on VBLANK */
-       drm_vbl_sig_t vbl_sigs2;        /**< signals to send on secondary VBLANK */
+       struct list_head vbl_sigs;              /**< signal list to send on VBLANK */
+       struct list_head vbl_sigs2;     /**< signals to send on secondary VBLANK */
        unsigned int vbl_pending;
        spinlock_t tasklet_lock;        /**< For drm_locked_tasklet */
        void (*locked_tasklet_func)(struct drm_device *dev);
@@ -751,7 +757,7 @@ typedef struct drm_device {
        unsigned int drw_bitfield_length;
        u32 *drw_bitfield;
        unsigned int drw_info_length;
-       drm_drawable_info_t **drw_info;
+       struct drm_drawable_info **drw_info;
        /*@} */
 } drm_device_t;
 
@@ -762,7 +768,7 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
 }
 
 #ifdef __alpha__
-#define drm_get_pci_domain(dev) dev->hose->bus->number
+#define drm_get_pci_domain(dev) dev->hose->index
 #else
 #define drm_get_pci_domain(dev) 0
 #endif
@@ -843,9 +849,6 @@ 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 void *drm_ioremap(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);
@@ -902,7 +905,7 @@ extern int drm_rmdraw(struct inode *inode, struct file *filp,
                      unsigned int cmd, unsigned long arg);
 extern int drm_update_drawable_info(struct inode *inode, struct file *filp,
                       unsigned int cmd, unsigned long arg);
-extern drm_drawable_info_t *drm_get_drawable_info(drm_device_t *dev,
+extern struct drm_drawable_info *drm_get_drawable_info(drm_device_t *dev,
                                                  drm_drawable_t id);
 
                                /* Authentication IOCTL support (drm_auth.h) */
@@ -916,16 +919,25 @@ 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);
+extern int drm_lock_take(drm_lock_data_t *lock_data, unsigned int context);
+extern int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context);
+extern void drm_idlelock_take(drm_lock_data_t *lock_data);
+extern void drm_idlelock_release(drm_lock_data_t *lock_data);
+
+/*
+ * These are exported to drivers so that they can implement fencing using
+ * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
+ */
+
+extern int drm_i_have_hw_lock(struct file *filp);
+extern int drm_kernel_take_hw_lock(struct file *filp);
 
                                /* 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_addbufs_agp(drm_device_t * dev, struct drm_buf_desc * request);
+extern int drm_addbufs_pci(drm_device_t * dev, struct drm_buf_desc * 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);
+                     unsigned int size, enum drm_map_type type,
+                     enum drm_map_flags 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);
@@ -978,22 +990,22 @@ extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
 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(drm_device_t * dev, struct drm_agp_mode 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(drm_device_t * dev, struct drm_agp_info * info);
 extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
                              unsigned int cmd, unsigned long arg);
-extern int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request);
+extern int drm_agp_alloc(drm_device_t *dev, struct drm_agp_buffer *request);
 extern int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
                         unsigned int cmd, unsigned long arg);
-extern int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request);
+extern int drm_agp_free(drm_device_t *dev, struct drm_agp_buffer *request);
 extern int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
                        unsigned int cmd, unsigned long arg);
-extern int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request);
+extern int drm_agp_unbind(drm_device_t *dev, struct drm_agp_binding *request);
 extern int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
                          unsigned int cmd, unsigned long arg);
-extern int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request);
+extern int drm_agp_bind(drm_device_t *dev, struct drm_agp_binding *request);
 extern int drm_agp_bind_ioctl(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,
@@ -1013,6 +1025,8 @@ extern drm_head_t **drm_heads;
 extern struct class *drm_class;
 extern struct proc_dir_entry *drm_proc_root;
 
+extern drm_local_map_t *drm_getsarea(struct drm_device *dev);
+
                                /* Proc support (drm_proc.h) */
 extern int drm_proc_init(drm_device_t * dev,
                         int minor,
@@ -1053,39 +1067,24 @@ extern void drm_sysfs_device_remove(struct class_device *class_dev);
 extern drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent,
                                       unsigned long size,
                                       unsigned alignment);
-extern void drm_mm_put_block(drm_mm_t *mm, drm_mm_node_t *cur);
+void drm_mm_put_block(drm_mm_node_t * cur);
 extern drm_mm_node_t *drm_mm_search_free(const drm_mm_t *mm, unsigned long size,
                                         unsigned alignment, int best_match);
 extern int drm_mm_init(drm_mm_t *mm, unsigned long start, unsigned long size);
 extern void drm_mm_takedown(drm_mm_t *mm);
+extern int drm_mm_clean(drm_mm_t *mm);
+extern unsigned long drm_mm_tail_space(drm_mm_t *mm);
+extern int drm_mm_remove_space_from_tail(drm_mm_t *mm, unsigned long size);
+extern int drm_mm_add_space_to_tail(drm_mm_t *mm, unsigned long size);
 
-/* 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);
-}
-
-#if 0
-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);
-}
-#endif  /*  0  */
-
-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);
-}
+extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev);
+extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *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)
+       list_for_each_entry(_entry, &dev->maplist, head)
            if (_entry->user_token == token)
                return _entry->map;
        return NULL;
@@ -1139,7 +1138,7 @@ extern void *drm_calloc(size_t nmemb, size_t size, int area);
 
 /*@}*/
 
-extern unsigned long drm_core_get_map_ofs(drm_map_t * map);
+extern unsigned long drm_core_get_map_ofs(struct drm_map * map);
 extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);
 
 #endif                         /* __KERNEL__ */