summaryrefslogtreecommitdiff
path: root/src/intel/intel_driver.c
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2014-12-25 16:22:42 +0800
committerZhigang Gong <zhigang.gong@intel.com>2014-12-29 09:44:23 +0800
commite2439a02ab8734cff7554521523ca93668754a57 (patch)
treeaec773f4527fa079a8010507cbe4a9e5cee3c7a0 /src/intel/intel_driver.c
parent796bb894082a3ffc48db37cfaf3bf4acfe3715df (diff)
Use libdrm interface to get device id
Remove own ioctl call for device id but use libdrm interface instead. This not only saves one extra ioctl call as it's already been read when gem bufmgr inits, and also would allow to override device id with libdrm helper environment 'INTEL_DEVID_OVERRIDE'. To combine with aub dump, you can do device debugging with fulsim emulator by choosing any device you want and don't need hw metal at all. Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'src/intel/intel_driver.c')
-rw-r--r--src/intel/intel_driver.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/intel/intel_driver.c b/src/intel/intel_driver.c
index 4ed1e251..21546d98 100644
--- a/src/intel/intel_driver.c
+++ b/src/intel/intel_driver.c
@@ -130,6 +130,7 @@ intel_driver_memman_init(intel_driver_t *driver)
driver->bufmgr = drm_intel_bufmgr_gem_init(driver->fd, BATCH_SIZE);
assert(driver->bufmgr);
drm_intel_bufmgr_gem_enable_reuse(driver->bufmgr);
+ driver->device_id = drm_intel_bufmgr_gem_get_devid(driver->bufmgr);
intel_driver_aub_dump(driver);
}
@@ -154,11 +155,7 @@ intel_driver_init(intel_driver_t *driver, int dev_fd)
driver->fd = dev_fd;
driver->locked = 0;
pthread_mutex_init(&driver->ctxmutex, NULL);
-#ifndef NDEBUG
- int res =
-#endif /* NDEBUG */
- intel_driver_get_param(driver, I915_PARAM_CHIPSET_ID, &driver->device_id);
- assert(res);
+
intel_driver_memman_init(driver);
intel_driver_context_init(driver);
@@ -266,20 +263,6 @@ intel_driver_close(intel_driver_t *intel)
}
LOCAL int
-intel_driver_get_param(intel_driver_t *driver, int param, int *value)
-{
- int ret;
- struct drm_i915_getparam gp;
-
- memset(&gp, 0, sizeof(struct drm_i915_getparam));
- gp.param = param;
- gp.value = value;
-
- ret = drmCommandWriteRead(driver->fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
- return ret == 0;
-}
-
-LOCAL int
intel_driver_is_active(intel_driver_t *driver) {
return driver->fd >= 0;
}