From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: [PATCH] intel: Do not assert on unknown chips in drm_intel_decode_context_alloc
Date: Wed, 18 Nov 2020 16:36:01 +0000 [thread overview]
Message-ID: <20201118163601.958254-1-tvrtko.ursulin@linux.intel.com> (raw)
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
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>
---
intel/intel_decode.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/intel/intel_decode.c b/intel/intel_decode.c
index e0a516644314..be6f77984d65 100644
--- a/intel/intel_decode.c
+++ b/intel/intel_decode.c
@@ -3815,32 +3815,35 @@ drm_public struct drm_intel_decode *
drm_intel_decode_context_alloc(uint32_t devid)
{
struct drm_intel_decode *ctx;
+ int gen = 0;
- ctx = calloc(1, sizeof(struct drm_intel_decode));
- if (!ctx)
- return NULL;
-
- ctx->devid = devid;
- ctx->out = stdout;
-
- if (intel_get_genx(devid, &ctx->gen))
+ if (intel_get_genx(devid, &gen))
;
else if (IS_GEN8(devid))
- ctx->gen = 8;
+ gen = 8;
else if (IS_GEN7(devid))
- ctx->gen = 7;
+ gen = 7;
else if (IS_GEN6(devid))
- ctx->gen = 6;
+ gen = 6;
else if (IS_GEN5(devid))
- ctx->gen = 5;
+ gen = 5;
else if (IS_GEN4(devid))
- ctx->gen = 4;
+ gen = 4;
else if (IS_9XX(devid))
- ctx->gen = 3;
- else {
- assert(IS_GEN2(devid));
- ctx->gen = 2;
- }
+ gen = 3;
+ else if (IS_GEN2(devid))
+ gen = 2;
+
+ if (!gen)
+ return NULL;
+
+ ctx = calloc(1, sizeof(struct drm_intel_decode));
+ if (!ctx)
+ return NULL;
+
+ ctx->devid = devid;
+ ctx->gen = gen;
+ ctx->out = stdout;
return ctx;
}
--
2.25.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2020-11-18 16:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-18 16:36 Tvrtko Ursulin [this message]
2020-11-18 17:04 ` [PATCH] intel: Do not assert on unknown chips in drm_intel_decode_context_alloc Chris Wilson
2020-11-19 13:42 ` Tvrtko Ursulin
2020-11-19 13:52 ` Chris Wilson
2020-11-19 13:58 ` Tvrtko Ursulin
2021-06-17 9:20 ` Tvrtko Ursulin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201118163601.958254-1-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=tvrtko.ursulin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox