I needed this patch to get the kernel module to insert properly.

Mostly it adds an irq handler for mach64, which I based on the rage128 one.

This patch was made from the xc/xc/programs/Xserver/hw/xfree86/os-support 
directory.

Dave, I'll try your new 2D driver tonight.  With the one before, I could 
compile, but X segfaulted while loading the ati_misc driver.

-James
Index: linux/drm/kernel/mach64_drv.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Attic/mach64_drv.c,v
retrieving revision 1.1.12.1
diff -u -r1.1.12.1 mach64_drv.c
--- linux/drm/kernel/mach64_drv.c	9 Feb 2004 00:08:59 -0000	1.1.12.1
+++ linux/drm/kernel/mach64_drv.c	13 Feb 2004 16:25:39 -0000
@@ -47,7 +47,6 @@
 #include "drm_ioctl.h"
 #include "drm_lock.h"
 #include "drm_memory.h"
-#include "drm_pci.h"
 #include "drm_proc.h"
 #include "drm_vm.h"
 #include "drm_stub.h"
Index: shared/drm/kernel/mach64_dma.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/Attic/mach64_dma.c,v
retrieving revision 1.1.4.1
diff -u -r1.1.4.1 mach64_dma.c
--- shared/drm/kernel/mach64_dma.c	9 Feb 2004 00:09:39 -0000	1.1.4.1
+++ shared/drm/kernel/mach64_dma.c	13 Feb 2004 16:26:33 -0000
@@ -34,6 +34,7 @@
 #include "mach64.h"
 #include "drmP.h"
 #include "drm.h"
+#include "drm_pci.h"
 #include "mach64_drm.h"
 #include "mach64_drv.h"
 
Index: shared/drm/kernel/mach64_drv.h
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/Attic/mach64_drv.h,v
retrieving revision 1.1.4.1
diff -u -r1.1.4.1 mach64_drv.h
--- shared/drm/kernel/mach64_drv.h	9 Feb 2004 00:09:39 -0000	1.1.4.1
+++ shared/drm/kernel/mach64_drv.h	13 Feb 2004 16:26:35 -0000
@@ -369,6 +369,7 @@
 #	define MACH64_CRTC_VBLANK			(1 << 0)
 #	define MACH64_CRTC_VBLANK_INT_EN		(1 << 1)
 #	define MACH64_CRTC_VBLANK_INT			(1 << 2)
+#      define MACH64_CRTC_VBLANK_INT_AK		(1 << 2)
 #	define MACH64_CRTC_VLINE_INT_EN			(1 << 3)
 #	define MACH64_CRTC_VLINE_INT			(1 << 4)
 #	define MACH64_CRTC_VLINE_SYNC			(1 << 5) /* 0=even, 1=odd */
Index: shared/drm/kernel/mach64_irq.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/Attic/mach64_irq.c,v
retrieving revision 1.1.4.1
diff -u -r1.1.4.1 mach64_irq.c
--- shared/drm/kernel/mach64_irq.c	9 Feb 2004 00:09:39 -0000	1.1.4.1
+++ shared/drm/kernel/mach64_irq.c	13 Feb 2004 16:26:36 -0000
@@ -76,6 +76,30 @@
 #endif
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,1)
+void DRM(irq_handler)( DRM_IRQ_ARGS )
+#else
+irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS )
+#endif
+{
+	drm_device_t *dev = (drm_device_t *)arg;
+	drm_mach64_private_t *dev_priv =
+		(drm_mach64_private_t *)dev->dev_private;
+	int status;
+
+	status = MACH64_READ( MACH64_CRTC_INT_CNTL );
+
+	/* VBLANK interrupt */
+	if ( status & MACH64_CRTC_VBLANK_INT ) {
+		MACH64_WRITE( MACH64_CRTC_INT_CNTL, MACH64_CRTC_VBLANK_INT_AK );
+		atomic_inc(&dev->vbl_received);
+		DRM_WAKEUP(&dev->vbl_queue);
+		DRM(vbl_send_signals)(dev);
+		return IRQ_HANDLED;
+	}
+	return IRQ_NONE;
+}
+
 int DRM(vblank_wait)(drm_device_t *dev, unsigned int *sequence)
 {
 	unsigned int cur_vblank;

Reply via email to