intel_noop_drm_shim: add ability to specify device id

Given a GPU platform, there are multiple device ids. This commit
adds ability to specify device id for the shim, instead of using
one of the hard-coded device ids per platform.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20526>
This commit is contained in:
Max Lee
2023-01-05 09:52:40 +11:00
committed by Marge Bot
parent a2252adde8
commit 32010d985c

View File

@@ -526,10 +526,18 @@ static ioctl_fn_t driver_ioctls[] = {
void
drm_shim_driver_init(void)
{
const char *user_platform = getenv("INTEL_STUB_GPU_PLATFORM");
i915.device_id = 0;
const char *device_id_str = getenv("INTEL_STUB_GPU_DEVICE_ID");
if (device_id_str != NULL) {
/* Set as 0 if strtoul fails */
i915.device_id = strtoul(device_id_str, NULL, 16);
}
if (i915.device_id == 0) {
const char *user_platform = getenv("INTEL_STUB_GPU_PLATFORM");
/* Use SKL if nothing is specified. */
i915.device_id = intel_device_name_to_pci_device_id(user_platform ?: "skl");
}
/* Use SKL if nothing is specified. */
i915.device_id = intel_device_name_to_pci_device_id(user_platform ?: "skl");
if (!intel_get_device_info_from_pci_id(i915.device_id, &i915.devinfo))
return;