[MPlayer-dev-eng] [PATCH] nvidia_vid update

Dmitry Baryshkov mitya at school.ioffe.ru
Mon Jan 5 22:16:38 CET 2004


Hello,
Attached is a patch, that fixes panning & small issues with
multibuffering. Could you please test it. It works for me, but can;t
test on >=NV10, NV03 and in cvidix(still can't get it working on my
Vanta :( ), winvidix.

If nobody objects, I'll commit it this weekend.
-- 
With best wishes
Dmitry Baryshkov

-------------- next part --------------
Index: nvidia_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/vidix/drivers/nvidia_vid.c,v
retrieving revision 1.19
diff -u -r1.19 nvidia_vid.c
--- nvidia_vid.c	24 Dec 2003 22:00:50 -0000	1.19
+++ nvidia_vid.c	5 Jan 2004 21:10:08 -0000
@@ -245,7 +245,7 @@
 	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                          */
 };
 typedef struct rivatv_info rivatv_info;
@@ -451,16 +451,16 @@
     }
 }
 
-static void nv_waitidle(struct rivatv_info *info ){
+/*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;
@@ -475,13 +475,13 @@
   /* get 9th bit in CRTC_OVERFLOW*/
   info->screen_y |= (VID_RD08(info->chip.PCIO,0x03D5) &0x02)<<7;
   /* and the 10th in CRTC_OVERFLOW*/
+  VID_WR08(info->chip.PCIO,0x03D4,0x07);
   info->screen_y |=(VID_RD08(info->chip.PCIO,0x03D5) &0x40)<<3;
   ++info->screen_y;
 }
 
 
 
-
 /* Start overlay video. */
 void rivatv_overlay_start (struct rivatv_info *info,int bufno){
     uint32_t base, size, offset, xscale, yscale, pan;
@@ -497,12 +497,24 @@
     nv_getscreenproperties(info);
 
     if(info->depth){
-        bps = info->screen_x * ((info->depth+1)/8);
     	/* get pan offset of the physical screen */
      	pan = rivatv_overlay_pan (info);
+//        bps = info->screen_x * ((info->depth+1)/8);
     	/* adjust window position depending on the pan offset */
+        bps = 0;
+	info->chip.lock (&info->chip, 0);
+	while (bps == 0)
+	{
+		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, "bps returned 0: %d\n");
+	}
     	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 +528,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 +746,9 @@
  
    
   rivatv_enable_PMEDIA(info);
-  info->next_frame = 0;
+  info->cur_frame = 0;
   info->use_colorkey = 0;
+
   return 0;
 }
 
@@ -833,7 +845,7 @@
 }
 
 int vixPlaybackOn(void){
-    rivatv_overlay_start(info,info->next_frame);
+    rivatv_overlay_start(info,info->cur_frame);
     return 0;
 }
 
@@ -861,6 +873,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;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20040106/e3c3a92e/attachment.pgp>


More information about the MPlayer-dev-eng mailing list