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.
main
Ian Romanick 2007-08-09 15:23:13 -07:00
parent f7ba02b745
commit 25cb876f85
4 changed files with 9 additions and 19 deletions

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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"