From: Adam Jackson Subject: [PATCH] Check that the drm fd is i915 before calling i915 ioctls on it Date: Mon, 20 Aug 2012 12:27:14 -0400 Message-ID: <1345480034-20847-1-git-send-email-ajax@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E43D9EFE4 for ; Mon, 20 Aug 2012 09:27:16 -0700 (PDT) Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7KGRFwG031889 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 Aug 2012 12:27:15 -0400 Received: from ihatethathostname.lab.bos.redhat.com (ihatethathostname.lab.bos.redhat.com [10.16.43.238]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7KGRFG9004334 for ; Mon, 20 Aug 2012 12:27:15 -0400 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org Signed-off-by: Adam Jackson --- src/intel_module.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/intel_module.c b/src/intel_module.c index edea48d..be9688a 100644 --- a/src/intel_module.c +++ b/src/intel_module.c @@ -392,11 +392,17 @@ static Bool has_kernel_mode_setting(struct pci_device *dev) ret = FALSE; fd = drmOpen(NULL, id); if (fd != -1) { - struct drm_i915_getparam gp; + drmVersionPtr v; - gp.param = I915_PARAM_HAS_GEM; - gp.value = &ret; - (void)drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); + v = drmGetVersion(fd); + if (v && !strcmp(v->name, "i915")) { + struct drm_i915_getparam gp; + + gp.param = I915_PARAM_HAS_GEM; + gp.value = &ret; + (void)drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); + } + drmFreeVersion(v); close(fd); } -- 1.7.7.6