Skip to contentSkip to conversation

compat-drivers: drm driver updates - enable i915

PATCH New Luis R. Rodriguez 1 participant 6 messages Sep 29, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

cover compat-drivers: drm driver updates - enable i915

From: "Luis R. Rodriguez" <[email protected]>

This series addresses enabling the i915 driver by default. This is now run time tested against the Debian 3.2.0-3-amd64 kernel. Direct rendering work and glxgears gives me:

3274 frames in 5.0 seconds = 654.724 FPS

I've also tesed suspend / resume and it is alive and well still.

mcgrof@frijol ~/devel/compat-drivers (git::master)$ glxinfo | grep direct direct rendering: Yes

If you want to disable drm you can just specify "network" to admin-update.sh as follows:

./scripts/admin-update.sh network

This will skip pulling in drm code from the $GIT_TREE.

It would be great for other users to enabe other DRM driver to test and if it succeeds we can start enabling them. For now we only enable i915 as that is the only one that has been run time tested. I should note that this should work against 3.0 but I've only run time tested this against 3.2 so far. Testers wishing to help test this on 3.1 and 3.0 are welcomed.

If you only want to test building drm drivers you can specify:

./scripts/driver-select drm

before compiling. This has all been tested against cmake.

mcgrof@garbanzo ~/staging/drm/compat-drivers-2012-09-26 $ time ckmake Trying kernel 3.5.0-030500-generic [OK]
Trying kernel 3.4.4-030404-generic [OK]
Trying kernel 3.3.7-030307-generic [OK]
Trying kernel 3.2.2-030202-generic [OK]
Trying kernel 3.1.10-030110-generic [OK]
Trying kernel 3.0.18-030018-generic [OK]
Trying kernel 2.6.39-02063904-generic [OK]
Trying kernel 2.6.38-02063808-generic [OK]
Trying kernel 2.6.37-02063706-generic [OK]
Trying kernel 2.6.36-02063604-generic [OK]
Trying kernel 2.6.35-02063512-generic [OK]
Trying kernel 2.6.34-02063410-generic [OK]
Trying kernel 2.6.33-02063305-generic [OK]
Trying kernel 2.6.32-02063255-generic [OK]
Trying kernel 2.6.31-02063113-generic [OK]
Trying kernel 2.6.30-02063010-generic [OK]
Trying kernel 2.6.29-02062906-generic [OK]
Trying kernel 2.6.28-02062810-generic [OK]
Trying kernel 2.6.27-020627-generic [OK]
Trying kernel 2.6.26-020626-generic [OK]
Trying kernel 2.6.25-020625-generic [OK]
Trying kernel 2.6.24-020624-generic [OK]

real    27m41.522s
user    145m17.725s
sys     14m13.617s

Luis R. Rodriguez (5):
compat-drivers: separate NOSTDINC_FLAGS include dir lines
compat-drivers: force using include/drm for header namespace
compat-drivers: address usage of intel_enable_gtt() for i915
compat-drivers: backport usage of shmem_truncate_range() on i915
compat-drivers: enable DRM drivers compilation

 Makefile                                   |    5 +-
 config.mk                                  |    9 +++-
 patches/drm/06-rename-config-options.patch |   77 ++++++++++++++++++++++++++++
 patches/drm/07-intel-gtt.patch             |   37 +++++++++++++
 patches/drm/08-shmem_truncate_range.patch  |   44 ++++++++++++++++
 patches/drm/99-change-makefile.patch       |   44 ++++++++--------
 scripts/admin-update.sh                    |    3 +-
 scripts/driver-select                      |   28 ++++++++++
 8 files changed, 222 insertions(+), 25 deletions(-)
 create mode 100644 patches/drm/06-rename-config-options.patch
 create mode 100644 patches/drm/07-intel-gtt.patch
 create mode 100644 patches/drm/08-shmem_truncate_range.patch
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/5 compat-drivers: separate NOSTDINC_FLAGS include dir lines

From: "Luis R. Rodriguez" <[email protected]>

This will make it easier to review changes to this variable later.

---
 Makefile |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index 6eccff6..d8c7d27 100644
@@ -31,7 +31,8 @@ ifneq ($(KERNELRELEASE),)
 -include $(COMPAT_CONFIG)
 include $(COMPAT_CONFIG_CW)
 
-NOSTDINC_FLAGS := -I$(M)/include/ \
+NOSTDINC_FLAGS := \
+	-I$(M)/include/ \
 	-include $(M)/include/linux/compat-2.6.h \
 	$(CFLAGS)
 
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/5 compat-drivers: force using include/drm for header namespace

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Turns out DRM drivers use this:

