[xorg-x11-drv-intel] Backport some patches to avoid binding to non-i915.ko-driven Intel GPUs,

Adam Jackson ajax at fedoraproject.org
Mon Aug 20 16:31:43 UTC 2012


commit 080e744ac8a0dac8a9ee1ec8ca77722e234786be
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Aug 20 12:30:35 2012 -0400

    Backport some patches to avoid binding to non-i915.ko-driven Intel GPUs,
    
      like Cedarview and friends (#849475)

 ...k-that-the-driver-is-an-i915.ko-GEM-devic.patch |   70 ++++++++++++++++++++
 0003-Missing-includes-for-b5b76ad849b.patch        |   39 +++++++++++
 xorg-x11-drv-intel.spec                            |   10 +++-
 3 files changed, 118 insertions(+), 1 deletions(-)
---
diff --git a/0001-Sanity-check-that-the-driver-is-an-i915.ko-GEM-devic.patch b/0001-Sanity-check-that-the-driver-is-an-i915.ko-GEM-devic.patch
new file mode 100644
index 0000000..88856a6
--- /dev/null
+++ b/0001-Sanity-check-that-the-driver-is-an-i915.ko-GEM-devic.patch
@@ -0,0 +1,70 @@
+From b5b76ad849bfda1e75192d1cb3c6c0fcc623bb91 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris at chris-wilson.co.uk>
+Date: Mon, 20 Aug 2012 12:01:39 +0100
+Subject: [PATCH 1/3] Sanity check that the driver is an i915.ko GEM device
+ before claiming it
+
+This fixes an issue with us claiming Poulsbo and friends even though we
+do not speak their language.
+
+Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
+---
+ src/intel_module.c |   28 ++++++++++++++++++++++------
+ 1 files changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/src/intel_module.c b/src/intel_module.c
+index c0403ca..0a70b24 100644
+--- a/src/intel_module.c
++++ b/src/intel_module.c
+@@ -31,6 +31,7 @@
+ #include <xf86_OSproc.h>
+ #include <xf86Parser.h>
+ #include <xf86drmMode.h>
++#include <i915_drm.h>
+
+ #include <xorgVersion.h>
+
+@@ -369,20 +370,35 @@ static Bool intel_driver_func(ScrnInfoPtr pScrn,
+ static Bool has_kernel_mode_setting(struct pci_device *dev)
+ {
+	char id[20];
+-	int ret;
++	int ret, fd;
+
+	snprintf(id, sizeof(id),
+		 "pci:%04x:%02x:%02x.%d",
+		 dev->domain, dev->bus, dev->dev, dev->func);
+
+	ret = drmCheckModesettingSupported(id);
+-	if (ret && xf86LoadKernelModule("i915"))
+-		ret = drmCheckModesettingSupported(id);
+-	/* Be nice to the user and load fbcon too */
+-	if (!ret)
++	if (ret) {
++		if (xf86LoadKernelModule("i915"))
++			ret = drmCheckModesettingSupported(id);
++		if (ret)
++			return FALSE;
++		/* Be nice to the user and load fbcon too */
+		(void)xf86LoadKernelModule("fbcon");
++	}
++
++	/* Confirm that this is a i915.ko device with GEM/KMS enabled */
++	ret = FALSE;
++	fd = drmOpen(NULL, id);
++	if (fd != -1) {
++		struct drm_i915_getparam gp;
++
++		gp.param = I915_PARAM_HAS_GEM;
++		gp.value = &ret;
++		(void)drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
++		close(fd);
++	}
+
+-	return ret == 0;
++	return ret;
+ }
+
+ extern XF86ConfigPtr xf86configptr;
+--
+1.7.7.6
diff --git a/0003-Missing-includes-for-b5b76ad849b.patch b/0003-Missing-includes-for-b5b76ad849b.patch
new file mode 100644
index 0000000..13c63e0
--- /dev/null
+++ b/0003-Missing-includes-for-b5b76ad849b.patch
@@ -0,0 +1,39 @@
+From 027569bf83fc6d67dca7cfd65fdfa37ef6b47204 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris at chris-wilson.co.uk>
+Date: Mon, 20 Aug 2012 12:55:20 +0100
+Subject: [PATCH 3/3] Missing includes for b5b76ad849b
+
+The warnings of implicit function declarations were lost amongst the
+noise.
+
+Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
+---
+ src/intel_module.c |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/src/intel_module.c b/src/intel_module.c
+index 0a70b24..edea48d 100644
+--- a/src/intel_module.c
++++ b/src/intel_module.c
+@@ -28,8 +28,10 @@
+ #include "config.h"
+ #endif
+
++#include <unistd.h>
+ #include <xf86_OSproc.h>
+ #include <xf86Parser.h>
++#include <xf86drm.h>
+ #include <xf86drmMode.h>
+ #include <i915_drm.h>
+
+@@ -394,7 +396,7 @@ static Bool has_kernel_mode_setting(struct pci_device *dev)
+
+		gp.param = I915_PARAM_HAS_GEM;
+		gp.value = &ret;
+-		(void)drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
++		(void)drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+		close(fd);
+	}
+
+--
+1.7.7.6
diff --git a/xorg-x11-drv-intel.spec b/xorg-x11-drv-intel.spec
index 63f7577..f27e19a 100644
--- a/xorg-x11-drv-intel.spec
+++ b/xorg-x11-drv-intel.spec
@@ -14,7 +14,7 @@
 Summary:   Xorg X11 Intel video driver
 Name:      xorg-x11-drv-intel
 Version:   2.20.4
-Release:   1%{?gitrev}%{?dist}
+Release:   2%{?gitrev}%{?dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X Hardware Support
@@ -29,6 +29,8 @@ Source3:    intel-gpu-tools-%{gputoolsdate}.tar.bz2
 Source4:    make-git-snapshot.sh
 
 Patch0: intel-prime-support.patch
+Patch1: 0001-Sanity-check-that-the-driver-is-an-i915.ko-GEM-devic.patch
+Patch2: 0003-Missing-includes-for-b5b76ad849b.patch
 
 ExclusiveArch: %{ix86} x86_64 ia64
 
@@ -73,6 +75,8 @@ Debugging tools for Intel graphics chips
 %prep
 %setup -q -n xf86-video-intel-%{?gitdate:%{gitdate}}%{!?gitdate:%{dirsuffix}} -b3
 %patch0 -p1 -b .prime
+%patch1 -p1 -b .lolsbo
+%patch2 -p1 -b .lolsbo2
 
 %build
  
@@ -129,6 +133,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/intel_*.1*
 
 %changelog
+* Mon Aug 20 2012 Adam Jackson <ajax at redhat.com> 2.20.4-2
+- Backport some patches to avoid binding to non-i915.ko-driven Intel GPUs,
+  like Cedarview and friends (#849475)
+
 * Mon Aug 20 2012 Adam Jackson <ajax at redhat.com> 2.20.4-1
 - intel 2.20.4
 


More information about the scm-commits mailing list