Eliminate allocation "owner" usage.

main
Ian Romanick 2007-08-06 15:31:34 -07:00
parent f83000c8b3
commit 997a9a738e
4 changed files with 6 additions and 50 deletions

View File

@ -38,7 +38,6 @@ int xgi_cmdlist_initialize(struct xgi_info * info, size_t size)
{
struct xgi_mem_alloc mem_alloc = {
.size = size,
.owner = PCIE_2D,
};
int err;

View File

@ -34,11 +34,11 @@
#define DRIVER_NAME "xgi"
#define DRIVER_DESC "XGI XP5 / XP10 / XG47"
#define DRIVER_DATE "20070723"
#define DRIVER_DATE "20070806"
#define DRIVER_MAJOR 0
#define DRIVER_MINOR 10
#define DRIVER_PATCHLEVEL 0
#define DRIVER_PATCHLEVEL 1
#include "xgi_cmdlist.h"
#include "xgi_drm.h"
@ -53,8 +53,6 @@ struct xgi_mem_block {
unsigned long offset;
unsigned long size;
struct drm_file * filp;
unsigned int owner;
};
struct xgi_mem_heap {
@ -93,23 +91,9 @@ struct xgi_info {
struct xgi_cmdring_info cmdring;
};
enum PcieOwner {
PCIE_2D = 0,
/*
PCIE_3D should not begin with 1,
2D alloc pcie memory will use owner 1.
*/
PCIE_3D = 11, /*vetex buf */
PCIE_3D_CMDLIST = 12,
PCIE_3D_SCRATCHPAD = 13,
PCIE_3D_TEXTURE = 14,
PCIE_INVALID = 0x7fffffff
};
extern struct kmem_cache *xgi_mem_block_cache;
extern struct xgi_mem_block *xgi_mem_alloc(struct xgi_mem_heap * heap,
unsigned long size, enum PcieOwner owner);
unsigned long size);
extern int xgi_mem_free(struct xgi_mem_heap * heap, unsigned long offset,
struct drm_file * filp);
extern int xgi_mem_heap_init(struct xgi_mem_heap * heap, unsigned int start,

View File

@ -93,7 +93,6 @@ struct xgi_mem_block *xgi_mem_new_node(void)
block->offset = 0;
block->size = 0;
block->owner = PCIE_INVALID;
block->filp = (struct drm_file *) -1;
return block;
@ -101,8 +100,7 @@ struct xgi_mem_block *xgi_mem_new_node(void)
struct xgi_mem_block *xgi_mem_alloc(struct xgi_mem_heap * heap,
unsigned long originalSize,
enum PcieOwner owner)
unsigned long originalSize)
{
struct xgi_mem_block *block, *free_block, *used_block;
unsigned long size = (originalSize + PAGE_SIZE - 1) & PAGE_MASK;
@ -167,7 +165,6 @@ struct xgi_mem_block *xgi_mem_alloc(struct xgi_mem_heap * heap,
heap->max_freesize -= size;
list_add(&used_block->list, &heap->used_list);
used_block->owner = owner;
return (used_block);
}
@ -258,7 +255,7 @@ int xgi_fb_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc,
("Video RAM allocation on front buffer successfully! \n");
} else {
down(&info->fb_sem);
block = xgi_mem_alloc(&info->fb_heap, alloc->size, PCIE_2D);
block = xgi_mem_alloc(&info->fb_heap, alloc->size);
up(&info->fb_sem);
if (block == NULL) {

View File

@ -153,31 +153,7 @@ int xgi_pcie_alloc(struct xgi_info * info, struct xgi_mem_alloc * alloc,
struct xgi_mem_block *block;
down(&info->pcie_sem);
if ((alloc->owner == PCIE_3D) && (xgi_pcie_vertex_block)) {
DRM_INFO("PCIE Vertex has been created, return directly.\n");
block = xgi_pcie_vertex_block;
}
else if ((alloc->owner == PCIE_3D_CMDLIST) && (xgi_pcie_cmdlist_block)) {
DRM_INFO("PCIE Cmdlist has been created, return directly.\n");
block = xgi_pcie_cmdlist_block;
}
else if ((alloc->owner == PCIE_3D_SCRATCHPAD) && (xgi_pcie_scratchpad_block)) {
DRM_INFO("PCIE Scratchpad has been created, return directly.\n");
block = xgi_pcie_scratchpad_block;
}
else {
block = xgi_mem_alloc(&info->pcie_heap, alloc->size, alloc->owner);
if (alloc->owner == PCIE_3D) {
xgi_pcie_vertex_block = block;
}
else if (alloc->owner == PCIE_3D_CMDLIST) {
xgi_pcie_cmdlist_block = block;
}
else if (alloc->owner == PCIE_3D_SCRATCHPAD) {
xgi_pcie_scratchpad_block = block;
}
}
block = xgi_mem_alloc(&info->pcie_heap, alloc->size);
up(&info->pcie_sem);
if (block == NULL) {