* [PATCH i-g-t 1/4] tools/intel_vbt_decode: store codename from VBT signature to context
2026-06-12 11:00 [PATCH i-g-t 0/4] intel_vbt_decode: fall back to guessing PCI ID from VBT signature Jani Nikula
@ 2026-06-12 11:00 ` Jani Nikula
2026-06-12 11:00 ` [PATCH i-g-t 2/4] lib/intel_device_info: add a helper to guess the PCI ID for a codename Jani Nikula
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2026-06-12 11:00 UTC (permalink / raw)
To: igt-dev, Michał Grzelak; +Cc: ville.syrjala, jani.nikula
The VBT often contains something resembling a codename in the
signature. Currently, we only use it for printing a description of sorts
(the --describe option). Store the codename-ish to context for more use.
Cc: Michał Grzelak <michal.grzelak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tools/intel_vbt_decode.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index cf7bcc5771a4..5b39e0c1c33e 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -74,6 +74,8 @@ struct context {
const struct bdb_header *bdb;
int size;
+ char codename[sizeof(((struct vbt_header *)0)->signature) + 1];
+
uint32_t devid;
int panel_type, panel_type2;
int sdvo_panel_type;
@@ -4023,31 +4025,38 @@ static bool dump_section(struct context *context, int section_id)
return true;
}
-/* print a description of the VBT of the form <bdb-version>-<vbt-signature> */
-static void print_description(struct context *context)
+/* initialize something resembling a codename based on the signature */
+static void init_codename(struct context *context)
{
const struct vbt_header *vbt = context->vbt;
- const struct bdb_header *bdb = context->bdb;
- char *desc = strndup((char *)vbt->signature, sizeof(vbt->signature));
+ char signature[sizeof(vbt->signature) + 1] = {};
char *p;
- for (p = desc + strlen(desc) - 1; p >= desc && isspace(*p); p--)
+ memcpy(signature, vbt->signature, sizeof(vbt->signature));
+
+ for (p = signature + strlen(signature) - 1; p >= signature && isspace(*p); p--)
*p = '\0';
- for (p = desc; *p; p++) {
+ for (p = signature; *p; p++) {
if (!isalnum(*p))
*p = '-';
else
*p = tolower(*p);
}
- p = desc;
+ p = signature;
if (strncmp(p, "-vbt-", 5) == 0)
p += 5;
- printf("%d-%s\n", bdb->version, p);
+ strncpy(context->codename, p, sizeof(context->codename));
+}
+
+/* print a description of the VBT of the form <bdb-version>-<vbt-signature> */
+static void print_description(struct context *context)
+{
+ const struct bdb_header *bdb = context->bdb;
- free (desc);
+ printf("%d-%s\n", bdb->version, context->codename);
}
static void dump_headers(struct context *context)
@@ -4313,6 +4322,8 @@ int main(int argc, char **argv)
context.bdb = (const struct bdb_header *)(VBIOS + bdb_off);
context.size = size;
+ init_codename(&context);
+
if (!context.devid) {
const char *devid_string = getenv("DEVICE");
if (devid_string)
--
2.47.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH i-g-t 2/4] lib/intel_device_info: add a helper to guess the PCI ID for a codename
2026-06-12 11:00 [PATCH i-g-t 0/4] intel_vbt_decode: fall back to guessing PCI ID from VBT signature Jani Nikula
2026-06-12 11:00 ` [PATCH i-g-t 1/4] tools/intel_vbt_decode: store codename from VBT signature to context Jani Nikula
@ 2026-06-12 11:00 ` Jani Nikula
2026-06-12 14:16 ` Kamil Konieczny
2026-06-12 11:00 ` [PATCH i-g-t 3/4] tools/vbt_decode: return 0 from get_device_id() Jani Nikula
` (3 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Jani Nikula @ 2026-06-12 11:00 UTC (permalink / raw)
To: igt-dev, Michał Grzelak; +Cc: ville.syrjala, jani.nikula
The struct intel_device_info contains the codenames for the
corresponding PCI device IDs. Add a reverse lookup to get a PCI ID for a
codename.
It's a bit fuzzy, though. The codenames aren't always spelled the same,
there are suffixes sometimes omitted, and you can only pick one of the
matching PCI IDs. Name the helper intel_guess_device_id() to emphasize
the point, and try increasing fuzziness in the matching to find an
appropriate struct intel_device_info.
There's nothing exact about this, and it should not be considered as
such. But it will be useful in VBT parsing.
Cc: Michał Grzelak <michal.grzelak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
lib/intel_chipset.h | 1 +
lib/intel_device_info.c | 75 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 76 insertions(+)
diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
index 3fcc5b18d648..98a2a81fcffd 100644
--- a/lib/intel_chipset.h
+++ b/lib/intel_chipset.h
@@ -103,6 +103,7 @@ struct intel_device_info {
};
const struct intel_device_info *intel_get_device_info(uint16_t devid) __attribute__((pure));
+uint16_t intel_guess_device_id(const char *codenameish) __attribute__((pure));
const struct intel_cmds_info *intel_get_cmds_info(uint16_t devid) __attribute__((pure));
unsigned intel_gen(uint16_t devid) __attribute__((pure));
diff --git a/lib/intel_device_info.c b/lib/intel_device_info.c
index da0b9f398885..3b5373265000 100644
--- a/lib/intel_device_info.c
+++ b/lib/intel_device_info.c
@@ -3,6 +3,7 @@
#include "i915_pciids_local.h"
#include <strings.h> /* ffs() */
+#include <ctype.h>
static const struct intel_device_info intel_generic_info = {
.graphics_ver = 0,
@@ -746,6 +747,80 @@ out:
return cache;
}
+static bool char_eq(char c1, char c2)
+{
+ c1 = isalnum(c1) ? tolower(c1) : '-';
+ c2 = isalnum(c2) ? tolower(c2) : '-';
+
+ return c1 == c2;
+}
+
+/*
+ * Return true if the codenames s1 and s2 match, with fuzziness.
+ *
+ * Case insensitive matching, ignoring differences in non-alnum characters. With
+ * non-zero fuzziness, accept matches up to the first non-alnum character.
+ */
+static bool codename_match(const char *s1, const char *s2, int fuzziness)
+{
+ while (*s1 && *s2 && char_eq(*s1, *s2)) {
+ s1++;
+ s2++;
+ }
+
+ /* full match */
+ if (!*s1 && !*s2)
+ return true;
+
+ /* sub-string match up to a non-alnum char */
+ if (fuzziness >=1) {
+ if (!*s1 && !isalnum(*s2))
+ return true;
+ if (!*s2 && !isalnum(*s1))
+ return true;
+ }
+
+ return false;
+}
+
+static uint16_t lookup_device_id(const char *codename, int fuzziness)
+{
+ int i;
+
+ for (i = 0; intel_device_match[i].device_id != PCI_MATCH_ANY; i++) {
+ const struct intel_device_info *info = (void *)intel_device_match[i].match_data;
+
+ if (codename_match(info->codename, codename, fuzziness))
+ return intel_device_match[i].device_id;
+ }
+
+ return 0;
+}
+
+/**
+ * intel_guess_device_id:
+ * @codenameish: something resembling a codename
+ *
+ * Based on something resembling a codename, try to fuzzy find the first PCI
+ * device ID matching the codename.
+ *
+ * Returns:
+ * PCI device ID fuzzy matching the @codenameish, or 0 if no match was found.
+ */
+uint16_t intel_guess_device_id(const char *codenameish)
+{
+ uint16_t devid;
+ int fuzziness;
+
+ for (fuzziness = 0; fuzziness < 2; fuzziness++) {
+ devid = lookup_device_id(codenameish, fuzziness);
+ if (devid)
+ return devid;
+ }
+
+ return 0;
+}
+
/**
* intel_get_cmds_info:
* @devid: pci device id
--
2.47.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH i-g-t 2/4] lib/intel_device_info: add a helper to guess the PCI ID for a codename
2026-06-12 11:00 ` [PATCH i-g-t 2/4] lib/intel_device_info: add a helper to guess the PCI ID for a codename Jani Nikula
@ 2026-06-12 14:16 ` Kamil Konieczny
0 siblings, 0 replies; 9+ messages in thread
From: Kamil Konieczny @ 2026-06-12 14:16 UTC (permalink / raw)
To: Jani Nikula; +Cc: igt-dev, Michał Grzelak, ville.syrjala
Hi Jani,
On 2026-06-12 at 14:00:42 +0300, Jani Nikula wrote:
> The struct intel_device_info contains the codenames for the
> corresponding PCI device IDs. Add a reverse lookup to get a PCI ID for a
> codename.
>
> It's a bit fuzzy, though. The codenames aren't always spelled the same,
> there are suffixes sometimes omitted, and you can only pick one of the
> matching PCI IDs. Name the helper intel_guess_device_id() to emphasize
> the point, and try increasing fuzziness in the matching to find an
> appropriate struct intel_device_info.
>
> There's nothing exact about this, and it should not be considered as
> such. But it will be useful in VBT parsing.
>
> Cc: Michał Grzelak <michal.grzelak@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> lib/intel_chipset.h | 1 +
> lib/intel_device_info.c | 75 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 76 insertions(+)
>
> diff --git a/lib/intel_chipset.h b/lib/intel_chipset.h
> index 3fcc5b18d648..98a2a81fcffd 100644
> --- a/lib/intel_chipset.h
> +++ b/lib/intel_chipset.h
> @@ -103,6 +103,7 @@ struct intel_device_info {
> };
>
> const struct intel_device_info *intel_get_device_info(uint16_t devid) __attribute__((pure));
> +uint16_t intel_guess_device_id(const char *codenameish) __attribute__((pure));
>
> const struct intel_cmds_info *intel_get_cmds_info(uint16_t devid) __attribute__((pure));
> unsigned intel_gen(uint16_t devid) __attribute__((pure));
> diff --git a/lib/intel_device_info.c b/lib/intel_device_info.c
> index da0b9f398885..3b5373265000 100644
> --- a/lib/intel_device_info.c
> +++ b/lib/intel_device_info.c
> @@ -3,6 +3,7 @@
> #include "i915_pciids_local.h"
>
> #include <strings.h> /* ffs() */
> +#include <ctype.h>
Move it before strings.h, keep alphabetical order.
Also, all system headers should be before igt ones.
Regards,
Kamil
[cut]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH i-g-t 3/4] tools/vbt_decode: return 0 from get_device_id()
2026-06-12 11:00 [PATCH i-g-t 0/4] intel_vbt_decode: fall back to guessing PCI ID from VBT signature Jani Nikula
2026-06-12 11:00 ` [PATCH i-g-t 1/4] tools/intel_vbt_decode: store codename from VBT signature to context Jani Nikula
2026-06-12 11:00 ` [PATCH i-g-t 2/4] lib/intel_device_info: add a helper to guess the PCI ID for a codename Jani Nikula
@ 2026-06-12 11:00 ` Jani Nikula
2026-06-12 14:13 ` Kamil Konieczny
2026-06-12 11:00 ` [PATCH i-g-t 4/4] tools/intel_vbt_decode: fall back to guessing PCI ID from VBT signature Jani Nikula
` (2 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Jani Nikula @ 2026-06-12 11:00 UTC (permalink / raw)
To: igt-dev, Michał Grzelak; +Cc: ville.syrjala, jani.nikula
From: Michał Grzelak <michal.grzelak@intel.com>
This function returns -1 on errors and the caller checks for 0. This
leads to -1 being used as the device id. Return 0 instead of -1.
Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tools/intel_vbt_decode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 5b39e0c1c33e..69961ce29e01 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -3702,13 +3702,13 @@ get_device_id(unsigned char *bios, int size)
int offset = (bios[0x19] << 8) + bios[0x18];
if (offset + 7 >= size)
- return -1;
+ return 0;
if (bios[offset] != 'P' ||
bios[offset+1] != 'C' ||
bios[offset+2] != 'I' ||
bios[offset+3] != 'R')
- return -1;
+ return 0;
device = (bios[offset+7] << 8) + bios[offset+6];
--
2.47.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH i-g-t 3/4] tools/vbt_decode: return 0 from get_device_id()
2026-06-12 11:00 ` [PATCH i-g-t 3/4] tools/vbt_decode: return 0 from get_device_id() Jani Nikula
@ 2026-06-12 14:13 ` Kamil Konieczny
0 siblings, 0 replies; 9+ messages in thread
From: Kamil Konieczny @ 2026-06-12 14:13 UTC (permalink / raw)
To: Jani Nikula; +Cc: igt-dev, Michał Grzelak, ville.syrjala
Hi Jani,
On 2026-06-12 at 14:00:43 +0300, Jani Nikula wrote:
> From: Michał Grzelak <michal.grzelak@intel.com>
>
> This function returns -1 on errors and the caller checks for 0. This
> leads to -1 being used as the device id. Return 0 instead of -1.
>
LGTM
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> tools/intel_vbt_decode.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
> index 5b39e0c1c33e..69961ce29e01 100644
> --- a/tools/intel_vbt_decode.c
> +++ b/tools/intel_vbt_decode.c
> @@ -3702,13 +3702,13 @@ get_device_id(unsigned char *bios, int size)
> int offset = (bios[0x19] << 8) + bios[0x18];
btw do we need a function for this?
like bios_u32(bios, offset) or lowend_u32(p, off)
Regards,
Kamil
>
> if (offset + 7 >= size)
> - return -1;
> + return 0;
>
> if (bios[offset] != 'P' ||
> bios[offset+1] != 'C' ||
> bios[offset+2] != 'I' ||
> bios[offset+3] != 'R')
> - return -1;
> + return 0;
>
> device = (bios[offset+7] << 8) + bios[offset+6];
>
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH i-g-t 4/4] tools/intel_vbt_decode: fall back to guessing PCI ID from VBT signature
2026-06-12 11:00 [PATCH i-g-t 0/4] intel_vbt_decode: fall back to guessing PCI ID from VBT signature Jani Nikula
` (2 preceding siblings ...)
2026-06-12 11:00 ` [PATCH i-g-t 3/4] tools/vbt_decode: return 0 from get_device_id() Jani Nikula
@ 2026-06-12 11:00 ` Jani Nikula
2026-06-12 11:45 ` ✓ Xe.CI.BAT: success for intel_vbt_decode: " Patchwork
2026-06-12 11:56 ` ✓ i915.CI.BAT: " Patchwork
5 siblings, 0 replies; 9+ messages in thread
From: Jani Nikula @ 2026-06-12 11:00 UTC (permalink / raw)
To: igt-dev, Michał Grzelak; +Cc: ville.syrjala, jani.nikula
If the PCI ID wasn't passed on the command-line, DEVICE environment
variable, or VBIOS, fall back to guessing the device ID from the VBT
signature.
Cc: Michał Grzelak <michal.grzelak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tools/intel_vbt_decode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/intel_vbt_decode.c b/tools/intel_vbt_decode.c
index 69961ce29e01..9451a77318ae 100644
--- a/tools/intel_vbt_decode.c
+++ b/tools/intel_vbt_decode.c
@@ -4331,6 +4331,8 @@ int main(int argc, char **argv)
}
if (!context.devid)
context.devid = get_device_id(VBIOS, size);
+ if (!context.devid)
+ context.devid = intel_guess_device_id(context.codename);
if (!context.devid)
fprintf(stderr, "Warning: could not find PCI device ID!\n");
--
2.47.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* ✓ Xe.CI.BAT: success for intel_vbt_decode: fall back to guessing PCI ID from VBT signature
2026-06-12 11:00 [PATCH i-g-t 0/4] intel_vbt_decode: fall back to guessing PCI ID from VBT signature Jani Nikula
` (3 preceding siblings ...)
2026-06-12 11:00 ` [PATCH i-g-t 4/4] tools/intel_vbt_decode: fall back to guessing PCI ID from VBT signature Jani Nikula
@ 2026-06-12 11:45 ` Patchwork
2026-06-12 11:56 ` ✓ i915.CI.BAT: " Patchwork
5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2026-06-12 11:45 UTC (permalink / raw)
To: Jani Nikula; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]
== Series Details ==
Series: intel_vbt_decode: fall back to guessing PCI ID from VBT signature
URL : https://patchwork.freedesktop.org/series/168428/
State : success
== Summary ==
CI Bug Log - changes from XEIGT_8960_BAT -> XEIGTPW_15357_BAT
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Participating hosts (13 -> 12)
------------------------------
Missing (1): bat-lnl-2
Changes
-------
No changes found
Build changes
-------------
* IGT: IGT_8960 -> IGTPW_15357
* Linux: xe-5244-311cbada9202146752938f54503d33980ee4f3f6 -> xe-5246-9ce63e3d9903982c053b125686abcb7a84357ed4
IGTPW_15357: 15357
IGT_8960: 88bd725754990332efcd158b0429f6ac7fb63862 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
xe-5244-311cbada9202146752938f54503d33980ee4f3f6: 311cbada9202146752938f54503d33980ee4f3f6
xe-5246-9ce63e3d9903982c053b125686abcb7a84357ed4: 9ce63e3d9903982c053b125686abcb7a84357ed4
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_15357/index.html
[-- Attachment #2: Type: text/html, Size: 1643 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* ✓ i915.CI.BAT: success for intel_vbt_decode: fall back to guessing PCI ID from VBT signature
2026-06-12 11:00 [PATCH i-g-t 0/4] intel_vbt_decode: fall back to guessing PCI ID from VBT signature Jani Nikula
` (4 preceding siblings ...)
2026-06-12 11:45 ` ✓ Xe.CI.BAT: success for intel_vbt_decode: " Patchwork
@ 2026-06-12 11:56 ` Patchwork
5 siblings, 0 replies; 9+ messages in thread
From: Patchwork @ 2026-06-12 11:56 UTC (permalink / raw)
To: Jani Nikula; +Cc: igt-dev
[-- Attachment #1: Type: text/plain, Size: 1691 bytes --]
== Series Details ==
Series: intel_vbt_decode: fall back to guessing PCI ID from VBT signature
URL : https://patchwork.freedesktop.org/series/168428/
State : success
== Summary ==
CI Bug Log - changes from IGT_8960 -> IGTPW_15357
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15357/index.html
Participating hosts (42 -> 39)
------------------------------
Missing (3): bat-dg2-13 fi-glk-j4005 fi-snb-2520m
Known issues
------------
Here are the changes found in IGTPW_15357 that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@kms_hdmi_inject@inject-audio:
- fi-tgl-1115g4: [FAIL][1] ([i915#16115]) -> [PASS][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8960/fi-tgl-1115g4/igt@kms_hdmi_inject@inject-audio.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15357/fi-tgl-1115g4/igt@kms_hdmi_inject@inject-audio.html
[i915#16115]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/16115
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_8960 -> IGTPW_15357
* Linux: CI_DRM_18667 -> CI_DRM_18668
CI-20190529: 20190529
CI_DRM_18667: d931e7b381f9d86766f3a971a9376e4312745af8 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_18668: 9ce63e3d9903982c053b125686abcb7a84357ed4 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_15357: 15357
IGT_8960: 88bd725754990332efcd158b0429f6ac7fb63862 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_15357/index.html
[-- Attachment #2: Type: text/html, Size: 2291 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread