From 32010d985c4a66c3fed103b6f8d4e4ac60291d1f Mon Sep 17 00:00:00 2001 From: Max Lee Date: Thu, 5 Jan 2023 09:52:40 +1100 Subject: [PATCH] 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 Part-of: --- src/intel/tools/intel_noop_drm_shim.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/intel/tools/intel_noop_drm_shim.c b/src/intel/tools/intel_noop_drm_shim.c index 3f2a5a4379a..a61e0cbfcef 100644 --- a/src/intel/tools/intel_noop_drm_shim.c +++ b/src/intel/tools/intel_noop_drm_shim.c @@ -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;