[MPlayer-users] cvidix PVIDEO/overlay state corruption bug

Ben Long chadernook at gmail.com
Sun May 3 12:58:04 CEST 2009


This bug pops up when I use the NVidia card cvidix (console) driver with

mplayer -vo cvidix [tv:// or some file]

The bug causes the video to randomly black out after a variable amount of
time (from half an hour to several hours). Upon quitting and running mplayer
a second time the driver refuses to display giving me only sound output.
There is no change in the output of mplayer and the logs seem to give the
impression that everything is working as normal. After the bug occurs the
situation could only be remedied by a reboot.

So, I compiled mplayer, uncommented the debug information (#if 0) in
vidix/nvidia_vid.c, and recompiled in vidix/ with:

gcc -g -o nvidia_vid nvidia_vid.c pci.c pci_names.c mtrr.c dha.c -I ../ -lm
../*/*.a

and obtained some useful information:

BEFORE BUG - during mplayer running cvidix output:
[nvidia_vid] Found chip: NV34 [GeForce FX 5200]
[nvidia_vid] arch 30 register base 0xb7253000
[nvidia_vid] detected memory size 128 MB
[nvidia_vid] MTRR set up
[nvidia_vid] video mode: 1600x1200 at 15
NV_PVIDEO_BASE (0x900) 0x7060000
NV_PVIDEO_LIMIT (0x908) 0x709fbff
NV_PVIDEO_OFFSET (0x920) 0x0
NV_PVIDEO_FORMAT (0x958) 0x103c0
NV_PVIDEO_STOP (0x704) 0x0
NV_PVIDEO_BUFFER (0x700) 0x1

The NV_PVIDEO registers seem to control the hardware NVidia video overlays.
Note here that the NV_PVIDEO_STOP register is blank, meaning that the video
is running. There is a single buffer used (allocated/mapped?) given the
state of NV_PVIDEO_BUFFER.

BEFORE BUG - outside mplayer, no video running:
[nvidia_vid] Found chip: NV34 [GeForce FX 5200]
[nvidia_vid] arch 30 register base 0xb71ac000
[nvidia_vid] detected memory size 128 MB
[nvidia_vid] MTRR set up
[nvidia_vid] video mode: 1600x1200 at 15
NV_PVIDEO_BASE (0x900) 0x7060000
NV_PVIDEO_LIMIT (0x908) 0x709fbff
NV_PVIDEO_OFFSET (0x920) 0x0
NV_PVIDEO_FORMAT (0x958) 0x103c0
NV_PVIDEO_STOP (0x704) 0x11
NV_PVIDEO_BUFFER (0x700) 0x0

Now NV_PVIDEO_STOP is set and NV_PVIDEO_BUFFER is blank, showing that the
PVIDEO system is stopped and there is no buffer used (allocated/mapped?)

AFTER BUG - outside mplayer, no video running:
[nvidia_vid] Found chip: NV34 [GeForce FX 5200]
[nvidia_vid] arch 30 register base 0xb71b5000
[nvidia_vid] detected memory size 128 MB
[nvidia_vid] MTRR set up
[nvidia_vid] video mode: 1600x1200 at 15
NV_PVIDEO_BASE (0x900) 0x7060000
NV_PVIDEO_LIMIT (0x908) 0x709fbff
NV_PVIDEO_OFFSET (0x920) 0x0
NV_PVIDEO_FORMAT (0x958) 0x103c0
NV_PVIDEO_STOP (0x704) 0x11
NV_PVIDEO_BUFFER (0x700) 0x1

Given that this is outside mplayer in console mode we can see that there is
a buffer still being used. I'm reasonably sure this is broken behaviour, and
this causes subsequent runs to use the same broken overlay state. I have
tried starting X with the nv driver after this and it appeared to produce a
black screen (but I am not entirely sure this is the cause, X is
temperamental).

Given that the overlay shutdown tries to unset this register and any other
attempts to write to this register fail, I assume it has something to do
with the private overlay memory state and I don't know much about that.

I have managed to produce a (semi) fix by placing the line

VID_AND32 (info->chip.PMC, 0x000200, 0x0FFFFFFF);

in the beginning of nv_destroy(). This line accesses the control register
NV_PMC_ENABLE and turns off the PVIDEO overlay system by removing the
associated bits. It might be more sensible to use 0xEFFFFFFF similar to the
method in the xf86-driver-nouveau project for fiddling with this register,
but I've tested this line on a console-only system and it prevents the need
for constant rebooting. It does not cause interactions in a console system
as nvidia_vid.c or anything that needs it will turn on the video overlay
system when it starts. It seems turning off and on the overlay system
removes the problematic overlay registers configuration.

However, submitting this line would probably not be a good idea as I think
this driver is also used for xvidix, and I have no idea what the impact of
turning off the overlay system as the program quits would be on an X
session, let alone on multiple running mplayer instances.

The only way to fix this properly would be to either find out why video
blacks out suddenly and what changes cause it, or a way to fix the overlay
state while it is running, or find out whether this is caused by an
interaction between drivers (I am also running vesafb).

Let me know if I have omitted any important information.

Thanks

Benjamin Long


More information about the MPlayer-users mailing list