From 25cb876f8513d02d4d189371eaa8b7b9a88e860d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 9 Aug 2007 15:23:13 -0700 Subject: Associate master file pointer with command list buffer. Pass the master's file pointer, as supplied to xgi_bootstrap, to xgi_cmdlist_initialize. Associate that pointer with the memory allocated for the command list buffer. By doing this the memory will be automatically cleaned up when the master closes the device. This allows the removal of some clean up code. --- linux-core/xgi_cmdlist.c | 13 ++++--------- linux-core/xgi_cmdlist.h | 9 ++------- linux-core/xgi_drv.c | 2 +- linux-core/xgi_drv.h | 4 ++-- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/linux-core/xgi_cmdlist.c b/linux-core/xgi_cmdlist.c index e1653021..a1ec5720 100644 --- a/linux-core/xgi_cmdlist.c +++ b/linux-core/xgi_cmdlist.c @@ -34,7 +34,8 @@ static unsigned int get_batch_command(enum xgi_batch_type type); static void triggerHWCommandList(struct xgi_info * info); static void xgi_cmdlist_reset(struct xgi_info * info); -int xgi_cmdlist_initialize(struct xgi_info * info, size_t size) +int xgi_cmdlist_initialize(struct xgi_info * info, size_t size, + struct drm_file * filp) { struct xgi_mem_alloc mem_alloc = { .location = XGI_MEMLOC_NON_LOCAL, @@ -42,7 +43,7 @@ int xgi_cmdlist_initialize(struct xgi_info * info, size_t size) }; int err; - err = xgi_alloc(info, &mem_alloc, 0); + err = xgi_alloc(info, &mem_alloc, filp); if (err) { return err; } @@ -50,7 +51,6 @@ int xgi_cmdlist_initialize(struct xgi_info * info, size_t size) info->cmdring.ptr = xgi_find_pcie_virt(info, mem_alloc.hw_addr); info->cmdring.size = mem_alloc.size; info->cmdring.ring_hw_base = mem_alloc.hw_addr; - info->cmdring.ring_gart_base = mem_alloc.offset; info->cmdring.last_ptr = NULL; info->cmdring.ring_offset = 0; @@ -202,12 +202,7 @@ void xgi_cmdlist_cleanup(struct xgi_info * info) xgi_waitfor_pci_idle(info); } - xgi_free(info, (XGI_MEMLOC_NON_LOCAL - | info->cmdring.ring_gart_base), - NULL); - info->cmdring.ring_hw_base = 0; - info->cmdring.ring_offset = 0; - info->cmdring.size = 0; + (void) memset(&info->cmdring, 0, sizeof(info->cmdring)); } } diff --git a/linux-core/xgi_cmdlist.h b/linux-core/xgi_cmdlist.h index 604c9aac..07a2eb98 100644 --- a/linux-core/xgi_cmdlist.h +++ b/linux-core/xgi_cmdlist.h @@ -72,12 +72,6 @@ struct xgi_cmdring_info { */ unsigned int ring_hw_base; - /** - * Offset, in bytes, from the base of PCI-e GART space to the start - * of the ring. - */ - unsigned long ring_gart_base; - u32 * last_ptr; /** @@ -88,7 +82,8 @@ struct xgi_cmdring_info { }; struct xgi_info; -extern int xgi_cmdlist_initialize(struct xgi_info * info, size_t size); +extern int xgi_cmdlist_initialize(struct xgi_info * info, size_t size, + struct drm_file * filp); extern int xgi_state_change(struct xgi_info * info, unsigned int to, unsigned int from); diff --git a/linux-core/xgi_drv.c b/linux-core/xgi_drv.c index b6fea437..9aaeb467 100644 --- a/linux-core/xgi_drv.c +++ b/linux-core/xgi_drv.c @@ -248,7 +248,7 @@ int xgi_bootstrap(struct drm_device * dev, void * data, } /* Alloc 1M bytes for cmdbuffer which is flush2D batch array */ - err = xgi_cmdlist_initialize(info, 0x100000); + err = xgi_cmdlist_initialize(info, 0x100000, filp); if (err) { DRM_ERROR("xgi_cmdlist_initialize() failed\n"); return err; diff --git a/linux-core/xgi_drv.h b/linux-core/xgi_drv.h index a7740ceb..9c0f5a28 100644 --- a/linux-core/xgi_drv.h +++ b/linux-core/xgi_drv.h @@ -34,11 +34,11 @@ #define DRIVER_NAME "xgi" #define DRIVER_DESC "XGI XP5 / XP10 / XG47" -#define DRIVER_DATE "20070806" +#define DRIVER_DATE "20070809" #define DRIVER_MAJOR 0 #define DRIVER_MINOR 10 -#define DRIVER_PATCHLEVEL 5 +#define DRIVER_PATCHLEVEL 6 #include "xgi_cmdlist.h" #include "xgi_drm.h" -- cgit v1.2.3