[PATCH] Interlace for rivafb driver

STALE8591d

6 messages, 3 authors, 2003-02-12 · open the first message on its own page

[PATCH] Interlace for rivafb driver

From: Fredrik Noring <hidden>
Date: 2003-01-25 23:07:47

Attached patch implements interlace for the rivafb driver and
the hardware that supports it (Riva 128, TNT, TNT2, some GeForce 
cards and possibly others).

It's a patch against 2.4.21-pre2 (with polarity and sync patches)
but it should fit with 2.5.x too skipping riva_hw.c and riva_hw.h 
which already are adopted from XFree86.

	Fredrik

--- linux-2.4.21-pre2/drivers/video/riva/riva_hw.c.orig	2003-01-25 00:36:10.000000000 +0100
+++ linux-2.4.21-pre2/drivers/video/riva/riva_hw.c	2003-01-25 00:38:14.000000000 +0100
@@ -1547,6 +1547,8 @@
     VGA_WR08(chip->PCIO, 0x03D5, state->cursor0);
     VGA_WR08(chip->PCIO, 0x03D4, 0x31);
     VGA_WR08(chip->PCIO, 0x03D5, state->cursor1);
+    VGA_WR08(chip->PCIO, 0x03D4, 0x39);
+    VGA_WR08(chip->PCIO, 0x03D5, state->interlace);
     chip->PRAMDAC[0x00000300/4]  = state->cursor2;
     chip->PRAMDAC[0x00000508/4]  = state->vpll;
     chip->PRAMDAC[0x0000050C/4]  = state->pllsel;
--- linux-2.4.21-pre2/drivers/video/riva/riva_hw.h.orig	2003-01-25 00:36:15.000000000 +0100
+++ linux-2.4.21-pre2/drivers/video/riva/riva_hw.h	2003-01-25 00:38:49.000000000 +0100
@@ -421,6 +421,7 @@
     U032 bpp;
     U032 width;
     U032 height;
+    U032 interlace;
     U032 repaint0;
     U032 repaint1;
     U032 screen;
--- linux-2.4.21-pre2/drivers/video/riva/fbdev.c.orig	2003-01-25 23:41:18.000000000 +0100
+++ linux-2.4.21-pre2/drivers/video/riva/fbdev.c	2003-01-25 23:45:07.000000000 +0100
@@ -14,6 +14,9 @@
  *
  *	Jindrich Makovicka:  Accel code help, hw cursor, mtrr
  *
+ *	Fredrik Noring <noring@nocrew.org>:  Sync polarity and
+ *	interlace code with XFree86 4.2 as reference.
+ *
  * Initial template from skeletonfb.c, created 28 Dec 1997 by Geert Uytterhoeven
  * Includes riva_hw.c from nVidia, see copyright below.
  * KGI code provided the basis for state storage, init, and mode switching.
@@ -26,6 +29,12 @@
  *	restoring text mode fails
  *	doublescan modes are broken
  *	option 'noaccel' has no effect
+ *
+ * Interlace is supported on Riva 128, TNT, TNT2 and some early
+ * GeForce cards. Many newer cards do not support interlace.
+ *
+ * Interlace and hardware accelerated video overlay are not compatible
+ * (likely a limitation in hardware).
  */
 
 #include <linux/config.h>
@@ -890,6 +899,9 @@
 
 	memcpy(&newmode, &reg_template, sizeof(struct riva_regs));
 
