[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fglrx and kernel 2.6.11



Hi,


Albert Dengg wrote:
Hi

i currently use version 8.10.19 with a self-compiled kernel 2.6.10-ac12
on my amd64 machine without problems (after the initial installation...)

I'm running debian sid x86 on my pentium m equipped laptop, so probably
 the patches I'm sending are not all the wright ones; I'm concerned
 especially for the correctness of the "rage3d_4-level-pagetables.diff"
 patch.


however, if i try to compile it for anything newer (i tried 2.6.11-rc4,
-rc5 and 2.6.11), the kernel module won't compile and i get the output
below...

does anybody know the cause of the problem and probably a way to solve
it?
(so far it is not a problem, though it would be nice to get i working)

I didn't looked very carefully to all the errors from you make log, but
 the attached patches should remove some of them at least. The patches
 that are mandatory (for me) in order to run fglrx under kernel version
 2.6.11, are:

 - agp_backend-2.6.11rc2.diff
 - rage3d_4-level-pagetables.diff
 - remap_page_range-2.6.11rc1.diff

the other 3 are just cosmetic warning cleanups.

also, just for the record, the rage3d_4-level and remap_page patches I
 collected from the rage3d forums, from more complicated patches.


thanks in advance

yours
Albert


[...]

Hoppeing it will do the trick for you,

Alex.
Date: Sun, 23 Jan 2005 21:49:38 +0200
From: Alexandru Fomin <yo3fxy at spymac dot com>

Hi,

latest 2.6.11 release candidate has dropped the definition of
  drm_agp_t structure, and is not exporting variable drm_agp
  anymore;

I tested the patch, and was able to enable dri with useinternalagp
  option defined and undefined; after solving my hangs/lockups in
  doom3 (inspired from the rage3d forums) I could play it for several
  hours (started a new game and played until I exited alpha labs
  section 1, when I got tired/spoked by the noise and monsters, without
  any lockups)

Best regards,

Alex.

PS: patch prerequisite -- working & compiling fglrx with kernel
     version 2.6.11rc1

--- firegl_public.c-orig	2005-02-17 21:10:34.821182824 +0200
+++ firegl_public.c	2005-02-17 21:11:26.549318952 +0200
@@ -2873,6 +2873,37 @@ int ATI_API_CALL __ke_vm_map(struct file
 
 #if LINUX_VERSION_CODE >= 0x020400
 
+#if LINUX_VERSION_CODE >= 0x02060b
+
+typedef struct {
+	void			(*free_memory)(struct agp_memory *);
+	struct agp_memory *	(*allocate_memory)(size_t, u32);
+	int			(*bind_memory)(struct agp_memory *, off_t);
+	int			(*unbind_memory)(struct agp_memory *);
+	void			(*enable)(u32);
+	int			(*acquire)(void);
+	void			(*release)(void);
+	int			(*copy_info)(struct agp_kern_info *);
+} drm_agp_t;
+
+static const drm_agp_t drm_agp = {
+	&agp_free_memory,
+	&agp_allocate_memory,
+	&agp_bind_memory,
+	&agp_unbind_memory,
+	&agp_enable,
+	&agp_backend_acquire,
+	&agp_backend_release,
+	&agp_copy_info
+};
+#undef DRM_AGP_MODULE_GET
+#undef DRM_AGP_MODULE_PUT
+
+#define DRM_AGP_MODULE_GET      &drm_agp
+#define DRM_AGP_MODULE_PUT 
+
+#endif
+
 static const drm_agp_t  *drm_agp_module_stub = NULL;
 
 #define AGP_FUNCTIONS		8

Hide a function and variable definition under x86, because are
 used only on AMD64

--- agpgart_be.c-orig	2005-02-17 21:07:10.540238000 +0200
+++ agpgart_be.c	2005-02-17 21:13:09.712635744 +0200
@@ -6503,6 +6503,7 @@ static u8 find_agpv3_capptr(struct pci_d
 
 // FGL - end
 
+#ifdef __x86_64__
 static int agp_check_supported_device(struct pci_dev *dev) 
 {
 
@@ -6517,13 +6518,13 @@ static int agp_check_supported_device(st
 
   return 0;
 }
+#endif
 
 /* Supported Device Scanning routine */
 
 static int __init agp_find_supported_device(void)
 {
 	struct pci_dev *dev = NULL;
-    u8 cap_ptr = 0x00;
 
     // locate host bridge device
 #ifdef __x86_64__
@@ -6543,6 +6544,7 @@ static int __init agp_find_supported_dev
                             PCI_DEVICE_ID_NVIDIA_NFORCE3,
                             NULL)) {
 
+      u8 cap_ptr = 0x00;
       /* find capndx */
       cap_ptr = pci_find_capability(dev, PCI_CAP_ID_AGP);
       if (cap_ptr == 0x00)

MODULE_PARM is removed in -mm patch series, and deprecated starting with I
 don't remember which version of 2.6.x 

--- firegl_public.c-orig	2005-02-17 21:11:26.549318952 +0200
+++ firegl_public.c	2005-02-17 21:16:12.581835400 +0200
@@ -217,7 +217,11 @@ int __ke_moduleflags = 0;
 /* global module vars and constants - defined trough macros */
 MODULE_AUTHOR("Fire GL - ATI Research GmbH, Germany");
 MODULE_DESCRIPTION("ATI Fire GL");
+#if LINUX_VERSION_CODE <= 0x020600
 MODULE_PARM(firegl, "s");
+#else
+module_param(firegl, charp, 0);
+#endif
 #ifdef MODULE_LICENSE
 MODULE_LICENSE("Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY");
 #endif
--- firegl_public.c-orig
+++ firegl_public.c
@@ -205,6 +205,7 @@ _syscall3( int, modify_ldt, int, func, v
 
 #ifndef pte_offset_map 
 #define pte_offset_map pte_offset
+#undef pte_unmap
 #define pte_unmap(pte)
 #endif
 // ============================================================
--- firegl_public.c.orig	2005-02-12 13:30:15.220853088 +0200
+++ firegl_public.c	2005-02-12 13:35:48.226228576 +0200
@@ -1669,13 +1669,22 @@ unsigned long ATI_API_CALL __ke_get_vm_p
 {
     unsigned long pte_linear;
     pgd_t* pgd_p;
+#if LINUX_VERSION_CODE > 0x02060a     /* KERNEL_VERSION(2,6,11) */
+    pud_t* pud_p;
+#endif
     pmd_t* pmd_p;
     pte_t* pte_p;
     pte_t  pte;
 
     pte_linear = VMALLOC_VMADDR(virtual_addr);  // convert to pte linear address (x86 => nop)
     pgd_p = pgd_offset(mm, pte_linear);
+#if LINUX_VERSION_CODE > 0x02060a     /* KERNEL_VERSION(2,6,11) */
+    pud_p = pud_offset(pgd_p, pte_linear);
+    pmd_p = pmd_offset(pud_p, pte_linear);
+#else
     pmd_p = pmd_offset(pgd_p, pte_linear);
+#endif
+
 #ifndef FGL_ATOMIC_PTE
 #if LINUX_VERSION_CODE > 0x020500
     pte_p = pte_offset_kernel(pmd_p, pte_linear);
@@ -2105,6 +2114,9 @@ static __inline__ vm_nopage_ret_t do_vm_
                                                    unsigned long address)
 {
     pgd_t* pgd_p;
+#if LINUX_VERSION_CODE > 0x02060a     /* KERNEL_VERSION(2,6,11) */
+    pud_t* pud_p;
+#endif
     pmd_t* pmd_p;
     pte_t* pte_p;
     pte_t  pte;
@@ -2205,7 +2217,12 @@ static __inline__ vm_nopage_ret_t do_vm_
         /* alternatively we could generate a NOPAGE_OOM "out of memory" */
     }
     /*  locate medium level page table (x86 => nop) */
+#if LINUX_VERSION_CODE > 0x02060a     /* KERNEL_VERSION(2,6,11) */
+    pud_p = pud_offset(pgd_p, pte_linear);
+    pmd_p = pmd_offset(pud_p, pte_linear);
+#else
     pmd_p = pmd_offset(pgd_p, pte_linear);
+#endif
     if (!pmd_present(*pmd_p))
     {
         __KE_ERROR("FATAL ERROR: User queue buffer not present! (pmd)\n");
@@ -2569,13 +2586,21 @@ char* ATI_API_CALL __ke_vm_phys_addr_str
 {
     unsigned long pte_linear;
     pgd_t* pgd_p;
+#if LINUX_VERSION_CODE > 0x02060a     /* KERNEL_VERSION(2,6,11) */
+    pud_t* pud_p;
+#endif
     pmd_t* pmd_p;
     pte_t* pte_p;
     pte_t  pte;
 
     pte_linear = VMALLOC_VMADDR(virtual_addr);  // convert to pte linear address (x86 => nop)
     pgd_p = pgd_offset(vma->vm_mm, pte_linear);
+#if LINUX_VERSION_CODE > 0x02060a     /* KERNEL_VERSION(2,6,11) */
+    pud_p = pud_offset(pgd_p, pte_linear);
+    pmd_p = pmd_offset(pud_p, pte_linear);
+#else
     pmd_p = pmd_offset(pgd_p, pte_linear);
+#endif
 #ifndef FGL_ATOMIC_PTE
 #if LINUX_VERSION_CODE > 0x020500
     pte_p = pte_offset_kernel(pmd_p, pte_linear);

Starting with 2.6.10 remap_page_range is deprecated, and removed in 2.6.11rc1 

--- firegl_public.c-orig	2005-02-17 21:26:53.552393064 +0200
+++ firegl_public.c	2005-02-17 21:27:01.075249416 +0200
@@ -2749,13 +2749,23 @@ int ATI_API_CALL __ke_vm_map(struct file
 #endif /* __ia64__ */
                 vma->vm_flags |= VM_IO; /* not in core dump */
             }
+#if LINUX_VERSION_CODE >= 0x02060b
+            if (remap_pfn_range(FGL_VMA_API_PASS
+                                 vma->vm_start,
+                                 vma->vm_pgoff,
+#else
             if (remap_page_range(FGL_VMA_API_PASS
                                  vma->vm_start,
                                  __ke_vm_offset(vma),
+#endif
                                  vma->vm_end - vma->vm_start,
                                  vma->vm_page_prot))
             {
+#if LINUX_VERSION_CODE >= 0x02060b
+                __KE_DEBUG("remap_pfn_range failed\n");
+#else
                 __KE_DEBUG("remap_page_range failed\n");
+#endif
                 return -EAGAIN;
             }
             vma->vm_flags |= VM_SHM | VM_RESERVED; /* Don't swap */
@@ -2814,15 +2824,29 @@ int ATI_API_CALL __ke_vm_map(struct file
 #else
 			//			else
 			{
+#if LINUX_VERSION_CODE >= 0x02060b
+				if (vma->vm_pgoff >= __pa(high_memory))
+#else
 				if (__ke_vm_offset(vma) >= __pa(high_memory))
+#endif
 					vma->vm_flags |= VM_IO; /* not in core dump */
+#if LINUX_VERSION_CODE >= 0x02060b
+				if (remap_pfn_range(FGL_VMA_API_PASS
+									 vma->vm_start,
+									 vma->vm_pgoff,
+#else
 				if (remap_page_range(FGL_VMA_API_PASS
 									 vma->vm_start,
 									 __ke_vm_offset(vma),
+#endif
 									 vma->vm_end - vma->vm_start,
 									 vma->vm_page_prot))
 				{
+#if LINUX_VERSION_CODE >= 0x02060b
+					__KE_DEBUG("remap_pfn_range failed\n");
+#else
 					__KE_DEBUG("remap_page_range failed\n");
+#endif
 					return -EAGAIN;
 				}
 #ifdef __x86_64__
@@ -2851,15 +2875,29 @@ int ATI_API_CALL __ke_vm_map(struct file
 //			else
 #else
 			{
+#if LINUX_VERSION_CODE >= 0x02060b
+				if (vma->vm_pgoff >= __pa(high_memory))
+#else
 				if (__ke_vm_offset(vma) >= __pa(high_memory))
+#endif
 					vma->vm_flags |= VM_IO; /* not in core dump */
+#if LINUX_VERSION_CODE >= 0x02060b
+				if (remap_pfn_range(FGL_VMA_API_PASS
+									 vma->vm_start,
+									 vma->vm_pgoff,
+#else
 				if (remap_page_range(FGL_VMA_API_PASS
 									 vma->vm_start,
 									 __ke_vm_offset(vma),
+#endif
 									 vma->vm_end - vma->vm_start,
 									 vma->vm_page_prot))
 				{
+#if LINUX_VERSION_CODE >= 0x02060b
+					__KE_DEBUG("remap_pfn_range failed\n");
+#else
 					__KE_DEBUG("remap_page_range failed\n");
+#endif
 					return -EAGAIN;
 				}
 #ifdef __x86_64__