To followup on my own message with an update... I have applied the matroxfb-vsync-irq-patch-2.4.6 patch in DirectFB/patches (with a little massaging due to my kernel being 2.4.18ish -- find a new full patch for matroxfb-vsync-irq-patch attached) and things look much better now.
On Tue, Jul 16, 2002 at 09:13:39AM -0400, [EMAIL PROTECTED] wrote: > > 1. Playback using framebuffer/mga is smoother than using directfb. With the vsync patch applied to the framebuffer, smoothness is much more comparible to the framebuffer/mga mplayer driver. > I cannot slow > down the output and display frame by frame but it appears that > sometimes an old frame (2-3 frames old) is getting recycled as the > scrolling text seems to have a back and forth jerky motion. I don't seem to see any of this anymore. > 2. CPU usage seems to be significantly higher with directfb than with > the standard framebuffer/mga combination. When I play my 640x480 > @ 29.97fps file using the framebuffer/mga combination, it consumes > about 55% of my TB Athlon 800Mhz CPU. The exact same file played > back through the directfb driver comsumes 85% of the same CPU. CPU usage with the below patch applied is also very comparible to the framebuffer/mga combination. I am a lot more pleased than I was when I wrote the message I quoted above! Is there any reason this vsync patch is not being pushed up to the kernel? b. -- Brian J. Murrell
diff -ur ../linux-2.4.18-19mdk/drivers/video/matrox/matroxfb_base.c
./drivers/video/matrox/matroxfb_base.c
--- ../linux-2.4.18-19mdk/drivers/video/matrox/matroxfb_base.c 2002-06-05
04:49:06.000000000 -0400
+++ ./drivers/video/matrox/matroxfb_base.c 2002-07-18 18:58:38.000000000 -0400
@@ -101,6 +101,7 @@
#include "matroxfb_maven.h"
#include "matroxfb_crtc2.h"
#include <linux/matroxfb.h>
+#include <linux/irq.h>
#include <asm/uaccess.h>
#ifdef CONFIG_PPC
@@ -139,6 +140,22 @@
};
+/* --------------------------------------------------------------------- */
+
+static DECLARE_WAIT_QUEUE_HEAD(vsync_wait);
+
+static void matrox_irq( int irq, void *dummy, struct pt_regs *fp )
+{
+
+ struct matrox_fb_info* minfo = dummy;
+
+ if (mga_inb( M_STATUS ) & 0x10) {
+ mga_setr( M_CRTC_INDEX, 0x11, ACCESS_FBINFO(hw).CRTC[0x11] & ~0x10 );
+ mga_setr( M_CRTC_INDEX, 0x11, ACCESS_FBINFO(hw).CRTC[0x11] | 0x10 );
+
+ wake_up_interruptible(&vsync_wait);
+ }
+}
/* --------------------------------------------------------------------- */
@@ -1030,6 +1047,15 @@
return -EFAULT;
return 0;
}
+ case FBIO_WAITFORVSYNC:
+ {
+ interruptible_sleep_on(&vsync_wait);
+
+ if (signal_pending(current))
+ return -EINTR;
+
+ return 0;
+ }
case MATROXFB_SET_OUTPUT_MODE:
{
struct matroxioc_output_mode mom;
@@ -2098,6 +2124,8 @@
ACCESS_FBINFO(output.ph) = MATROXFB_OUTPUT_CONN_PRIMARY;
ACCESS_FBINFO(output.sh) = 0;
+ request_irq(pdev->irq, matrox_irq, SA_SHIRQ, "MGA Vertical Sync", MINFO);
+
err = initMatrox2(PMINFO d, b);
if (!err) {
#ifndef CONFIG_FB_MATROX_MULTIHEAD
diff -ur ../linux-2.4.18-19mdk/drivers/video/matrox/matroxfb_misc.c
./drivers/video/matrox/matroxfb_misc.c
--- ../linux-2.4.18-19mdk/drivers/video/matrox/matroxfb_misc.c 2002-06-05
04:49:06.000000000 -0400
+++ ./drivers/video/matrox/matroxfb_misc.c 2002-07-18 15:27:51.000000000 -0400
@@ -398,7 +398,7 @@
for (i = 10; i < 16; i++)
hw->CRTC[i] = 0x00;
hw->CRTC[16] = vs /* & 0xFF */;
- hw->CRTC[17] = (ve & 0x0F) | 0x20;
+ hw->CRTC[17] = (ve & 0x0F) | 0x10; /* vsync interrupt enabled! to disable:
+s/0x10/0x20/ */
hw->CRTC[18] = vd /* & 0xFF */;
hw->CRTC[19] = wd /* & 0xFF */;
hw->CRTC[20] = 0x00;
diff -ur ../linux-2.4.18-19mdk/include/linux/fb.h ./include/linux/fb.h
--- ../linux-2.4.18-19mdk/include/linux/fb.h 2002-06-05 07:10:46.000000000 -0400
+++ ./include/linux/fb.h 2002-07-18 16:47:35.000000000 -0400
@@ -32,6 +32,8 @@
#define FBIOPUT_MODEINFO 0x4617
#define FBIOGET_DISPINFO 0x4618
+#define FBIO_WAITFORVSYNC 0x4620
+
#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
#define FB_TYPE_PLANES 1 /* Non interleaved planes */
msg00808/pgp00000.pgp
Description: PGP signature
