diff options
-rw-r--r-- | linux-core/drmP.h | 2 | ||||
-rw-r--r-- | linux-core/drm_memory.h | 8 | ||||
-rw-r--r-- | linux-core/drm_pci.c | 14 | ||||
-rw-r--r-- | linux/drmP.h | 2 | ||||
-rw-r--r-- | linux/drm_memory.h | 8 | ||||
-rw-r--r-- | linux/drm_pci.h | 14 |
6 files changed, 30 insertions, 18 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 95067342..ec4786a3 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -117,6 +117,8 @@ #define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then also include looping detection. */ +#define DRM_DEBUG_MEMORY 1 /* Include memory allocation debugging code + from drm_memory_debug.h */ #define DRM_HASH_SIZE 16 /* Size of key hash table */ #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h index ae5737f1..9e14591f 100644 --- a/linux-core/drm_memory.h +++ b/linux-core/drm_memory.h @@ -34,13 +34,11 @@ #include "drmP.h" /* Cut down version of drm_memory_debug.h, which used to be called - * drm_memory.h. If you want the debug functionality, change 0 to 1 - * below. + * drm_memory.h. If you want the debug functionality, set DRM_DEBUG_MEMORY + * to 1 in drmP.h. */ -#define DEBUG_MEMORY 0 - -#if DEBUG_MEMORY +#if DRM_DEBUG_MEMORY #include "drm_memory_debug.h" #else void DRM(mem_init)(void) diff --git a/linux-core/drm_pci.c b/linux-core/drm_pci.c index fb9df119..b32c0a30 100644 --- a/linux-core/drm_pci.c +++ b/linux-core/drm_pci.c @@ -55,9 +55,11 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr, dma_addr_t *busaddr) { void *address; +#if 0 unsigned long addr; size_t sz; -#if DEBUG_MEMORY +#endif +#if DRM_DEBUG_MEMORY int area = DRM_MEM_DMA; spin_lock(&DRM(mem_lock)); @@ -83,7 +85,7 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align, address = pci_alloc_consistent( dev->pdev, size, busaddr ); -#if DEBUG_MEMORY +#if DRM_DEBUG_MEMORY if (address == NULL) { spin_lock(&DRM(mem_lock)); ++DRM(mem_stats)[area].fail_count; @@ -122,16 +124,20 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align, void DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr) { +#if 0 unsigned long addr; size_t sz; -#if DEBUG_MEMORY +#endif +#if DRM_DEBUG_MEMORY int area = DRM_MEM_DMA; int alloc_count; int free_count; #endif if (!vaddr) { +#if DRM_DEBUG_MEMORY DRM_MEM_ERROR(area, "Attempt to free address 0\n"); +#endif } else { #if 0 /* XXX - Is virt_to_page() legal for consistent mem? */ @@ -145,7 +151,7 @@ DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr) pci_free_consistent( dev->pdev, size, vaddr, busaddr ); } -#if DEBUG_MEMORY +#if DRM_DEBUG_MEMORY spin_lock(&DRM(mem_lock)); free_count = ++DRM(mem_stats)[area].free_count; alloc_count = DRM(mem_stats)[area].succeed_count; diff --git a/linux/drmP.h b/linux/drmP.h index 95067342..ec4786a3 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -117,6 +117,8 @@ #define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then also include looping detection. */ +#define DRM_DEBUG_MEMORY 1 /* Include memory allocation debugging code + from drm_memory_debug.h */ #define DRM_HASH_SIZE 16 /* Size of key hash table */ #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ diff --git a/linux/drm_memory.h b/linux/drm_memory.h index ae5737f1..9e14591f 100644 --- a/linux/drm_memory.h +++ b/linux/drm_memory.h @@ -34,13 +34,11 @@ #include "drmP.h" /* Cut down version of drm_memory_debug.h, which used to be called - * drm_memory.h. If you want the debug functionality, change 0 to 1 - * below. + * drm_memory.h. If you want the debug functionality, set DRM_DEBUG_MEMORY + * to 1 in drmP.h. */ -#define DEBUG_MEMORY 0 - -#if DEBUG_MEMORY +#if DRM_DEBUG_MEMORY #include "drm_memory_debug.h" #else void DRM(mem_init)(void) diff --git a/linux/drm_pci.h b/linux/drm_pci.h index fb9df119..b32c0a30 100644 --- a/linux/drm_pci.h +++ b/linux/drm_pci.h @@ -55,9 +55,11 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr, dma_addr_t *busaddr) { void *address; +#if 0 unsigned long addr; size_t sz; -#if DEBUG_MEMORY +#endif +#if DRM_DEBUG_MEMORY int area = DRM_MEM_DMA; spin_lock(&DRM(mem_lock)); @@ -83,7 +85,7 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align, address = pci_alloc_consistent( dev->pdev, size, busaddr ); -#if DEBUG_MEMORY +#if DRM_DEBUG_MEMORY if (address == NULL) { spin_lock(&DRM(mem_lock)); ++DRM(mem_stats)[area].fail_count; @@ -122,16 +124,20 @@ DRM(pci_alloc)(drm_device_t *dev, size_t size, size_t align, void DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr) { +#if 0 unsigned long addr; size_t sz; -#if DEBUG_MEMORY +#endif +#if DRM_DEBUG_MEMORY int area = DRM_MEM_DMA; int alloc_count; int free_count; #endif if (!vaddr) { +#if DRM_DEBUG_MEMORY DRM_MEM_ERROR(area, "Attempt to free address 0\n"); +#endif } else { #if 0 /* XXX - Is virt_to_page() legal for consistent mem? */ @@ -145,7 +151,7 @@ DRM(pci_free)(drm_device_t *dev, size_t size, void *vaddr, dma_addr_t busaddr) pci_free_consistent( dev->pdev, size, vaddr, busaddr ); } -#if DEBUG_MEMORY +#if DRM_DEBUG_MEMORY spin_lock(&DRM(mem_lock)); free_count = ++DRM(mem_stats)[area].free_count; alloc_count = DRM(mem_stats)[area].succeed_count; |