+	if((video_mode->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) 
+		vTotal |= 1;
+
 	newmode.crtc[0x0] = Set8Bits (hTotal - 4);
 	newmode.crtc[0x1] = Set8Bits (hDisplay);
 	newmode.crtc[0x2] = Set8Bits (hDisplay);
@@ -929,6 +941,15 @@
 	else
 		newmode.misc_output |= 0x80;
 	
+	if((video_mode->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED)
+	{
+	        int tmp = (hTotal >> 1) & ~1;
+		newmode.ext.interlace = Set8Bits(tmp);
+		newmode.ext.horiz |= SetBitField(tmp, 8:8,4:4);
+	} else {
+		newmode.ext.interlace = 0xff;  /* interlace off */
+	}
+
 	rinfo->riva.CalcStateExt(&rinfo->riva, &newmode.ext, bpp, width,
 				  hDisplaySize, hDisplay, hStart, hEnd,
 				  hTotal, height, vDisplay, vStart, vEnd,



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com

Re: [PATCH] Interlace for rivafb driver

From: James Simmons <hidden>
Date: 2003-01-28 19:30:12

On 26 Jan 2003, Fredrik Noring wrote:
Attached patch implements interlace for the rivafb driver and
the hardware that supports it (Riva 128, TNT, TNT2, some GeForce 
cards and possibly others).

It's a patch against 2.4.21-pre2 (with polarity and sync patches)
but it should fit with 2.5.x too skipping riva_hw.c and riva_hw.h 
which already are adopted from XFree86.
Applied. 


P.S
   To Tony. I applied your patches as well. The only patch I didn't was 
the DIRECTCOLOR patch. The X server freaked out for my card when the video 
mode was in a DIRECTCOLOR state.



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com

Re: [PATCH] Interlace for rivafb driver

From: Antonino Daplas <hidden>
Date: 2003-01-30 02:44:29

On Wed, 2003-01-29 at 03:29, James Simmons wrote:
On 26 Jan 2003, Fredrik Noring wrote:
quoted
Attached patch implements interlace for the rivafb driver and
the hardware that supports it (Riva 128, TNT, TNT2, some GeForce 
cards and possibly others).

It's a patch against 2.4.21-pre2 (with polarity and sync patches)
but it should fit with 2.5.x too skipping riva_hw.c and riva_hw.h 
which already are adopted from XFree86.
Applied. 


P.S
   To Tony. I applied your patches as well. The only patch I didn't was 
the DIRECTCOLOR patch. The X server freaked out for my card when the video 
mode was in a DIRECTCOLOR state.
Yes I'm not sure about this too.  Also the patch I submitted is untested
for RGB565, tested only for RGB555 and RGB8888.  So, does X work for
rivafb?  It does not work in my hardware unless I add the directcolor
patch.

Tony





-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com

Re: [PATCH] Interlace for rivafb driver

From: James Simmons <hidden>
Date: 2003-01-30 19:35:13

quoted
   To Tony. I applied your patches as well. The only patch I didn't was 
the DIRECTCOLOR patch. The X server freaked out for my card when the video 
mode was in a DIRECTCOLOR state.
Yes I'm not sure about this too.  Also the patch I submitted is untested
for RGB565, tested only for RGB555 and RGB8888.  So, does X work for
rivafb?  It does not work in my hardware unless I add the directcolor
patch.
I applied your direct color patch. The X server has issues without it as 
well. For some reason the screen is cut in half and the colors are wrong.
Even when I leave X. The only solution is to switch back to 8 bpp mode.



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com

Re: [PATCH] Interlace for rivafb driver

From: Antonino Daplas <hidden>
Date: 2003-01-30 23:14:44

On Fri, 2003-01-31 at 03:34, James Simmons wrote:
quoted
quoted
   To Tony. I applied your patches as well. The only patch I didn't was 
the DIRECTCOLOR patch. The X server freaked out for my card when the video 
mode was in a DIRECTCOLOR state.
Yes I'm not sure about this too.  Also the patch I submitted is untested
for RGB565, tested only for RGB555 and RGB8888.  So, does X work for
rivafb?  It does not work in my hardware unless I add the directcolor
patch.
I applied your direct color patch. The X server has issues without it as 
well. For some reason the screen is cut in half and the colors are wrong.
Even when I leave X. The only solution is to switch back to 8 bpp mode.
I get this too.  For some reason, X fails to dynamically set rivafb to
the mode it wants to use.  So, I have to use fbset first to set rivafb
to the mode and visual X is going to use.  After doing this, I get
XFBdev working nicely (at Depth 15).

I have no problems with DirectFB though.

Tony



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com

Re: [PATCH] Interlace for rivafb driver

From: James Simmons <hidden>
Date: 2003-02-12 20:10:28

quoted
I applied your direct color patch. The X server has issues without it as 
well. For some reason the screen is cut in half and the colors are wrong.
Even when I leave X. The only solution is to switch back to 8 bpp mode.
I get this too.  For some reason, X fails to dynamically set rivafb to
the mode it wants to use.  So, I have to use fbset first to set rivafb
to the mode and visual X is going to use.  After doing this, I get
XFBdev working nicely (at Depth 15).

I have no problems with DirectFB though.
Ug. Well the driver is really coming along. This is without specs. 




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help