Eliminate allocation "owner" usage.
authorIan Romanick <idr@us.ibm.com>
Mon, 6 Aug 2007 22:31:34 +0000 (15:31 -0700)
committerIan Romanick <idr@us.ibm.com>
Mon, 6 Aug 2007 22:31:34 +0000 (15:31 -0700)
linux-core/xgi_cmdlist.c
linux-core/xgi_drv.h
linux-core/xgi_fb.c
linux-core/xgi_pcie.c

index 4bb147c..e0ca31f 100644 (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;
 
index 8dec1fa..f771517 100644 (file)
 
 #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,
index 9c60a87..bbdebb5 100644 (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) {
index b91471b..f66ffee 100644 (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) {