intel: Do not assert on unknown chips in drm_intel_decode_context_alloc

There is this long standing nit of igt/tools/intel_error_decode asserting
when you feed it an error state from a GPU the local libdrm does not know
of.

To fix this I need a tweak in drm_intel_decode_context_alloc to make it
not assert but just return NULL (which seems an already possible return
value).

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
main
Tvrtko Ursulin 2020-11-18 16:31:26 +00:00 committed by Tvrtko Ursulin
parent 02dd464bf6
commit 122ff0e878
1 changed files with 22 additions and 19 deletions

View File

@ -3815,33 +3815,36 @@ drm_public struct drm_intel_decode *
drm_intel_decode_context_alloc(uint32_t devid) drm_intel_decode_context_alloc(uint32_t devid)
{ {
struct drm_intel_decode *ctx; struct drm_intel_decode *ctx;
int gen = 0;
if (intel_get_genx(devid, &gen))
;
else if (IS_GEN8(devid))
gen = 8;
else if (IS_GEN7(devid))
gen = 7;
else if (IS_GEN6(devid))
gen = 6;
else if (IS_GEN5(devid))
gen = 5;
else if (IS_GEN4(devid))
gen = 4;
else if (IS_9XX(devid))
gen = 3;
else if (IS_GEN2(devid))
gen = 2;
if (!gen)
return NULL;
ctx = calloc(1, sizeof(struct drm_intel_decode)); ctx = calloc(1, sizeof(struct drm_intel_decode));
if (!ctx) if (!ctx)
return NULL; return NULL;
ctx->devid = devid; ctx->devid = devid;
ctx->gen = gen;
ctx->out = stdout; ctx->out = stdout;
if (intel_get_genx(devid, &ctx->gen))
;
else if (IS_GEN8(devid))
ctx->gen = 8;
else if (IS_GEN7(devid))
ctx->gen = 7;
else if (IS_GEN6(devid))
ctx->gen = 6;
else if (IS_GEN5(devid))
ctx->gen = 5;
else if (IS_GEN4(devid))
ctx->gen = 4;
else if (IS_9XX(devid))
ctx->gen = 3;
else {
assert(IS_GEN2(devid));
ctx->gen = 2;
}
return ctx; return ctx;
} }