Hello!I wrote programm to capture image from CMOS-matrix, encode JPEG and to send image via RTSP_stream. I have successfully see MJPEG stream via VLC, but I get green image and I think that IPIPE can solve this problem.I looked sample in dvsdk_2_00_00_22/PSP_02_00_00_140/examples/dm355/ipipe and wrote my function:short initIPIPE(Buffer_Handle *hBufPtr){ struct ipipe_reqbufs reqbufs; struct ipipe_buffer t_buff; int ret; ipipeFd = open(IPIPE_DEVICE, O_RDWR); if (-1 == ipipeFd) { cout << "Can't open " << IPIPE_DEVICE << "!" << endl; return ipipeFd; } ret = configureIPIPE(ipipeFd); if (0 != ret) { cout << "Can't configure IPIPE!" << endl; return ret; } reqbufs.buf_type = IPIPE_BUF_OUT; reqbufs.size = imageHeight * (((imageWidth << 1) + 31) & (~31)); reqbufs.count = NUM_BUF; ret = ioctl(ipipeFd, IPIPE_REQBUF, &reqbufs); if (-1 == ret ) { cout << "Can't get IPIPE requested buffer (" << strerror(errno) << "!" << endl; return ret; } t_buff.index = 0; t_buff.buf_type = IPIPE_BUF_OUT; ret = ioctl(ipipeFd, IPIPE_QUERYBUF, &t_buff); if (-1 == ret) { cout << "Can't get IPIPE out buffer address (" << strerror(errno) << "!" << endl; return ret; } BufferGfx_Attrs gfxAttrs = BufferGfx_Attrs_DEFAULT; gfxAttrs.dim.width = imageWidth; gfxAttrs.dim.height = imageHeight; gfxAttrs.dim.lineLength = imageWidth << 1; gfxAttrs.colorSpace = ColorSpace_UYVY; gfxAttrs.bAttrs.reference = TRUE; Buffer_setNumBytesUsed(*hBufPtr, t_buff.size); Int8 *virtPtr; virtPtr = (Int8 *)mmap(NULL, t_buff.size, PROT_READ | PROT_WRITE, MAP_SHARED, ipipeFd, t_buff.offset); if (virtPtr == MAP_FAILED) { cout << "Can't mmap IPIPE buffer (" << strerror(errno) << ")!" << endl; return -1; } Buffer_setUseMask(*hBufPtr, gfxAttrs.bAttrs.useMask); Buffer_setUserPtr(*hBufPtr, virtPtr); return 0;}short processIPIPE(Buffer_Handle hInBuf, Buffer_Handle hOutBuf){ struct ipipe_convert convert; if (-1 == configureIPIPE(ipipeFd)) { cout << "Can't configure IPIPE!" << endl; return -1; } convert.in_buff.buf_type = IPIPE_BUF_IN; convert.in_buff.index = -1; convert.in_buff.offset = (unsigned int)Buffer_getUserPtr(hInBuf); convert.in_buff.size = Buffer_getNumBytesUsed(hInBuf); convert.out_buff.index = -1; convert.out_buff.buf_type = IPIPE_BUF_OUT; convert.out_buff.offset = (unsigned int)Buffer_getUserPtr(hOutBuf); convert.out_buff.size = Buffer_getNumBytesUsed(hOutBuf); if (-1 == ioctl(ipipeFd, IPIPE_START, &convert)) { cout << "IPIPE don't convert image!" << endl; return -1; } return 0;}And programm:Buffer_Handle hIPIPEBuf;if (-1 == initIPIPE(&hIPIPEBuf)) { cout << "Can't init IPIPE!" << endl; closeIPIPE(hIPIPEBuf); clear();}while (true) { if (Dmai_EOK != Capture_get(hCapture, &hCapBuf)) { cout << "Failed to get capture buffer!" << endl; clear(); } if (Dmai_EOK != Framecopy_execute(hFramecopy, hCapBuf, hDstBuf)) { cout << "Failed to execute frame copy job!" << endl; clear(); } processIPIPE(hDstBuf, hIPIPEBuf); ..........................}Information about hIPIPEBuf:[1073957228] @ 0x41b94000 (0x84700000 phys) numBytes 614400 (1073862896) useMask 1 (17148) ref yesInformation about hDstBuf:[0] @ 0x43475000 (0x87300000 phys) numBytes 0 (614400) useMask 0 (1) ref no Width 640, Height 480, LineLength 1280 [1] @ 0x436f5000 (0x87080000 phys) numBytes 0 (614400) useMask 0 (1) ref no Width 640, Height 480, LineLength 1280 [2] @ 0x43975000 (0x86e00000 phys) numBytes 0 (614400) useMask 0 (1) ref no Width 640, Height 480, LineLength 1280
lsmod:dm355_ipipe_driver 26024 0 - Live 0xbf01d000 dm350mmap 5268 0 - Live 0xbf01a000 cmemk 28044 0 - Live 0xbf012000davinci_capture 42120 0 - Live 0xbf006000capture_driver 7768 1 davinci_capture, Live 0xbf003000tvp5146 6856 1 davinci_capture, Live 0xbf000000When I start programm I don't get any error and this output:CPU load 17% CPU load 1% CPU load 0%When I try to get stream via vlc I get Floating point exception.
I have found what problem in the ioctl(ipipeFd, IPIPE_START, &convert), but why?Where I have error and how can I solve it?Thank you and excuse me for my bad english.
Hi,
KirillI have found what problem in the ioctl(ipipeFd, IPIPE_START, &convert), but why?
Can you provide the exact message that you get when IOCTL IPIPE_START is called? Based on the error message, we can try to analyse the parameters that you are setting. I hope you are using IPIPE only as in resizer mode as it seems your input is a YUV data coming from TVP5146.
Regards,
Anshuman
Hello Anshuman Saxena and thank you for your reply!
I don't get any error.
My function:..................................cout << "before ipipe_start" << endl;if (-1 == ioctl(ipipeFd, IPIPE_START, &convert)) { cout << "IPIPE don't convert image!" << endl; return -1;}cout << "after ipipe_start" << endl;...................................
And programm output:before ipipe_start CPU load 16% CPU load 1% CPU load 0%
Difference CPU load output in the 10 sec.
Hello!
I have insert into kernel/linux-2.6.18_pro500/drivers/media/davinci/dm355_ipipe.c debug output (#define dprintk(fmt, arg...) printk("["DRIVERNAME"] " fmt"\n", ##arg)) and I get next result:
[DM355IPIPE] Starting IPIPE_GET_PARAM[DM355IPIPE] Starting IPIPE_SET_PARAM[DM355IPIPE] Starting validate_params[DM355IPIPE] End validate_params[DM355IPIPE] Starting IPIPE_REQBUF[DM355IPIPE] Starting request_buffer[DM355IPIPE] End request_buffer[DM355IPIPE] Starting IPIPE_QUERYBUF[DM355IPIPE] Starting query_buffer[DM355IPIPE] End query_buffer[DM355IPIPE] Starting ipipe_mmap[DM355IPIPE] End ipipe_mmap[0] @ 0x44231000 (0x86b80000 phys) numBytes 0 (614400) useMask 0 (1) ref no Width 640, Height 480, LineLength 1280[DM355IPIPE] Starting IPIPE_GET_PARAM[DM355IPIPE] Starting IPIPE_SET_PARAM[DM355IPIPE] Starting validate_params[DM355IPIPE] End validate_paramsbefore ipipe_start[DM355IPIPE] Starting IPIPE_START[DM355IPIPE] Starting ipipe[DM355IPIPE] device->params->ipipeif_param.source != 0[DM355IPIPE] resizer_no_0[DM355IPIPE] resizer_no_1[DM355IPIPE] arg->out_buff.index < 0[DM355IPIPE] after regw_ip(0xff, IRQ_EN)[DM355IPIPE] after regw_ip(1, IPIPE_EN)[DM355IPIPE] before regw_if(1, IPIPEIF_ENABLE)[DM355IPIPE] before wait_for_completion_interruptible(&device->wfc)CPU load 18%CPU load 1%CPU load 0%
If I press Ctr+C I get [DM355IPIPE] End ipipe. Why don't work interruptible?
There can be multiple reasons why the interrupt did not come. It depends on parameters that are being set for IPIPE, RSZ, IPIPEIF and CCDC. Can you provide me all the registers for the above modules?
I have not used the DVSDK 2.00.xx for DM355, so i might not be able to directly comment on the driver details, but surely looking at the registers, i can help.
anshuman
Now I work with MT9M131 matrix in BT6565 format, base resolution 640x480.CCDC configuration:ccdc_params_ycbcr params;params.pix_fmt = CCDC_PIXFMT_YCBCR_8BIT;params.frm_fmt = CCDC_FRMFMT_PROGRESSIVE;params.win.left = 0;params.win.top = 0;params.win.width = imageWidth;params.win.height = imageHeight;params.fid_pol = CCDC_PINPOL_POSITIVE;params.vd_pol = CCDC_PINPOL_POSITIVE;params.hd_pol = CCDC_PINPOL_POSITIVE;params.bt656_enable = TRUE;params.pix_order = CCDC_PIXORDER_YCBYCR;//CCDC_PIXORDER_CBYCRY;params.buf_type = CCDC_BUFTYPE_FLD_SEPARATED;IPIPE configuration:struct ipipe_params params;//IPIPEIFparams.ipipeif_param.data_shift = BITS9_0;params.ipipeif_param.clock_select = SDRAM_CLK;params.ipipeif_param.ialaw = ALAW_OFF;params.ipipeif_param.pack_mode = SIXTEEN_BIT;params.ipipeif_param.avg_filter = AVG_OFF;params.ipipeif_param.clk_div = (MT9V034 == matrixId ? DIVIDE_EIGHTH : DIVIDE_SIXTH);params.ipipeif_param.source = (CAPTURE_FORMAT_YUV == captureFormat ? SDRAM_YUV : SDRAM_RAW);params.ipipeif_param.decimation = DECIMATION_OFF;params.ipipeif_param.mode = CONTINUOUS;params.ipipeif_param.glob_hor_size = imageWidth + 8;params.ipipeif_param.glob_ver_size = imageHeight + 10;params.ipipeif_param.hnum = imageWidth;params.ipipeif_param.vnum = imageHeight;params.ipipeif_param.adofs = ((imageWidth << 1) + 31) & (~31);params.ipipe_mode = CONTINUOUS;params.ipipe_dpaths_fmt = (CAPTURE_FORMAT_YUV == captureFormat ? YUV2YUV : RAW2YUV);params.ipipe_dpaths_bypass = (CAPTURE_FORMAT_YUV == captureFormat ? RAW_MODE_OFF : RAW_MODE_ON);if (MT9V034 == matrixId) { params.ipipe_colpat_elep = GREEN_RED; params.ipipe_colpat_elop = RED; params.ipipe_colpat_olep = BLUE; params.ipipe_colpat_olop = GREEN_BLUE;} else { params.ipipe_colpat_elep = RED; params.ipipe_colpat_elop = GREEN_RED; params.ipipe_colpat_olep = BLUE; params.ipipe_colpat_olop = GREEN_BLUE;}params.ipipe_vsz = imageHeight;params.ipipe_hsz = imageWidth;//Defect correctionparams.def_cor.dfc_en = DISABLE;//Noise filterparams.prog_nf.noise_fil_en = DISABLE;//Prefilterparams.prefilter.pre_en = DISABLE;//RGB to RGB conversion (include GAMMA correction)params.rgb2rgb.gmm_cfg_bypr = GC_BYPASS;params.rgb2rgb.gmm_cfg_bypg = GC_BYPASS;params.rgb2rgb.gmm_cfg_bypb = GC_BYPASS;params.rgb2rgb.gmm_cfg_tbl = IPIPE_RAM;params.rgb2rgb.gmm_cfg_siz = IPIPE_128;//RGB to YUV (YCbCr) conversionparams.rgb2yuv.yuv_phs_lpf = DISABLE;params.rgb2yuv.yuv_phs_position = CENTERING;//Edge Enchancerparams.edge_enhancer.yee_en = DISABLE;params.edge_enhancer.yee_emf = DISABLE;//False Color Suppresionparams.false_color_suppresion.fcs_en = DISABLE;params.rsz_seq_seq = DISABLE;params.rsz_seq_tmm = DISABLE;params.rsz_seq_hrv = DISABLE;params.rsz_seq_vrv = DISABLE;params.rsz_seq_crv = DISABLE;params.rsz_aal = DISABLE;params.rsz_en[0] = DISABLE;params.rsz_en[1] = DISABLE;
It seems like the following two lines might be possible cause of the problem. Why have you disabled the two resizer outputs? These are the output port of the IPIPE and hence if it is disbaled, you are not going to get any output and hence no interrupt.
Kirillparams.rsz_en[0] = DISABLE;params.rsz_en[1] = DISABLE;
BTW, i asked for the actual physical register values. Can you provide the register values to me? You can refer to VPFE PRG for DM355 to get the exact address.
PS: Please mark this post as verified, if you think it has answered your question. Thanks.
Thank you Anshuman for your reply!I reconfigured IPIPE://Resizer Rescale Parametersif (imageWidth > 640) { params.rsz_rsc_param[0].rsz_o_vsz = imageHeight - 1; params.rsz_rsc_param[0].rsz_o_hsz = imageWidth -1; params.rsz_rsc_param[0].rsz_v_dif = (imageHeight * 256 / imageHeight); params.rsz_rsc_param[0].rsz_h_dif = (imageWidth * 256 / imageWidth); params.rsz_rsc_param[0].rsz_h_typ = CUBIC; params.rsz_rsc_param[0].rsz_h_lse_sel = INTERNAL_VALUE;} else { params.rsz_rsc_param[1].rsz_o_vsz = imageHeight - 1; params.rsz_rsc_param[1].rsz_o_hsz = imageWidth -1; params.rsz_rsc_param[1].rsz_v_dif = (imageHeight * 256 / imageHeight); params.rsz_rsc_param[1].rsz_h_dif = (imageWidth * 256 / imageWidth); params.rsz_rsc_param[1].rsz_h_typ = CUBIC; params.rsz_rsc_param[1].rsz_h_lse_sel = INTERNAL_VALUE;}//Resizer RGB Conversion Parametersif (imageWidth > 640) { params.rsz2rgb[0].rsz_rgb_en = ENABLE; params.rsz2rgb[0].rsz_rgb_typ = OUTPUT_16BIT; params.rsz2rgb[0].rsz_rgb_msk0 = NOMASK; params.rsz2rgb[0].rsz_rgb_msk1 = NOMASK;} else { params.rsz2rgb[1].rsz_rgb_en = ENABLE; params.rsz2rgb[1].rsz_rgb_typ = OUTPUT_16BIT; params.rsz2rgb[1].rsz_rgb_msk0 = NOMASK; params.rsz2rgb[1].rsz_rgb_msk1 = NOMASK;}//Resizer External Memory Parametersif (imageWidth > 640) { params.ext_mem_param[0].rsz_sdr_oft = ((imageWidth * 2+ 31)&(~31)); params.ext_mem_param[0].rsz_sdr_ptr_e = imageHeight;} else { params.ext_mem_param[1].rsz_sdr_oft = ((imageWidth * 2+ 31)&(~31)); params.ext_mem_param[1].rsz_sdr_ptr_e = imageHeight;}if (imageWidth > 640) { params.rsz_en[0] = ENABLE; params.rsz_en[1] = DISABLE;} else { params.rsz_en[0] = DISABLE; params.rsz_en[1] = ENABLE;}But this don't solve problem.
How can I get physical register values?I have regdump programm(DaVinci processor register dumper V0.0.2) and here it's ouput.# ./regdump sys--- System Module ---------------------01C40000: 00007F55 PINMUX001C40004: 00145555 PINMUX101C40008: 00000004 DSPBOOTADDR01C4000C: 1BFF55FF SUSPSRC01C40010: 00000000 INTGEN01C40014: 00000108 BOOTCFG01C40028: 0B73B02F JTAGID01C40030: 00000000 HPI_CTL01C40034: 000009D0 USBPHY_CTL01C40038: 00000014 CHP_SHRTSW01C4003C: 00050011 MSTPRI001C40040: 00000400 MSTPRI101C40044: 00000018 BPSS_CLKCTL01C40048: 00001760 VDD3P3V_PWDN01C4004C: 00000000 DRVVTPER# ./regdump venc--- VENC Registers ---------------------01C72400: 41C4A451 VMOD01C72404: 9122A750 VIDCTL01C72408: F34610EC VDPRO01C7240C: 77989FA8 SYNCCTL01C72410: F0320DAB HSPLS01C72414: 42347ED7 VSPLS01C72418: 99F89036 HINT01C7241C: 1A48B2C1 HSTART01C72420: A0F74626 HVALID01C72424: 1A2C693C VINT01C72428: CA13F651 VSTART01C7242C: 18DE9A08 VVALID01C72430: 26783E70 HSDLY01C72434: 04C57762 VSDLY01C72438: 9001DB38 YCCCTL01C7243C: 00887CAD RGBCTL01C72440: 5C74669C RGBCLP01C72444: 920AF08A LINECTL01C72448: 18600F6C CULLLINE01C7244C: B368863A LCDOUT01C72450: 5FE1D9A3 BRTS01C72454: F0B18580 BRTW01C72458: 778FC05A ACCTL01C7245C: 24A83816 PWMP01C72460: 74927EC7 PWMW01C72464: 37E71D58 DCLKCTL01C72468: 7830D358 DCLKPTN001C7246C: 34698EFB DCLKPTN101C72470: D6C660F6 DCLKPTN201C72474: 2CA13256 DCLKPTN301C72478: A7F3ECD5 DCLKPTN0A01C7247C: 924AD971 DCLKPTN1A01C72480: F692400B DCLKPTN2A01C72484: 22A4F7D9 DCLKPTN3A01C72488: 2617FC3C DCLKHS01C7248C: 8B551859 DCLKHSA01C72490: FD0A31B7 DCLKHR01C72494: 3A76A52E DCLKVS01C72498: 2F70E2C6 DCLKVR01C7249C: 9964E884 CAPCTL01C724A0: 50004BBA CAPDO01C724A4: 6D000ECE CAPDE01C724A8: 99BCF169 ATR001C724AC: EBA1569C ATR101C724B0: 5B528E78 ATR201C724B4: 15F5603A STN_LCDCT01C724B8: E767065A VSTAT01C724BC: DD3CDD7B RAMADR01C724C0: 913464BE RAMPORT01C724C4: 049302A0 DACTST01C724C8: 518EB8D3 YCOLVL01C724CC: 5A3292D2 SCPROG01C724DC: 4C322182 CVBS01C724E0: 2AC3A043 CMPNT01C724E4: 662F1A22 ETMG001C724E8: 2BFE1A12 ETMG101C724EC: 91CA22B2 ETMG201C724F0: 3AFF036D ETMG301C724F4: 6BC55033 DACSEL01C72500: C8CD5E7A ARGBX001C72504: 58B90E60 ARGBX101C72508: 8F609035 ARGBX201C7250C: F6768359 ARGBX301C72510: 6317CE34 ARGBX401C72514: 4A2F83C2 DRGBX001C72518: D4E22740 DRGBX101C7251C: F1A43649 DRGBX201C72520: B08A9328 DRGBX301C72524: C9D0583A DRGBX401C72528: F61E03A2 VSTARTA01C7252C: AAE7B4B2 OSDCLK001C72530: AA8CC7DB OSDCLK101C72534: 18BA6F5E HVLDCL001C72538: 76ABC547 HVLDCL101C7253C: 7542E815 OSDHAD
P.S. Earlyer I work with dvsdk_1_30_01_41 and kernel 2.6.10 and did not have such problem.
You can use attached readl utility on the DM355 linux shell. Actually, i wanted to get the register dump for IPIPE, IPIPEIF and CCDC registers, not the VENC register. So can you provide those register details.
Hello Anshuman!
I have read SPRUF71a and run readl, but I am not sure that I use right values:- for CCDC ./readl 0x01c70600 0 0x15c- for IPIPEIF ./readl 0x01c70100 0 0x28- for IPIPE ./readl 0x01c71000 0 0x400
I dump values before runing programm and after (files with after suffix).
Also after last reconfiguration, when I enabled resize, output from programm changed:[0] @ 0x44231000 (0x86b80000 phys) numBytes 0 (614400) useMask 0 (1) ref no Width 640, Height 480, LineLength 1280 before ipipe_start after ipipe_start before ipipe_start
Now it seems that IPIPE can process one buffer, but then it stops again.