[MPlayer-dev-eng] Fwd: [Mplayerxp-general] GLINT R3 vidix driver and some fixes

Arpi arpi at thot.banki.hu
Wed Apr 17 16:53:50 CEST 2002


some of this patch looks interesting, mayeb someone could test and integrate
to mplayer... especially the xvidix aspect fix.

--------- Forwarded message ---------
From: "Måns Rullgård" <mru at users.sourceforge.net>
To: mplayerxp-general at lists.sourceforge.net
Subject: [Mplayerxp-general] GLINT R3 vidix driver and some fixes

Below is a patch for:
- Alpha support in libdha
- xvidix output keeps aspect on fullscreen
- Fixed stride for YUY2 format in vosub_vidix.c. This need to be
  looked at a bit more. There should be a clear rule what the
  {y,u,v}stride means.
- Speed up yv12toyuy2 by factor 10 when using vidix.
- Add vidix driver for 3DLabs GLINT R3 and Permedia3 chips. The actual
  driver is a bit big for mail, so grab it from
  http://www.e.kth.se/~e99_mru/pm3/ and drop in drivers dir of vidix.

Index: mplayerxp/libdha/libdha.c
===================================================================
RCS file: /cvsroot/mplayerxp/mplayerxp/mplayerxp/libdha/libdha.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 libdha.c
--- mplayerxp/libdha/libdha.c	23 Mar 2002 11:09:20 -0000	1.1.1.1
+++ mplayerxp/libdha/libdha.c	17 Apr 2002 00:33:55 -0000
@@ -28,6 +28,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
+#include <sys/io.h>
 
 /* instead exit() use libdha_exit, and do the 'mother-application' deinit
    only in this code */
@@ -67,8 +68,11 @@
 #include "kernelhelper/dhahelper.h"
 
 static int mem=-1;
-void *map_phys_mem(unsigned base, unsigned size)
+void *map_phys_mem(unsigned long base, unsigned long size)
 {
+#ifdef ARCH_ALPHA
+  base += bus_base();
+#endif
   if ( (mem = open("/dev/dhahelper",O_RDWR)) < 0)
   {
     if ( (mem = open(DEV_MEM,O_RDWR)) == -1) {
@@ -95,8 +99,11 @@
 #else
 
 static int mem=-1;
-void *map_phys_mem(unsigned base, unsigned size)
+void *map_phys_mem(unsigned long base, unsigned long size)
 {    
+#ifdef ARCH_ALPHA
+  base += bus_base();
+#endif
   if ( (mem = open(DEV_MEM,O_RDWR)) == -1) {
     perror("libdha: open(/dev/mem) failed") ; exit(1) ;
   }
@@ -104,7 +111,7 @@
 }
 #endif /* CONFIG_DHAHELPER */
 
-void unmap_phys_mem(void *ptr, unsigned size)
+void unmap_phys_mem(void *ptr, unsigned long size)
 {
   int res=munmap(ptr,size) ;
   if (res == -1) { perror("libdha: munmap() failed") ; exit(1) ; }
Index: mplayerxp/libdha/libdha.h
===================================================================
RCS file: /cvsroot/mplayerxp/mplayerxp/mplayerxp/libdha/libdha.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 libdha.h
--- mplayerxp/libdha/libdha.h	23 Mar 2002 11:09:20 -0000	1.1.1.1
+++ mplayerxp/libdha/libdha.h	17 Apr 2002 00:33:55 -0000
@@ -55,8 +55,8 @@
 extern void          OUTPORT32(unsigned idx,unsigned val);
 #define OUTPORT(idx,val) OUTPORT32(idx,val)
 
-extern void *  map_phys_mem(unsigned base, unsigned size);
-extern void    unmap_phys_mem(void *ptr, unsigned size);
+extern void *  map_phys_mem(unsigned long base, unsigned long size);
+extern void    unmap_phys_mem(void *ptr, unsigned long size);
 
 /*  These are the region types  */
 #define MTRR_TYPE_UNCACHABLE 0
Index: mplayerxp/libdha/pci.c
===================================================================
RCS file: /cvsroot/mplayerxp/mplayerxp/mplayerxp/libdha/pci.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 pci.c
--- mplayerxp/libdha/pci.c	23 Mar 2002 11:09:20 -0000	1.1.1.1
+++ mplayerxp/libdha/pci.c	17 Apr 2002 00:33:57 -0000
@@ -736,4 +736,4 @@
 int disable_app_io( void )
 {
   return disable_os_io();
-}
\ No newline at end of file
+}
Index: mplayerxp/libdha/sysdep/pci_alpha.c
===================================================================
RCS file: /cvsroot/mplayerxp/mplayerxp/mplayerxp/libdha/sysdep/pci_alpha.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 pci_alpha.c
--- mplayerxp/libdha/sysdep/pci_alpha.c	23 Mar 2002 11:09:20 -0000	1.1.1.1
+++ mplayerxp/libdha/sysdep/pci_alpha.c	17 Apr 2002 00:33:57 -0000
@@ -11,7 +11,7 @@
           unsigned char dev,
           int func)
 {
-    int retval;
+    unsigned long retval;
     pciconfig_read(bus, dev<<3, PCI_ID_REG, 4, &retval);
     return retval;
 }
@@ -22,7 +22,7 @@
           int func, 
           unsigned cmd)
 {
-    long retval;
+    unsigned long retval;
     pciconfig_read(bus, dev<<3, cmd, 4, &retval);
     return retval;
 }
Index: mplayerxp/libvo/vo_xvidix.c
===================================================================
RCS file: /cvsroot/mplayerxp/mplayerxp/mplayerxp/libvo/vo_xvidix.c,v
retrieving revision 1.7
diff -u -r1.7 vo_xvidix.c
--- mplayerxp/libvo/vo_xvidix.c	13 Apr 2002 17:56:15 -0000	1.7
+++ mplayerxp/libvo/vo_xvidix.c	17 Apr 2002 00:34:01 -0000
@@ -93,7 +93,14 @@
 	drwY = (vo_screenheight - (dheight > vo_screenheight ? vo_screenheight : d
height)) / 2;
 	drwcY += drwY;
 	drwWidth = (dwidth > vo_screenwidth ? vo_screenwidth : dwidth);
-	drwHeight = (dheight > vo_screenheight ? vo_screenheight : dheight);
+	drwHeight = drwWidth * vo_old_height / vo_old_width;
+	if(drwHeight > vo_screenheight){
+	    drwHeight = vo_screenheight;
+	    drwWidth = drwHeight * vo_old_width / vo_old_height;
+	}
+	drwcX = drwX += (vo_screenwidth - drwWidth) / 2;
+	drwcY = drwY += (vo_screenheight - drwHeight) / 2;
+/* 	drwHeight = (dheight > vo_screenheight ? vo_screenheight : dheight); */
 	mp_msg(MSGT_VO, MSGL_V, "[xvidix-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d 
dh: %d\n",
 	    drwcX, drwcY, drwX, drwY, drwWidth, drwHeight);
     }
Index: mplayerxp/libvo/vosub_vidix.c
===================================================================
RCS file: /cvsroot/mplayerxp/mplayerxp/mplayerxp/libvo/vosub_vidix.c,v
retrieving revision 1.6
diff -u -r1.6 vosub_vidix.c
--- mplayerxp/libvo/vosub_vidix.c	12 Apr 2002 07:20:31 -0000	1.6
+++ mplayerxp/libvo/vosub_vidix.c	17 Apr 2002 00:34:03 -0000
@@ -628,8 +628,9 @@
 		image_Bpp=3;
 		break;
 	    default:
-		apitch = vidix_play.dest.pitch.y-1;
-		dstrides.y = (image_width*2 + apitch) & ~apitch;
+/* 		apitch = vidix_play.dest.pitch.y-1; */
+/* 		dstrides.y = (image_width*2 + apitch) & ~apitch; */
+		dstrides.y = vidix_play.dest.pitch.y * 2;
 		dstrides.u = dstrides.v = 0;
 		image_Bpp=2;
 		break;
Index: mplayerxp/postproc/rgb2rgb_template.c
===================================================================
RCS file: /cvsroot/mplayerxp/mplayerxp/mplayerxp/postproc/rgb2rgb_template.c
,v
retrieving revision 1.3
diff -u -r1.3 rgb2rgb_template.c
--- mplayerxp/postproc/rgb2rgb_template.c	14 Apr 2002 10:09:52 -0000	1.3
+++ mplayerxp/postproc/rgb2rgb_template.c	17 Apr 2002 00:34:05 -0000
@@ -682,13 +682,14 @@
 			: "%eax"
 		);
 #else
-		int i;
-		for(i=0; i<chromWidth; i++)
-		{
-			dst[4*i+0] = ysrc[2*i+0];
-			dst[4*i+1] = usrc[i];
-			dst[4*i+2] = ysrc[2*i+1];
-			dst[4*i+3] = vsrc[i];
+		int i, *idst = (int32_t *) dst;
+		const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
+		for(i = 0; i < chromWidth; i++){
+			*idst++ = yc[0] + (uc[0] << 8) +
+			    (yc[1] << 16) + (vc[0] << 24);
+			yc += 2;
+			uc++;
+			vc++;
 		}
 #endif
 		if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
Index: mplayerxp/vidix/drivers/Makefile
===================================================================
RCS file: /cvsroot/mplayerxp/mplayerxp/mplayerxp/vidix/drivers/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- mplayerxp/vidix/drivers/Makefile	11 Apr 2002 05:45:09 -0000	1.2
+++ mplayerxp/vidix/drivers/Makefile	17 Apr 2002 00:34:05 -0000
@@ -17,6 +17,12 @@
 RAGE128_LIBS=-L../../libdha -ldha
 RAGE128_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W -DRAGE128
 
+PM3_VID=pm3_vid.so
+PM3_SRCS=pm3_vid.c
+PM3_OBJS=pm3_vid.o
+PM3_LIBS=-L../../libdha -ldha
+PM3_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W
+
 MACH64_VID=mach64_vid.so
 MACH64_SRCS=mach64_vid.c
 MACH64_OBJS=mach64_vid.o
@@ -47,13 +53,19 @@
 MGA_CRTC2_LIBS=-L../../libdha -ldha -lm
 MGA_CRTC2_CFLAGS=$(OPTFLAGS) -fPIC -I. -I.. -Wall -W -DCRTC2
 
-all:    $(RADEON_VID) $(RAGE128_VID) $(MACH64_VID) $(NVIDIA_VID) $(GENFB_VI
D) $(MGA_VID) $(MGA_CRTC2_VID)
+all:    $(RADEON_VID) $(RAGE128_VID) $(MACH64_VID) $(NVIDIA_VID) $(GENFB_VI
D) $(MGA_VID) $(MGA_CRTC2_VID) $(PM3_VID)
 
 
 .SUFFIXES: .c .o
 
 # .PHONY: all clean
 
+$(PM3_OBJS):    $(PM3_SRCS)
+	$(CC) -c $(PM3_CFLAGS) -o $@ $<
+
+$(PM3_VID):     $(PM3_OBJS)
+	$(LD) $(PM3_LIBS) -shared -soname $(PM3_VID) -o $(PM3_VID) $(PM3_OBJS)
+
 $(RADEON_OBJS):    $(RADEON_SRCS)
 	$(CC) -c $(RADEON_CFLAGS) -o $@ $<
 


_______________________________________________
Mplayerxp-general mailing list
Mplayerxp-general at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mplayerxp-general





More information about the MPlayer-dev-eng mailing list