#include "drmP.h"

Instead of:

#include <drm/drmP.h>

Withtout this change we are using the older kernel's header file and not the one we are cherry pickng over from the kernel we want to help backport.

---
 Makefile |    1 +
 1 file changed, 1 insertion(+)
Makefile +1 -0
index d8c7d27..e3c3fa6 100644
@@ -33,6 +33,7 @@ include $(COMPAT_CONFIG_CW)
 
 NOSTDINC_FLAGS := \
 	-I$(M)/include/ \
+	-I$(M)/include/drm \
 	-include $(M)/include/linux/compat-2.6.h \
 	$(CFLAGS)
 
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/5 compat-drivers: address usage of intel_enable_gtt() for i915

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Kernels older than 3.6 don't have intel_enable_gtt() exported and most Linux distributions have CONFIG_AGP_INTEL as built-in
(y) and as such we don't bother to make it available as modular here. The change to export intel_enable_gtt() was made through commit 8ecd1a66 but previous to this the driver never called intel_enable_gtt() so we can safely assume we can do the same for older kernels.

There should be a way to export an intel_enable_gtt() for kernels with CONFIG_AGP_INTEL as built-in but that itself is a project.

commit 8ecd1a6615f0d9de6759aafe229bc1cc4ee99c7b

Author: Daniel Vetter <[email protected]>
Date:   Thu Jun 7 15:56:03 2012 +0200

drm/i915: call intel_enable_gtt

When drm/i915 is in control of the gtt, we need to call the enable function at all the relevant places ourselves.

This now goes with i915 run time tested against 3.2.0-3-amd64 and code extrated from linux-next next-20120926.

---
 patches/drm/07-intel-gtt.patch |   37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 patches/drm/07-intel-gtt.patch
patches/drm/07-intel-gtt.patch new file +37 -0
new file mode 100644
index 0000000..6b3fabe
@@ -0,0 +1,37 @@
+Kernels older than 3.6 don't have intel_enable_gtt() exported
+and most Linux distributions have CONFIG_AGP_INTEL as built-in
+(y) and as such we don't bother to make it available as
+modular here. The change to export intel_enable_gtt() was
+made through commit 8ecd1a66 but previous to this the driver
+never called intel_enable_gtt() so we can safely assume we
+can do the same for older kernels.
+
+There should be a way to export an intel_enable_gtt() for
+kernels with CONFIG_AGP_INTEL as built-in but that itself
+is a project.
+
+commit 8ecd1a6615f0d9de6759aafe229bc1cc4ee99c7b
+Author: Daniel Vetter <[email protected]>
+Date:   Thu Jun 7 15:56:03 2012 +0200
+
+    drm/i915: call intel_enable_gtt
+    
+    When drm/i915 is in control of the gtt, we need to call
+    the enable function at all the relevant places ourselves.
+    
+    Reviewed-by: Jani Nikula <[email protected]>
+    Signed-off-by: Daniel Vetter <[email protected]>
+
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -3914,8 +3914,10 @@ i915_gem_init_hw(struct drm_device *dev)
+ 	drm_i915_private_t *dev_priv = dev->dev_private;
+ 	int ret;
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
+ 	if (!intel_enable_gtt())
+ 		return -EIO;
++#endif
+ 
+ 	i915_gem_l3_remap(dev);
+ 
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH 4/5 compat-drivers: backport usage of shmem_truncate_range() on i915

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Backport e2377fe0b -- this could likely be implemented on compat.git but I'd much prefer a better review of that. For now this stays as a patch.

commit e2377fe0b65e3c7577ff6df1701c56ef477d336f

Author: Hugh Dickins <[email protected]>
Date:   Mon Jun 27 16:18:19 2011 -0700

drm/i915: use shmem_truncate_range

The interface to ->truncate_range is changing very slightly: once "tmpfs:
take control of its truncate_range" has been applied, this can be applied.
For now there is only a slight inefficiency while this remains unapplied,
but it will soon become essential for managing shmem's use of swap.

Change i915_gem_object_truncate() to use shmem_truncate_range() directly:
which should also spare i915 later change if we switch from inode_operations->truncate_range to file_operations->fallocate.

Cc Christoph Hellwig <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Keith Packard <[email protected]>
Cc Dave Airlie <[email protected]>
---
 patches/drm/08-shmem_truncate_range.patch |   44 +++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 patches/drm/08-shmem_truncate_range.patch
