From: Daniel Vetter Date: Mon, 28 Mar 2011 19:16:12 +0000 (+0200) Subject: i915g: use drm ioctl to get pci devid X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0fbb64a52931ba5871aa2c5eb01b81d391f678d1;p=mesa.git i915g: use drm ioctl to get pci devid Signed-off-by: Daniel Vetter --- diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.c b/src/gallium/winsys/i915/drm/i915_drm_winsys.c index 2c3b508d056..a2b61cde2c2 100644 --- a/src/gallium/winsys/i915/drm/i915_drm_winsys.c +++ b/src/gallium/winsys/i915/drm/i915_drm_winsys.c @@ -15,24 +15,14 @@ static void i915_drm_get_device_id(unsigned int *device_id) { - char path[512]; - FILE *file; - void *shutup_gcc; - - /* - * FIXME: Fix this up to use a drm ioctl or whatever. - */ - - snprintf(path, sizeof(path), "/sys/class/drm/card0/device/device"); - file = fopen(path, "r"); - if (!file) { - return; - } - - shutup_gcc = fgets(path, sizeof(path), file); - (void) shutup_gcc; - sscanf(path, "%x", device_id); - fclose(file); + int ret; + struct drm_i915_getparam gp; + + gp.param = I915_PARAM_CHIPSET_ID; + gp.value = (int *)devid; + + ret = ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)); + assert(ret == 0); } static void