freedreno/rnn: Make rnn_decode_enum() respect variants
We'll need this for afuc, and we're currently also open-coding the same thing in rnnutils. It seems this function was added to decode pm4 packet names, but it currently has no users, so make it useful for what it was intended to do. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6140>
This commit is contained in:
parent
b67695d597
commit
73241ca53e
|
@ -137,14 +137,11 @@ static const char *rnndec_decode_enum_val(struct rnndeccontext *ctx,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
char *rnndec_decode_enum(struct rnndeccontext *ctx, const char *enumname, uint64_t enumval)
|
||||
const char *rnndec_decode_enum(struct rnndeccontext *ctx, const char *enumname, uint64_t enumval)
|
||||
{
|
||||
struct rnnenum *en = rnn_findenum (ctx->db, enumname);
|
||||
if (en) {
|
||||
int i;
|
||||
for (i = 0; i < en->valsnum; i++)
|
||||
if (en->vals[i]->valvalid && en->vals[i]->value == enumval)
|
||||
return en->vals[i]->name;
|
||||
return rnndec_decode_enum_val(ctx, en->vals, en->valsnum, enumval);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ struct rnndecaddrinfo {
|
|||
struct rnndeccontext *rnndec_newcontext(struct rnndb *db);
|
||||
int rnndec_varadd(struct rnndeccontext *ctx, char *varset, const char *variant);
|
||||
int rnndec_varmatch(struct rnndeccontext *ctx, struct rnnvarinfo *vi);
|
||||
char *rnndec_decode_enum(struct rnndeccontext *ctx, const char *enumname, uint64_t enumval);
|
||||
const char *rnndec_decode_enum(struct rnndeccontext *ctx, const char *enumname, uint64_t enumval);
|
||||
char *rnndec_decodeval(struct rnndeccontext *ctx, struct rnntypeinfo *ti, uint64_t value);
|
||||
int rnndec_checkaddr(struct rnndeccontext *ctx, struct rnndomain *domain, uint64_t addr, int write);
|
||||
struct rnndecaddrinfo *rnndec_decodeaddr(struct rnndeccontext *ctx, struct rnndomain *domain, uint64_t addr, int write);
|
||||
|
|
Loading…
Reference in New Issue