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 <anarsoul@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3755>
This commit is contained in:
Qiang Yu 2020-02-10 16:09:31 +08:00 committed by Marge Bot
parent 5502bc83b0
commit 57d9a51d45
2 changed files with 10 additions and 7 deletions

View file

@ -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);

View file

@ -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