summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/i915
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2011-03-28 21:16:12 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2011-03-28 21:23:31 +0200
commit0fbb64a52931ba5871aa2c5eb01b81d391f678d1 (patch)
tree25eb57dcc7bd1943689be2b800f4830befc8e833 /src/gallium/winsys/i915
parent40ae214067673edbda79371969d1730b6194d83e (diff)
downloadexternal_mesa3d-0fbb64a52931ba5871aa2c5eb01b81d391f678d1.zip
external_mesa3d-0fbb64a52931ba5871aa2c5eb01b81d391f678d1.tar.gz
external_mesa3d-0fbb64a52931ba5871aa2c5eb01b81d391f678d1.tar.bz2
i915g: use drm ioctl to get pci devid
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'src/gallium/winsys/i915')
-rw-r--r--src/gallium/winsys/i915/drm/i915_drm_winsys.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/gallium/winsys/i915/drm/i915_drm_winsys.c b/src/gallium/winsys/i915/drm/i915_drm_winsys.c
index 2c3b508..a2b61cd 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