Attached patch against latest r300 CVS fixes compilation of r300 drm on linux kernel 2.6.10 and .11.

Basically, Jerome incorrectly assumes that additional argument to some agp 
functions was added in 2.6.10, while actually it
was included in Linus' kernel only by the time of 2.6.12rc1 (look for 
'[AGPGART] allow multiple backends' line in
http://www.kernel.org/pub/linux/kernel/v2.6/testing/ChangeLog-2.6.12-rc1).

Patch is just changing #ifdef's for 2.6.12 to 2.6.10. Checked on linux-2.6.11.

Please include my email when replying, as I'm not subscribed to the list.

Regards,
 Kir

diff -urN r300/drm/linux-core/drmP.h r300-my/drm/linux-core/drmP.h
--- r300/drm/linux-core/drmP.h	2005-05-05 16:26:07.000000000 +0400
+++ r300-my/drm/linux-core/drmP.h	2005-05-13 03:34:49.000000000 +0400
@@ -771,7 +771,7 @@
 extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area);
 extern unsigned long drm_alloc_pages(int order, int area);
 extern void drm_free_pages(unsigned long address, int order, int area);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 extern DRM_AGP_MEM *drm_alloc_agp(int pages, u32 type);
 #else
 extern DRM_AGP_MEM *drm_alloc_agp(struct agp_bridge_data *bridge, int pages, u32 type);
@@ -900,14 +900,14 @@
 extern void drm_vbl_send_signals(drm_device_t * dev);
 
 				/* AGP/GART support (drm_agpsupport.h) */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 extern drm_agp_head_t *drm_agp_init(void);
 #else
 extern drm_agp_head_t *drm_agp_init(drm_device_t *dev);
 #endif
 extern int drm_agp_acquire(struct inode *inode, struct file *filp,
 			   unsigned int cmd, unsigned long arg);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 extern void drm_agp_do_release(void);
 #else
 extern void drm_agp_do_release(drm_device_t *dev);
@@ -926,7 +926,7 @@
 			  unsigned int cmd, unsigned long arg);
 extern int drm_agp_bind(struct inode *inode, struct file *filp,
 			unsigned int cmd, unsigned long arg);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 extern DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type);
 #else
 extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type);
diff -urN r300/drm/linux-core/drm_agpsupport.c r300-my/drm/linux-core/drm_agpsupport.c
--- r300/drm/linux-core/drm_agpsupport.c	2005-05-05 16:26:07.000000000 +0400
+++ r300-my/drm/linux-core/drm_agpsupport.c	2005-05-13 03:35:26.000000000 +0400
@@ -102,7 +102,7 @@
 	if (dev->agp->cant_use_aperture)
 		return -EINVAL;
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 	if ((retcode = agp_backend_acquire()))
 		return retcode;
 #else
@@ -132,7 +132,7 @@
 
 	if (!dev->agp || !dev->agp->acquired)
 		return -EINVAL;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 	agp_backend_release();
 #else
 	agp_backend_release(dev->agp->bridge);
@@ -147,7 +147,7 @@
  *
  * Calls agp_backend_release().
  */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 void drm_agp_do_release(void)
 {
 	agp_backend_release();
@@ -187,7 +187,7 @@
 		return -EFAULT;
 
 	dev->agp->mode = mode.mode;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 	agp_enable(mode.mode);
 #else
 	agp_enable(dev->agp->bridge, mode.mode);
@@ -233,7 +233,7 @@
 	pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
 	type = (u32) request.type;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 	if (!(memory = drm_alloc_agp(pages, type))) {
 		drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
 		return -ENOMEM;
@@ -420,7 +420,7 @@
  * via the inter_module_* functions. Creates and initializes a drm_agp_head
  * structure.
  */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 drm_agp_head_t *drm_agp_init(void)
 {
 	drm_agp_head_t *head = NULL;
@@ -475,7 +475,7 @@
 #endif
 
 /** Calls agp_allocate_memory() */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type)
 {
 	return agp_allocate_memory(pages, type);
diff -urN r300/drm/linux-core/drm_drv.c r300-my/drm/linux-core/drm_drv.c
--- r300/drm/linux-core/drm_drv.c	2005-05-05 16:26:07.000000000 +0400
+++ r300-my/drm/linux-core/drm_drv.c	2005-05-13 03:24:13.000000000 +0400
@@ -180,7 +180,7 @@
 		}
 		dev->agp->memory = NULL;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 		if (dev->agp->acquired)
 			drm_agp_do_release();
 #else
diff -urN r300/drm/linux-core/drm_memory.c r300-my/drm/linux-core/drm_memory.c
--- r300/drm/linux-core/drm_memory.c	2005-05-05 16:26:07.000000000 +0400
+++ r300-my/drm/linux-core/drm_memory.c	2005-05-13 03:34:20.000000000 +0400
@@ -151,7 +151,7 @@
 
 #if __OS_HAS_AGP
 /** Wrapper around agp_allocate_memory() */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 DRM_AGP_MEM *drm_alloc_agp(int pages, u32 type)
 {
 	return drm_agp_allocate_memory(pages, type);
diff -urN r300/drm/linux-core/drm_stub.c r300-my/drm/linux-core/drm_stub.c
--- r300/drm/linux-core/drm_stub.c	2005-05-05 16:26:07.000000000 +0400
+++ r300-my/drm/linux-core/drm_stub.c	2005-05-13 03:24:39.000000000 +0400
@@ -99,7 +99,7 @@
 			goto error_out_unreg;
 
 	if (drm_core_has_AGP(dev)) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
 		dev->agp = drm_agp_init();
 #else
 		dev->agp = drm_agp_init(dev);

Reply via email to