patches/drm/08-shmem_truncate_range.patch new file +44 -0
new file mode 100644
index 0000000..71ad03b
@@ -0,0 +1,44 @@
+Backport e2377fe0b -- this could likely be implemented
+on compat.git but I'd much prefer a better review of that.
+For now this stays as a patch.
+
+commit e2377fe0b65e3c7577ff6df1701c56ef477d336f
+Author: Hugh Dickins <[email protected]>
+Date:   Mon Jun 27 16:18:19 2011 -0700
+
+    drm/i915: use shmem_truncate_range
+    
+    The interface to ->truncate_range is changing very slightly: once "tmpfs:
+    take control of its truncate_range" has been applied, this can be applied.
+     For now there is only a slight inefficiency while this remains unapplied,
+    but it will soon become essential for managing shmem's use of swap.
+    
+    Change i915_gem_object_truncate() to use shmem_truncate_range() directly:
+    which should also spare i915 later change if we switch from
+    inode_operations->truncate_range to file_operations->fallocate.
+    
+    Signed-off-by: Hugh Dickins <[email protected]>
+    Cc: Christoph Hellwig <[email protected]>
+    Cc: Chris Wilson <[email protected]>
+    Cc: Keith Packard <[email protected]>
+    Cc: Dave Airlie <[email protected]>
+    Signed-off-by: Andrew Morton <[email protected]>
+    Signed-off-by: Linus Torvalds <[email protected]>
+
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -1648,7 +1648,14 @@ i915_gem_object_truncate(struct drm_i915
+ 	 * backing pages, *now*.
+ 	 */
+ 	inode = obj->base.filp->f_path.dentry->d_inode;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0))
+ 	shmem_truncate_range(inode, 0, (loff_t)-1);
++#else
++	truncate_inode_pages(inode->i_mapping, 0);
++	if (inode->i_op->truncate_range)
++		inode->i_op->truncate_range(inode, 0, (loff_t)-1);
++#endif
++
+ 
+ 	obj->madv = __I915_MADV_PURGED;
+ }
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH 5/5 compat-drivers: enable DRM drivers compilation

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

Ozan Çağlayan had done most of the work to suck in all the DRM drivers but left out the enablement of compiling the drm drivers. The DRM drivers were also not load tested. This patch enables to test compilation by renaming the DRM Kconfig options with a _COMPAT prefix and enables compilation by default for the i915 drm driver which I can test against at run time on my laptop running on v3.2.

Users and developer can help enable older kernels down to 3.0 (as this was the oldest supported target kernel for DRM drivers) or other DRM drivers as they are run time tested.

The admin-update.sh script is modified to now always run by including the DRM code and patching it accordingly. If you happen to only want networking code you can do so by supplying the network argument to the script as follows:

./scripts/adming-update.sh network

This will disable taking in DRM code.

It should be noted that although only the i915 drm driver is being enabled all other drivers except the following have been test compiled to work down to v3.0.

-obj-$(CONFIG_COMPAT_DRM_TDFX)  += tdfx/
-obj-$(CONFIG_COMPAT_DRM_R128)  += r128/
-obj-$(CONFIG_COMPAT_DRM_MGA)   += mga/
-obj-$(CONFIG_COMPAT_DRM_SIS)   += sis/

-obj-$(CONFIG_COMPAT_DRM_SAVAGE)+= savage/
-obj-$(CONFIG_COMPAT_DRM_EXYNOS) +=exynos/
-obj-$(CONFIG_COMPAT_DRM_UDL) += udl/

Apart from the above drivers we should be able to enable the other drivers as reports come in for run time testing on them. As it is right now only the i915 goes run time tested -- by me.

---
 Makefile                                   |    1 +
 config.mk                                  |    9 +++-
 patches/drm/06-rename-config-options.patch |   77 ++++++++++++++++++++++++++++
 patches/drm/99-change-makefile.patch       |   44 ++++++++--------
 scripts/admin-update.sh                    |    3 +-
 scripts/driver-select                      |   28 ++++++++++
 6 files changed, 138 insertions(+), 24 deletions(-)
 create mode 100644 patches/drm/06-rename-config-options.patch
Makefile +1 -0
index e3c3fa6..6aa03c7 100644
@@ -40,6 +40,7 @@ NOSTDINC_FLAGS := \
 obj-y := compat/
 
 obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/
+obj-$(CONFIG_COMPAT_VIDEO_MODULES) += drivers/gpu/drm/
 
 ifeq ($(BT),)
 obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/
config.mk +8 -1
index 165a6ad..c3872b1 100644
@@ -17,7 +17,6 @@ else
 KERNEL_26SUBLEVEL := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
 endif
 
