Int32 IpcFramesInLink_getFullFrames(Utils_TskHndl * pTsk, UInt16 queId,
                                   FVID2_FrameList * pFrameBufList)
{
    IpcFramesInLink_Obj *pObj = (IpcFramesInLink_Obj *) pTsk->appData;
    UInt32 idx;
    Int32 status;

    if (IPC_FRAMES_IN_LINK_STATE_ACTIVE == pObj->state)
    {
        for (idx = 0; idx < FVID2_MAX_FVID_FRAME_PTR; idx++)
        {
          status =
            Utils_queGet(&pObj->outFrameBufQue, (Ptr *) & pFrameBufList->frames[idx],
                   1, BIOS_NO_WAIT);
          if (status != FVID2_SOK)
            break;
        }
 
        pFrameBufList->numFrames = idx;
    }
    else
    {
        Vps_printf(" %d: IPC_FRAMES_IN:Warning! Get Frames invoked after link delete\n",
                    Utils_getCurTimeInMsec());
        pFrameBufList->numFrames = 0;
    }

    return IPC_FRAMES_IN_LINK_S_SUCCESS;
}
Beispiel #2
0
Int32 Utils_bitbufGetEmpty(Utils_BitBufHndl * pHndl,
                           Bitstream_BufList * pBufList, UInt32 allocPoolID,
                           UInt32 timeout)
{
    UInt32 idx, maxBufs;
    Int32 status;

    UTILS_assert(pHndl != NULL);
    UTILS_assert(pBufList != NULL);

    if (timeout == BIOS_NO_WAIT)
        maxBufs = VIDBITSTREAM_MAX_BITSTREAM_BUFS;
    else
        maxBufs = pBufList->numBufs;

    UTILS_assert(maxBufs <= VIDBITSTREAM_MAX_BITSTREAM_BUFS);
    UTILS_assert(allocPoolID < pHndl->numAllocPools);

    for (idx = 0; idx < maxBufs; idx++)
    {
        status = Utils_queGet(&(pHndl->emptyQue[allocPoolID]),
                              (Ptr *) & pBufList->bufs[idx], 1, timeout);
        if (status != FVID2_SOK)
            break;
        pBufList->bufs[idx]->allocPoolID = allocPoolID;
    }

    pBufList->numBufs = idx;

    return FVID2_SOK;
}
Beispiel #3
0
Int32 Utils_bufGetEmpty(Utils_BufHndl * pHndl, FVID2_FrameList * pFrameList,
                        UInt32 timeout)
{
    UInt32 idx, maxFrames;
    Int32 status;

    UTILS_assert(pHndl != NULL);
    UTILS_assert(pFrameList != NULL);

    if (timeout == BIOS_NO_WAIT)
        maxFrames = FVID2_MAX_FVID_FRAME_PTR;
    else
        maxFrames = pFrameList->numFrames;

    UTILS_assert(maxFrames <= FVID2_MAX_FVID_FRAME_PTR);

    for (idx = 0; idx < maxFrames; idx++)
    {
        status =
            Utils_queGet(&pHndl->emptyQue, (Ptr *) & pFrameList->frames[idx], 1,
                         timeout);
        if (status != FVID2_SOK)
            break;
    }

    pFrameList->numFrames = idx;

    return FVID2_SOK;
}
Beispiel #4
0
Int32 Utils_bitbufGetFull(Utils_BitBufHndl * pHndl,
                          Bitstream_BufList * pBufList, UInt32 timeout)
{
    UInt32 idx, maxBufs;
    Int32 status;

    UTILS_assert(pHndl != NULL);
    UTILS_assert(pBufList != NULL);

    if (timeout == BIOS_NO_WAIT)
        maxBufs = FVID2_MAX_FVID_FRAME_PTR;
    else
        maxBufs = pBufList->numBufs;

    UTILS_assert(maxBufs <= FVID2_MAX_FVID_FRAME_PTR);

    for (idx = 0; idx < maxBufs; idx++)
    {
        status = Utils_queGet(&pHndl->fullQue, (Ptr *) & pBufList->bufs[idx], 1,
                              timeout);
        if (status != FVID2_SOK)
            break;
    }

    pBufList->numBufs = idx;

    return FVID2_SOK;
}
Beispiel #5
0
Int32 AlgLink_scdAlgSubmitFrame(AlgLink_ScdObj * pObj, AlgLink_ScdChObj *pChObj, FVID2_Frame *pFrame)
{
    FVID2_Frame *pEmptyFrame;
    System_LinkChInfo *pChInfo;
    Utils_DmaCopy2D dmaPrm;
    Int32 status;

    pEmptyFrame = NULL;

    Utils_queGet(&pChObj->freeQ, (Ptr*)&pEmptyFrame, 1, BIOS_NO_WAIT);

    if(pEmptyFrame==NULL)
    {
        /* no free available for SCD, so skipping this frame */
        pChObj->inFrameSkipCount++;
        return FVID2_SOK;
    }

    /* found a free frame, do DMA copy of Y data to this frame */
    pChInfo = &pObj->inQueInfo->chInfo[pFrame->channelNum];

    dmaPrm.destAddr[0]  = pEmptyFrame->addr[0][0];
    dmaPrm.destPitch[0] = pChObj->algProcessPrm.pitch;

    dmaPrm.srcAddr[0]  = pFrame->addr[0][0];
    dmaPrm.srcPitch[0] = pChInfo->pitch[0];

    /* need to transfer only Y data, so set data format as 422I and set width = actual width / 2 */
    dmaPrm.dataFormat = FVID2_DF_YUV422I_YUYV;
    dmaPrm.srcStartX  = 0;
    dmaPrm.srcStartY  = 0;
    dmaPrm.destStartX = 0;
    dmaPrm.destStartY = 0;
    dmaPrm.width      = pChObj->width/2;
    dmaPrm.height     = pChObj->height;


    status = Utils_dmaCopy2D(&pObj->dmaCh, &dmaPrm, 1);
    UTILS_assert(status==FVID2_SOK);

    pEmptyFrame->channelNum = pFrame->channelNum;

    status = Utils_quePut(&pObj->processQ, pEmptyFrame, BIOS_NO_WAIT);

    if(status!=FVID2_SOK)
    {
        /* cannot submit frame now process queue is full, release frame to free Q */
        pChObj->inFrameSkipCount++;

        status = Utils_quePut(&pChObj->freeQ, pEmptyFrame, BIOS_NO_WAIT);

        /* this assert should never occur */
        UTILS_assert(status==FVID2_SOK);

        return FVID2_SOK;
    }

    return FVID2_SOK;
}
Beispiel #6
0
Int32 Utils_bufGetEmptyFrame(Utils_BufHndl * pHndl,
                             FVID2_Frame ** pFrame, UInt32 timeout)
{
    Int32 status;

    UTILS_assert(pHndl != NULL);
    UTILS_assert(pFrame != NULL);

    *pFrame = NULL;

    status = Utils_queGet(&pHndl->emptyQue, (Ptr *) pFrame, 1, timeout);

    return status;
}
Beispiel #7
0
Int32 Utils_bitbufGetFullBuf(Utils_BitBufHndl * pHndl,
                             Bitstream_Buf ** pBuf, UInt32 timeout)
{
    Int32 status;

    UTILS_assert(pHndl != NULL);
    UTILS_assert(pBuf != NULL);

    *pBuf = NULL;

    status = Utils_queGet(&pHndl->fullQue, (Ptr *) pBuf, 1, timeout);

    return status;
}
Beispiel #8
0
Int32 Utils_bitbufGetEmptyBuf(Utils_BitBufHndl * pHndl,
                              Bitstream_Buf ** pBuf,
                              UInt32 allocPoolID, UInt32 timeout)
{
    Int32 status;

    UTILS_assert(pHndl != NULL);
    UTILS_assert(pBuf != NULL);

    *pBuf = NULL;
    UTILS_assert(allocPoolID < pHndl->numAllocPools);
    status = Utils_queGet(&(pHndl->emptyQue[allocPoolID]),
                          (Ptr *) pBuf, 1, timeout);
    if (status == FVID2_SOK)
    {
        (*pBuf)->allocPoolID = allocPoolID;
    }
    return status;
}
Beispiel #9
0
static
Vps_DispRtParams * DisplayLink_drvSetFramePitchRtParams(DisplayLink_Obj * pObj)
{
    Int32 status;
    DisplayLink_drvRtParams *rtParams;
    Int i;

    status = Utils_queGet(&pObj->rtParams.freeQ,
                          (Ptr *)&rtParams,
                          1,
                          BIOS_NO_WAIT);
    UTILS_assert(status == 0);
    rtParams->dispRtPrms.inFrmPrms = &rtParams->inFrmPrms;
    rtParams->inFrmPrms.width      = pObj->displayFormat.width;
    rtParams->inFrmPrms.height     = pObj->displayFormat.height;
    for (i = 0; i < pObj->numDisplayBufPlanes; i++)
    {
        rtParams->inFrmPrms.pitch[i] = pObj->displayFormat.pitch[i];
    }
    return (&rtParams->dispRtPrms);
}
static Int32 IpcFramesInLink_getFrameBuf(IpcFramesInLink_Obj * pObj,
                                     SystemIpcFrames_ListElem * pListElem,
                                     FVID2_Frame ** pFrameBufPtr)
{
    FVID2_Frame *freeFrameBuf;
    Int status;


    UTILS_assert(pListElem != NULL);
    /* No cache ops done since pListElem is allocated from non-cached memory */
    UTILS_assert(SharedRegion_isCacheEnabled(SharedRegion_getId(pListElem)) ==
                 FALSE);
    status = Utils_queGet(&pObj->freeFrameQue,
                          (Ptr *)&freeFrameBuf,1,BIOS_NO_WAIT);
    UTILS_assert(status == FVID2_SOK);

    IpcFramesInLink_copyFrameInfo(pObj,
                                  &pListElem->frameBuf,
                                  freeFrameBuf,
                                  pListElem->srBufPtr);
    *pFrameBufPtr = freeFrameBuf;
    return IPC_FRAMES_IN_LINK_S_SUCCESS;
}
Beispiel #11
0
Int32 IpcOutM3Link_processFrames(IpcOutM3Link_Obj * pObj)
{
    System_LinkInQueParams *pInQueParams;
    FVID2_FrameList frameList;
    FVID2_Frame *pFrame;
    SystemIpcM3_ListElem *pListElem;
    Int32 status;
    Int32 frameId;
    IpcOutM3Link_ChObj *pChObj;
	
    pInQueParams = &pObj->createArgs.inQueParams;

    System_getLinksFullFrames(pInQueParams->prevLinkId,
                              pInQueParams->prevLinkQueId, &frameList);

    pObj->freeFrameList.numFrames = 0;

    if (frameList.numFrames)
    {
#ifdef SYSTEM_DEBUG_IPC_RT
        Vps_printf(" %d: IPC_OUT_M3   : Received %d frames !!!\n",
                   Utils_getCurTimeInMsec(), frameList.numFrames);
#endif

        pObj->totalFrameCount += frameList.numFrames;
        for (frameId = 0; frameId < frameList.numFrames; frameId++)
        {
            Bool          doFrameDrop;
            pFrame = frameList.frames[frameId];
            pChObj = &pObj->chObj[pFrame->channelNum];
            pChObj->inFrameRecvCount++;
            doFrameDrop = Utils_doSkipFrame(&(pChObj->frameSkipCtx));
            
            /* frame skipped due to user setting */
            if(doFrameDrop)
            {
                pChObj->inFrameUserSkipCount++;
                pObj->freeFrameList.frames[pObj->freeFrameList.numFrames] =
                    pFrame;
                pObj->freeFrameList.numFrames++;
                UTILS_assert(pObj->freeFrameList.numFrames <=
                             FVID2_MAX_FVID_FRAME_PTR);
                continue;;
            }

            status =
                Utils_queGet(&pObj->listElemQue, (Ptr *) & pListElem, 1,
                             BIOS_NO_WAIT);
            if (status != FVID2_SOK)
            {
                /* normally this condition should not happen, if it happens
                 * return the frame back to its generator */
#if 0
                Vps_printf(" IPC_OUT: Dropping frame\n");
#endif

                pObj->freeFrameList.frames[pObj->freeFrameList.numFrames] =
                    pFrame;
                pObj->freeFrameList.numFrames++;
                UTILS_assert(pObj->freeFrameList.numFrames <=
                             FVID2_MAX_FVID_FRAME_PTR);
                pChObj->inFrameUserSkipCount++;
                continue;
            }

            pListElem->pFrame = pFrame;

            /* no need to do cache ops since this is inter-M3 list */
            status = ListMP_putTail(pObj->listMPOutHndl, &pListElem->listElem);
            UTILS_assert(status == ListMP_S_SUCCESS);
            pChObj->inFrameProcessCount++;
        }

        if (pObj->freeFrameList.numFrames)
        {
            System_putLinksEmptyFrames(pInQueParams->prevLinkId,
                                       pInQueParams->prevLinkQueId,
                                       &pObj->freeFrameList);
        }

        if (pObj->createArgs.notifyNextLink)
        {
            UTILS_assert(pObj->createArgs.numOutQue == 1);
            System_ipcSendNotify(pObj->createArgs.outQueParams[0].nextLink);
        }

        if (TRUE == pObj->createArgs.noNotifyMode)
        {
            if (FALSE == pObj->prd.clkStarted)
            {
                IpcOutM3Link_startPrdObj(pObj,
                                          IPC_M3OUT_LINK_DONE_PERIOD_MS, FALSE);
            }
        }
    }

    return FVID2_SOK;
}
Beispiel #12
0
static
Void  DisplayLink_drvSetFrameInfo(DisplayLink_Obj * pObj,
                                  FVID2_Frame **pFramePtr,
                                  Bool        *frameReject)
{
    DisplayLink_FrameInfo *frameInfo;
    FVID2_Frame *frame;
    Int32 status;
    Bool fieldSeparatedInputMode;

    *frameReject = FALSE;
    frame = *pFramePtr;


    fieldSeparatedInputMode = FALSE;

    if (pObj->fieldInput[pObj->curActiveQueue]
            &&
        pObj->createArgs.forceFieldSeparatedInputMode == FALSE
       )
    {
        fieldSeparatedInputMode = TRUE;
    }
    if (pObj->fieldInput[pObj->curActiveQueue]
            &&
        pObj->createArgs.forceFieldSeparatedInputMode == TRUE
            &&
        pObj->enableFieldSeparatedInputMode
       )
    {
        fieldSeparatedInputMode = TRUE;
    }

    if (DISPLAY_LINK_BLANK_FRAME_CHANNEL_NUM !=
        frame->channelNum)
    {
        if(fieldSeparatedInputMode)
        {
            if(pObj->createArgs.forceFieldSeparatedInputMode)
                frame->fid = pObj->nextFid;

            if (frame->fid == pObj->nextFid)
            {
                pObj->nextFid = !(pObj->nextFid);
                if (frame->fid == FVID2_FID_BOTTOM)
                {
                    status = Utils_queGet(&pObj->frameInfo.infoQ,
                                          (Ptr *)&frameInfo,
                                          1,
                                          BIOS_NO_WAIT);
                    UTILS_assert(status == 0);
                    frameInfo->activeQueueId = pObj->curActiveQueue;
                    /* Received bot fields of frame.
                     * Create a field merged frame
                     */
                    UTILS_assert(pObj->topField != NULL);
                    UTILS_assert(pObj->topField->fid == FVID2_FID_TOP);
                    DisplayLink_drvCreateFieldMergedFrame(pObj, pObj->topField,
                                                         frame,
                                                         frameInfo);
                    pObj->topField = NULL;
                    *pFramePtr = &frameInfo->frame;
                }
                else
                {
                    /* if top field. Store top field */
                    pObj->topField = frame;
                    frame->timeStamp = Utils_getCurTimeInMsec();
                    *pFramePtr = NULL;
                }
            }
            else
            {
                /* FID out of order. Reject */
                *frameReject = TRUE;
            }
        }
        else
        {
            status = Utils_queGet(&pObj->frameInfo.infoQ,
                                  (Ptr *)&frameInfo,
                                  1,
                                  BIOS_NO_WAIT);
            UTILS_assert(status == 0);
            frameInfo->activeQueueId = pObj->curActiveQueue;
            frameInfo->isFieldPair = FALSE;
            frameInfo->origFrameInfo = frame->appData;
            frame->appData = frameInfo;
        }
    }
}