From patchwork Mon Aug 20 16:27:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Jackson X-Patchwork-Id: 1350041 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 099CCDF215 for ; Mon, 20 Aug 2012 16:28:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D6D5E9EFD2 for ; Mon, 20 Aug 2012 09:28:05 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org 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 From: Adam Jackson To: intel-gfx@lists.freedesktop.org Date: Mon, 20 Aug 2012 12:27:14 -0400 Message-Id: <1345480034-20847-1-git-send-email-ajax@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Subject: [Intel-gfx] [PATCH] Check that the drm fd is i915 before calling i915 ioctls on it X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@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); }