From 15db60fbbc7e4c659a933ebda7a18cb6f78c19ce Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Thu, 11 May 2023 13:28:58 +0200 Subject: [PATCH] freedreno/rnn: Fix addvariant being set effectively once Each time addvariant was added it was added to the end of ctx->vars list, without previous variant being removed. While the check for variant tests only the first one that has expected enum name. Fix this by updating `variant` instead of appending new one if variant with such enum already exists. Signed-off-by: Danylo Piliaiev Part-of: --- src/freedreno/rnn/rnndec.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/freedreno/rnn/rnndec.c b/src/freedreno/rnn/rnndec.c index 8bf230cc4bc..3829689c0ff 100644 --- a/src/freedreno/rnn/rnndec.c +++ b/src/freedreno/rnn/rnndec.c @@ -48,11 +48,7 @@ int rnndec_varadd(struct rnndeccontext *ctx, char *varset, const char *variant) int i, j; for (i = 0; i < en->valsnum; i++) if (!strcasecmp(en->vals[i]->name, variant)) { - struct rnndecvariant *ci = calloc (sizeof *ci, 1); - ci->en = en; - ci->variant = i; - ADDARRAY(ctx->vars, ci); - return 1; + break; } if (i == en->valsnum) { @@ -67,7 +63,7 @@ int rnndec_varadd(struct rnndeccontext *ctx, char *varset, const char *variant) } } - if (i == ctx->varsnum) { + if (j == ctx->varsnum) { struct rnndecvariant *ci = calloc (sizeof *ci, 1); ci->en = en; ci->variant = i;