diff options
author | Mark Janes <[email protected]> | 2019-07-24 13:48:03 -0700 |
---|---|---|
committer | Mark Janes <[email protected]> | 2019-08-01 16:39:44 -0700 |
commit | 96e1c945f2bc4047a603753ae10fc4f27754361c (patch) | |
tree | a930eef68d90d5ab13389d6e2beb5c339294fd7b /src/mesa/drivers/dri/i965/intel_screen.c | |
parent | 1186f6ea6947e779b99b87e48b8e5ac6d25b87bf (diff) |
i965: Move device info initialization to common code
With perf queries, initializing the device info is much more complex
than just getting a PCI ID and calling gen_get_device_info. This commit
adds a new gen_get_device_info_from_fd helper in common code which does
all of the requisite kernel queries to get device info including all of
the topology information.
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/intel_screen.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 36 |
1 files changed, 4 insertions, 32 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 2bc2e41178d..6c4d7c5be27 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -2413,28 +2413,6 @@ set_max_gl_versions(struct intel_screen *screen) } } -/** - * Return the revision (generally the revid field of the PCI header) of the - * graphics device. - */ -static int -intel_device_get_revision(int fd) -{ - struct drm_i915_getparam gp; - int revision; - int ret; - - memset(&gp, 0, sizeof(gp)); - gp.param = I915_PARAM_REVISION; - gp.value = &revision; - - ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp)); - if (ret) - revision = -1; - - return revision; -} - static void shader_debug_log_mesa(void *data, const char *fmt, ...) { @@ -2513,22 +2491,16 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen) screen->driScrnPriv = dri_screen; dri_screen->driverPrivate = (void *) 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)) + if (!gen_get_device_info_from_fd(dri_screen->fd, &screen->devinfo)) return NULL; - screen->devinfo.revision = intel_device_get_revision(dri_screen->fd); + const struct gen_device_info *devinfo = &screen->devinfo; + screen->deviceID = devinfo->chipset_id; + screen->no_hw = devinfo->no_hw; if (!intel_init_bufmgr(screen)) return NULL; - const struct gen_device_info *devinfo = &screen->devinfo; - brw_process_intel_debug_variable(); if ((INTEL_DEBUG & DEBUG_SHADER_TIME) && devinfo->gen < 7) { |