[Mplayer-users] Patch enabling use of multiple Xvideo ports.

Artur Zaprzala artur.zaprzala at talex.com.pl
Thu Jun 21 17:10:50 CEST 2001


nVidia drivers (1.0-1251) now provide 2 adaptors for hardware scaling and YUV conversion:
`Video Overlay' (1 port) and `Video Blitter' (32 ports).

MPlayer with supplied patch will select the first available Xvideo port and locks it for
exclusive use with XvGrabPort() to avoid conflicts with other clients.

This theoretically enables watching 33 accelereated video streams simultaneously, but
something strange happens. After starting 8 mplayers (with no sound) with mpeg video, CPU
usage is about 50%-70% and video is smooth. After starting the 9th mplayer, CPU usage is
100% and video is jerky. Who is to blame?


Hardware: GeForce 2MX (Elsa), Duron @ 850MHz
Software: RedHat 7.1, XFree86 4.0.3, Linux 2.4.4, MPlayer-0.17a_IdegCounter

Artur Zaprzala
-------------- next part --------------
diff -ur main-orig/libvo/vo_xv.c main/libvo/vo_xv.c
--- main-orig/libvo/vo_xv.c	Sun Jun 17 03:22:09 2001
+++ main/libvo/vo_xv.c	Thu Jun 21 16:12:58 2001
@@ -101,6 +101,7 @@
  XSizeHints hint;
  XVisualInfo vinfo;
  XEvent xev;
+ XvPortID xv_p;
 
  XGCValues xgcv;
  XSetWindowAttributes xswa;
@@ -177,9 +178,16 @@
      return -1;
     }
    /* check adaptors */
-   for (i = 0; i < adaptors; i++)
+   for (i = 0; i < adaptors && xv_port == 0; i++)
     {
-     if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask) && (xv_port == 0)) xv_port = ai[i].base_id;
+     if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask))
+	 for (xv_p = ai[i].base_id; xv_p < ai[i].base_id+ai[i].num_ports; ++xv_p)
+	     if (!XvGrabPort(mDisplay, xv_p, CurrentTime)) {
+		 xv_port = xv_p;
+		 break;
+	     } else {
+		 printf("Xv: could not grab port %i\n", (int)xv_p);
+	     }
     }
    /* check image formats */
    if (xv_port != 0)


More information about the MPlayer-users mailing list