summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQiang Yu <[email protected]>2020-02-10 16:09:31 +0800
committerMarge Bot <[email protected]>2020-02-17 02:54:15 +0000
commit57d9a51d455900946f3eac18b8d1d77cb03b972c (patch)
treef3daa84e93b2b7b059ed3c65e74d831befe54c67 /src
parent5502bc83b0e4d4542bc5234fe6592db575658356 (diff)
lima: move dump check to macro for lima_dump_command_stream_print
This can prevent the execution of some function like lima_ctx_buff_va which is passed in as parameter when no dump case. Reviewed-by: Vasily Khoruzhick <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/lima/lima_util.c7
-rw-r--r--src/gallium/drivers/lima/lima_util.h10
2 files changed, 10 insertions, 7 deletions
diff --git a/src/gallium/drivers/lima/lima_util.c b/src/gallium/drivers/lima/lima_util.c
index 4ad88f5829a..dca9307c991 100644
--- a/src/gallium/drivers/lima/lima_util.c
+++ b/src/gallium/drivers/lima/lima_util.c
@@ -165,12 +165,9 @@ lima_dump_free(struct lima_dump *dump)
}
void
-lima_dump_command_stream_print(struct lima_dump *dump, void *data,
- int size, bool is_float, const char *fmt, ...)
+_lima_dump_command_stream_print(struct lima_dump *dump, void *data,
+ int size, bool is_float, const char *fmt, ...)
{
- if (!dump)
- return;
-
va_list ap;
va_start(ap, fmt);
vfprintf(dump->fp, fmt, ap);
diff --git a/src/gallium/drivers/lima/lima_util.h b/src/gallium/drivers/lima/lima_util.h
index 30c97d2f872..3749523f3a1 100644
--- a/src/gallium/drivers/lima/lima_util.h
+++ b/src/gallium/drivers/lima/lima_util.h
@@ -45,7 +45,13 @@ void lima_dump_rsw_command_stream_print(struct lima_dump *dump, void *data,
int size, uint32_t start);
void lima_dump_texture_descriptor(struct lima_dump *dump, void *data,
int size, uint32_t start, uint32_t offset);
-void lima_dump_command_stream_print(struct lima_dump *dump, void *data,
- int size, bool is_float, const char *fmt, ...);
+
+void _lima_dump_command_stream_print(struct lima_dump *dump, void *data,
+ int size, bool is_float, const char *fmt, ...);
+#define lima_dump_command_stream_print(dump, ...) \
+ do { \
+ if (dump) \
+ _lima_dump_command_stream_print(dump, __VA_ARGS__); \
+ } while (0)
#endif