diff --git a/packages/ti/psp/vps/core/src/vpscore_graphics.c b/packages/ti/psp/vps/core/src/vpscore_graphics.c index 6264b1c..020629b 100755 --- a/packages/ti/psp/vps/core/src/vpscore_graphics.c +++ b/packages/ti/psp/vps/core/src/vpscore_graphics.c @@ -137,6 +137,11 @@ static Int32 vcoreGrpxRtProgramOvlyMem(Vcore_GrpxHandleObj *hObj, const Vcore_DescMem *descMem, UInt32 regId); +static Int32 vcoreGrpxRtUpdateDataDesc(Vcore_GrpxHandleObj *hObj, + Vcore_GrpxChObj *chObj, + const Vcore_DescMem *descMem, + UInt32 regId); + /* ========================================================================== */ /* Global Variables */ /* ========================================================================== */ @@ -1607,8 +1612,8 @@ static Int32 Vcore_grpxUpdateRtMem(Vcore_Handle handle, } if (VPS_SOK == retVal) { - /*program the data descriptor if applicable*/ - retVal = vcoreGrpxRtProgramDataDesc(hObj, + /*Update the data descriptor if applicable*/ + retVal = vcoreGrpxRtUpdateDataDesc(hObj, chObj, descMem, regIdx); @@ -2107,3 +2112,82 @@ static Int32 vcoreGrpxRtProgramOvlyMem(Vcore_GrpxHandleObj *hObj, return (retVal); } +/** + * vcoreGrpxRtUpdateDataDesc + * runtime program the data descriptor + * return VPS_SOK on success else return error value + */ +static Int32 vcoreGrpxRtUpdateDataDesc(Vcore_GrpxHandleObj *hObj, + Vcore_GrpxChObj *chObj, + const Vcore_DescMem *descMem, + UInt32 regId) + +{ + Int32 retVal = VPS_SOK; + UInt32 descSet; + Ptr dataDesc; + Vps_GrpxRegionParams *regParams; + Vcore_GrpxInstObj *instObj; + VpsHal_VpdmaRegionDataDescParams regDesc; + VpsHal_VpdmaInDescParams stenDescParam; + + + GT_assert(GrpxCoreTrace, (NULL != descMem)); + instObj = hObj->instObj; + GT_assert(GrpxCoreTrace, (NULL != instObj)); + + if (TRUE == chObj->state.isMultiWinMode) + { + regParams = &chObj->mInfo.regParam[regId]; + } + else + { + regParams = &chObj->regParam; + } + + + /* For first region, totally three data descriptors CLUT, Stenciling and + * Data. For the rest regions, only two data descriptors: stenciling and Data. + */ + for (descSet = 0u; descSet < instObj->numDescPerReg; descSet++) + { + /*Get the right descriptor memory based on the region num*/ + if (0u == regId) + { + dataDesc =(Ptr)descMem->inDataDesc[1u + descSet]; + } + else + { + dataDesc =(Ptr)descMem->multiWinDataDesc[VCORE_GRPX_DESCS_PER_REGION * + (regId - 1u) + descSet]; + } + /*stenciling descriptor comes first */ + if (descSet == 0u) + { + if (TRUE == regParams->stencilingEnable) + { + retVal = vcoreGrpxCreateStenDataDesc(hObj, chObj, + regParams, &stenDescParam, dataDesc,regId); + } + else + { + /*create dummy to replace the real descriptor one*/ + VpsHal_vpdmaCreateDummyDesc(dataDesc); + VpsHal_vpdmaCreateDummyDesc( + (Ptr)((UInt32)dataDesc + + VPSHAL_VPDMA_CONFIG_DESC_SIZE)); + } + } + else + { + /*Update grpx data descriptor*/ + retVal = vcoreGrpxUpdateGrpxDataDesc(hObj, + chObj, + regParams, + ®Desc, + dataDesc, + regId); + } + } + return (retVal); +} diff --git a/packages/ti/psp/vps/core/src/vpscore_grpxPriv.c b/packages/ti/psp/vps/core/src/vpscore_grpxPriv.c index cc68389..6104f7a 100755 --- a/packages/ti/psp/vps/core/src/vpscore_grpxPriv.c +++ b/packages/ti/psp/vps/core/src/vpscore_grpxPriv.c @@ -978,4 +978,74 @@ Int32 vcoreGrpxCreateGrpxDataDesc(const Vcore_GrpxHandleObj *hObj, return (retVal); } +/** + * vcoreGrpxUpdateGrpxDataDesc + * function to updates a graphics data descriptor + */ +Int32 vcoreGrpxUpdateGrpxDataDesc(const Vcore_GrpxHandleObj *hObj, + Vcore_GrpxChObj *chObj, + Vps_GrpxRegionParams *regParams, + VpsHal_VpdmaRegionDataDescParams*regD, + Ptr descPtr, + UInt32 regId) +{ + Int32 retVal = VPS_SOK; + Vcore_GrpxInstObj *instObj; + + instObj = hObj->instObj; + GT_assert(GrpxCoreTrace, (NULL != instObj)); + + regD->channel = instObj->chGrpx; + regD->nextChannel = instObj->chGrpx; + if (FVID2_SF_INTERLACED == chObj->coreFmt.fmt.scanFormat) + { + if (TRUE == chObj->coreFmt.fmt.fieldMerged[FVID2_RGB_ADDR_IDX]) + { + regD->lineSkip = VPSHAL_VPDMA_LS_2; + } + else + { + regD->lineSkip = VPSHAL_VPDMA_LS_1; + } + } + else + { + regD->lineSkip = VPSHAL_VPDMA_LS_1; + } + if (TRUE == chObj->state.isMultiWinMode) + { + regD->lineStride = + (UInt16)chObj->mInfo.regFmt[regId].pitch[FVID2_RGB_ADDR_IDX]; + regD->dataType = vcoreGrpxGetVpdmaChanDataType( + chObj->mInfo.regFmt[regId].dataFormat); + } + else + { + regD->dataType = + vcoreGrpxGetVpdmaChanDataType(chObj->coreFmt.fmt.dataFormat); + + regD->lineStride = + (UInt16)chObj->coreFmt.fmt.pitch[FVID2_RGB_ADDR_IDX]; + } + regD->memType = (VpsHal_VpdmaMemoryType)chObj->coreFmt.memType; + regD->notify = FALSE; + if (VCORE_OPMODE_DISPLAY == instObj->curMode) + { + regD->priority = VPS_CFG_DISP_VPDMA_PRIORITY; + } + else + { + regD->priority = VPS_CFG_M2M_VPDMA_PRIORITY_RD; + } + + retVal = VpsHal_grpxRegionDispAttrSet(instObj->grpxHandle, regParams, regD); + if (VPS_SOK == retVal) + { + retVal = VpsHal_vpdmaUpdateRegionDataDesc(descPtr, regD); + GT_1trace(GrpxCoreTrace, GT_DEBUG, + "---------REGION DATA at 0x%0.8x-------------\n",(UInt32)descPtr); + VpsHal_vpdmaPrintDesc(descPtr, GrpxCoreTrace); + } + return (retVal); +} diff --git a/packages/ti/psp/vps/core/src/vpscore_grpxPriv.h b/packages/ti/psp/vps/core/src/vpscore_grpxPriv.h index 611a338..5fb92f1 100755 --- a/packages/ti/psp/vps/core/src/vpscore_grpxPriv.h +++ b/packages/ti/psp/vps/core/src/vpscore_grpxPriv.h @@ -538,6 +538,12 @@ Int32 vcoreGrpxCreateGrpxDataDesc(const Vcore_GrpxHandleObj *hObj, Ptr descPtr, UInt32 regId); +Int32 vcoreGrpxUpdateGrpxDataDesc(const Vcore_GrpxHandleObj *hObj, + Vcore_GrpxChObj *chObj, + Vps_GrpxRegionParams *regParams, + VpsHal_VpdmaRegionDataDescParams*regD, + Ptr descPtr, + UInt32 regId); #ifdef __cplusplus diff --git a/packages/ti/psp/vps/drivers/display/src/vpsdrv_dispGrpx.c b/packages/ti/psp/vps/drivers/display/src/vpsdrv_dispGrpx.c index 52cca4f..a0de999 100755 --- a/packages/ti/psp/vps/drivers/display/src/vpsdrv_dispGrpx.c +++ b/packages/ti/psp/vps/drivers/display/src/vpsdrv_dispGrpx.c @@ -978,19 +978,7 @@ static Int32 VpsDdrvGrpxUpdateDesc(VpsDdrv_GrpxInstObj * instObj, for (set = 0; set < DC_NUM_DESC_SET; set++) { - - /*update the RT parameters to core*/ - retVal = vpsDdrvGrpxUpdateRtParams(instObj, - frameList, - set); - - if (FVID2_SOK != retVal) - { - GT_0trace(VpsDdrvGrpxTrace, GT_ERR, - "Update RT parameters failed.\n"); - return retVal; - } - + /* Program the next buffer if required */ if (TRUE == instObj->state.isMultiRegion) { @@ -1142,6 +1130,28 @@ static Int32 vpsDdrvGrpxFbUpdateBufIsr(UInt32 curSet, instObj->clutSet[nextSet] = FALSE; } + + /* Update the rtparams during vsync interval instead of while rtparams + update queue in order avoid driver accessing the descriptors + which are used by VPDMA which can lead to hang . + Only Last queued rtparams are updated to core during vsync + interval others are discarded*/ + if(instObj->bmObj.fbQObj != NULL) + { + /*update the RT parameters to core*/ + retVal = vpsDdrvGrpxUpdateRtParams(instObj, + &instObj->bmObj.fbQObj->frameList, + nextSet); + + if (FVID2_SOK != retVal) + { + GT_0trace(VpsDdrvGrpxTrace, GT_ERR, + "Update RT parameters failed.\n"); + return retVal; + } + + } + /* Intimate the application that a buffer is ready to be dequeued */ if (instObj->bmObj.expectedSet >= (DC_NUM_DESC_SET - 1u)) { diff --git a/packages/ti/psp/vps/hal/src/vpshal_vpdma.c b/packages/ti/psp/vps/hal/src/vpshal_vpdma.c index 57a1683..f163efd 100755 --- a/packages/ti/psp/vps/hal/src/vpshal_vpdma.c +++ b/packages/ti/psp/vps/hal/src/vpshal_vpdma.c @@ -2230,3 +2230,59 @@ VpsHal_VpdmaClient VpsHal_vpdmaGetClientNo(VpsHal_VpdmaChannel chan) return (clientNo); } + +/** + * VpsHal_vpdmaUpdateRegionDataDesc + * \brief This function is used to update the Region data descriptor in + * the given memory. Upper layer passes the parameters need to be set + * in second argument and this function makes data descriptor in + * the memory given in the first argument. Memory pointer given must + * contain physically contiguous memory because VPDMA works with that only. + * + * \param memPtr Pointer to physically contiguous memory into + * which descriptor will be created + * \param descInfo Pointer to structure containing region data + * descriptor parameters + * \return Returns 0 on success else returns error value + */ +Int VpsHal_vpdmaUpdateRegionDataDesc(Ptr memPtr, + VpsHal_VpdmaRegionDataDescParams *descInfo) +{ + volatile VpsHal_VpdmaRegionDataDesc *dataDesc = NULL; + Int32 ptr; + Int32 *testPtr; + + GT_assert(VpsHalTrace, (NULL != memPtr)); + GT_assert(VpsHalTrace, (NULL != descInfo)); + GT_assert(VpsHalTrace, (0u == ((UInt32)(descInfo->lineStride) & + (VPSHAL_VPDMA_LINE_STRIDE_ALIGN - 1u)))); + + dataDesc = (volatile VpsHal_VpdmaRegionDataDesc *)memPtr; + dataDesc->descType = VPSHAL_VPDMA_PT_DATA; + dataDesc->channel = descInfo->channel; + dataDesc->dataType = descInfo->dataType; + dataDesc->transferHeight = dataDesc->regionHeight = descInfo->regionHeight; + dataDesc->transferWidth = dataDesc->regionWidth = descInfo->regionWidth; + dataDesc->horizontalStart = descInfo->startX; + dataDesc->verticalStart = descInfo->startY; + dataDesc->lineStride = descInfo->lineStride; + dataDesc->evenSkip = dataDesc->oddSkip = descInfo->lineSkip; + dataDesc->nextChannel = descInfo->nextChannel; + dataDesc->memType = descInfo->memType; + dataDesc->direction = VPSHAL_VPDMA_INBOUND_DATA_DESC; + dataDesc->regionPriority = descInfo->regionPriority; + dataDesc->regionAttr = descInfo->regionAttr & + VPSHAL_VPDMA_GRPX_REGION_ATTR_MASK; + dataDesc->bbAlpha = descInfo->bbAlpha; + dataDesc->blendAlpha = descInfo->blendAlpha; + dataDesc->blendType = descInfo->blendType; + if(0 != (descInfo->regionAttr & VPSHAL_VPDMA_GRPX_TRANSPARENCY)) + { + dataDesc->enableTransparency = 1u; + } + dataDesc->transMask = descInfo->transMask; + dataDesc->transColor = descInfo->transColor; + dataDesc->notify = descInfo->notify; + dataDesc->priority = descInfo->priority; + return (0); +} diff --git a/packages/ti/psp/vps/hal/vpshal_vpdma.h b/packages/ti/psp/vps/hal/vpshal_vpdma.h index 489c716..3948d74 100755 --- a/packages/ti/psp/vps/hal/vpshal_vpdma.h +++ b/packages/ti/psp/vps/hal/vpshal_vpdma.h @@ -37,6 +37,23 @@ #endif +/** + * VpsHal_vpdmaUpdateRegionDataDesc + * \brief This function is used to update the Region data descriptor in + * the given memory. Upper layer passes the parameters need to be set + * in second argument and this function makes data descriptor in + * the memory given in the first argument. Memory pointer given must + * contain physically contiguous memory because VPDMA works with that only. + * + * \param memPtr Pointer to physically contiguous memory into + * which descriptor will be created + * \param descInfo Pointer to structure containing region data + * descriptor parameters + * \return Returns 0 on success else returns error value + */ +Int VpsHal_vpdmaUpdateRegionDataDesc(Ptr memPtr, + VpsHal_VpdmaRegionDataDescParams *descInfo); + #ifdef __cplusplus extern "C" {