[MPlayer-dev-eng] neomagic tv out support [PATCH]

Rudolf Marek MAREKR2 at cs.felk.cvut.cz
Sat Jun 12 23:27:58 CEST 2004


Hello,

This patch will add support for Neomagic cards with TV out.
It works on IBM 390E, but it will work on any
combination of Neomagic and Chrontel 70xx chip. It may work with
neomagic and simple analog converter which has some notebooks
(Toshiba I think??)

How does it work:

It just calls OEM VESA VBE extensions after VESA mode is set.

Snip to manual:

If you want to have TV out working with your Neomagic card, simply
use vesa driver with neotv_pal or neotv_ntsc suboption.
 -vo vesa:neotv_pal or -vo vesa:neotv_ntsc

It will provide TV output in following 16bit and 8bit modes:

NTSC 320x240, 640x480 and maybe 800x600 too.
PAL  320x240, 400x300, 640x480, 800x600.

512x384 is not supported by BIOS. You must scale image to different
resolution to activate TV out.

If you see image on screen in 640x480 or in 800x600 but not in 320x240
you need to replace two tables in vbelib.c see vbeSetTV function for details.
Please contact the author in this case.


snip end.

Thats all I have for now. Any comments?

Thanks

Rudolf
-------------- next part --------------
diff -Naur b/libvo/vo_vesa.c a/libvo/vo_vesa.c
--- b/libvo/vo_vesa.c	2003-12-24 23:00:50.000000000 +0100
+++ a/libvo/vo_vesa.c	2004-06-12 19:42:23.000000000 +0200
@@ -123,6 +123,10 @@
 static vidix_grkey_t gr_key;
 #endif
 
+/* Neomagic TV out */
+static int neomagic_tvout = 0;
+static int neomagic_tvnorm = NEO_PAL;
+ 
 #define HAS_DGA()  (win.idx == -1)
 #define MOVIE_MODE (MODE_ATTR_COLOR | MODE_ATTR_GRAPHICS)
 #define FRAME_MODE (MODE_WIN_RELOCATABLE | MODE_WIN_WRITEABLE)
@@ -444,6 +448,10 @@
    else
    if(strcmp(sd,"dga") == 0)   { flags &= ~(SUBDEV_NODGA); flags |= SUBDEV_FORCEDGA; }
    else
+   if(strcmp(sd,"neotv_pal") == 0)   { neomagic_tvout = 1; neomagic_tvnorm = NEO_PAL; }
+   else
+   if(strcmp(sd,"neotv_ntsc") == 0)   { neomagic_tvout = 1; neomagic_tvnorm = NEO_NTSC; }
+   else
    if(memcmp(sd,"lvo:",4) == 0) lvo_name = &sd[4]; /* lvo_name will be valid within init() */
 #ifdef CONFIG_VIDIX
    else
@@ -927,6 +935,15 @@
 			return -1;
 		}
 		
+		if (neomagic_tvout) {
+		err = vbeSetTV(video_mode,neomagic_tvnorm);
+		    if (err!=0x4f) {
+		    printf("vo_vesa: Sorry unsupported mode, try -x 640 -zoom\n");
+		    }
+		    else {
+		    printf("vo_vesa: Oh you really have picture on TV!\n");
+		    } 
+		}
 		/* Now we are in video mode!!!*/
 		/* Below 'return -1' is impossible */
 		if(verbose)
diff -Naur b/osdep/vbelib.c a/osdep/vbelib.c
--- b/osdep/vbelib.c	2003-11-13 21:53:40.000000000 +0100
+++ a/osdep/vbelib.c	2004-06-12 22:51:30.000000000 +0200
@@ -6,6 +6,7 @@
    You can redistribute this file under terms and conditions
    of GNU General Public licence v2.
    Written by Nick Kurshev <nickols_k at mail.ru>
+   Neomagic TV out support by Rudolf Marek <r.marek et sh.cvut.cz>
 */
 
 #include <../config.h>
@@ -336,6 +337,46 @@
   return retval;
 }
 
+
+int vbeSetTV(unsigned int vesa_mode,unsigned int TV_mode) {
+
+#define NR_MODES 8
+
+unsigned int mode_table[NR_MODES] =    
+			{0x101,0x103,0x111,0x114,0x120,0x121,0x122,0x123};
+unsigned int tv_table[][NR_MODES] = {
+	        	{0x201,0x202,0x211,0x212,0x221,0x231,0x222,0x232},
+	        	{0x200,0x203,0x210,0x213,0x220,0x230,0xFFFF,0xFFFF}};
+
+/*
+
+Alternate mode map. If modes like 320x240 and 400x300 does not work, but
+640x480 and 800x600 work, then try to replace above two lines with this
+lines and write email to me if it works.
+r.marek et sh.cvut.cz
+
+	        	{0x201,0x202,0x211,0x212,0x222,0x223,0x224,0x225},
+	        	{0x200,0x203,0x210,0x213,0x220,0x221,0xFFFF,0xFFFF}};
+
+*/				 
+  int i,retval;
+  struct LRMI_regs r;
+
+  memset(&r,0,sizeof(struct LRMI_regs));
+  for (i=0;((mode_table[i]!=(vesa_mode&0x3FF))&&(i<NR_MODES));i++) ;
+  
+  if (i==NR_MODES) return 0;
+  if(verbose > 1) printf("vbelib: Trying to set TV mode %x\n",tv_table[TV_mode][i]);
+  r.eax = 0x4f14;
+  r.ebx = 0x20;
+  r.edx = 0;
+  r.edi = 0;
+  r.ecx =  tv_table[TV_mode][i];
+  retval = VBE_LRMI_int(0x10,&r);
+  if(!retval) return VBE_VM86_FAIL;
+  return r.eax & 0xffff;
+  
+}
 int vbeSetMode(unsigned mode,struct VesaCRTCInfoBlock *data)
 {
   struct LRMI_regs r;
diff -Naur b/osdep/vbelib.h a/osdep/vbelib.h
--- b/osdep/vbelib.h	2002-08-23 01:03:51.000000000 +0200
+++ a/osdep/vbelib.h	2004-06-12 18:29:35.000000000 +0200
@@ -82,6 +82,8 @@
 #define MODE_WIN_RELOCATABLE 	(1 << 0)
 #define MODE_WIN_READABLE 	(1 << 1)
 #define MODE_WIN_WRITEABLE 	(1 << 2)
+#define NEO_PAL 0
+#define NEO_NTSC 1
 
 /* SuperVGA mode information block */
 struct VesaModeInfoBlock {
@@ -211,6 +213,7 @@
 extern int vbeGetDisplayStart(unsigned *pixel_num,unsigned *scan_line);
 extern int vbeSetDisplayStart(unsigned long offset, int vsync);
 extern int vbeSetScheduledDisplayStart(unsigned long offset, int vsync);
+extern int vbeSetTV(unsigned int vesa_mode,unsigned int TV_mode);
 /*
    Func 0x08-0x09:
    Support of palette currently is not implemented.


More information about the MPlayer-dev-eng mailing list