Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: drop DRM_DEBUG_CODE

DRM_DEBUG_CODE is currently always set, so distributions enable it. The
only reason to keep support in code is if developers wanted to disable
debug support. Sounds unlikely.

All the DRM_DEBUG() printks are still guarded by a drm_debug read. So if
its cacheline is read once, they're discarded pretty fast.. There should
hardly be any performance penalty, it's even guarded by unlikely().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

David Herrmann and committed by
Dave Airlie
edf0ac7c 96993908

+12 -44
-2
drivers/gpu/drm/drm_debugfs.c
··· 49 49 {"clients", drm_clients_info, 0}, 50 50 {"bufs", drm_bufs_info, 0}, 51 51 {"gem_names", drm_gem_name_info, DRIVER_GEM}, 52 - #if DRM_DEBUG_CODE 53 52 {"vma", drm_vma_info, 0}, 54 - #endif 55 53 }; 56 54 #define DRM_DEBUGFS_ENTRIES ARRAY_SIZE(drm_debugfs_list) 57 55
-4
drivers/gpu/drm/drm_vm.c
··· 683 683 } 684 684 } 685 685 686 - #if DRM_DEBUG_CODE 687 - 688 686 int drm_vma_info(struct seq_file *m, void *data) 689 687 { 690 688 struct drm_info_node *node = (struct drm_info_node *) m->private; ··· 736 738 mutex_unlock(&dev->struct_mutex); 737 739 return 0; 738 740 } 739 - 740 - #endif
+12 -5
drivers/gpu/drm/radeon/radeon.h
··· 2776 2776 /* 2777 2777 * RING helpers. 2778 2778 */ 2779 - #if DRM_DEBUG_CODE == 0 2779 + 2780 + /** 2781 + * radeon_ring_write - write a value to the ring 2782 + * 2783 + * @ring: radeon_ring structure holding ring information 2784 + * @v: dword (dw) value to write 2785 + * 2786 + * Write a value to the requested ring buffer (all asics). 2787 + */ 2780 2788 static inline void radeon_ring_write(struct radeon_ring *ring, uint32_t v) 2781 2789 { 2790 + if (ring->count_dw <= 0) 2791 + DRM_ERROR("radeon: writing more dwords to the ring than expected!\n"); 2792 + 2782 2793 ring->ring[ring->wptr++] = v; 2783 2794 ring->wptr &= ring->ptr_mask; 2784 2795 ring->count_dw--; 2785 2796 ring->ring_free_dw--; 2786 2797 } 2787 - #else 2788 - /* With debugging this is just too big to inline */ 2789 - void radeon_ring_write(struct radeon_ring *ring, uint32_t v); 2790 - #endif 2791 2798 2792 2799 /* 2793 2800 * ASICs macro.
-21
drivers/gpu/drm/radeon/radeon_ring.c
··· 45 45 static int radeon_debugfs_ring_init(struct radeon_device *rdev, struct radeon_ring *ring); 46 46 47 47 /** 48 - * radeon_ring_write - write a value to the ring 49 - * 50 - * @ring: radeon_ring structure holding ring information 51 - * @v: dword (dw) value to write 52 - * 53 - * Write a value to the requested ring buffer (all asics). 54 - */ 55 - void radeon_ring_write(struct radeon_ring *ring, uint32_t v) 56 - { 57 - #if DRM_DEBUG_CODE 58 - if (ring->count_dw <= 0) { 59 - DRM_ERROR("radeon: writing more dwords to the ring than expected!\n"); 60 - } 61 - #endif 62 - ring->ring[ring->wptr++] = v; 63 - ring->wptr &= ring->ptr_mask; 64 - ring->count_dw--; 65 - ring->ring_free_dw--; 66 - } 67 - 68 - /** 69 48 * radeon_ring_supports_scratch_reg - check if the ring supports 70 49 * writing to scratch registers 71 50 *
-12
include/drm/drmP.h
··· 140 140 /** \name Begin the DRM... */ 141 141 /*@{*/ 142 142 143 - #define DRM_DEBUG_CODE 2 /**< Include debugging code if > 1, then 144 - also include looping detection. */ 145 - 146 143 #define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ 147 144 148 145 /*@}*/ ··· 185 188 * \param fmt printf() like format string. 186 189 * \param arg arguments 187 190 */ 188 - #if DRM_DEBUG_CODE 189 191 #define DRM_DEBUG(fmt, args...) \ 190 192 do { \ 191 193 if (unlikely(drm_debug & DRM_UT_CORE)) \ ··· 206 210 if (unlikely(drm_debug & DRM_UT_PRIME)) \ 207 211 drm_ut_debug_printk(__func__, fmt, ##args); \ 208 212 } while (0) 209 - #else 210 - #define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) 211 - #define DRM_DEBUG_KMS(fmt, args...) do { } while (0) 212 - #define DRM_DEBUG_PRIME(fmt, args...) do { } while (0) 213 - #define DRM_DEBUG(fmt, arg...) do { } while (0) 214 - #endif 215 213 216 214 /*@}*/ 217 215 ··· 1338 1348 void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); 1339 1349 void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf); 1340 1350 1341 - #if DRM_DEBUG_CODE 1342 1351 extern int drm_vma_info(struct seq_file *m, void *data); 1343 - #endif 1344 1352 1345 1353 /* Scatter Gather Support (drm_scatter.h) */ 1346 1354 extern void drm_legacy_sg_cleanup(struct drm_device *dev);