Re: [PATCH v2 2/3] lib/intel: add fd-based intel_gen/intel_graphics_ver via Xe query

Jani Nikula
2026-02-05T09:10:05Z

On Thu, 22 Jan 2026, Xin Wang <x.wang@intel.com> wrote:
> +/**
> + * intel_gen:
> + * @fd: DRM device file descriptor.
> + *
> + * Attempts to determine the graphics "generation" by querying the Xe driver for
> + * the main GT IP version major. If unavailable (e.g., not an Xe device or no IP
> + * version reported), falls back to retrieving the DRM device ID and mapping it
> + * to a legacy graphics version.
> + *
> + * Return: The graphics generation/major IP version for the device.
> + */
> +unsigned intel_gen(int fd)
> +{
> + uint16_t devid;
> + const struct drm_xe_gt* main_gt = xe_get_main_gt(fd);
> +
> + if (main_gt && main_gt->ip_ver_major)
> + return main_gt->ip_ver_major;
> +
> + devid = intel_get_drm_devid(fd);
> + return intel_gen_legacy(devid);
> +}

Why stick with the "gen" naming when the kernel side has completely
moved to "ver" naming?

Also, you won't get build failures if any remaining (or new one, racing
to get merged) call sites pass in devid to this.

BR,
Jani.

--
Jani Nikula, Intel