From 7b48f0022a24bc5f565ae64b450dda77dee616c1 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 26 May 2007 04:26:24 +1000 Subject: drm: cleanup use of Linux list handling macros This makes the drms use of the list handling macros a lot cleaner and more along the lines of how they should be used. --- linux-core/drmP.h | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index a3f9ca86..6cede35e 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -300,19 +300,14 @@ 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; } 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; @@ -411,8 +406,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; @@ -493,8 +487,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; /** @@ -504,7 +497,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 */ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,11) struct agp_bridge_data *bridge; @@ -726,15 +719,14 @@ typedef struct drm_device { /** \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; 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 */ drm_mm_t offset_manager; /**< User token manager */ @@ -744,14 +736,14 @@ typedef struct drm_device { /** \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 */ 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 */ /*@} */ @@ -787,8 +779,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); @@ -1194,7 +1186,7 @@ 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; -- cgit v1.2.3 From f64674743a49c242e4f24cbb7599c1c21c035a4f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 27 May 2007 07:26:52 +1000 Subject: drm: convert drawable handling to use Linux idr This cleans this code up a lot and uses the generic Linux idr which is designed for this. Signed-off-by: Dave Airlie --- linux-core/drmP.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 6cede35e..16d7dbbf 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -76,6 +76,7 @@ #include #include "drm.h" #include +#include #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) #define __OS_HAS_MTRR (defined(CONFIG_MTRR)) @@ -593,6 +594,11 @@ typedef struct ati_pcigart_info { int table_size; } drm_ati_pcigart_info; +struct drm_drawable_list { + struct list_head head; + int id; + drm_drawable_info_t info; +}; #include "drm_objects.h" @@ -818,10 +824,8 @@ typedef struct drm_device { /** \name Drawable information */ /*@{ */ spinlock_t drw_lock; - unsigned int drw_bitfield_length; - u32 *drw_bitfield; - unsigned int drw_info_length; - drm_drawable_info_t **drw_info; + struct idr drw_idr; + struct list_head drwlist; /*@} */ } drm_device_t; -- cgit v1.2.3 From 056c2f249a61ba7078bae3d767a59f2be4c6556e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 27 May 2007 08:44:38 +1000 Subject: drm: move context handling code to use linux idr --- linux-core/drmP.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 16d7dbbf..f988db35 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -570,6 +570,12 @@ typedef struct drm_ctx_list { drm_file_t *tag; /**< associated fd private data */ } drm_ctx_list_t; +struct drm_ctx_sarea_list { + struct list_head head; + int ctx_id; + drm_map_t *map; +}; + typedef struct drm_vbl_sig { struct list_head head; unsigned int sequence; @@ -746,8 +752,8 @@ typedef struct drm_device { int ctx_count; /**< Number of context handles */ struct mutex ctxlist_mutex; /**< For ctxlist */ - drm_map_t **context_sareas; /**< per-context SAREA's */ - int max_context; + struct idr ctx_idr; + struct list_head context_sarealist; struct list_head vmalist; /**< List of vmas (for debugging) */ drm_lock_data_t lock; /**< Information on hardware lock */ @@ -808,7 +814,6 @@ typedef struct drm_device { struct pci_controller *hose; #endif drm_sg_mem_t *sg; /**< Scatter gather memory */ - unsigned long *ctx_bitmap; /**< context bitmap */ void *dev_private; /**< device private data */ drm_sigdata_t sigdata; /**< For block_all_signals */ sigset_t sigmask; -- cgit v1.2.3 From a4cddc6596b30dfa781eb7803de5b60aca50f112 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 3 Jun 2007 18:12:28 +1000 Subject: Revert "drm: add new drm_wait_on function to replace macro" This reverts commit 6e860d08d0f5b1e9a2d711aaf9fd6b982aa8039e. As I said not a good plan - this macro will have to stay for now, trying to do the vbl code with the inline was a bit messy - may need specialised drm wait on functions --- linux-core/drmP.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index f988db35..94cb4eee 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1130,9 +1130,7 @@ extern struct drm_sysfs_class *drm_class; extern struct proc_dir_entry *drm_proc_root; extern drm_local_map_t *drm_getsarea(struct drm_device *dev); -extern int drm_wait_on(drm_device_t *dev, wait_queue_head_t *queue, - int timeout, int (*fn)(drm_device_t *dev, void *priv), - void *priv); + /* Proc support (drm_proc.h) */ extern int drm_proc_init(drm_device_t * dev, int minor, -- cgit v1.2.3 From 280083d4a2a12a1ff6dc1b068553a4ae8960200c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 10 Jun 2007 15:40:10 +1000 Subject: use krh's idr mods to remove lists from idr code --- linux-core/drmP.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 94cb4eee..dd3a69df 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -571,8 +571,6 @@ typedef struct drm_ctx_list { } drm_ctx_list_t; struct drm_ctx_sarea_list { - struct list_head head; - int ctx_id; drm_map_t *map; }; @@ -601,8 +599,6 @@ typedef struct ati_pcigart_info { } drm_ati_pcigart_info; struct drm_drawable_list { - struct list_head head; - int id; drm_drawable_info_t info; }; @@ -753,7 +749,6 @@ typedef struct drm_device { struct mutex ctxlist_mutex; /**< For ctxlist */ struct idr ctx_idr; - struct list_head context_sarealist; struct list_head vmalist; /**< List of vmas (for debugging) */ drm_lock_data_t lock; /**< Information on hardware lock */ @@ -830,7 +825,6 @@ typedef struct drm_device { /*@{ */ spinlock_t drw_lock; struct idr drw_idr; - struct list_head drwlist; /*@} */ } drm_device_t; @@ -1008,6 +1002,7 @@ 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, drm_drawable_t id); +extern void drm_drawable_free_all(drm_device_t *dev); /* Authentication IOCTL support (drm_auth.h) */ extern int drm_getmagic(struct inode *inode, struct file *filp, -- cgit v1.2.3 From b323ab52aa9ccbfb06dd723ece361a5242d067b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 28 Jun 2007 14:45:26 -0400 Subject: Drop drm_drawable_list and add drm_drawable_info directly to the idr. --- linux-core/drmP.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index dd3a69df..7bcd095a 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -598,10 +598,6 @@ typedef struct ati_pcigart_info { int table_size; } drm_ati_pcigart_info; -struct drm_drawable_list { - drm_drawable_info_t info; -}; - #include "drm_objects.h" /** -- cgit v1.2.3 From d57b7f02d2e525e5600e5d77370d7ad2b4c9b265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 3 Jul 2007 10:41:48 -0400 Subject: Use idr_replace trick to eliminate struct drm_ctx_sarea_list. --- linux-core/drmP.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 7bcd095a..c992c8d9 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -570,10 +570,6 @@ typedef struct drm_ctx_list { drm_file_t *tag; /**< associated fd private data */ } drm_ctx_list_t; -struct drm_ctx_sarea_list { - drm_map_t *map; -}; - typedef struct drm_vbl_sig { struct list_head head; unsigned int sequence; -- cgit v1.2.3 From 04e4922c0c407a9f0cfe268f62130891e98fc682 Mon Sep 17 00:00:00 2001 From: Arthur Huillet Date: Wed, 11 Jul 2007 02:33:12 +0200 Subject: Made drm_sg_alloc accessible from inside the DRM - drm_sg_alloc_ioctl is the ioctl wrapper --- linux-core/drmP.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux-core/drmP.h') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index c992c8d9..c274f1fa 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1129,8 +1129,9 @@ extern int drm_proc_cleanup(int minor, /* 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, +extern int drm_sg_alloc_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +extern int drm_sg_alloc(drm_device_t *dev, drm_scatter_gather_t * request); extern int drm_sg_free(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -- cgit v1.2.3