diff -urN natty/dkms/patches/replace-global-lock-with-a-driver-specific-mutex.patch oneiric/dkms/patches/replace-global-lock-with-a-driver-specific-mutex.patch
--- natty/dkms/patches/replace-global-lock-with-a-driver-specific-mutex.patch	1970-01-01 09:00:00.000000000 +0900
+++ oneiric/dkms/patches/replace-global-lock-with-a-driver-specific-mutex.patch	2011-06-23 05:15:37.066055849 +0900
@@ -0,0 +1,74 @@
+From 33585d73b1ce3c9480d2cb928a75fb409ebd8717 Mon Sep 17 00:00:00 2001
+From: Alberto Milone <alberto.milone@canonical.com>
+Date: Tue, 14 Jun 2011 19:47:56 +0200
+Subject: [PATCH 1/1] replace global lock with a driver specific mutex
+
+---
+ drmP.h          |    2 +-
+ firegl_public.c |   11 +++++------
+ 2 files changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/drmP.h b/drmP.h
+index b18e7e8..a8e9cae 100644
+--- a/drmP.h
++++ b/drmP.h
+@@ -57,7 +57,7 @@
+ #include <linux/pci.h>
+ #include <linux/version.h>
+ #include <linux/sched.h>
+-#include <linux/smp_lock.h>	/* For (un)lock_kernel */
++#include <linux/mutex.h>
+ #include <linux/mm.h>
+ #include <linux/pagemap.h>
+ #if defined(__alpha__) || defined(__powerpc__)
+diff --git a/firegl_public.c b/firegl_public.c
+index 66ae0c6..d9b19a2 100644
+--- a/firegl_public.c
++++ b/firegl_public.c
+@@ -114,7 +114,7 @@
+ #include <linux/pci.h>
+ #include <linux/wait.h>
+ #include <linux/miscdevice.h>
+-#include <linux/smp_lock.h>
++#include <linux/mutex.h>
+ // newer SuSE kernels need this
+ #include <linux/highmem.h>
+ 
+@@ -289,6 +289,8 @@ typedef enum
+     KCL_MEM_PAT_ENABLED_KERNEL
+ } kcl_mem_pat_status_t;
+ 
++static DEFINE_MUTEX(ati_mutex);
++
+ static kcl_mem_pat_status_t kcl_mem_pat_status = KCL_MEM_PAT_DISABLED;
+ static u64 kcl_mem_pat_orig_val; 
+ 
+@@ -1048,9 +1050,6 @@ static int __init firegl_init_module(void)
+ 
+     dev->pubdev.signature = FGL_DEVICE_SIGNATURE;
+ 
+-    for (i = 0; i < __KE_MAX_SPINLOCKS; i++)
+-        dev->spinlock[i] = SPIN_LOCK_UNLOCKED;
+-
+     for (i=0; i < __KE_MAX_SEMAPHORES; i++)
+         sema_init(&dev->struct_sem[i], 1);
+ 
+@@ -1900,13 +1899,13 @@ void ATI_API_CALL KCL_spin_unlock(void *lock)
+ /** \brief Grab global kernel lock */
+ void ATI_API_CALL KCL_GlobalKernelLock(void)
+ {
+-    lock_kernel();
++    mutex_lock(&ati_mutex);
+ }
+ 
+ /** \brief Release global kernel lock */
+ void ATI_API_CALL KCL_GlobalKernelUnlock(void)
+ {
+-    unlock_kernel();
++    mutex_unlock(&ati_mutex);
+ }
+ 
+ /*****************************************************************************/
+-- 
+1.7.4.1
+ 
diff -urN natty/dkms/patches/rt_preempt_28.patch oneiric/dkms/patches/rt_preempt_28.patch
--- natty/dkms/patches/rt_preempt_28.patch	2011-06-16 07:53:33.000000000 +0900
+++ oneiric/dkms/patches/rt_preempt_28.patch	1970-01-01 09:00:00.000000000 +0900
@@ -1,26 +0,0 @@
---- a/firegl_public.c
-+++ b/firegl_public.c
-@@ -1352,7 +1352,11 @@
-    int process_terminated = 1;
-   
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)  
-+#if !defined(CONFIG_PREEMPT_RT)
-    rcu_read_lock();
-+#else
-+   preempt_disable();
-+#endif
- #else   
-    read_lock(&tasklist_lock);
- #endif   
-@@ -1373,7 +1377,11 @@
-       }
-    }   
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)  
-+#if !defined(CONFIG_PREEMPT_RT)
-    rcu_read_unlock();
-+#else
-+   preempt_enable();
-+#endif
- #else   
-    read_unlock(&tasklist_lock);
- #endif   
diff -urN natty/dkms/patches/rt_preempt_31.patch oneiric/dkms/patches/rt_preempt_31.patch
--- natty/dkms/patches/rt_preempt_31.patch	2011-06-16 07:53:33.000000000 +0900
+++ oneiric/dkms/patches/rt_preempt_31.patch	1970-01-01 09:00:00.000000000 +0900
@@ -1,36 +0,0 @@
---- build_mod/firegl_public.c.orig	2009-10-13 23:26:53.583314294 +0200
-+++ build_mod/firegl_public.c	2009-10-13 23:28:41.639335726 +0200
-@@ -135,6 +135,9 @@
- #endif
- #include <asm/delay.h>
- #include <linux/agp_backend.h>
-+#ifdef CONFIG_PREEMPT_RT
-+#include <linux/semaphore.h>
-+#endif
- 
- #ifndef EXPORT_NO_SYMBOLS
- #define EXPORT_NO_SYMBOLS
-@@ -1025,7 +1028,11 @@ static int __init firegl_init_module(voi
-     dev->pubdev.signature = FGL_DEVICE_SIGNATURE;
- 
-     for (i = 0; i < __KE_MAX_SPINLOCKS; i++)
-+#if !defined (CONFIG_PREEMPT_RT)
-         dev->spinlock[i] = SPIN_LOCK_UNLOCKED;
-+#else
-+        spin_lock_init(&dev->spinlock[i]);
-+#endif
- 
-     for (i=0; i < __KE_MAX_SEMAPHORES; i++)
-         sema_init(&dev->struct_sem[i], 1);
-@@ -4998,7 +5005,11 @@ unsigned int ATI_API_CALL KAS_Mutex_GetO
- unsigned int ATI_API_CALL KAS_Mutex_Initialize(void* hMutex)
- {
-     kasMutex_t* mutex_obj = (kasMutex_t*)hMutex;
-+#if !defined (CONFIG_PREEMPT_RT)
-     init_MUTEX(&(mutex_obj->mutex));
-+#else
-+    semaphore_init(&(mutex_obj->mutex));
-+#endif
-     return 1;
- }
- 
diff -urN natty/dkms.conf.in oneiric/dkms.conf.in
--- natty/dkms.conf.in	2011-06-16 07:53:33.000000000 +0900
+++ oneiric/dkms.conf.in	2011-06-23 05:19:14.694840023 +0900
@@ -1,11 +1,11 @@
 PACKAGE_NAME="fglrx"
 PACKAGE_VERSION="#CVERSION#"
+#Prevent builds with kernels newer than the ones we ship
+OBSOLETE_BY=3.1
 CLEAN="rm -f *.*o"
 BUILT_MODULE_NAME[0]="fglrx"
 MAKE[0]="cd ${dkms_tree}/fglrx/#CVERSION#/build; sh make.sh --nohints --uname_r=$kernelver --norootcheck"
 DEST_MODULE_LOCATION[0]="/kernel/drivers/char/drm"
 AUTOINSTALL="yes"
-PATCH[0]="rt_preempt_28.patch"
-PATCH_MATCH[0]="^2.6.28\-[0-9]*\-rt$"
-PATCH[1]="rt_preempt_31.patch"
-PATCH_MATCH[1]="^2.6.31\-[0-9]*\-rt$"
+PATCH[0]="replace-global-lock-with-a-driver-specific-mutex.patch"
+PATCH_MATCH[0]="^3.0"
diff -urN natty/fglrx.postinst oneiric/fglrx.postinst
--- natty/fglrx.postinst	2011-06-16 07:53:33.000000000 +0900
+++ oneiric/fglrx.postinst	2011-06-23 05:02:13.752583399 +0900
@@ -99,7 +99,7 @@
     fi
 
     update-alternatives --force \
-        --install /etc/ld.so.conf.d/GL.conf gl_conf /usr/lib/fglrx/ld.so.conf 1000 \
+        --install /etc/ld.so.conf.d/i386-linux-gnu_GL.conf i386-linux-gnu_gl_conf /usr/lib/fglrx/ld.so.conf 1000 \
         --slave /usr/bin/aticonfig aticonfig /usr/lib/fglrx/bin/aticonfig \
         --slave /usr/bin/atiode atiode /usr/lib/fglrx/bin/atiode \
         --slave /usr/bin/amdnotifyui amdnotifyui /usr/lib/fglrx/bin/amdnotifyui \
@@ -128,7 +128,7 @@
     # This is for switchable graphics
     # Note: the radeon kernel module is still blacklisted
     update-alternatives --force \
-        --install /etc/ld.so.conf.d/GL.conf gl_conf /usr/lib/pxpress/ld.so.conf 900 \
+        --install /etc/ld.so.conf.d/i386-linux-gnu_GL.conf i386-linux-gnu_gl_conf /usr/lib/pxpress/ld.so.conf 900 \
         --slave /usr/bin/aticonfig aticonfig /usr/lib/fglrx/bin/aticonfig \
         --slave /usr/bin/atiode atiode /usr/lib/fglrx/bin/atiode \
         --slave /usr/bin/amdnotifyui amdnotifyui /usr/lib/fglrx/bin/amdnotifyui \
@@ -166,7 +166,7 @@
     CURRENT_KERNEL=$(uname -r)
     NEWEST_KERNEL=$(get_newest_kernel "$KERNELS")
 
-    ALTERNATIVE=$(readlink /etc/alternatives/gl_conf)
+    ALTERNATIVE=$(readlink /etc/alternatives/i386-linux-gnu_gl_conf)
     if [ "$ALTERNATIVE" = "/usr/lib/fglrx/ld.so.conf" ]; then
         # Update initramfs so that the blacklist ends up in the initramfs
         update-initramfs -u
diff -urN natty/fglrx.prerm oneiric/fglrx.prerm
--- natty/fglrx.prerm	2011-06-16 07:53:33.000000000 +0900
+++ oneiric/fglrx.prerm	2011-06-23 05:02:58.783088488 +0900
@@ -20,7 +20,7 @@
 	remove)
 		remove_dkms_module 
 	
-		update-alternatives --remove gl_conf /usr/lib/fglrx/ld.so.conf
+		update-alternatives --remove i386-linux-gnu_gl_conf /usr/lib/fglrx/ld.so.conf
 
 		# Trigger gmenu so as to update the gnome menu
 		dpkg-trigger --by-package=$PACKAGE_NAME gmenucache || true