diff options
author | Eric Anholt <eric@anholt.net> | 2009-03-24 15:23:04 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-06-18 16:00:33 -0400 |
commit | 9a298b2acd771d8a5c0004d8f8e4156c65b11f6b (patch) | |
tree | f8bf6cfe675492cb881abb50d9aa9aa8f38733d6 /drivers/gpu/drm/drm_pci.c | |
parent | 52dc7d32b88156248167864f77a9026abe27b432 (diff) |
drm: Remove memory debugging infrastructure.
It hasn't been used in ages, and having the user tell your how much
memory is being freed at free time is a recipe for disaster even if it
was ever used.
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/drm_pci.c')
-rw-r--r-- | drivers/gpu/drm/drm_pci.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index b55d5bc6ea61..577094fb1995 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -55,17 +55,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali | |||
55 | unsigned long addr; | 55 | unsigned long addr; |
56 | size_t sz; | 56 | size_t sz; |
57 | #endif | 57 | #endif |
58 | #ifdef DRM_DEBUG_MEMORY | ||
59 | int area = DRM_MEM_DMA; | ||
60 | |||
61 | spin_lock(&drm_mem_lock); | ||
62 | if ((drm_ram_used >> PAGE_SHIFT) | ||
63 | > (DRM_RAM_PERCENT * drm_ram_available) / 100) { | ||
64 | spin_unlock(&drm_mem_lock); | ||
65 | return 0; | ||
66 | } | ||
67 | spin_unlock(&drm_mem_lock); | ||
68 | #endif | ||
69 | 58 | ||
70 | /* pci_alloc_consistent only guarantees alignment to the smallest | 59 | /* pci_alloc_consistent only guarantees alignment to the smallest |
71 | * PAGE_SIZE order which is greater than or equal to the requested size. | 60 | * PAGE_SIZE order which is greater than or equal to the requested size. |
@@ -86,26 +75,10 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali | |||
86 | dmah->size = size; | 75 | dmah->size = size; |
87 | dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, GFP_KERNEL | __GFP_COMP); | 76 | dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, GFP_KERNEL | __GFP_COMP); |
88 | 77 | ||
89 | #ifdef DRM_DEBUG_MEMORY | ||
90 | if (dmah->vaddr == NULL) { | ||
91 | spin_lock(&drm_mem_lock); | ||
92 | ++drm_mem_stats[area].fail_count; | ||
93 | spin_unlock(&drm_mem_lock); | ||
94 | kfree(dmah); | ||
95 | return NULL; | ||
96 | } | ||
97 | |||
98 | spin_lock(&drm_mem_lock); | ||
99 | ++drm_mem_stats[area].succeed_count; | ||
100 | drm_mem_stats[area].bytes_allocated += size; | ||
101 | drm_ram_used += size; | ||
102 | spin_unlock(&drm_mem_lock); | ||
103 | #else | ||
104 | if (dmah->vaddr == NULL) { | 78 | if (dmah->vaddr == NULL) { |
105 | kfree(dmah); | 79 | kfree(dmah); |
106 | return NULL; | 80 | return NULL; |
107 | } | 81 | } |
108 | #endif | ||
109 | 82 | ||
110 | memset(dmah->vaddr, 0, size); | 83 | memset(dmah->vaddr, 0, size); |
111 | 84 | ||
@@ -132,17 +105,8 @@ void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) | |||
132 | unsigned long addr; | 105 | unsigned long addr; |
133 | size_t sz; | 106 | size_t sz; |
134 | #endif | 107 | #endif |
135 | #ifdef DRM_DEBUG_MEMORY | ||
136 | int area = DRM_MEM_DMA; | ||
137 | int alloc_count; | ||
138 | int free_count; | ||
139 | #endif | ||
140 | 108 | ||
141 | if (!dmah->vaddr) { | 109 | if (dmah->vaddr) { |
142 | #ifdef DRM_DEBUG_MEMORY | ||
143 | DRM_MEM_ERROR(area, "Attempt to free address 0\n"); | ||
144 | #endif | ||
145 | } else { | ||
146 | /* XXX - Is virt_to_page() legal for consistent mem? */ | 110 | /* XXX - Is virt_to_page() legal for consistent mem? */ |
147 | /* Unreserve */ | 111 | /* Unreserve */ |
148 | for (addr = (unsigned long)dmah->vaddr, sz = dmah->size; | 112 | for (addr = (unsigned long)dmah->vaddr, sz = dmah->size; |
@@ -152,21 +116,6 @@ void __drm_pci_free(struct drm_device * dev, drm_dma_handle_t * dmah) | |||
152 | dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr, | 116 | dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr, |
153 | dmah->busaddr); | 117 | dmah->busaddr); |
154 | } | 118 | } |
155 | |||
156 | #ifdef DRM_DEBUG_MEMORY | ||
157 | spin_lock(&drm_mem_lock); | ||
158 | free_count = ++drm_mem_stats[area].free_count; | ||
159 | alloc_count = drm_mem_stats[area].succeed_count; | ||
160 | drm_mem_stats[area].bytes_freed += size; | ||
161 | drm_ram_used -= size; | ||
162 | spin_unlock(&drm_mem_lock); | ||
163 | if (free_count > alloc_count) { | ||
164 | DRM_MEM_ERROR(area, | ||
165 | "Excess frees: %d frees, %d allocs\n", | ||
166 | free_count, alloc_count); | ||
167 | } | ||
168 | #endif | ||
169 | |||
170 | } | 119 | } |
171 | 120 | ||
172 | /** | 121 | /** |