一个简单的demo,代码如下:
CaptureLink_CreateParams capturePrm;
CaptureLink_VipInstParams *pCaptureInstPrm;
CaptureLink_OutParams *pCaptureOutPrm;
HelloWorldLink_CreateParams helloWorldPrm;
DisplayLink_CreateParams displayPrm;
IpcFramesInLinkRTOS_CreateParams ipcFramesInDspPrm;
IpcFramesOutLinkRTOS_CreateParams ipcFramesOutVpssPrm;
UInt32 captureId;
UInt32 vipInstId;
UInt32 helloWorldId;
UInt32 displayId;
Uint32 ipcFramesOutVpssId, ipcFramesInDspId;
char ch;
CHAINS_INIT_STRUCT(CaptureLink_CreateParams, capturePrm);
CHAINS_INIT_STRUCT(DisplayLink_CreateParams,displayPrm);
CHAINS_INIT_STRUCT(IpcFramesInLinkRTOS_CreateParams,ipcFramesInDspPrm);
CHAINS_INIT_STRUCT(IpcFramesOutLinkRTOS_CreateParams,ipcFramesOutVpssPrm);
CHAINS_INIT_STRUCT(HelloWorldLink_CreateParams, helloWorldPrm);
captureId = SYSTEM_LINK_ID_CAPTURE;
helloWorldId = SYSTEM_LINK_ID_HELLOWORLD_0;
displayId = SYSTEM_LINK_ID_DISPLAY_0;
ipcFramesOutVpssId = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_OUT_0;
ipcFramesInDspId = SYSTEM_DSP_LINK_ID_IPC_FRAMES_IN_0;
capturePrm.numVipInst = 1;
capturePrm.tilerEnable = FALSE;
capturePrm.numBufsPerCh = CAPTURE_LINK_NUM_BUFS_PER_CH_DEFAULT;
capturePrm.numExtraBufs = 0;
capturePrm.maxBlindAreasPerCh = 0;
capturePrm.isPalMode = FALSE;
capturePrm.enableSdCrop = FALSE;
capturePrm.doCropInCapture = FALSE;
for(vipInstId=0; vipInstId<capturePrm.numVipInst; vipInstId++)
{
pCaptureInstPrm = &capturePrm.vipInst[vipInstId];
pCaptureInstPrm->vipInstId = (SYSTEM_CAPTURE_INST_VIP0_PORTA+vipInstId*2)%SYSTEM_CAPTURE_INST_MAX;
pCaptureInstPrm->videoDecoderId = SYSTEM_DEVICE_VID_DEC_SII9233A_DRV;
pCaptureInstPrm->inDataFormat = SYSTEM_DF_YUV422P;
pCaptureInstPrm->standard = chainsCfg->displayRes[vipInstId];
pCaptureInstPrm->numOutput = 1;
pCaptureInstPrm->numChPerOutput = 1;
pCaptureOutPrm = &pCaptureInstPrm->outParams[0];
pCaptureOutPrm->dataFormat = SYSTEM_DF_YUV422I_YUYV;
pCaptureOutPrm->scEnable = FALSE;
pCaptureOutPrm->outQueId = 0;
}
capturePrm.outQueParams[0].nextLink = ipcFramesOutVpssId;//dy-chg ipcFramesOutVpssId displayId
System_linkCreate(captureId, &capturePrm, sizeof(capturePrm));
ipcFramesOutVpssPrm.baseCreateParams.inQueParams.prevLinkId = captureId;
ipcFramesOutVpssPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
ipcFramesOutVpssPrm.baseCreateParams.notifyPrevLink = FALSE;
ipcFramesOutVpssPrm.baseCreateParams.numOutQue = 1;
ipcFramesOutVpssPrm.baseCreateParams.outQueParams[0].nextLink = displayId;
ipcFramesOutVpssPrm.baseCreateParams.notifyNextLink = TRUE;
ipcFramesOutVpssPrm.baseCreateParams.processLink = ipcFramesInDspId; //dy-omit
ipcFramesOutVpssPrm.baseCreateParams.notifyProcessLink = TRUE;
ipcFramesOutVpssPrm.baseCreateParams.noNotifyMode = FALSE;
ipcFramesInDspPrm.baseCreateParams.inQueParams.prevLinkId = ipcFramesOutVpssId;
ipcFramesInDspPrm.baseCreateParams.inQueParams.prevLinkQueId = 0;
ipcFramesInDspPrm.baseCreateParams.numOutQue = 1;
ipcFramesInDspPrm.baseCreateParams.outQueParams[0].nextLink = helloWorldId; //dy-chg SYSTEM_LINK_ID_INVALID helloWorldId
ipcFramesInDspPrm.baseCreateParams.notifyPrevLink = FALSE;
ipcFramesInDspPrm.baseCreateParams.notifyNextLink = TRUE;
ipcFramesInDspPrm.baseCreateParams.noNotifyMode = FALSE;
helloWorldPrm.inQueParams.prevLinkId = ipcFramesInDspId; //dy-chg ipcFramesInDspId;
helloWorldPrm.inQueParams.prevLinkQueId = 0;
displayPrm.inQueParams[0].prevLinkId = ipcFramesOutVpssId;//dy-chg ipcFramesOutVpssId captureId
displayPrm.inQueParams[0].prevLinkQueId = 0;
displayPrm.displayRes = chainsCfg->displayRes[0];
displayPrm.numInputQueues = 1;
displayPrm.activeQueue = 0;
displayPrm.forceFieldSeparatedInputMode = FALSE;
Chains_displayCtrlInit(chainsCfg->displayRes);
System_linkCreate(ipcFramesOutVpssId, &ipcFramesOutVpssPrm, sizeof(ipcFramesOutVpssPrm)); //dy-omit
System_linkCreate(ipcFramesInDspId, &ipcFramesInDspPrm, sizeof(ipcFramesInDspPrm));//dy-omit
System_linkCreate(helloWorldId, &helloWorldPrm, sizeof(helloWorldPrm));//dy-omit
System_linkCreate(displayId, &displayPrm, sizeof(displayPrm));
Chains_memPrintHeapStatus();
{
System_linkStart(displayId);
System_linkStart(ipcFramesOutVpssId);//dy-omit
System_linkStart(ipcFramesInDspId);//dy-omit
System_linkStart(helloWorldId);//dy-omit
System_linkStart(captureId);
printf("\n\n1015a-cap ipcout ipcin dis\n\n");
while(1)
{
ch = Chains_menuRunTime();
if(ch=='0')
break;
if(ch=='v')
System_linkControl(captureId, CAPTURE_LINK_CMD_FORCE_RESET, NULL, 0, TRUE);
if(ch=='p') {
System_linkControl(captureId, CAPTURE_LINK_CMD_PRINT_ADV_STATISTICS, NULL, 0, TRUE);
System_linkControl(helloWorldId, HELLOWORLD_LINK_CMD_PRINT_STATISTICS, NULL, 0, TRUE);//dy-omit
System_linkControl(displayId, DISPLAY_LINK_CMD_PRINT_STATISTICS, NULL, 0, TRUE);
}
}
System_linkStop(captureId);
System_linkStop(ipcFramesOutVpssId);//dy-omit
System_linkStop(ipcFramesInDspId);//dy-omit
System_linkStop(helloWorldId);//dy-omit
System_linkStop(displayId);
}
System_linkDelete(captureId);
System_linkDelete(ipcFramesOutVpssId);//dy-omit
System_linkDelete(ipcFramesInDspId);//dy-omit
System_linkDelete(helloWorldId);//dy-omit
System_linkDelete(displayId);
Chains_displayCtrlDeInit();
我若将上述代码修改为capture link与display link 直连时图像输出正常。若维持原架构,
即cap——ipcout——ipcin——hello(dsp)
|
display
则 显示黑屏。
打印信息如下:
[m3vpss ] *** Capture Driver Advanced Statistics ***
[m3vpss ]
[m3vpss ] VIP Parser Reset Count : 0
[m3vpss ]
[m3vpss ] | Total Even Odd Total Even Odd Min / Max Min / Max Dropped Fid Repeat Frame Error Y/C
[m3vpss ] CH | Fields Fields Fields FPS FPS FPS Width Height Fields Count (Desc Error Y/C)
[m3vpss ] ————————————————————————————————————
[m3vpss ] 000 | 676 676 0 61 61 0 1920 / 1920 1080 / 1080 665 0 0/0 (0/0)
[m3vpss ]
[m3vpss ] VIP Capture Port 0 | DescMissMatch1 = 0, DescMissMatch2 = 0 , DescMissMatch3 = 0
[m3vpss ]
[m3vpss ] *** Capture List Manager Advanced Statistics ***
[m3vpss ]
[m3vpss ] List Post Count : 133319
[m3vpss ] List Stall Count : 0
[m3vpss ] List Post Time (ms) : Max = 0, Min = 0, Avg = 0, Total = 0
[m3vpss ] INTC Timeout Count : (0, 0) (Min timeout value = 991, 999)
[m3vpss ] Descriptor miss found count : 0
[m3vpss ]
[m3vpss ]
[m3vpss ] VIP and VPDMA registers,
[m3vpss ] VIP0 : FIQ_STATUS : 0x4810551c = 0x00004400
[m3vpss ] VIP1 : FIQ_STATUS : 0x48105a1c = 0x00000000
[m3vpss ] VPDMA: LIST_BUSY : 0x4810d00c = 0x00020000
[m3vpss ]
[m3vpss ]
[m3vpss ] 1167561: CAPTURE: Fields = 11 (fps = 0, CPU Load = 0)
[m3vpss ] 1167561: CAPTURE: Num Resets = 0 (Avg 0 ms per reset)
[m3vpss ] 1167561: SYSTEM : FREE SPACE : System Heap = 6328 B, Mbx = 10239 msgs)
[m3vpss ] 1167562: SYSTEM : FREE SPACE : SR0 Heap = 11003648 B (10 MB)
[m3vpss ] 1167562: SYSTEM : FREE SPACE : Frame Buffer = 190567296 B (181 MB)
[m3vpss ] 1167562: SYSTEM : FREE SPACE : Bitstream Buffer = 352845696 B (336 MB)
[m3vpss ] 1167562: DISPLAY: HDDAC(BP0) : 59 fps, Latency (Min / Max) = ( 255 / 0 ), Callback Interval (Min / Max) = ( 16 / 17 ) !!!
[m3vpss ] 1167562: DISPLAY: UNDERFLOW COUNT: HDMI(BP0) 525, HDDAC(BP0) 1073, DVO2(BP1) 1073, SDDAC(SEC1) 1073
[m3vpss ] 1167562: SYSTEM : FREE SPACE : System Heap = 6328 B, Mbx = 10238 msgs)
[m3vpss ] 1167563: SYSTEM : FREE SPACE : SR0 Heap = 11003648 B (10 MB)
[m3vpss ] 1167563: SYSTEM : FREE SPACE : Frame Buffer = 190567296 B (181 MB)
[m3vpss ] 1167563: SYSTEM : FREE SPACE : Bitstream Buffer = 352845696 B (336 MB)
[m3vpss ] 1167563: SYSTEM : FREE SPACE : Tiler 8-bit = 134217728 B (128 MB) – TILER ON
[m3vpss ] 1167563: SYSTEM : FREE SPACE : Tiler 16-bit = 134217728 B (128 MB) – TILER ON
[m3vpss ] 1167564: SYSTEM : FREE SPACE : Tiler 8-bit = 134217728 B (128 MB) – TILER ON
[m3vpss ] 1167564: SYSTEM : FREE SPACE : Tiler 16-bit = 134217728 B (128 MB) – TILER ON
观察[m3vpss ] 1167561: CAPTURE: Fields = 11 (fps = 0, CPU Load = 0),似乎是没有输入?
希望 得到帮助 ,谢谢
devin dai:
会不会是下面这个linkstart顺序不对?与linkstop的顺序不太匹配。
System_linkStart(displayId);System_linkStart(ipcFramesOutVpssId);//dy-omitSystem_linkStart(ipcFramesInDspId);//dy-omitSystem_linkStart(helloWorldId);//dy-omitSystem_linkStart(captureId);
System_linkStop(captureId);System_linkStop(ipcFramesOutVpssId);//dy-omitSystem_linkStop(ipcFramesInDspId);//dy-omitSystem_linkStop(helloWorldId);//dy-omitSystem_linkStop(displayId);
Robin Edson:
回复 devin dai:
。。。。。。。。。。。。。
昨晚上不是给你回答了吗?你的chain有问题。仔细看看给你回的邮件。
devin dai:
回复 Robin Edson:
我好像没有收到你的邮件,你发我另一个邮箱吧:334512663@qq.com
万分感谢
Robin Edson:
回复 devin dai:
汗,你再检查下,我昨天晚上回的你邮件。在公司用不了163.
devin dai:
回复 Robin Edson:
你发的是devin_dai@live.com这个邮箱么,这个邮箱的确没收到。
能不能先简单说下chain哪里有问题?晚上再发邮件给我,谢谢了
Robin Edson:
回复 devin dai:
额,好吧,俺搞错了,刚刚用手机看了下,是一个叫张斌的。
wei oozi:
回复 Robin Edson:
能不能说下他的chain问题出在哪?
wei oozi:
回复 wei oozi:
问下你的dsp算法在这个程序里是那个link在运行dsp算法?
wei oozi:
你的程序那一块在做dsp算法处理呢?这个dsp算法是自己写的吗?能告诉我在哪修改的吗?
devin dai:
问题已解决,我只更新了开发板上的XXX.out二进制可执行文件,未更新开发板端的dsp-firmware(XXX.xe674),故导致DSP算法无法执行,造成输出黑屏。