-# FIXME: This lower limit is different (e.g. 3.0) for DRM stuff.
 ifdef CONFIG_COMPAT_KERNEL_2_6_24
 $(error "ERROR: compat-drivers by default supports kernels >= 2.6.24, try enabling only one driver though")
 endif #CONFIG_COMPAT_KERNEL_2_6_24
@@ -697,3 +696,11 @@ endif #CONFIG_LEDS_TRIGGERS
 export CONFIG_RFKILL_BACKPORT_INPUT=y
 endif #CONFIG_COMPAT_KERNEL_2_6_31
 
+# compilation has been tested down to 3.0 but run time
+# tests have only started on 3.2.
+ifndef CONFIG_COMPAT_KERNEL_3_2
+export CONFIG_COMPAT_VIDEO_MODULES=y
+export CONFIG_COMPAT_DRM=m
+export CONFIG_COMPAT_DRM_I915=m
+export CONFIG_COMPAT_DRM_KMS_HELPER=m
+endif #CONFIG_COMPAT_KERNEL_3_2
patches/drm/06-rename-config-options.patch new file +77 -0

77 lines not on this page · raw message

patches/drm/99-change-makefile.patch +22 -22

48 lines not on this page · raw message

scripts/admin-update.sh +2 -1
index 2deb0a4..01ebd2d 100755
@@ -202,7 +202,7 @@ copyDirectories() {
 # compatibility with compat-wireless, wlan/bt/eth drivers are
 # fetched in by default.
 ENABLE_NETWORK=1
-ENABLE_DRM=0
+ENABLE_DRM=1
 SUBSYSTEMS=
 
 EXTRA_PATCHES="patches"
@@ -244,6 +244,7 @@ if [ $# -ge 1 ]; then
 				;;
 			"network")
 				ENABLE_NETWORK=1
+				ENABLE_DRM=0
 				shift
 				;;
 			"drm")
scripts/driver-select +28 -0
index 0076f62..640f9fa 100755
@@ -41,6 +41,8 @@ SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_ap ath9k_htc carl9170 ath6kl wil6210
 # what if you update b44 but not b43? It will bust.
 SUPPORTED_ETH_DRIVERS="atl1 atl2 atl1e atl1c alx"
 
+SUPPORTED_DRM_DRIVERS="i915"
+
 function usage {
 	echo -e "${GREEN}Usage${NORMAL}: ${BOLD}$0${NORMAL} [ ${PURPLE}<driver-name>${NORMAL} | ${CYAN}<driver-group-name>${NORMAL} | ${GREEN}restore${NORMAL} ]"
 
@@ -56,6 +58,11 @@ function usage {
 		echo -e "\t${PURPLE}${i}${NORMAL}"
 	done
 
+	echo -e "Supported DRM drivers:"
+	for i in $SUPPORTED_DRM_DRIVERS; do
+		echo -e "\t${PURPLE}${i}${NORMAL}"
+	done
+
 	# These should match the switch below.
 	echo -e "\nSupported group drivers:"
 	echo -e "\t${CYAN}atheros${NORMAL} < ${PURPLE} ath5k ath9k carl9170 zd1211rw ath6kl wil6210${NORMAL}>"
@@ -70,6 +77,9 @@ function usage {
 	echo -e "\t${CYAN}atlxx${NORMAL} < ${PURPLE} atl1 atl2 atl1e alx${NORMAL}>"
 	echo -e "\t${CYAN}bt${NORMAL} < ${PURPLE} Linux bluetooth drivers ${NORMAL}>"
 
+	echo -e "\nSupported group drivers: DRM:"
+	echo -e "\t${CYAN}drm${NORMAL} < ${PURPLE} i915${NORMAL}>"
+
 	echo -e "Restoring compat-drivers:"
 	echo -e "\t${GREEN}restore${NORMAL}: you can use this option to restore compat-drivers to the original state"
 }
@@ -233,6 +243,18 @@ function disable_update-initramfs
 	perl -i -ne 'print if ! /update-initramfs/' Makefile
 }
 
+function enable_only_drm {
+	backup_file Makefile
+	disable_ethernet
+	disable_staging
+	disable_usbnet
+	disable_var_03
+	disable_bt
+	# rfkill may be needed if you enable b44 as you may have b43
+	disable_rfkill
+	disable_80211
+}
+
 function select_ath_driver 
 {
 	backup_file $ATH_MAKEFILE
@@ -510,6 +532,12 @@ case $1 in
 		disable_staging
 		disable_80211
 		;;
+	i915)
+		enable_only_drm
+		;;
+	drm)
+		enable_only_drm
+		;;
 	*)
 		echo "Unsupported driver"
 		exit
Signature · 1 line
1.7.10.4