From: Jordan Justen Date: Sat, 10 Feb 2018 02:48:18 +0000 (-0800) Subject: i965: Use gen_get_pci_device_id_override X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=843f6d187a2896386a6fb8c17daed378aefbdb91;p=mesa.git i965: Use gen_get_pci_device_id_override Signed-off-by: Jordan Justen Reviewed-by: Samuel Iglesias Gonsálvez Reviewed-by: Scott D Phillips --- diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 1f9b0efa42f..9e0c15bad21 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -2359,57 +2359,6 @@ shader_perf_log_mesa(void *data, const char *fmt, ...) va_end(args); } -static int -parse_devid_override(const char *devid_override) -{ - static const struct { - const char *name; - int pci_id; - } name_map[] = { - { "brw", 0x2a02 }, - { "g4x", 0x2a42 }, - { "ilk", 0x0042 }, - { "snb", 0x0126 }, - { "ivb", 0x016a }, - { "hsw", 0x0d2e }, - { "byt", 0x0f33 }, - { "bdw", 0x162e }, - { "chv", 0x22B3 }, - { "skl", 0x1912 }, - { "bxt", 0x5A85 }, - { "kbl", 0x5912 }, - { "glk", 0x3185 }, - { "cnl", 0x5a52 }, - }; - - for (unsigned i = 0; i < ARRAY_SIZE(name_map); i++) { - if (!strcmp(name_map[i].name, devid_override)) - return name_map[i].pci_id; - } - - return strtol(devid_override, NULL, 0); -} - -/** - * Get the PCI ID for the device. This can be overridden by setting the - * INTEL_DEVID_OVERRIDE environment variable to the desired ID. - * - * Returns -1 on ioctl failure. - */ -static int -get_pci_device_id(struct intel_screen *screen) -{ - if (geteuid() == getuid()) { - char *devid_override = getenv("INTEL_DEVID_OVERRIDE"); - if (devid_override) { - screen->no_hw = true; - return parse_devid_override(devid_override); - } - } - - return intel_get_integer(screen, I915_PARAM_CHIPSET_ID); -} - /** * This is the driver specific part of the createNewScreen entry point. * Called when using DRI2. @@ -2447,7 +2396,11 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen) screen->driScrnPriv = dri_screen; dri_screen->driverPrivate = (void *) screen; - screen->deviceID = get_pci_device_id(screen); + screen->deviceID = gen_get_pci_device_id_override(); + if (screen->deviceID < 0) + screen->deviceID = intel_get_integer(screen, I915_PARAM_CHIPSET_ID); + else + screen->no_hw = true; if (!gen_get_device_info(screen->deviceID, &screen->devinfo)) return NULL;