XVideo patch for Trident Microsystems Cyber 9397DVD video card

This patch has been tested on my Thinkpad 770Z. The XVideo is an extension of the X server (you should see it with xdpyinfo), and provide some useful YUV colour space conversion. This extension is used for exemple in SDL, and in various video players using SDL, for example smpeg and also xmps.

The XVideo driver provides you information with the command xvinfo :

X-Video Extension version 2.2
screen #0
  Adaptor #0: "Trident Backend Scaler"
    number of ports: 1
    port base: 46
    operations supported: PutImage 
    supported visuals:
      depth 16, visualID 0x23
      depth 16, visualID 0x24
    number of attributes: 1
      "XV_COLORKEY" (range 0 to 16777215)
              client settable attribute
              client gettable attribute (current value is 2110)
    maximum XvImage size: 1024 x 1024
    Number of image formats: 4
      id: 0x35315652 (RV15)
        guid: 52563135-0000-0000-0000-000000000000
        bits per pixel: 16
        number of planes: 1
        type: RGB (packed)
        depth: 0
        red, green, blue masks: 0x1f, 0x3e0, 0x7c00
      id: 0x36315652 (RV16)
        guid: 52563136-0000-0000-0000-000000000000
        bits per pixel: 16
        number of planes: 1
        type: RGB (packed)
        depth: 0
        red, green, blue masks: 0x1f, 0x7e0, 0xf800
      id: 0x32315659 (YV12)
        guid: 59563132-0000-0010-8000-00aa00389b71
        bits per pixel: 12
        number of planes: 3
        type: YUV (planar)
      id: 0x32595559 (YUY2)
        guid: 59555932-0000-0010-8000-00aa00389b71
        bits per pixel: 16
        number of planes: 1
        type: YUV (packed)
 

The implementation of the XVideo extension for the trident driver is broken : data are mapped in the X window with a wrong offset at the left of the picture, and window resizing sucks too. The proposed patch solves this issue. At least on my chipset. You can test your XVideo extension with this sample code, if you don't have any of the mpeg players referenced previously. Compile it with gcc -o testxv testxv.c -L/usr/X11R6/lib -lX11 -lXext -lXv

Here are the spec of my trident chipset according to lspci -v :

01:00.0 VGA compatible controller: Trident Microsystems Cyber 9397DVD (rev f3) (prog-if 00 [VGA])
	Subsystem: IBM: Unknown device 00ea
	Flags: 66Mhz, medium devsel, IRQ 11
	Memory at 70800000 (32-bit, non-prefetchable) [size=8M]
	Memory at 71000000 (32-bit, non-prefetchable) [size=128K]
	Memory at 70000000 (32-bit, non-prefetchable) [size=8M]
	Expansion ROM at <unassigned> [disabled] [size=64K]
	Capabilities: [80] AGP version 1.0
	Capabilities: [90] Power Management version 1

The proposed patch applies to file xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c in the current XFree86 sources from CVS. Just rebuild the trident_drv.o in this directory, and put it in /usr/X11R6/lib/modules/drivers before restarting it.

Feedback/comments are welcome to Fabrice Bellet.

Last modified : Sat Feb 17 22:17:08 CET 2001