[Mplayer-cvslog] CVS: main/vidix/drivers nvidia_vid.c,1.19,1.20

Dmitry Baryshkov CVS lumag at mplayerhq.hu
Mon Jan 12 14:43:32 CET 2004


Update of /cvsroot/mplayer/main/vidix/drivers
In directory mail:/scsi/2/tmp/cvs-serv6958

Modified Files:
	nvidia_vid.c 
Log Message:
Fix "panning" display
Ease multibuffer.
Cosmetics.


Index: nvidia_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/vidix/drivers/nvidia_vid.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- nvidia_vid.c	24 Dec 2003 22:00:50 -0000	1.19
+++ nvidia_vid.c	12 Jan 2004 13:43:30 -0000	1.20
@@ -245,8 +245,9 @@
 	unsigned long picture_base;	 /* direct pointer to video picture	       */
 	unsigned long picture_offset;	 /* offset of video picture in frame buffer    */
 //	struct rivatv_dma dma;           /* DMA structure                              */
-    unsigned int next_frame;
+    unsigned int cur_frame;
 	unsigned int num_frames;             /* number of buffers                          */
+	int bps;			/* bytes per line */
 };
 typedef struct rivatv_info rivatv_info;
 
@@ -451,16 +452,12 @@
     }
 }
 
-static void nv_waitidle(struct rivatv_info *info ){
-     while (info->chip.PGRAPH[0x1C0] & 1) {}
-}
-
 static void nv_getscreenproperties(struct rivatv_info *info){
   uint32_t bpp=0;
   info->chip.lock(&info->chip, 0);
   /*get screen depth*/
   VID_WR08(info->chip.PCIO, 0x03D4,0x28);
-  bpp = VID_RD08(info->chip.PCIO,0x03D5);
+  bpp = VID_RD08(info->chip.PCIO,0x03D5)&0x3;
   if(bpp==3)bpp=4;
   if((bpp == 2) && (info->chip.PVIDEO[0x00000600/4] & 0x00001000) == 0x0)info->depth=15;           
   else info->depth = bpp*8;
@@ -489,6 +486,7 @@
 	int x=info->wx?info->wx:8, y=info->wy?info->wy:8;
 	int lwidth=info->d_width, lheight=info->d_height;
 	int bps;
+	int i;
 
     size = info->buffer_size;
 	base = info->picture_offset;
@@ -497,12 +495,37 @@
     nv_getscreenproperties(info);
 
     if(info->depth){
-        bps = info->screen_x * ((info->depth+1)/8);
+//        bps = info->screen_x * ((info->depth+1)/8);
     	/* get pan offset of the physical screen */
      	pan = rivatv_overlay_pan (info);
     	/* adjust window position depending on the pan offset */
-    	x = info->wx - (pan % bps) * 8 / info->depth;
+        bps = 0;
+	info->chip.lock (&info->chip, 0);
+	for (i = 0; (i < 1024) && (bps == 0); i++)
+	{
+		if (info->chip.arch != NV_ARCH_03)
+			bps = info->chip.PGRAPH[0x00000670/4];
+		else
+			bps = info->chip.PGRAPH[0x00000650/4];
+	}
+	if (bps == 0)
+	{
+		fprintf(stderr, "[nvidia_vid] reading bps returned 0!!!\n");
+		if (info->bps != 0)
+			bps = info->bps;
+	}
+	else
+	{
+		info->bps = bps;
+	}
+
+    	if (bps != 0)
+	{
+	x = info->wx - (pan % bps) * 8 / info->depth;
     	y = info->wy - (pan / bps);
+	}
+    }
+    
 	    /* adjust negative output window variables */
 	    if (x < 0) {
 		  lwidth = info->d_width + x;
@@ -516,7 +539,6 @@
 //		offset += (-window->y * port->vld_height / window->height * port->org_width) << 1;
 	      y = 0;
 	    }
-    }
 
 	switch (info->chip.arch) {
 	case NV_ARCH_10:
@@ -735,8 +757,9 @@
  
    
   rivatv_enable_PMEDIA(info);
-  info->next_frame = 0;
+  info->cur_frame = 0;
   info->use_colorkey = 0;
+
   return 0;
 }
 
@@ -833,7 +856,7 @@
 }
 
 int vixPlaybackOn(void){
-    rivatv_overlay_start(info,info->next_frame);
+    rivatv_overlay_start(info,info->cur_frame);
     return 0;
 }
 
@@ -861,6 +884,6 @@
 //  printf("selecting buffer %d\n", frame);
   rivatv_overlay_start(info, frame);
   if (info->num_frames >= 1)
-	  info->next_frame = (frame+1)%info->num_frames;
+	  info->cur_frame = frame/*(frame+1)%info->num_frames*/;
   return 0;
 }




More information about the MPlayer-cvslog mailing list