diff options
author | Rob Clark <[email protected]> | 2018-11-30 08:29:51 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2018-12-13 15:51:01 -0500 |
commit | 4cd016b5d6a8f3baeea8850deeb528d5febf4784 (patch) | |
tree | 47bf18bb1f67cd9c27e500549c6743649a17a8d7 /src/freedreno/drm/freedreno_drmif.h | |
parent | 7ef722861b691ce99be3827ed05f8c0ddf2cd66e (diff) |
freedreno: debug GEM obj names
With a recent enough kernel, set debug names for GEM BOs, which will
show up in $debugfs/gem
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/freedreno/drm/freedreno_drmif.h')
-rw-r--r-- | src/freedreno/drm/freedreno_drmif.h | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/freedreno/drm/freedreno_drmif.h b/src/freedreno/drm/freedreno_drmif.h index 27ca0a96f26..a53c3406950 100644 --- a/src/freedreno/drm/freedreno_drmif.h +++ b/src/freedreno/drm/freedreno_drmif.h @@ -29,6 +29,8 @@ #include <stdint.h> +#include "util/u_debug.h" + struct fd_bo; struct fd_pipe; struct fd_device; @@ -107,8 +109,44 @@ int fd_pipe_wait_timeout(struct fd_pipe *pipe, uint32_t timestamp, /* buffer-object functions: */ -struct fd_bo * fd_bo_new(struct fd_device *dev, +struct fd_bo * _fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags); +void _fd_bo_set_name(struct fd_bo *bo, const char *fmt, va_list ap); + +static inline void +fd_bo_set_name(struct fd_bo *bo, const char *fmt, ...) _util_printf_format(2, 3); + +static inline void +fd_bo_set_name(struct fd_bo *bo, const char *fmt, ...) +{ +#ifndef NDEBUG + va_list ap; + va_start(ap, fmt); + _fd_bo_set_name(bo, fmt, ap); + va_end(ap); +#endif +} + +static inline struct fd_bo * +fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags, + const char *fmt, ...) _util_printf_format(4, 5); + +static inline struct fd_bo * +fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags, + const char *fmt, ...) +{ + struct fd_bo *bo = _fd_bo_new(dev, size, flags); +#ifndef NDEBUG + if (fmt) { + va_list ap; + va_start(ap, fmt); + _fd_bo_set_name(bo, fmt, ap); + va_end(ap); + } +#endif + return bo; +} + struct fd_bo *fd_bo_from_handle(struct fd_device *dev, uint32_t handle, uint32_t size); struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name); |