mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
freedreno/decode: Add rnn_reginfo_free() helper
Simplify things a bit.. and fix a few places that just leaked the rnndecaddrinfo. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20456>
This commit is contained in:
parent
9feea4e7c0
commit
59f2748163
7 changed files with 18 additions and 12 deletions
|
|
@ -859,10 +859,7 @@ dump_register_val(uint32_t regbase, uint32_t dword, int level)
|
|||
printf("%s<%04x>: %08x\n", levels[level], regbase, dword);
|
||||
}
|
||||
|
||||
if (info) {
|
||||
free(info->name);
|
||||
free(info);
|
||||
}
|
||||
rnn_reginfo_free(info);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ dump_mem_pool_reg_write(unsigned reg, uint32_t data, unsigned context,
|
|||
printf("\t\t\t");
|
||||
dump_register(rnn_pipe, reg, data);
|
||||
}
|
||||
rnn_reginfo_free(info);
|
||||
} else {
|
||||
printf("\t\twrite %s (%05x) context %d\n", regname(reg, 1), reg, context);
|
||||
dump_register_val(reg, data, 2);
|
||||
|
|
|
|||
|
|
@ -469,6 +469,7 @@ dump_register(struct rnn *rnn, uint32_t offset, uint32_t value)
|
|||
} else {
|
||||
printf("<%04x>: %08x\n", offset, value);
|
||||
}
|
||||
rnn_reginfo_free(info);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -266,6 +266,8 @@ decompile_register(uint32_t regbase, uint32_t *dwords, uint16_t cnt, int level)
|
|||
printlvl(level, "pkt4(cs, %u, (%u), %u);\n", regbase, cnt, dword);
|
||||
}
|
||||
|
||||
rnn_reginfo_free(info);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,12 +144,22 @@ rnn_regname(struct rnn *rnn, uint32_t regbase, int color)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* call rnn_reginfo_free() to free the result */
|
||||
struct rnndecaddrinfo *
|
||||
rnn_reginfo(struct rnn *rnn, uint32_t regbase)
|
||||
{
|
||||
return rnndec_decodeaddr(rnn->vc, finddom(rnn, regbase), regbase, 0);
|
||||
}
|
||||
|
||||
void
|
||||
rnn_reginfo_free(struct rnndecaddrinfo *info)
|
||||
{
|
||||
if (!info)
|
||||
return;
|
||||
free(info->name);
|
||||
free(info);
|
||||
}
|
||||
|
||||
const char *
|
||||
rnn_enumname(struct rnn *rnn, const char *name, uint32_t val)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ void rnn_load(struct rnn *rnn, const char *gpuname);
|
|||
uint32_t rnn_regbase(struct rnn *rnn, const char *name);
|
||||
const char *rnn_regname(struct rnn *rnn, uint32_t regbase, int color);
|
||||
struct rnndecaddrinfo *rnn_reginfo(struct rnn *rnn, uint32_t regbase);
|
||||
void rnn_reginfo_free(struct rnndecaddrinfo *info);
|
||||
const char *rnn_enumname(struct rnn *rnn, const char *name, uint32_t val);
|
||||
|
||||
struct rnndelem *rnn_regelem(struct rnn *rnn, const char *name);
|
||||
|
|
|
|||
|
|
@ -393,10 +393,7 @@ l_rnn_reg_meta_tostring(lua_State *L)
|
|||
}
|
||||
lua_pushstring(L, decoded);
|
||||
free(decoded);
|
||||
if (info) {
|
||||
free(info->name);
|
||||
free(info);
|
||||
}
|
||||
rnn_reginfo_free(info);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -519,10 +516,7 @@ l_rnn_regval(lua_State *L)
|
|||
}
|
||||
lua_pushstring(L, decoded);
|
||||
free(decoded);
|
||||
if (info) {
|
||||
free(info->name);
|
||||
free(info);
|
||||
}
|
||||
rnn_reginfo_free(info);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue