mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-30 07:10:27 +01:00
freedreno: move redump.h to common code + cleanup
remove the unused parts and add an implementation of rd_write_section Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25246>
This commit is contained in:
parent
8512972787
commit
d35922ce26
4 changed files with 19 additions and 37 deletions
|
|
@ -43,6 +43,7 @@ libfreedreno_common = static_library(
|
|||
'freedreno_guardband.h',
|
||||
freedreno_devices_h,
|
||||
sha1_h,
|
||||
'redump.h'
|
||||
],
|
||||
include_directories : [inc_freedreno, inc_include, inc_src],
|
||||
c_args : [no_override_init_args],
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef REDUMP_H_
|
||||
#define REDUMP_H_
|
||||
|
||||
#include "util/u_math.h"
|
||||
#include <unistd.h>
|
||||
|
||||
enum rd_sect_type {
|
||||
RD_NONE,
|
||||
|
|
@ -60,31 +60,12 @@ enum rd_param_type {
|
|||
RD_PARAM_BLIT_Y2, /* BLIT_Y + BLIT_WIDTH */
|
||||
};
|
||||
|
||||
void rd_start(const char *name, const char *fmt, ...) __attribute__((weak));
|
||||
void rd_end(void) __attribute__((weak));
|
||||
void rd_write_section(enum rd_sect_type type, const void *buf, int sz)
|
||||
__attribute__((weak));
|
||||
|
||||
/* for code that should run with and without libwrap, use the following
|
||||
* macros which check if the fxns are present before calling
|
||||
*/
|
||||
#define RD_START(n, f, ...) \
|
||||
do { \
|
||||
if (rd_start) \
|
||||
rd_start(n, f, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define RD_END() \
|
||||
do { \
|
||||
if (rd_end) \
|
||||
rd_end(); \
|
||||
} while (0)
|
||||
#define RD_WRITE_SECTION(t, b, s) \
|
||||
do { \
|
||||
if (rd_write_section) \
|
||||
rd_write_section(t, b, s); \
|
||||
} while (0)
|
||||
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
static inline void
|
||||
rd_write_section(int fd, enum rd_sect_type type, const void *buf, int sz)
|
||||
{
|
||||
write(fd, &type, 4);
|
||||
write(fd, &sz, 4);
|
||||
write(fd, buf, sz);
|
||||
}
|
||||
|
||||
#endif /* REDUMP_H_ */
|
||||
|
|
@ -448,7 +448,7 @@ disasm_gpuaddr(const char *name, uint64_t gpuaddr, int level)
|
|||
uint32_t sizedwords = hostlen(gpuaddr) / 4;
|
||||
const char *ext;
|
||||
|
||||
dump_hex(buf, min(64, sizedwords), level + 1);
|
||||
dump_hex(buf, MIN2(64, sizedwords), level + 1);
|
||||
try_disasm_a3xx(buf, sizedwords, level + 2, stdout, options->info->chip * 100);
|
||||
|
||||
/* this is a bit ugly way, but oh well.. */
|
||||
|
|
@ -1835,11 +1835,11 @@ dump_a2xx_shader_const(uint32_t *dwords, uint32_t sizedwords, uint32_t val,
|
|||
size, fmt);
|
||||
// TODO maybe dump these as bytes instead of dwords?
|
||||
size = (size + 3) / 4; // for now convert to dwords
|
||||
dump_hex(addr, min(size, 64), level + 1);
|
||||
if (size > min(size, 64))
|
||||
dump_hex(addr, MIN2(size, 64), level + 1);
|
||||
if (size > MIN2(size, 64))
|
||||
printf("%s\t\t...\n", levels[level + 1]);
|
||||
dump_float(addr, min(size, 64), level + 1);
|
||||
if (size > min(size, 64))
|
||||
dump_float(addr, MIN2(size, 64), level + 1);
|
||||
if (size > MIN2(size, 64))
|
||||
printf("%s\t\t...\n", levels[level + 1]);
|
||||
}
|
||||
}
|
||||
|
|
@ -2179,13 +2179,13 @@ cp_draw_indirect_multi(uint32_t *dwords, uint32_t sizedwords, int level)
|
|||
printf("%sindirect count: %u\n", levels[level], *buf);
|
||||
if (*buf == 0 || *buf > max_indirect_draw_count) {
|
||||
/* garbage value */
|
||||
count = min(count, max_draw_count);
|
||||
count = MIN2(count, max_draw_count);
|
||||
} else {
|
||||
/* not garbage */
|
||||
count = min(count, *buf);
|
||||
count = MIN2(count, *buf);
|
||||
}
|
||||
} else {
|
||||
count = min(count, max_draw_count);
|
||||
count = MIN2(count, max_draw_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "freedreno/decode/redump.h"
|
||||
#include "redump.h"
|
||||
|
||||
#include "util/u_math.h"
|
||||
|
||||
|
|
@ -378,4 +378,4 @@ gpu_print(struct replay_context *ctx, struct cmdstream *_cs, uint64_t iova,
|
|||
}
|
||||
|
||||
end_ib();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue