[MPlayer-dev-eng] [PATCH] vo_tdfxfb.c dest size patch for gcc3.*+

Burton Samograd kruhft at kruhft.dyndns.org
Tue Aug 27 18:16:55 CEST 2002


Here's my patch resubmitted using the patches.txt guidelines.

On Mon, Aug 26, 2002 at 08:07:08PM -0700, Burton Samograd wrote:
> Hi all,
> 
> I'm quite new to this list, but I was trying to get mplayer to work
> with tdfxfb for a while and I managed to fix what seemed to be a
> problem with gcc 3.*+: when playing a video the output would only be
> the size of a single text character.
> 
> It was a pretty wierd problem.  The problem stemmed from two very
> bizarre things:
> 
> 1) the XYREG macro from 3dfx.h didn't seem to work
> 2) the values of the variable vidwidth and vidheight weren't being
> retrieved properly by the compiler.
> 
> To fix the first problem i explicitly built the register value without
> using the macro.  The second problem was fixed by first loading the
> vidwidth and vidheight globals into temporary stack variables before
> using them.
> 
> I've tested this on my system using various resolutions and video
> sizes/aspects and it seems to work for all cases that I've found.
>

Burton Samograd
-------------- next part --------------
? h
Index: vo_tdfxfb.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_tdfxfb.c,v
retrieving revision 1.14
diff -u -r1.14 vo_tdfxfb.c
--- vo_tdfxfb.c	13 Apr 2002 19:14:33 -0000	1.14
+++ vo_tdfxfb.c	27 Aug 2002 16:17:38 -0000
@@ -322,6 +322,10 @@
 {
 	voodoo_2d_reg regs = *reg_2d;		/* Copy the regs */
 	int i = 0;
+	/* This has to be done of else setting dstSize doesn't work  */
+	/* Must be a gcc 3.0+ bug */
+	int tempvidheight = vidheight; 
+	int tempvidwidth = vidwidth;
 
 	if(vo_doublebuffering) {
 		/* Flip to an offscreen buffer for rendering */
@@ -346,7 +350,8 @@
 	reg_2d->dstBaseAddr = vidpageoffset;
 	reg_2d->dstXY = XYREG(vidx, vidy);
 	reg_2d->dstFormat = vid_voodoo_format;
-	reg_2d->dstSize = XYREG(vidwidth, vidheight);
+	/* The XYREG macro doesn't seem to work for this line so build the register contents very explicitly */
+	reg_2d->dstSize = ((((unsigned long)vidheight) & 0x0000FFFF) << 16) | (((unsigned long) vidwidth) & 0x0000FFFF);  
 	reg_2d->command = S2S_STRECH_BLT | S2S_IMMED | S2S_ROP;
 
 	/* Wait for the command to finish (If we don't do this, we get wierd


More information about the MPlayer-dev-eng mailing list