Now that the kfir driver has been ported to kernel 2.6 (thanks to Anssi Hannula) I'd like to get back to a problem that has been bugging me ever since I'm using the kfir card.
When I load the kfir driver with
insmod kfir.ko vidinput=0 vidrate=3000000 debug=0 streamtype=4
so that I get a Transport Stream, and then open the /dev/video device for reading, I get a perfectly ok TS. However, if I close /dev/video and open it again, the video resulting from the TS shows block artefacts at the bottom of the screen. Every time I repeat this close/open procedure, the area that is distorted grows further up, until after some 5 or so cycles the entire screen is full of artefacts (and there are also sound distortions).
Only rmmod/insmod of kfir.ko fixes this, which means that I have to unload/load the driver before every recording.
Does anybody (Anssi?) have any idea what might be the cause for this?
Well, let's try to see if some device initializing helps. Apply the attached patch (assigns some initialization functions to ioctl's), and between /dev/video openings use the kfirtester.c:
./kfirtester /dev/video0 a b c d e f g h
Every letter runs the initialization function assigned to that letter, so if the stream is ok after the command, take some letter off and open the device to see if the stream is still ok. Continue until found what is the letter(s) required for correct stream. This way we see in what function is the required initialization routine in.
-- Anssi Hannula
--- kfir/driver/kfir.c 2005-02-19 17:17:38.000000000 +0200 +++ kfir-debug-disto/driver/kfir.c 2005-02-19 17:24:43.000000000 +0200 @@ -2492,28 +2492,42 @@ static int kfir_do_ioctl(struct inode *i } case VIDIOCSWIN: - return -EINVAL; + InitParams(kfir); + return 0; case VIDIOCGWIN: - return -EINVAL; + u32 val; + /* Disable PLX PCI interrupt */ + val = rplxl(PLX9054_INT_CNTRL_STS); + val &= ~PCI_INT_ENABLE; + wplxl(PLX9054_INT_CNTRL_STS, val); + + return 0; case VIDIOCCAPTURE: - return -EINVAL; + AlteraLoadMicro(kfir); + + return 0; case VIDIOCGFBUF: - return -EINVAL; + Kfir_Reset(kfir); + return 0; case VIDIOCSFBUF: - return -EINVAL; + ADSP_KfInit(kfir); + return 0; case VIDIOCKEY: - return -EINVAL; + KfirGeneric_Init(kfir); + return 0; case VIDIOCGFREQ: - return -EINVAL; + DecoderInit(kfir); + return 0; case VIDIOCSFREQ: - return -EINVAL; + InitIRQs(kfir); + return 0; case VIDIOCGAUDIO: {
/* for usage with kfir-distortion-debug version. */ #include <fcntl.h> #include <linux/videodev.h> #include <sys/ioctl.h> #include <stdio.h> int main (int argc, char *argv[]) { int i; int fd = open (argv[1], O_RDWR); if (fd < 0) { printf("Failure opening device %s\n", argv[1]); return 1; } for (i=2; i<argc; i++) { sleep(1); printf("ioctl %c\n",*argv[i]); switch(*argv[i]) { case 'a': ioctl(fd,VIDIOCSWIN,0); break; case 'b': ioctl(fd,VIDIOCGWIN,0); break; case 'c': ioctl(fd,VIDIOCCAPTURE,0); break; case 'd': ioctl(fd,VIDIOCGFBUF,0); break; case 'e': ioctl(fd,VIDIOCSFBUF,0); break; case 'f': ioctl(fd,VIDIOCKEY,0); break; case 'g': ioctl(fd,VIDIOCGFREQ,0); break; case 'h': ioctl(fd,VIDIOCSFREQ,0); break; } } return 0; }
_______________________________________________ mpeg2 mailing list mpeg2@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/mpeg2