From 22eae947bf76e236ba972f2f11cfd1b083b736ad Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 10 Nov 2005 22:16:34 +1100 Subject: drm: rename driver hooks more understandably Rename the driver hooks in the DRM to something a little more understandable: preinit -> load postinit -> (removed) presetup -> firstopen postsetup -> (removed) open_helper -> open prerelease -> preclose free_filp_priv -> postclose pretakedown -> lastclose postcleanup -> unload release -> reclaim_buffers_locked version -> (removed) postinit and version were replaced with generic code in the Linux DRM (drivers now set their version numbers and description in the driver structure, like on BSD). postsetup wasn't used at all. Fixes the savage hooks for initializing and tearing down mappings at the right times. Testing involved at least starting X, running glxgears, killing glxgears, exiting X, and repeating. Tested on: FreeBSD (g200, g400, r200, r128) Linux (r200, savage4) From: Eric Anholt Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 3dc3c9d79ae..d842cce1144 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -544,16 +544,14 @@ typedef struct ati_pcigart_info { struct drm_device; struct drm_driver { - int (*preinit) (struct drm_device *, unsigned long flags); - void (*prerelease) (struct drm_device *, struct file * filp); - void (*pretakedown) (struct drm_device *); - int (*postcleanup) (struct drm_device *); - int (*presetup) (struct drm_device *); - int (*postsetup) (struct drm_device *); + int (*load) (struct drm_device *, unsigned long flags); + int (*firstopen) (struct drm_device *); + int (*open) (struct drm_device *, drm_file_t *); + void (*preclose) (struct drm_device *, struct file * filp); + void (*postclose) (struct drm_device *, drm_file_t *); + void (*lastclose) (struct drm_device *); + int (*unload) (struct drm_device *); int (*dma_ioctl) (DRM_IOCTL_ARGS); - int (*open_helper) (struct drm_device *, drm_file_t *); - void (*free_filp_priv) (struct drm_device *, drm_file_t *); - void (*release) (struct drm_device *, struct file * filp); void (*dma_ready) (struct drm_device *); int (*dma_quiescent) (struct drm_device *); int (*context_ctor) (struct drm_device * dev, int context); @@ -579,16 +577,25 @@ struct drm_driver { /* these have to be filled in */ - int (*postinit) (struct drm_device *, unsigned long flags); - irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); + irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); void (*irq_preinstall) (struct drm_device * dev); void (*irq_postinstall) (struct drm_device * dev); void (*irq_uninstall) (struct drm_device * dev); void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); + void (*reclaim_buffers_locked) (struct drm_device *drv, + struct file *filp); unsigned long (*get_map_ofs) (drm_map_t * map); unsigned long (*get_reg_ofs) (struct drm_device * dev); void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); int (*version) (drm_version_t * version); + + int major; + int minor; + int patchlevel; + char *name; + char *desc; + char *date; + u32 driver_features; int dev_priv_size; drm_ioctl_desc_t *ioctls; @@ -772,7 +779,7 @@ 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); +extern int drm_lastclose(drm_device_t *dev); /* Device support (drm_fops.h) */ extern int drm_open(struct inode *inode, struct file *filp); -- cgit v1.2.3 From 3f9df54d6386bb632ffc00665489bb3bb3bf6ff2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 10 Nov 2005 22:28:56 +1100 Subject: drm: remove drm_init.c it is no longer needed Move drm_cpu_valid into drm_fops.c Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index d842cce1144..3593f609241 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -770,7 +770,6 @@ static inline int drm_core_has_MTRR(struct drm_device *dev) /* 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); -- cgit v1.2.3 From 8f5f39f77f5a6053ae287d4673028e7a69335f5e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 11 Nov 2005 19:40:52 +1100 Subject: drm: remove drm_flush drm_flush is no longer needed remove. Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 3593f609241..6c35879bbe3 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -783,7 +783,6 @@ extern int drm_lastclose(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); -- cgit v1.2.3 From 61d04160ff89514919ef95b0d10bee706f569925 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 11 Nov 2005 19:52:22 +1100 Subject: drm: remove old backwards compatibilty stuff Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 6c35879bbe3..7fe516160b6 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -144,20 +144,6 @@ /** \name Backward compatibility section */ /*@{*/ -#ifndef MODULE_LICENSE -#define MODULE_LICENSE(x) -#endif - -#ifndef preempt_disable -#define preempt_disable() -#define preempt_enable() -#endif - -#ifndef pte_offset_map -#define pte_offset_map pte_offset -#define pte_unmap(pte) -#endif - #define DRM_RPR_ARG(vma) vma, #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) -- cgit v1.2.3 From 732052ed3e7539d87136dd833be523747af3fb3e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 11 Nov 2005 22:07:35 +1100 Subject: drm: simplify sysfs code for drm This simplifies the sysfs code for the drm and add a dri_library_name attribute which can be used by a userspace app to figure out which library to load. From: Jon Smirl Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 7fe516160b6..e9ede8d69e2 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -547,6 +547,7 @@ struct drm_driver { void (*kernel_context_switch_unlock) (struct drm_device * dev, drm_lock_t * lock); int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); + int (*dri_library_name) (struct drm_device *dev, char *buf); /** * Called by \c drm_device_is_agp. Typically used to determine if a @@ -982,10 +983,8 @@ 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); + drm_head_t *head); +extern void drm_sysfs_device_remove(struct class_device *class_dev); /* Inline replacements for DRM_IOREMAP macros */ static __inline__ void drm_core_ioremap(struct drm_map *map, -- cgit v1.2.3 From efa58395bee82dc5a87805e7eb7c710e88eb4bd7 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 11 Nov 2005 22:33:39 +1100 Subject: drm: add in-kernel entry points for rest of AGP ioctls Allow DRM modules to call AGP internally in the kernel. From: Ian Romanick Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index e9ede8d69e2..66814291949 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -925,13 +925,17 @@ extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, 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, +extern int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request); +extern int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_agp_free(struct inode *inode, struct file *filp, +extern int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request); +extern int drm_agp_free_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_agp_unbind(struct inode *inode, struct file *filp, +extern int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request); +extern int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_agp_bind(struct inode *inode, struct file *filp, +extern int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *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, size_t pages, u32 type); -- cgit v1.2.3 From a7a2cc315c8a5e51b08538d102ec3229c966ac87 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jan 2006 13:54:04 +1100 Subject: drm: move ioctl flags to a bit field of flags From: Dave Airlie Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 66814291949..295de65b708 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -272,10 +272,13 @@ typedef int drm_ioctl_t(struct inode *inode, struct file *filp, typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, unsigned long arg); +#define DRM_AUTH 0x1 +#define DRM_MASTER 0x2 +#define DRM_ROOT_ONLY 0x4 + typedef struct drm_ioctl_desc { drm_ioctl_t *func; - int auth_needed; - int root_only; + int flags; } drm_ioctl_desc_t; typedef struct drm_devstate { @@ -370,6 +373,7 @@ typedef struct drm_buf_entry { /** File private data */ typedef struct drm_file { int authenticated; + int master; int minor; pid_t pid; uid_t uid; -- cgit v1.2.3 From 269dc51296f4e985741d2fd567e7be4e7a0a9f29 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jan 2006 16:23:01 +1100 Subject: drm: bring savage inline with latest CVS apply some whitespace cleanup and add wrappers for MTRR for OS calls From: Eric Anholt + Dave Airlie Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 295de65b708..a3ad85e05bd 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -750,6 +750,21 @@ static inline int drm_core_has_MTRR(struct drm_device *dev) { return drm_core_check_feature(dev, DRIVER_USE_MTRR); } + +#define DRM_MTRR_WC MTRR_TYPE_WRCOMB + +static inline int drm_mtrr_add(unsigned long offset, unsigned long size, + unsigned int flags) +{ + return mtrr_add(offset, size, flags, 1); +} + +static inline int drm_mtrr_del(int handle, unsigned long offset, + unsigned long size, unsigned int flags) +{ + return mtrr_del(handle, offset, size); +} + #else #define drm_core_has_MTRR(dev) (0) #endif -- cgit v1.2.3 From f26c473cdf557ea6e8f267d34eee82d30473a363 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jan 2006 17:18:39 +1100 Subject: drm: update PCIGART support from CVS In order to work on FreeBSD the gart needed to use a local mapping This patch moves the mainline to the new code and aligns some comment changes From: Eric Anholt Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index a3ad85e05bd..43c49ad3069 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -522,8 +522,9 @@ typedef struct drm_vbl_sig { typedef struct ati_pcigart_info { int gart_table_location; int is_pcie; - unsigned long addr; + void *addr; dma_addr_t bus_addr; + drm_local_map_t mapping; } drm_ati_pcigart_info; /** -- cgit v1.2.3 From d985c1088146607532093d9eaaaf99758f6a4d21 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jan 2006 21:32:48 +1100 Subject: drm: major update from CVS for radeon and core This patch pull in a lot of changes from CVS to the main core DRM, and updates the radeon driver to 1.21.0 that supports r300 texrect and radeon card type ioctl. Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 43c49ad3069..307254da7d0 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -550,7 +550,7 @@ struct drm_driver { int (*kernel_context_switch) (struct drm_device * dev, int old, int new); void (*kernel_context_switch_unlock) (struct drm_device * dev, - drm_lock_t * lock); + drm_lock_t *lock); int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); int (*dri_library_name) (struct drm_device *dev, char *buf); @@ -574,12 +574,11 @@ struct drm_driver { void (*irq_postinstall) (struct drm_device * dev); void (*irq_uninstall) (struct drm_device * dev); void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); - void (*reclaim_buffers_locked) (struct drm_device *drv, + void (*reclaim_buffers_locked) (struct drm_device *dev, struct file *filp); unsigned long (*get_map_ofs) (drm_map_t * map); unsigned long (*get_reg_ofs) (struct drm_device * dev); void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); - int (*version) (drm_version_t * version); int major; int minor; @@ -774,10 +773,6 @@ static inline int drm_mtrr_del(int handle, unsigned long offset, /** \name Internal function definitions */ /*@{*/ - /* Misc. support (drm_init.h) */ -extern int drm_flags; -extern void drm_parse_options(char *s); - /* Driver support (drm_drv.h) */ extern int drm_init(struct drm_driver *driver); extern void drm_exit(struct drm_driver *driver); @@ -831,6 +826,8 @@ 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); +extern int drm_noop(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, @@ -869,10 +866,6 @@ extern int drm_getmagic(struct inode *inode, struct file *filp, 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); @@ -885,6 +878,7 @@ extern int drm_lock_free(drm_device_t * dev, /* 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_fb(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); @@ -920,8 +914,8 @@ 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 int drm_irq_uninstall(drm_device_t * dev); 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); -- cgit v1.2.3 From 9c7d462eda13ca211b7b4a62f191f4cfda135e2d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 12 Jan 2006 20:44:30 +1100 Subject: drm: fix issues with systems with no MTRR On systems with no MTRR we should still define the interface. Original bug from apkm. Signed-off-by: Dave Airlie --- drivers/char/drm/drmP.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'drivers/char/drm/drmP.h') diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 307254da7d0..54b561e6948 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h @@ -767,6 +767,20 @@ static inline int drm_mtrr_del(int handle, unsigned long offset, #else #define drm_core_has_MTRR(dev) (0) + +#define DRM_MTRR_WC 0 + +static inline int drm_mtrr_add(unsigned long offset, unsigned long size, + unsigned int flags) +{ + return 0; +} + +static inline int drm_mtrr_del(int handle, unsigned long offset, + unsigned long size, unsigned int flags) +{ + return 0; +} #endif /******************************************************************/ -- cgit v1.2.3