diff -urN video4linux.20050119-130350-orig/cx88-core.c video4linux-20050119-hack7/cx88-core.c --- video4linux.20050119-130350-orig/cx88-core.c 2005-01-19 13:07:01.000000000 +0100 +++ video4linux-20050119-hack7/cx88-core.c 2005-01-31 02:37:08.000000000 +0100 @@ -36,7 +36,7 @@ #include "cx88.h" -MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); +MODULE_DESCRIPTION("v4l2 driver core module for cx2388x based TV cards. Hacked by Martin Dvh for testing purpose"); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); @@ -69,6 +69,79 @@ module_param(nicam,int,0644); MODULE_PARM_DESC(nicam,"tv audio is nicam"); + + +static unsigned int force_htotal = 0; +module_param(force_htotal,int,0644); +MODULE_PARM_DESC(force_htotal,"default PAL 1135, NTSC 910. Force htotal to this value, maximum is 2047.Programmable total number of pixel per line. This determines tha actual number of raw samples per line taken during a normal capture"); + +static unsigned int force_swidth = 0; +module_param(force_swidth,int,0644); +MODULE_PARM_DESC(force_swidth,"force scaled width to this value. default for PAL is 922, for NTSC 754"); + +static unsigned int force_hdelay = 0; +module_param(force_hdelay,int,0644); +MODULE_PARM_DESC(force_hdelay,"default PAL 186, NTSC 135, maximum 1023. HDELAY is programmed with the number of pixels between horizontal sync and the first pixel of each line to be displayed or captured. HDELAY should be an even number to get Cb as the first pixel, an odd number to get Cr. The register value is programmed with respect to the scaled frequency clock."); + +static unsigned int force_vdelay = 0; +module_param(force_vdelay,int,0644); +MODULE_PARM_DESC(force_vdelay,"default PAL 36,default NTSC 24 For video decoding, VDELAY is programmed with the number of half lines between the end of the serration pulses and the first line to be displayed or captured. The register value is programmed with respect to the unscaled input signal. VDELAY must be programmed to an even number to avoid apparent field reversal.*/"); + +static unsigned int force_fsc8 = 0; +module_param(force_fsc8,int,0644); +MODULE_PARM_DESC(force_fsc8,"pll frequency in Hz. (for videodecoder (will be scaled) and ADC) default PAL 35468950, NTSC 28636360. min 16000000 max 80000000"); + +static unsigned int force_vbi_pkt_size = 0; +module_param(force_vbi_pkt_size,int,0644); +MODULE_PARM_DESC(force_vbi_pkt_size,"default PAL 511, NTSC 288, max 1023 .VBI Packet Size. The number of raw data dwords (four 8-bit samples) to capture per line while in VBI capture mode (only used in VBI line mode)."); + +static unsigned int force_vactive = 0; +module_param(force_vactive,int,0644); +MODULE_PARM_DESC(force_vactive,"default PAL 576, NTSC 480, This is the vertical active. It defines the number of half lines used in the vertical scaling process. Values between 1 and 1023 are allowed."); + +static unsigned int force_hactive = 0; +module_param(force_hactive,int,0644); +MODULE_PARM_DESC(force_hactive,"default set to capture_width.This is the horizontal active. It defines the number of horizontal active pixels per line. Values between 1 and 1023 are allowed."); + +static unsigned int frm_size = 1024; +module_param(frm_size,int,0644); +MODULE_PARM_DESC(frm_size,"VBI Frame Size: default 1024. max 4095. Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet. Has to be QWORD boundary.\nThis number might need to correspond in some way to the exact height and /or width requested in the capture command."); + +static unsigned int vbi_v_del = 2; +module_param(vbi_v_del ,int,0644); +MODULE_PARM_DESC(vbi_v_del ,"The number of CLKx1 s to delay from the trailing edge of HRESET before starting VBI line capture. Used in both VBI line mode and VBI frame mode, where in VBI frame mode it has to set to a value of 2."); + +static unsigned int extend_vbi = 0; +module_param(extend_vbi,int,0644); +MODULE_PARM_DESC(extend_vbi,"A value of 1 extends the frame output capture region to include the 20 half lines prior to the default VACTIVE region. Can be used in vbi_frame_mode."); + +/*static unsigned int pll_freq = 0; +module_param(pll_freq ,int,0644); +MODULE_PARM_DESC(pll_freq ,"fsc8=pll_freq 28636360 for NTSC 35468950 for PAL");*/ + +static unsigned int disable_samplerateconverter = 0; +module_param(disable_samplerateconverter ,int,0644); +MODULE_PARM_DESC(disable_samplerateconverter ,"set to 1 to disable the samplerate_conversion for the video_decoder and make the videodecoderrate the same as the ADC sampling freq. If set to 0 the videodecoder works at a different frequency as the sampling frequency of the ADCs, for normal operation we should not need the samplerateconversion and just use pll_freq=fsc8 for everything. The datasheets are confusing about these settings"); + +static unsigned int disable_vscale = 0; +module_param(disable_vscale ,int,0644); +MODULE_PARM_DESC(disable_vscale ,"set to 1 to disable the vertical scaling."); + +static unsigned int disable_hscale = 0; +module_param(disable_hscale ,int,0644); +MODULE_PARM_DESC(disable_hscale ,"set to 1 to disable the horizontal scaling."); + +static unsigned int vbi_frame_capture_raw_mode = 0; +module_param(vbi_frame_capture_raw_mode,int,0644); +MODULE_PARM_DESC(vbi_frame_capture_raw_mode," This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size..\n If you set this you must set this as module parameter of both cx88xx.ko and cx8800.ko"); + +static unsigned int cap_raw_all = 0; +module_param(cap_raw_all,int,0644); +MODULE_PARM_DESC(cap_raw_all,"A value of 1 enables continuous raw data mode capture. You also need to set frm_size.\n If you set this you must set this as module parameter of both cx88xx.ko and cx8800.ko"); +/*static unsigned int disable_size_checks = 0; +module_param(disable_size_checks,int,0644); +MODULE_PARM_DESC(disable_size_checks,"if set to 1 no width and height checks are performed, dangerous !");*/ + static unsigned int nocomb = 0; module_param(nocomb,int,0644); MODULE_PARM_DESC(nocomb,"disable comb filter"); @@ -725,6 +798,60 @@ static unsigned int inline norm_swidth(struct cx88_tvnorm *norm) { + force_swidth=force_swidth & 0x1fff;/*mdvh This value is used to determine the scale factor so I don't know the exact maximum */ + return (force_swidth)?force_swidth:(norm->id & V4L2_STD_625_50) ? 922 : 754; +} + +static unsigned int inline norm_sheight(struct cx88_tvnorm *norm) +{ + return (norm->id & V4L2_STD_625_50) ? 576 : 480; +} + + +static unsigned int inline norm_hdelay(struct cx88_tvnorm *norm) +{ + force_hdelay=force_hdelay&0x03FF; + return (force_hdelay)?force_hdelay:(norm->id & V4L2_STD_625_50) ? 186 : 135; +} + +static unsigned int inline norm_vdelay(struct cx88_tvnorm *norm) +{ + force_vdelay=force_vdelay &0x03FF; + return (force_vdelay)?force_vdelay:(norm->id & V4L2_STD_625_50) ? 0x24 : 0x18; + /*For video decoding, VDELAY is programmed with the number of half lines between the end of the serration pulses and the first line to be displayed or captured. The register value is programmed with respect to the unscaled input signal. VDELAY must be programmed to an even number to avoid apparent field reversal.*/ + +} + +static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm) +{ + force_fsc8=(force_fsc8>16000000 && force_fsc8<80000000)?force_fsc8:0; + static const unsigned int ntsc = 28636360; + static const unsigned int pal = 35468950; + + return (force_fsc8)?force_fsc8:(norm->id & V4L2_STD_625_50) ? pal : ntsc; +} + +static unsigned int inline norm_notchfilter(struct cx88_tvnorm *norm) +{ + return (norm->id & V4L2_STD_625_50) + ? HLNotchFilter135PAL + : HLNotchFilter135NTSC; +} + +static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) +{ + force_htotal=force_htotal &0x07FF; + return (force_htotal)?force_htotal:((norm->id & V4L2_STD_625_50) ? 1135 : 910); +} + +static unsigned int inline norm_vbipack(struct cx88_tvnorm *norm) +{ + force_vbi_pkt_size=force_vbi_pkt_size & 0x03FF;//only used for vbi_line mode + return (force_vbi_pkt_size)?force_vbi_pkt_size:(norm->id & V4L2_STD_625_50) ? 511 : 288; +} + +/*static unsigned int inline norm_swidth(struct cx88_tvnorm *norm) +{ return (norm->id & V4L2_STD_625_50) ? 922 : 754; } @@ -762,12 +889,12 @@ { return (norm->id & V4L2_STD_625_50) ? 511 : 288; } - +*/ int cx88_set_scale(struct cx88_core *core, unsigned int width, unsigned int height, enum v4l2_field field) { unsigned int swidth = norm_swidth(core->tvnorm); - unsigned int sheight = norm_maxh(core->tvnorm); + unsigned int sheight = norm_sheight(core->tvnorm);//mdvh: was norm_maxh(core->tvnorm); u32 value; dprintk(1,"set_scale: %dx%d [%s%s,%s]\n", width, height, @@ -778,35 +905,38 @@ height *= 2; // recalc H delay and scale registers - value = (width * norm_hdelay(core->tvnorm)) / swidth; + value =(disable_hscale)?norm_hdelay(core->tvnorm): (width * norm_hdelay(core->tvnorm)) / swidth; value &= 0x3fe; cx_write(MO_HDELAY_EVEN, value); cx_write(MO_HDELAY_ODD, value); dprintk(1,"set_scale: hdelay 0x%04x\n", value); - value = (swidth * 4096 / width) - 4096; + value = (disable_hscale)?0:(swidth * 4096 / width) - 4096; cx_write(MO_HSCALE_EVEN, value); cx_write(MO_HSCALE_ODD, value); dprintk(1,"set_scale: hscale 0x%04x\n", value); - cx_write(MO_HACTIVE_EVEN, width); - cx_write(MO_HACTIVE_ODD, width); - dprintk(1,"set_scale: hactive 0x%04x\n", width); - + force_hactive=force_hactive & 0x3ff; + value=(force_hactive)?force_hactive:width; + cx_write(MO_HACTIVE_EVEN, value); + cx_write(MO_HACTIVE_ODD, value); + dprintk(1,"set_scale: hactive 0x%04x\n", value); // recalc V scale Register (delay is constant) cx_write(MO_VDELAY_EVEN, norm_vdelay(core->tvnorm)); cx_write(MO_VDELAY_ODD, norm_vdelay(core->tvnorm)); dprintk(1,"set_scale: vdelay 0x%04x\n", norm_vdelay(core->tvnorm)); - value = (0x10000 - (sheight * 512 / height - 512)) & 0x1fff; + value =(disable_vscale)?0: (0x10000 - (sheight * 512 / height - 512)) & 0x1fff; cx_write(MO_VSCALE_EVEN, value); cx_write(MO_VSCALE_ODD, value); dprintk(1,"set_scale: vscale 0x%04x\n", value); - cx_write(MO_VACTIVE_EVEN, sheight); - cx_write(MO_VACTIVE_ODD, sheight); - dprintk(1,"set_scale: vactive 0x%04x\n", sheight); - + force_vactive=force_vactive &0x3ff; + value=(force_vactive)?force_vactive:sheight; + cx_write(MO_VACTIVE_EVEN, value); + cx_write(MO_VACTIVE_ODD, value); + dprintk(1,"set_scale: vactive 0x%04x\n", value); + // setup filters value = 0; value |= (1 << 19); // CFILT (default) @@ -928,7 +1058,8 @@ core->tvnorm = norm; fsc8 = norm_fsc8(norm); - adc_clock = xtal; + //adc_clock = xtal; + adc_clock = (disable_samplerateconverter)?fsc8:xtal; vdec_clock = fsc8; step_db = fsc8; step_dr = fsc8; @@ -990,8 +1121,15 @@ cx_write(MO_HTOTAL, htotal); // vbi stuff - cx_write(MO_VBI_PACKET, ((1 << 11) | /* (norm_vdelay(norm) << 11) | */ - norm_vbipack(norm))); + //cx_write(MO_VBI_PACKET, ((1 << 11) | /* (norm_vdelay(norm) << 11) | */ + // norm_vbipack(norm))); + //mdvh: vbi and raw stuff + frm_size=frm_size &0x0FFF;//VBI Frame Size Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet has to be QWORD boundary. + vbi_v_del =vbi_v_del &0x3F;//vdelay=2 is minimum according to datasheet + //vbi_v_del=(vbi_v_del)?vbi_v_del:2; + extend_vbi =(extend_vbi )?1:0;//enable extend vbi capture range to include 20 halflines prior to vactive during vbi_frame capture mode + + cx_write(MO_VBI_PACKET,((cap_raw_all || vbi_frame_capture_raw_mode)? frm_size<<17:0)|(vbi_v_del << 11) |extend_vbi <<10| norm_vbipack(norm)); // this is needed as well to set all tvnorm parameter cx88_set_scale(core, 320, 240, V4L2_FIELD_INTERLACED); diff -urN video4linux.20050119-130350-orig/cx88-video.c video4linux-20050119-hack7/cx88-video.c --- video4linux.20050119-130350-orig/cx88-video.c 2005-01-04 15:07:00.000000000 +0100 +++ video4linux-20050119-hack7/cx88-video.c 2005-01-31 02:37:22.000000000 +0100 @@ -35,7 +35,7 @@ #include "cx88.h" -MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); +MODULE_DESCRIPTION("v4l2 driver video module for cx2388x based TV cards. Hacked by Martin Dvh for testing purpose"); MODULE_AUTHOR("Gerd Knorr [SuSE Labs]"); MODULE_LICENSE("GPL"); @@ -72,6 +72,27 @@ module_param(vid_limit,int,0644); MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes"); + +static unsigned int cap_raw_all = 0; +module_param(cap_raw_all,int,0644); +MODULE_PARM_DESC(cap_raw_all,"A value of 1 enables continuous raw data mode capture. You also need to set frm_size.\n If you set this you must set this as module parameter of both cx88xx.ko and cx8800.ko"); + +static unsigned int raw16 = 0; +module_param(raw16,int,0644); +MODULE_PARM_DESC(raw16," 0 = 8xFsc 8-bit data mode (Raw Data)\n 1 = 4xFsc 16-bit data mode (Filtered VBI data)"); + +static unsigned int vbi_frame_capture_raw_mode = 0; +module_param(vbi_frame_capture_raw_mode,int,0644); +MODULE_PARM_DESC(vbi_frame_capture_raw_mode," This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size..\n If you set this you must set this as module parameter of both cx88xx.ko and cx8800.ko"); + +static unsigned int force_maxh = 0; +module_param(force_maxh,int,0644); +MODULE_PARM_DESC(force_maxh,"default PAL 576, NTSC 480, maximum value the driver will accept for height"); + +static unsigned int force_maxw = 0; +module_param(force_maxw,int,0644); +MODULE_PARM_DESC(force_maxw,"default PAL 768, NTSC 640, maximum value the driver will accept for width"); + #define dprintk(level,fmt, arg...) if (video_debug >= level) \ printk(KERN_DEBUG "%s/0: " fmt, dev->core->name , ## arg) @@ -335,6 +356,19 @@ const int CX8800_CTLS = ARRAY_SIZE(cx8800_ctls); /* ------------------------------------------------------------------- */ +static unsigned int inline norm_maxh(struct cx88_tvnorm *norm) +{ + force_maxh=force_maxh & 0x1fff; + return (force_maxh)?force_maxh:(norm->id & V4L2_STD_625_50) ? 576 : 480; +} + +static unsigned int inline norm_maxw(struct cx88_tvnorm *norm) +{ + force_maxw=force_maxw & 0x1fff; + return (force_maxw)?force_maxw:(norm->id & V4L2_STD_625_50) ? 768 : 640; +} + +/* ------------------------------------------------------------------- */ /* resource management */ static int res_get(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bit) @@ -429,7 +463,8 @@ cx88_sram_channel_setup(dev->core, &cx88_sram_channels[SRAM_CH21], buf->bpl, buf->risc.dma); cx88_set_scale(dev->core, buf->vb.width, buf->vb.height, buf->vb.field); - cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma); + //cx_write(MO_COLOR_CTRL, buf->fmt->cxformat | ColorFormatGamma); + cx_write(MO_COLOR_CTRL, ((vbi_frame_capture_raw_mode && (buf->fmt->cxformat==ColorFormatY8))?ColorFormatRAW: buf->fmt->cxformat)| ColorFormatGamma);/*mdvh: hack set vbi_frame capture raw format in stead of grey when requested*/ /* reset counter */ cx_write(MO_VIDY_GPCNTRL,GP_COUNT_CONTROL_RESET); @@ -440,7 +475,10 @@ cx_set(MO_VID_INTMSK, 0x0f0011); /* enable capture */ - cx_set(VID_CAPTURE_CONTROL,0x06); + //cx_set(VID_CAPTURE_CONTROL,0x06); + cap_raw_all=(cap_raw_all)?1:0; + raw16=(raw16)?1:0; + cx_set(VID_CAPTURE_CONTROL,cap_raw_all<<6 | raw16<<5 | 0x06);/*mdvh: cap_raw_all:set contiunous raw capturing, raw16:8 bit 8Fsc or 16 bit 4xfsc raw capturing, 0x06 means capture_odd | capture_even*/ /* start dma */ cx_set(MO_DEV_CNTRL2, (1<<5)); diff -urN video4linux.20050119-130350-orig/cx88.h video4linux-20050119-hack7/cx88.h --- video4linux.20050119-130350-orig/cx88.h 2005-01-13 18:27:01.000000000 +0100 +++ video4linux-20050119-hack7/cx88.h 2005-01-31 02:26:50.000000000 +0100 @@ -75,6 +75,7 @@ u32 cxoformat; }; +/*moved to cx88-video.c because it became module-parameter dependent static unsigned int inline norm_maxw(struct cx88_tvnorm *norm) { return (norm->id & V4L2_STD_625_50) ? 768 : 640; @@ -84,7 +85,7 @@ static unsigned int inline norm_maxh(struct cx88_tvnorm *norm) { return (norm->id & V4L2_STD_625_50) ? 576 : 480; -} +}*/ /* ----------------------------------------------------------- */ /* static data */ diff -urN video4linux.20050119-130350-orig/doc/cx2388x_tests1.txt video4linux-20050119-hack7/doc/cx2388x_tests1.txt --- video4linux.20050119-130350-orig/doc/cx2388x_tests1.txt 1970-01-01 01:00:00.000000000 +0100 +++ video4linux-20050119-hack7/doc/cx2388x_tests1.txt 2005-01-31 00:55:46.000000000 +0100 @@ -0,0 +1,204 @@ +Tests for the hacked cx2388x video4linux driver to find out if it can do continuous capturing using the cap_raw_all flag, and to find out how to use it. + +first build the driver: +tar zxvf cx88-0.0.4-mdvh-hackX.tar.gz +cd cx88-0.0.4-mdvh-hackX +make KDIR=/path/to/kernel/source/tree + +Now use the insmod options below to load cx8800.ko. You also need to insmod v4l1-compat.ko and cx88xx.ko but that one does not need any special options. +To see the list of new insmod options run: +modinfo ./cx8800.ko + +loading for the first time: +cd +rmmod cx88xx (be sure no old modules are loaded) +rmmod cx8800 +insmod v4l1-compat +insmod ./cx88xx.ko +insmod ./cx8800.ko +for example the last line could be: +insmod ./cx8800.ko cap_raw_all=1 frm_size=2048 + +I tried to dig up the right parameters to get the continuous raw capturing working. +I think it will only work if you also enable vbi_frame mode. Since this mode was not yet supported in the driver I tried to find out the parameters used in the bttv driver (which does support vbi_frame mode, called BT848_COLOR_FMT_RAW in the driver) +Still there are lots of uncertainties because bttv and cx2388x are not the same and the datasheets leave a lot of room for interpretation. +But maybe the vbi_frame mode is not needed at all and we only need to set the cap_raw_all flag and the frm_size. +frm_size is needed for cap_raw_all mode but it is still quite a mistery to me. +It might need to correspond to capture_width or capture_width*2. I don't know exactly what a frame is here. I suspect it is the number of samples per output_line. In the bt878 chip there is no frm_size register. If using vbi_frame mode the bt878 always outputs 1024 samples per line. +The datasheet says: VBI Frame Size Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet has to be QWORD boundary. +But there is no description of what a packet is. +The datasheet also says: +In the VBI frame output mode, VBI data capture occurs in the active video region and includes all the horizontal blank/sync information in the data stream. This feature can be used to provide a high-quality still-capture of video. The data is vertically bound beginning at the first line during VACTIVE and ending after a fixed number of packets. The data stream is packetized into a series of 256-dword blocks. A fixed number of dword blocks (434 for NTSC and 650 for PAL) are captured during each field. This is equivalent to 111,104 dwords for NTSC (434 × 256 dwords) and 166,400 dwords for PAL (650 × 256 dwords) per field. The VBI frame capture region can be extended to include the 10 lines prior to the default VACTIVE region by setting the EXT_FRAME register bit. VDELAY must also be set to its minimum value of 2. + +So, since 256 dwords is 2048 bytes, possibly the default should be: frm_size=2048 +The only real option to find out is to try different settings. + + +Here are the test videocaptures I thought of. I don't know if standard capture programs will allow you to use non-standard capture_sizes like 2048x692. If not please let me know and I will write a small test_capture appplication. +Any comments welcome. + + +Simple test to see what cap_raw_all in normal (not vbi_frame) mode does: +capture settings: +Try different standard settings. Also try grey 8bpp 1024x640 +insmod options: +cap_raw_all=1 +frm_size = try 2048 or 1024 or capture_width or capture_width/2 or 0 +so for example: +insmod ./cx8800.ko cap_raw_all=1 frm_size=2048 + + +Try more things to see what cap_raw_all in normal (not vbi_frame) mode does: +capture settings: +capture_color :try different color modes, probably GREY, 8bpp works best +capture_width: try normal resolutions (640x480) or try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=try normal resolutions (640x480) or for PAL 625 or 674 or 692 for NTSC 450 or 466 or 525 +insmod options: +cap_raw_all=1 +vbi_frame_capture_raw_mode=0 +force_hactive=0 (or for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm)) +force_maxw=2048 (set to capture_width or greater) +force_maxh=800 (set to capture_height or greater) +frm_size = try 2048 or 1024 or capture_width or capture_width/2 or 0 +force_vdelay=2 +force_vactive=for PAL try 576, 610,625,692 (values from 576 to 694) for NTSC try 450,480,508,525 (values from 448 to 526) +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 or 0 +disable_hscale=1 or 0 + + +Test to determine if vbi_frame mode works: +normal vbi_frame mode without extend_vbi: +capture settings: +capture_color : use GREY, 8bpp +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=for PAL 640 for NTSC 434 or 640 + +insmod options: +vbi_frame_capture_raw_mode=1 +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +force_maxw=2048 (set to capture_width or greater) +force_maxh=692 (set to capture_height or greater) +frm_size = try 2048 or 1024 or 0 +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 +disable_hscale=1 + +If vbi_frame mode works, try to get extra lines with this test. +normal vbi_frame mode with extend_vbi (you get more output lines): +capture settings: +capture_color : use GREY, 8bpp +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=for PAL 674 for NTSC 450 or 674 +insmod options: +vbi_frame_capture_raw_mode=1 +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +force_maxw=2048 (set to capture_width or greater) +force_maxh=692 (set to capture_height or greater) +frm_size = try 2048 or 1024 or 0 +force_vdelay=2 +force_vactive=for try 610 (values from 600 to 694) for NTSC try 508 (values from 448 to 526) +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 +disable_hscale=1 + +Try to see what cap_raw_all does when in vbi_frame mode. +cap_raw_all in vbi_frame mode without extend_vbi: +capture settings: +capture_color : use GREY, 8bpp +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=for PAL 640 for NTSC 434 or 640 + +insmod options: +cap_raw_all=1 +vbi_frame_capture_raw_mode=1 +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +force_maxw=2048 (set to capture_width or greater) +force_maxh=800 (set to capture_height or greater) +frm_size = try 2048 or 1024 or 0 +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 +disable_hscale=1 + +See if we can get more extra lines in cap_raw_all and vbi_frame mode: +cap_raw_all in vbi_frame mode with extend_vbi (you get more output lines): +capture settings: +capture_color : use GREY, 8bpp +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +capture_height=for PAL 674 for NTSC 450 or 674 +insmod options: +cap_raw_all=1 +vbi_frame_capture_raw_mode=1 +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +force_maxw=2048 (set to capture_width or greater) +force_maxh=800 (set to capture_height or greater) +frm_size = try 2048 or 1024 or 0 +force_vdelay=2 +force_vactive=for PAL try 576, 610,625,692 (values from 576 to 694) for NTSC try 450,480,508,525 (values from 448 to 526) +vbi_v_del=2 +disable_samplerateconverter=1 or 0 +disable_vscale=1 +disable_hscale=1 +cap_raw_all=1 + + + + + + + + + +frm_size versus capture_width versus htotal versus hactive: +force_htotal:default PAL 1135, NTSC 910. maximum is 2047.Programmable total number of pixel per line. This determines the actual number of raw samples per line/2 taken during a normal capture. We probably don't need to verride this. + +force_hactive=for PAL use 922, for NTSC use 754, must correspond to norm_swidth(tvnorm) +capture_width: try 1024 and 2048. This might need to correspond to frm_size or frm_size/2 +frm_size = try 2048 or 1024 ? This might need to correspond to capture_width or capture_width*2. I don't know exactly what a frame is here. I suspect it is the number of samples per output_line. In the bt878 chip there is no frm_size register. If using vbi_frame mode the bt878 always outputs 1024 samples per line. +The datasheet says: VBI Frame Size Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet has to be QWORD boundary. +But there is no description of what a packet is. +The datasheet also says: +In the VBI frame output mode, VBI data capture occurs in the active video region and includes all the horizontal blank/sync information in the data stream. This feature can be used to provide a high-quality still-capture of video. The data is vertically bound beginning at the first line during VACTIVE and ending after a fixed number of packets. The data stream is packetized into a series of 256-dword blocks. A fixed number of dword blocks (434 for NTSC and 650 for PAL) are captured during each field. This is equivalent to 111,104 dwords for NTSC (434 × 256 dwords) and 166,400 dwords for PAL (650 × 256 dwords) per field. The VBI frame capture region can be extended to include the 10 lines prior to the default VACTIVE region by setting the EXT_FRAME register bit. VDELAY must also be set to its minimum value of 2. + +So possibly the default frm_size=256 dwords =256*8=2048 + + +disable_samplerateconverter=1 Use the same clock for the ADC as for the video_decoder. Strangely enough the current driver nomally enables the samplerate_converter. I don't know why. Experiment with this setting +disable_vscale=1 Do not do any vertical scaling (needed for vbi_frame_mode, probably also for cap_caw_all) +disable_hscale=1 Do not do any horizontal scaling (needed for vbi_frame_mode, probably also for cap_raw_all) +cap_raw_all=0 of 1 A value of 1 enables continuous raw data mode capture. You also need to set frm_size to the correct value and probably use a capture height of 640 or 674 and a capture width corresponding to frm_size +vbi_frame_capture_raw_mode=1 Enable vbi_frame mode. This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size. + + +All new insmod options: (get the current list with modinfo ./cx8800.ko) +filename: ./cx8800.ko +description: v4l2 driver module for cx2388x based TV cards +parm: force_htotal:default PAL 1135, NTSC 910. Force htotal to this value, maximum is 2047.Programmable total number of pixel per line. This determines tha actual number of raw samples per line taken during a normal capture +parm: force_swidth:force scaled width to this value. default for PAL is 922, for NTSC 754 +parm: force_hdelay:default PAL 186, NTSC 135, maximum 1023. HDELAY is programmed with the number of pixels between horizontal sync and the first pixel of each line to be displayed or captured. HDELAY should be an even number to get Cb as the first pixel, an odd number to get Cr. The register value is programmed with respect to the scaled frequency clock. +parm: force_vdelay:default PAL 36,default NTSC 24 For video decoding, VDELAY is programmed with the number of half lines between the end of the serration pulses and the first line to be displayed or captured. The register value is programmed with respect to the unscaled input signal. VDELAY must be programmed to an even number to avoid apparent field reversal.*/ +parm: force_fsc8:pll frequency in Hz. (for videodecoder (will be scaled) and ADC) default PAL 35468950, NTSC 28636360. min 16000000 max 80000000 +parm: force_vbi_pkt_size:default PAL 511, NTSC 288, max 1023 .VBI Packet Size. The number of raw data dwords (four 8-bit samples) to capture per line while in VBI capture mode (only used in VBI line mode). +parm: force_vactive:default PAL 576, NTSC 480, This is the vertical active. It defines the number of half lines used in the vertical scaling process. Values between 1 and 1023 are allowed. +parm: force_hactive:default set to capture_width.This is the horizontal active. It defines the number of horizontal active pixels per line. Values between 1 and 1023 are allowed. +parm: force_maxh:default PAL 576, NTSC 480, maximum value the driver will accept for height +parm: force_maxw:default PAL 768, NTSC 640, maximum value the driver will accept for width +parm: frm_size:VBI Frame Size: default 1024. Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet. Has to be QWORD boundary. +This number might need to correspond in some way to the exact height and /or width requested in the capture command. +parm: vbi_v_del:The number of CLKx1 s to delay from the trailing edge of HRESET before starting VBI line capture. Used in both VBI line mode and VBI frame mode, where in VBI frame mode it has to set to a value of 2. +parm: extend_vbi:A value of 1 extends the frame output capture region to include the 20 half lines prior to the default VACTIVE region. Can be used in vbi_frame_mode. +parm: disable_samplerateconverter:set to 1 to disable the samplerate_conversion for the video_decoder and make the videodecoderrate the same as the ADC sampling freq. If set to 0 the videodecoder works at a different frequency as the sampling frequency of the ADCs, for normal operation we should not need the samplerateconversion and just use pll_freq=fsc8 for everything. The datasheets are confusing about these settings +parm: disable_vscale:set to 1 to disable the vertical scaling. +parm: disable_hscale:set to 1 to disable the horizontal scaling. +parm: cap_raw_all:A value of 1 enables continuous raw data mode capture. You also need to set frm_size +parm: raw16: 0 = 8xFsc 8-bit data mode (Raw Data) + 1 = 4xFsc 16-bit data mode (Filtered VBI data) +parm: vbi_frame_capture_raw_mode: This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size. + + +greetings, +Martin Dvh diff -urN video4linux.20050119-130350-orig/doc/cx8800_modinfo.txt video4linux-20050119-hack7/doc/cx8800_modinfo.txt --- video4linux.20050119-130350-orig/doc/cx8800_modinfo.txt 1970-01-01 01:00:00.000000000 +0100 +++ video4linux-20050119-hack7/doc/cx8800_modinfo.txt 2005-01-31 00:55:46.000000000 +0100 @@ -0,0 +1,41 @@ +filename: ./cx8800.ko +description: v4l2 driver module for cx2388x based TV cards +author: Gerd Knorr [SuSE Labs] +license: GPL +parm: video_nr:video device numbers +parm: vbi_nr:vbi device numbers +parm: radio_nr:radio device numbers +parm: latency:pci latency timer +parm: video_debug:enable debug messages [video] +parm: irq_debug:enable debug messages [IRQ handler] +parm: vid_limit:capture memory limit in megabytes +parm: tuner:tuner type +parm: card:card type +parm: nicam:tv audio is nicam +parm: force_htotal:default PAL 1135, NTSC 910. Force htotal to this value, maximum is 2047.Programmable total number of pixel per line. This determines tha actual number of raw samples per line taken during a normal capture +parm: force_swidth:force scaled width to this value. default for PAL is 922, for NTSC 754 +parm: force_hdelay:default PAL 186, NTSC 135, maximum 1023. HDELAY is programmed with the number of pixels between horizontal sync and the first pixel of each line to be displayed or captured. HDELAY should be an even number to get Cb as the first pixel, an odd number to get Cr. The register value is programmed with respect to the scaled frequency clock. +parm: force_vdelay:default PAL 36,default NTSC 24 For video decoding, VDELAY is programmed with the number of half lines between the end of the serration pulses and the first line to be displayed or captured. The register value is programmed with respect to the unscaled input signal. VDELAY must be programmed to an even number to avoid apparent field reversal.*/ +parm: force_fsc8:pll frequency in Hz. (for videodecoder (will be scaled) and ADC) default PAL 35468950, NTSC 28636360. min 16000000 max 80000000 +parm: force_vbi_pkt_size:default PAL 511, NTSC 288, max 1023 .VBI Packet Size. The number of raw data dwords (four 8-bit samples) to capture per line while in VBI capture mode (only used in VBI line mode). +parm: force_vactive:default PAL 576, NTSC 480, This is the vertical active. It defines the number of half lines used in the vertical scaling process. Values between 1 and 1023 are allowed. +parm: force_hactive:default set to capture_width.This is the horizontal active. It defines the number of horizontal active pixels per line. Values between 1 and 1023 are allowed. +parm: force_maxh:default PAL 576, NTSC 480, maximum value the driver will accept for height +parm: force_maxw:default PAL 768, NTSC 640, maximum value the driver will accept for width +parm: frm_size:VBI Frame Size: default 1024. max 4095. Used in both RAW all mode and VBI frame mode specifies # of bytes packed in each packet. Has to be QWORD boundary. +This number might need to correspond in some way to the exact height and /or width requested in the capture command. +parm: vbi_v_del:The number of CLKx1 s to delay from the trailing edge of HRESET before starting VBI line capture. Used in both VBI line mode and VBI frame mode, where in VBI frame mode it has to set to a value of 2. +parm: extend_vbi:A value of 1 extends the frame output capture region to include the 20 half lines prior to the default VACTIVE region. Can be used in vbi_frame_mode. +parm: disable_samplerateconverter:set to 1 to disable the samplerate_conversion for the video_decoder and make the videodecoderrate the same as the ADC sampling freq. If set to 0 the videodecoder works at a different frequency as the sampling frequency of the ADCs, for normal operation we should not need the samplerateconversion and just use pll_freq=fsc8 for everything. The datasheets are confusing about these settings +parm: disable_vscale:set to 1 to disable the vertical scaling. +parm: disable_hscale:set to 1 to disable the horizontal scaling. +parm: cap_raw_all:A value of 1 enables continuous raw data mode capture. You also need to set frm_size +parm: raw16: 0 = 8xFsc 8-bit data mode (Raw Data) + 1 = 4xFsc 16-bit data mode (Filtered VBI data) +parm: vbi_frame_capture_raw_mode: This sets up the driver to use RAW vbi_frame_capture_mode when V4L2_PIX_FMT_GREY 8 bpp, gray is chosen as the color format in the capture application. Use normal capture device, NOT the vbi device for this. You also need to set frm_size. +parm: vbibufs:number of vbi buffers, range 2-32 +parm: vbi_debug:enable debug messages [video] +parm: audio_debug:enable debug messages [audio] +vermagic: 2.6.7-1-k7 preempt K7 gcc-3.3 +depends: cx88xx,video-buf,videodev,i2c-core,i2c-algo-bit,btcx-risc,v4l2-common,v4l1-compat +alias: pci:v000014F1d00008800sv*sd*bc*sc*i* diff -urN video4linux.20050119-130350-orig/doc/insmod-options video4linux-20050119-hack7/doc/insmod-options --- video4linux.20050119-130350-orig/doc/insmod-options 2004-02-22 02:59:36.000000000 +0100 +++ video4linux-20050119-hack7/doc/insmod-options 2005-01-31 00:55:46.000000000 +0100 @@ -171,3 +171,5 @@ insmod args: debug=1 print some debug info to the syslog. chip=9850/9855 set the chip type. + +cx8800.o: see cx8800_modinfo.txt