[DSS M2M Driver]Addressed review comments
authorVivek Dhande <a0132295@ti.com>
Tue, 9 Mar 2021 18:48:01 +0000 (00:18 +0530)
committerAnkur <ankurbaranwal@ti.com>
Thu, 11 Mar 2021 06:07:49 +0000 (00:07 -0600)
Signed-off-by: Vivek Dhande <a0132295@ti.com>
packages/ti/drv/dss/include/dss_m2m.h
packages/ti/drv/dss/soc/V1/dss_soc.h
packages/ti/drv/dss/src/drv/m2m/dss_m2mApi.c
packages/ti/drv/dss/src/drv/m2m/dss_m2mDctrl.c
packages/ti/drv/dss/src/drv/m2m/dss_m2mDisp.c
packages/ti/drv/dss/src/drv/m2m/dss_m2mPriv.h

index 68038d497f781ad0044b7e5f9cac2ac07f8b116b..fc0f51df92c73722b306a82db994af9f36b42def 100755 (executable)
@@ -73,14 +73,12 @@ extern "C" {
  * These are display FVID2 APIs that can be called by the application.
  * Display M2M driver supports additional IOCTLs from other modules/drivers
  * and those are follows:
- * 1. IOCTLs from Display Pipe Driver (Refer to \ref DRV_DSS_DISP_IOCTL):
- *      - IOCTL_DSS_DISP_SET_DSS_PARAMS
- *      - IOCTL_DSS_DISP_SET_PIPE_MFLAG_PARAMS
- *      - IOCTL_DSS_DISP_SET_PIPE_CSC_COEFF
- * 2. IOCTLs from Display Controller Driver (Refer to \ref DRV_DSS_DCTRL_IOCTL):
+ * 1. IOCTLs from Display Controller Driver (Refer to \ref DRV_DSS_DCTRL_IOCTL):
  *      - IOCTL_DSS_DCTRL_SET_OVERLAY_PARAMS
  *      - IOCTL_DSS_DCTRL_SET_LAYER_PARAMS
  *      - IOCTL_DSS_DCTRL_SET_GLOBAL_DSS_PARAMS
+ *          - These Global Parameters are common across multiple driver handles
+ *            across multiple DSS drivers like DISP, DCTRL and M2M.
  */
 
 /**
@@ -94,12 +92,12 @@ extern "C" {
  *
  * \return  FVID2_SOK if successful, else suitable error code
  */
-#define IOCTL_DSS_M2M_SET_PIPE_PARAMS          (DSS_M2M_IOCTL_BASE + 0x0001U)
+#define IOCTL_DSS_M2M_SET_WB_PIPE_PARAMS          (DSS_M2M_IOCTL_BASE + 0x0001U)
 
 /**
- * \brief Command to set MFLAG parameters for video pipe.
+ * \brief Command to set MFLAG parameters for WB pipe.
  *
- *  This IOCTL can be used to set the MFLAG parameters for the given video pipe.
+ *  This IOCTL can be used to set the MFLAG parameters for the given WB pipe.
  *
  * \param cmdArgs       [IN]  Pointer of type #Dss_WbPipeMflagParams
  * \param cmdArgsStatus [OUT] NULL
@@ -107,7 +105,7 @@ extern "C" {
  * \return  FVID2_SOK if successful, else suitable error code
  *
  */
-#define IOCTL_DSS_M2M_SET_PIPE_MFLAG_PARAMS   (DSS_M2M_IOCTL_BASE + 0x0002U)
+#define IOCTL_DSS_M2M_SET_WB_PIPE_MFLAG_PARAMS   (DSS_M2M_IOCTL_BASE + 0x0002U)
 
 /**
  * \brief Command to get the display status.
@@ -127,7 +125,7 @@ extern "C" {
 #define IOCTL_DSS_M2M_GET_CURRENT_STATUS      (DSS_M2M_IOCTL_BASE + 0x0003U)
 
 /**
- * \brief Command to program the CSC coefficients for Video Pipe.
+ * \brief Command to program the CSC coefficients for WB Pipe.
  *  By default BT 601 coefficients are set.
  *
  * \param cmdArgs       [IN]  Pointer of type #CSL_DssCscCoeff
@@ -135,7 +133,7 @@ extern "C" {
  *
  * \return  FVID2_SOK if successful, else suitable error code
  */
-#define IOCTL_DSS_M2M_SET_PIPE_CSC_COEFF      (DSS_M2M_IOCTL_BASE + 0x0004U)
+#define IOCTL_DSS_M2M_SET_WB_PIPE_CSC_COEFF      (DSS_M2M_IOCTL_BASE + 0x0004U)
 
 /**
  * \brief Command to program the write-back pipe DMA configuration parameters
@@ -145,8 +143,44 @@ extern "C" {
  *
  * \return  FVID2_SOK if successful, else suitable error code
  */
-#define IOCTL_DSS_M2M_SET_PIPE_DMA_CFG       (DSS_M2M_IOCTL_BASE + 0x0005U)
+#define IOCTL_DSS_M2M_SET_WB_PIPE_DMA_CFG       (DSS_M2M_IOCTL_BASE + 0x0005U)
 
+/**
+ * \brief Command to set DSS display pipeline parameters.
+ *
+ *  This IOCTL is used to program the DSS display parameters. Refer to structure
+ *  #Dss_PipeCfgParams for details on DSS parameters.
+ *
+ * \param cmdArgs       [IN]  Pointer of type #Dss_PipeCfgParams
+ * \param cmdArgsStatus [OUT] NULL
+ *
+ * \return  FVID2_SOK if successful, else suitable error code
+ */
+#define IOCTL_DSS_M2M_SET_PIPE_PARAMS          (DSS_M2M_IOCTL_BASE + 0x0006U)
+
+/**
+ * \brief Command to set MFLAG parameters for video pipe.
+ *
+ *  This IOCTL can be used to set the MFLAG parameters for the given video pipe.
+ *
+ * \param cmdArgs       [IN]  Pointer of type #Dss_PipeMflagParams
+ * \param cmdArgsStatus [OUT] NULL
+ *
+ * \return  FVID2_SOK if successful, else suitable error code
+ *
+ */
+#define IOCTL_DSS_M2M_SET_PIPE_MFLAG_PARAMS   (DSS_M2M_IOCTL_BASE + 0x0007U)
+
+/**
+ * \brief Command to program the CSC coefficients for Video Pipe.
+ *  By default BT 601 coefficients are set.
+ *
+ * \param cmdArgs       [IN]  Pointer of type #Dss_PipeCscParams
+ * \param cmdArgsStatus [OUT] NULL
+ *
+ * \return  FVID2_SOK if successful, else suitable error code
+ */
+#define IOCTL_DSS_M2M_SET_PIPE_CSC_COEFF      (DSS_M2M_IOCTL_BASE + 0x0008U)
 /* @} */
 
 /* ========================================================================== */
@@ -167,7 +201,7 @@ typedef struct
 /**
  *  \brief Structure containing Video write-back Pipe Mflag Information.
  *   This structure is used as an argument to
- *   IOCTL_DSS_M2M_SET_PIPE_MFLAG_PARAMS.
+ *   IOCTL_DSS_M2M_SET_WB_PIPE_MFLAG_PARAMS.
  */
 typedef struct
 {
@@ -199,17 +233,16 @@ typedef struct
 
 /**
  *  \brief Structure containing display driver create arguments, used when
- *   calling Fvid2_create().
+ *   calling Fvid2_create(). Application shall maintain same create time
+ *   configurations between multiple driver handles for same WB pipe-line.
  */
 typedef struct
 {
-    uint32_t instId;
-    /**< DSS M2M/WB pipeline instance ID */
-    CSL_DssWbPipeDmaCfg dmaCfg;
-    /**< DMA configuration for WB pipeline
-     *   See \ref CSL_DssWbPipeDmaCfg for details */
-    uint32_t pipeId;
-    /**< ID DSS pipeline to use.
+    uint32_t numPipe;
+    /**< Number of Display pipe-lines used for given M2M/WB pipeline.
+     *   This should be set to '1' (as done in Dss_m2mCreateParamsInit()) */
+    uint32_t pipeId[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
+    /**< ID DSS pipeline to use. Application shall only set pipe IDs which are used.
      *   See \ref CSL_DssVidPipeId for details */
     uint32_t overlayId;
     /**< ID DSS overlay to use.
@@ -224,6 +257,48 @@ typedef struct
     int32_t retVal;
     /**< Create status, FVID2_SOK on success, else failure. */
 } Dss_WbCreateStatus;
+
+/**
+ *  \brief Structure containing video pipe configuration.
+ *   This structure is used as an argument to
+ *   IOCTL_DSS_M2M_SET_PIPE_PARAMS.
+ */
+typedef struct
+{
+    uint32_t pipeId;
+    /**< Display Pipe-line ID */
+    Dss_DispParams cfgParams;
+    /**< Configuration for Display pipeline
+     *   See \ref Dss_DispParams for details */
+} Dss_PipeCfgParams;
+
+/**
+ *  \brief Structure containing Video Pipe Mflag Information.
+ *   This structure is used as an argument to
+ *   IOCTL_DSS_M2M_SET_PIPE_MFLAG_PARAMS.
+ */
+typedef struct
+{
+    uint32_t pipeId;
+    /**< Display Pipe-line ID */
+    Dss_DispPipeMflagParams mFlagCfg;
+    /**< MFlag configuration parameters for display pipeline
+     *   See \ref Dss_DispPipeMflagParams for details */
+} Dss_PipeMflagParams;
+
+/**
+ *  \brief Structure containing Video Pipe CSC Information.
+ *   This structure is used as an argument to
+ *   IOCTL_DSS_M2M_SET_PIPE_CSC_COEFF.
+ */
+typedef struct
+{
+    uint32_t pipeId;
+    /**< Display Pipe-line ID */
+    CSL_DssCscCoeff csc;
+    /**< MFlag configuration parameters for WB pipeline
+     *   See \ref CSL_DssCscCoeff for details */
+} Dss_PipeCscParams;
 /* ========================================================================== */
 /*                  Internal/Private Function Declarations                    */
 /* ========================================================================== */
@@ -271,12 +346,18 @@ static inline void Dss_m2mStatusInit(Dss_WbStatus *status);
 /* ========================================================================== */
 static inline void Dss_m2mCreateParamsInit(Dss_WbCreateParams *createParams)
 {
+    uint32_t loopCnt = 0U;
+
     if(NULL != createParams)
     {
-        createParams->instId    = DSS_M2M_WB_PIPELINE_ID_0;
-        createParams->pipeId    = CSL_DSS_VID_PIPE_ID_VID1;
+        createParams->numPipe = 1U;
+        for (loopCnt = 0U ;
+             loopCnt < DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE ;
+             loopCnt++)
+        {
+            createParams->pipeId[loopCnt] = CSL_DSS_VID_PIPE_ID_MAX;
+        }
         createParams->overlayId = CSL_DSS_OVERLAY_ID_1;
-        CSL_dssWbPipeDmaCfgInit(&(createParams->dmaCfg));
     }
 }
 
@@ -285,6 +366,9 @@ static inline void Dss_m2mPipeCfgParamsInit(Dss_WbPipeCfgParams *cfgParams)
     if(NULL != cfgParams)
     {
         CSL_dssWbPipeCfgInit(&(cfgParams->pipeCfg));
+        /* dataFormat is fixed as Display pipe/overlay can only output in
+           ARGB48 format */
+        cfgParams->pipeCfg.inFmt.dataFormat = FVID2_DF_ARGB48_12121212;
         /* Set mode to M2M mode */
         cfgParams->pipeCfg.wbMode = CSL_DSS_WB_PIPE_MODE_M2M;
     }
index 0f4c309934526f33e4b928a5f8ab709e3fe0b81d..c0b73eacb332c6fbe00431cd789d9e497883c1bd 100755 (executable)
@@ -204,6 +204,9 @@ typedef void (*Dss_DctrlDpHpdCbFxn)(uint32_t hpdState, void *appData);
 #define DSS_M2M_WB_PIPELINE_ID_MAX                   (CSL_DSS_WB_PIPE_ID_MAX)
 #define DSSM2M_NUM_WB_PIPELINE                       (CSL_DSS_WB_PIPE_ID_MAX)
 
+/** \brief DSS pipe-lines number available in the SoC for blending in M2M mode */
+#define DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE       (1U)
+
 /** \brief DSS M2M DRV Virtual Context: Number of virtual contexts per DSS M2M pipeline */
 #define DSSM2M_NUM_VIRTUAL_CONTEXT                   (8U)
 
index 1e3429facde43f99c54deb5470bd9905635bc17d..f5fb690e86ac41c1543fe87a14af4ff6da47977e 100755 (executable)
@@ -88,9 +88,6 @@ Dss_EvtMgrClientInfo gDss_M2MEvtMgrClientInfo[DSS_DISP_EVT_MGR_MAX_CLIENTS];
 /* ========================================================================== */
 /*                  Internal/Private Function Declarations                    */
 /* ========================================================================== */
-static int32_t Dss_m2mDrvSetWbPipeDmaCfg(DssM2MDrv_InstObj *instObj,
-                                         const CSL_DssWbPipeDmaCfg *dmaCfg);
-
 static int32_t Dss_m2mDrvCreateInstQueues(DssM2MDrv_VirtContext *context);
 
 static int32_t Dss_m2mDrvDeleteInstQueues(DssM2MDrv_VirtContext *context);
@@ -151,7 +148,7 @@ int32_t Dss_m2mDrvInit(const Dss_InitParams *initParams)
 {
     int32_t retVal = FVID2_SOK;
     DssM2MDrv_CommonObj *m2mObj;
-    uint32_t loopCnt = 0U, contextCnt = 0U, eventGroup;
+    uint32_t loopCnt = 0U, contextCnt = 0U, eventGroup, pipeIdx = 0U;
     uint32_t numEvents, evtMgrId, numHandle;
     DssM2MDrv_VirtContext *virtContext;
     DssM2MDrv_InstObj *instObj;
@@ -194,9 +191,15 @@ int32_t Dss_m2mDrvInit(const Dss_InitParams *initParams)
         instObj->commonObjRef            = m2mObj;
         instObj->wbRegs                  = socInfo->wbRegs[loopCnt];
         instObj->commRegs                = NULL;
-        instObj->pipeRegs                = NULL;
+        instObj->numPipe                 = 0U;
+        for (pipeIdx = 0U ;
+             pipeIdx < DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE ;
+             pipeIdx++)
+        {
+            instObj->pipeRegs[pipeIdx] = NULL;
+            instObj->pipeId[pipeIdx]   = CSL_DSS_VID_PIPE_ID_MAX;
+        }
         instObj->ovrRegs                 = NULL;
-        instObj->pipeId                  = CSL_DSS_VID_PIPE_ID_MAX;
         instObj->overlayId               = CSL_DSS_OVERLAY_ID_MAX;
         instObj->pathCfgDone             = (uint32_t) FALSE;
         /* Allocate instance semaphore */
@@ -207,7 +210,13 @@ int32_t Dss_m2mDrvInit(const Dss_InitParams *initParams)
              contextCnt++)
         {
             virtContext            = &m2mObj->virtContext[loopCnt][contextCnt];
-            virtContext->pipeId    = CSL_DSS_VID_PIPE_ID_MAX;
+            for (pipeIdx = 0U ;
+                 pipeIdx < DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE ;
+                 pipeIdx++)
+            {
+                virtContext->pipeId[pipeIdx] = CSL_DSS_VID_PIPE_ID_MAX;
+            }
+            virtContext->numPipe   = 0U;
             virtContext->overlayId = CSL_DSS_OVERLAY_ID_MAX;
             virtContext->contextId = contextCnt;
             virtContext->state     = DSSM2M_DRV_STATE_IDLE;
@@ -267,7 +276,7 @@ int32_t Dss_m2mDrvDeInit(void)
 {
     int32_t retVal = FVID2_SOK;
     DssM2MDrv_CommonObj *m2mObj;
-    uint32_t loopCnt = 0U, contextCnt = 0U, eventIdx = 0U;
+    uint32_t loopCnt = 0U, contextCnt = 0U, eventIdx = 0U, pipeIdx = 0U;
     DssM2MDrv_VirtContext *virtContext;
     DssM2MDrv_InstObj *instObj;
 
@@ -285,7 +294,14 @@ int32_t Dss_m2mDrvDeInit(void)
         instObj->inUse                   = DSSM2M_DRV_USAGE_STATUS_NOT_USED;
         instObj->commonObjRef            = NULL;
         instObj->commRegs                = NULL;
-        instObj->pipeRegs                = NULL;
+        for (pipeIdx = 0U ;
+             pipeIdx < DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE ;
+             pipeIdx++)
+        {
+            instObj->pipeRegs[pipeIdx] = NULL;
+            instObj->pipeId[pipeIdx]   = CSL_DSS_VID_PIPE_ID_MAX;
+        }
+        instObj->numPipe                 = 0U;
         instObj->ovrRegs                 = NULL;
         instObj->wbRegs                  = NULL;
         instObj->pathCfgDone             = (uint32_t) FALSE;
@@ -294,6 +310,7 @@ int32_t Dss_m2mDrvDeInit(void)
              contextCnt++)
         {
             virtContext            = &m2mObj->virtContext[loopCnt][contextCnt];
+            virtContext->numPipe   = 0U;
             virtContext->state     = DSSM2M_DRV_STATE_UNINIT;
             virtContext->inUse     = DSSM2M_DRV_USAGE_STATUS_NOT_USED;
             virtContext->instObj   = NULL;
@@ -352,7 +369,7 @@ Fdrv_Handle Dss_m2mCreate(uint32_t drvId,
         /* Get free Virtual Context */
         for (loopCnt = 0U ; loopCnt < DSSM2M_NUM_VIRTUAL_CONTEXT ; loopCnt++)
         {
-            if (m2mObj->virtContext[createParams->instId][loopCnt].inUse ==
+            if (m2mObj->virtContext[instId][loopCnt].inUse ==
                                 DSSM2M_DRV_USAGE_STATUS_NOT_USED)
             {
                 break;
@@ -365,7 +382,7 @@ Fdrv_Handle Dss_m2mCreate(uint32_t drvId,
         }
         else
         {
-            virtContext = &m2mObj->virtContext[createParams->instId][loopCnt];
+            virtContext = &m2mObj->virtContext[instId][loopCnt];
             instObj = virtContext->instObj;
             GT_assert(DssTrace, (NULL != instObj->commonObjRef));
 
@@ -376,15 +393,31 @@ Fdrv_Handle Dss_m2mCreate(uint32_t drvId,
                                        SemaphoreP_WAIT_FOREVER);
             }
 
+            for (loopCnt = 0U ;
+                 loopCnt < createParams->numPipe ;
+                 loopCnt++)
+            {
+                if (((instObj->pipeId[loopCnt] != CSL_DSS_VID_PIPE_ID_MAX) &&
+                    (instObj->pipeId[loopCnt] != createParams->pipeId[loopCnt])) ||
+                    (createParams->pipeId[loopCnt] == CSL_DSS_VID_PIPE_ID_MAX))
+                {
+                    break;
+                }
+            }
+            if (loopCnt < createParams->numPipe)
+            {
+                retVal = FVID2_EBADARGS;
+                GT_0trace(DssTrace, GT_ERR, "Wrong Pipe instance used!!!\r\n");
+            }
+
             /* Check if same DSS Pipe and Overlay is provided within
                different Create calls */
-            if (((instObj->pipeId != CSL_DSS_VID_PIPE_ID_MAX) &&
-                            (instObj->pipeId != createParams->pipeId)) ||
-                ((instObj->overlayId != CSL_DSS_OVERLAY_ID_MAX) &&
-                            (instObj->overlayId != createParams->overlayId)))
+            if (((instObj->overlayId != CSL_DSS_OVERLAY_ID_MAX) &&
+                 (instObj->overlayId != createParams->overlayId)) ||
+                 (createParams->overlayId == CSL_DSS_OVERLAY_ID_MAX))
             {
                 retVal = FVID2_EBADARGS;
-                GT_0trace(DssTrace, GT_ERR, "Wrong Pipe/Overlay instance used!!!\r\n");
+                GT_0trace(DssTrace, GT_ERR, "Wrong Overlay instance used!!!\r\n");
             }
 
             if (FVID2_SOK == retVal)
@@ -404,15 +437,14 @@ Fdrv_Handle Dss_m2mCreate(uint32_t drvId,
                 Fvid2Utils_memset(&virtContext->instCfg,
                                   0U,
                                   sizeof(DssM2MDrv_moduleCfg));
-                virtContext->pipeId    = createParams->pipeId;
+                for (loopCnt = 0U ;
+                     loopCnt < createParams->numPipe ;
+                     loopCnt++)
+                {
+                    virtContext->pipeId[loopCnt] = createParams->pipeId[loopCnt];
+                }
+                virtContext->numPipe   = createParams->numPipe;
                 virtContext->overlayId = createParams->overlayId;
-                /* Update WB pipeline DMA configurations */
-                Fvid2Utils_memcpy(&virtContext->instCfg.wbPipeCfg.dmaCfg,
-                                  &createParams->dmaCfg,
-                                  sizeof(CSL_DssWbPipeDmaCfg));
-                /* Configure WB pipeline */
-                retVal = Dss_m2mDrvSetWbPipeDmaCfg(instObj,
-                                                   &createParams->dmaCfg);
             }
 
             if (FVID2_SOK == retVal)
@@ -425,11 +457,17 @@ Fdrv_Handle Dss_m2mCreate(uint32_t drvId,
 
             if (FVID2_SOK == retVal)
             {
-                if ((0U == m2mObj->numVirtContUsed[createParams->instId]) &&
+                if ((0U == m2mObj->numVirtContUsed[instId]) &&
                     (DSSM2M_DRV_USAGE_STATUS_NOT_USED == instObj->inUse))
                 {
-                    instObj->pipeId    = virtContext->pipeId;
+                    for (loopCnt = 0U ;
+                         loopCnt < createParams->numPipe ;
+                         loopCnt++)
+                    {
+                        instObj->pipeId[loopCnt] = virtContext->pipeId[loopCnt];
+                    }
                     instObj->overlayId = virtContext->overlayId;
+                    instObj->numPipe   = virtContext->numPipe;
                     /* Set instance status */
                     Fvid2Utils_memset(&instObj->status,
                                       0U,
@@ -446,13 +484,18 @@ Fdrv_Handle Dss_m2mCreate(uint32_t drvId,
                     instObj->commRegs      =
                         instObj->commonObjRef->socInfo.commRegs[CSL_DSS_COMM_REG_ID_0];
                     instObj->ovrRegs       =
-                        instObj->commonObjRef->socInfo.overlayRegs[createParams->overlayId];;
-                    instObj->pipeRegs      =
-                        instObj->commonObjRef->socInfo.pipeRegs[createParams->pipeId];;
+                        instObj->commonObjRef->socInfo.overlayRegs[createParams->overlayId];
+                    for (loopCnt = 0U ;
+                         loopCnt < DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE ;
+                         loopCnt++)
+                    {
+                        instObj->pipeRegs[createParams->pipeId[loopCnt]] =
+                            instObj->commonObjRef->socInfo.pipeRegs[createParams->pipeId[loopCnt]];
+                    }
                     virtContext->inUse     = DSSM2M_DRV_USAGE_STATUS_IN_USE;
                     virtContext->state     = DSSM2M_DRV_STATE_CREATED;
                     instObj->inUse         = DSSM2M_DRV_USAGE_STATUS_IN_USE;
-                    m2mObj->numVirtContUsed[createParams->instId]++;
+                    m2mObj->numVirtContUsed[instId]++;
                     drvHandle = (Fdrv_Handle)virtContext;
                 }
             }
@@ -476,6 +519,7 @@ Fdrv_Handle Dss_m2mCreate(uint32_t drvId,
 int32_t Dss_m2mDelete(Fdrv_Handle handle, void *reserved)
 {
     int32_t retVal = FVID2_SOK;
+    uint32_t pipeIdx;
     DssM2MDrv_CommonObj *m2mObj;
     DssM2MDrv_VirtContext *virtContext;
     DssM2MDrv_InstObj *instObj;
@@ -510,17 +554,29 @@ int32_t Dss_m2mDelete(Fdrv_Handle handle, void *reserved)
             Fvid2Utils_destructQ(virtContext->doneQ);
             virtContext->doneQ = NULL;
         }
-        virtContext->pipeId    = CSL_DSS_VID_PIPE_ID_MAX;
+        for (pipeIdx = 0U ;
+             pipeIdx < DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE ;
+             pipeIdx++)
+        {
+            virtContext->pipeId[pipeIdx] = CSL_DSS_VID_PIPE_ID_MAX;
+        }
+        virtContext->numPipe   = 0U;
         virtContext->overlayId = CSL_DSS_OVERLAY_ID_MAX;
 
         /* Delete Queues only on delete call for last opened Virtual context */
         if ((0U == m2mObj->numVirtContUsed[virtContext->contextId]) &&
                     (DSSM2M_DRV_USAGE_STATUS_IN_USE == instObj->inUse))
         {
-            instObj->pipeId    = CSL_DSS_VID_PIPE_ID_MAX;
+            for (pipeIdx = 0U ;
+                 pipeIdx < DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE ;
+                 pipeIdx++)
+            {
+                instObj->pipeRegs[pipeIdx] = NULL;
+                instObj->pipeId[pipeIdx]   = CSL_DSS_VID_PIPE_ID_MAX;
+            }
+            instObj->numPipe   = 0U;
             instObj->overlayId = CSL_DSS_OVERLAY_ID_MAX;
             instObj->commRegs  = NULL;
-            instObj->pipeRegs  = NULL;
             instObj->ovrRegs   = NULL;
             if(NULL != instObj->commonObjRef->lockSem)
             {
@@ -551,7 +607,7 @@ int32_t Dss_m2mProcessRequest(Fdrv_Handle handle,
     int32_t retVal = FVID2_SOK;
     DssM2MDrv_VirtContext *virtContext= NULL;
     DssM2MDrv_InstObj *instObj = NULL;
-    uint32_t semTimeout, frmCnt, cookie;;
+    uint32_t semTimeout, frmCnt, cookie, loopCnt;
     DssM2M_DrvQueObj *qObj;
     DssM2M_DrvBufManObj *bmObj;
 
@@ -618,27 +674,31 @@ int32_t Dss_m2mProcessRequest(Fdrv_Handle handle,
 
     }
     if ((FVID2_SOK == retVal) &&
-        (inProcessList->numFrames != outProcessList->numFrames))
+        (inProcessList->numFrames != virtContext->createParams.numPipe) &&
+        (outProcessList->numFrames != 1U))
     {
         retVal = FVID2_EBADARGS;
         GT_0trace(DssTrace, GT_ERR,
-            "Number of frames input & output frame list does not match !!\r\n");
+            "Number of frames in input (must be equal to number of pipes used) OR "
+            "output (must be equal to 1) frame list does not match !!\r\n");
     }
     if (FVID2_SOK == retVal)
     {
-        for (frmCnt = 0 ; frmCnt < inProcessList->numFrames ; frmCnt++)
+        qObj = (DssM2M_DrvQueObj *) Fvid2Utils_dequeue(bmObj->freeQ);
+        if (qObj == NULL)
         {
-            qObj = (DssM2M_DrvQueObj *) Fvid2Utils_dequeue(bmObj->freeQ);
-            if (qObj == NULL)
+            GT_0trace(DssTrace, GT_ERR,
+                      "ALLOC: Q object allocation failed\r\n");
+            retVal = FVID2_EALLOC;
+        }
+        if (FVID2_SOK == retVal)
+        {
+            qObj->virtContext = virtContext;
+            qObj->outFrm      = outProcessList->frames[0U];
+            for (frmCnt = 0 ; frmCnt < inProcessList->numFrames ; frmCnt++)
             {
-                GT_0trace(DssTrace, GT_ERR,
-                          "ALLOC: Q object allocation failed\r\n");
-                retVal = FVID2_EALLOC;
-                break;
+                qObj->inFrm[frmCnt] = inProcessList->frames[frmCnt];
             }
-            qObj->virtContext = virtContext;
-            qObj->inFrm       = inProcessList->frames[frmCnt];
-            qObj->outFrm      = outProcessList->frames[frmCnt];
             Fvid2Utils_queue(bmObj->reqQ, &qObj->qElem, qObj);
             virtContext->wbStatus.queueCount++;
             instObj->status.queueCount++;
@@ -648,26 +708,39 @@ int32_t Dss_m2mProcessRequest(Fdrv_Handle handle,
     if (FVID2_SOK == retVal)
     {
         GT_assert(DssTrace, (NULL != instObj->commRegs));
-        GT_assert(DssTrace, (NULL != instObj->pipeRegs));
+        for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
+        {
+            GT_assert(DssTrace,
+                    (NULL != instObj->pipeRegs[virtContext->pipeId[loopCnt]]));
+        }
         GT_assert(DssTrace, (NULL != instObj->ovrRegs));
         GT_assert(DssTrace, (NULL != instObj->wbRegs));
+
         if (Fvid2Utils_getNumQElem(bmObj->currQ) == 0U)
         {
             qObj = (DssM2M_DrvQueObj *) Fvid2Utils_dequeue(bmObj->reqQ);
             GT_assert(DssTrace, (NULL != qObj));
-            CSL_dssVidPipeEnable(instObj->pipeRegs, (uint32_t) FALSE);
+            for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
+            {
+                CSL_dssVidPipeEnable(instObj->pipeRegs[virtContext->pipeId[loopCnt]],
+                                     (uint32_t) FALSE);
+            }
             CSL_dssWbPipeEnable(instObj->wbRegs, (uint32_t) FALSE);
 
-            retVal = Dss_m2mDrvPrgramDctrl(qObj->virtContext);
             retVal += Dss_m2mDrvPrgramDisp(qObj->virtContext);
+            retVal += Dss_m2mDrvPrgramDctrl(qObj->virtContext);
             retVal += Dss_m2mDrvPrgramWbPipe(qObj->virtContext);
 
             if (FVID2_SOK == retVal)
             {
-                CSL_dssVidPipeSetBuffAddr(instObj->pipeRegs,
-                                          FVID2_FID_TOP,
-                                          qObj->inFrm->addr[0U],
-                                          qObj->inFrm->addr[1U]);
+                for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
+                {
+                    CSL_dssVidPipeSetBuffAddr(
+                            instObj->pipeRegs[qObj->inFrm[loopCnt]->chNum],
+                            FVID2_FID_TOP,
+                            qObj->inFrm[loopCnt]->addr[0U],
+                            qObj->inFrm[loopCnt]->addr[1U]);
+                }
                 CSL_dssWbPipeSetBuffAddr(instObj->wbRegs,
                                          FVID2_FID_TOP,
                                          qObj->outFrm->addr[0U],
@@ -682,7 +755,11 @@ int32_t Dss_m2mProcessRequest(Fdrv_Handle handle,
             }
 
             CSL_dssWbPipeEnable(instObj->wbRegs, (uint32_t) TRUE);
-            CSL_dssVidPipeEnable(instObj->pipeRegs, (uint32_t) TRUE);
+            for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
+            {
+                CSL_dssVidPipeEnable(instObj->pipeRegs[virtContext->pipeId[loopCnt]],
+                                     (uint32_t) TRUE);
+            }
         }
     }
 
@@ -704,7 +781,7 @@ int32_t Dss_m2mGetProcessedRequest(Fdrv_Handle handle,
     int32_t retVal = FVID2_SOK;
     DssM2MDrv_VirtContext *virtContext= NULL;
     DssM2MDrv_InstObj *instObj = NULL;
-    uint32_t semTimeout, cookie, loopBreakFlag = 1U;
+    uint32_t semTimeout, cookie, loopCnt;
     DssM2M_DrvQueObj *qObj;
     DssM2M_DrvBufManObj *bmObj;
 
@@ -761,30 +838,25 @@ int32_t Dss_m2mGetProcessedRequest(Fdrv_Handle handle,
         inProcessList->perListCfg  = NULL;
         outProcessList->numFrames  = 0U;
         outProcessList->perListCfg = NULL;
-        do
+        /* Only De-queue one frame per call */
+        qObj = (DssM2M_DrvQueObj *) Fvid2Utils_dequeue(virtContext->doneQ);
+        if (qObj != NULL)
         {
-            qObj = (DssM2M_DrvQueObj *) Fvid2Utils_dequeue(virtContext->doneQ);
-            if (qObj != NULL)
+            for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
             {
-                inProcessList->frames[inProcessList->numFrames]   = qObj->inFrm;
+                inProcessList->frames[loopCnt] = qObj->inFrm[loopCnt];
                 inProcessList->numFrames++;
-                outProcessList->frames[outProcessList->numFrames] = qObj->outFrm;
-                outProcessList->numFrames++;
-                qObj->virtContext = NULL;
-                qObj->inFrm       = NULL;
-                qObj->outFrm      = NULL;
-                virtContext->wbStatus.dequeueCount++;
-                instObj->status.dequeueCount++;
-                Fvid2Utils_queue(bmObj->freeQ, &qObj->qElem, qObj);
-            }
-             /* Max frames limit exceeded exit */
-            if ((inProcessList->numFrames >= FVID2_MAX_FRAME_PTR) ||
-                (outProcessList->numFrames >= FVID2_MAX_FRAME_PTR) ||
-                (qObj == NULL))
-            {
-                loopBreakFlag = 0U;
+                qObj->inFrm[loopCnt] = NULL;
             }
-        } while(loopBreakFlag == 1U);
+
+            outProcessList->frames[outProcessList->numFrames] = qObj->outFrm;
+            outProcessList->numFrames++;
+            qObj->virtContext = NULL;
+            qObj->outFrm      = NULL;
+            virtContext->wbStatus.dequeueCount++;
+            instObj->status.dequeueCount++;
+            Fvid2Utils_queue(bmObj->freeQ, &qObj->qElem, qObj);
+        }
     }
 
     if ((NULL != instObj->commonObjRef->lockSem) && (NULL != instObj))
@@ -823,11 +895,11 @@ int32_t Dss_m2mControl(Fdrv_Handle handle,
             case FVID2_STOP:
                 retVal = Dss_m2mDrvIoctlStop(virtContext);
             break;
-            case IOCTL_DSS_M2M_SET_PIPE_PARAMS:
+            case IOCTL_DSS_M2M_SET_WB_PIPE_PARAMS:
                 retVal = Dss_m2mDrvIoctlSetWbPipeParams(virtContext,
                                     (const Dss_WbPipeCfgParams *)cmdArgs);
             break;
-            case IOCTL_DSS_M2M_SET_PIPE_MFLAG_PARAMS:
+            case IOCTL_DSS_M2M_SET_WB_PIPE_MFLAG_PARAMS:
                 retVal = Dss_m2mDrvIoctlSetmFlagParams(virtContext,
                                     (const Dss_WbPipeMflagParams *)cmdArgs);
             break;
@@ -835,11 +907,11 @@ int32_t Dss_m2mControl(Fdrv_Handle handle,
                 retVal = Dss_m2mDrvIoctlGetCurrentStatus(virtContext,
                                     (Dss_WbStatus *)cmdArgs);
             break;
-            case IOCTL_DSS_M2M_SET_PIPE_CSC_COEFF:
+            case IOCTL_DSS_M2M_SET_WB_PIPE_CSC_COEFF:
                 retVal = Dss_m2mDrvIoctlSetWbPipeCsc(virtContext,
                                     (const CSL_DssCscCoeff *)cmdArgs);
             break;
-            case IOCTL_DSS_M2M_SET_PIPE_DMA_CFG:
+            case IOCTL_DSS_M2M_SET_WB_PIPE_DMA_CFG:
                 retVal = Dss_m2mDrvIoctlSetDmaCfg(virtContext,
                                     (const CSL_DssWbPipeDmaCfg *)cmdArgs);
             break;
@@ -847,17 +919,17 @@ int32_t Dss_m2mControl(Fdrv_Handle handle,
                 tsParams = (Fvid2_TimeStampParams *)cmdArgs;
                 gDssM2mCommonObj.getTimeStamp = tsParams->timeStampFxn;
             break;
-            case IOCTL_DSS_DISP_SET_DSS_PARAMS:
+            case IOCTL_DSS_M2M_SET_PIPE_PARAMS:
                 retVal = Dss_m2mDrvIoctlSetDssPipeParams(virtContext,
-                                    (const Dss_DispParams *)cmdArgs);
+                                    (const Dss_PipeCfgParams *)cmdArgs);
             break;
-            case IOCTL_DSS_DISP_SET_PIPE_MFLAG_PARAMS:
+            case IOCTL_DSS_M2M_SET_PIPE_MFLAG_PARAMS:
                 retVal = Dss_m2mDrvIoctlSetPipeMflagParams(virtContext,
-                                    (const Dss_DispPipeMflagParams *)cmdArgs);
+                                    (const Dss_PipeMflagParams *)cmdArgs);
             break;
-            case IOCTL_DSS_DISP_SET_PIPE_CSC_COEFF:
+            case IOCTL_DSS_M2M_SET_PIPE_CSC_COEFF:
                 retVal = Dss_m2mDrvIoctlSetPipeCsc(virtContext,
-                                    (const CSL_DssCscCoeff *)cmdArgs);
+                                    (const Dss_PipeCscParams *)cmdArgs);
             break;
             case IOCTL_DSS_DCTRL_SET_PATH:
             break;
@@ -890,8 +962,8 @@ int32_t Dss_m2mControl(Fdrv_Handle handle,
 /* ========================================================================== */
 /*                       Static Function Definitions                          */
 /* ========================================================================== */
-static int32_t Dss_m2mDrvSetWbPipeDmaCfg(DssM2MDrv_InstObj *instObj,
-                                         const CSL_DssWbPipeDmaCfg *dmaCfg)
+int32_t Dss_m2mDrvSetWbPipeDmaCfg(DssM2MDrv_InstObj *instObj,
+                                  const CSL_DssWbPipeDmaCfg *dmaCfg)
 {
     int32_t retVal = FVID2_SOK;
 
@@ -916,7 +988,7 @@ static int32_t Dss_m2mDrvCreateInstQueues(DssM2MDrv_VirtContext *context)
 {
     int32_t retVal = FVID2_SOK;
     DssM2M_DrvBufManObj *bmObj;
-    uint32_t qCnt = 0U;
+    uint32_t qCnt = 0U, loopCnt;
     DssM2M_DrvQueObj *qObj;
     DssM2MDrv_InstObj *instObj;
 
@@ -948,7 +1020,10 @@ static int32_t Dss_m2mDrvCreateInstQueues(DssM2MDrv_VirtContext *context)
         {
             qObj              = &bmObj->m2mQObj[qCnt];
             qObj->virtContext = context;
-            qObj->inFrm       = NULL;
+            for (loopCnt = 0U ; loopCnt < context->numPipe ; loopCnt++)
+            {
+                qObj->inFrm[loopCnt] = NULL;
+            }
             qObj->outFrm      = NULL;
             Fvid2Utils_queue(bmObj->freeQ, &qObj->qElem, qObj);
         }
@@ -1395,6 +1470,7 @@ static void Dss_wbPipeCbFxn(const uint32_t *event,
 static void Dss_wbPipeDmaCompletionCbFxn(DssM2MDrv_InstObj *instObj)
 {
     int32_t retVal = FVID2_SOK;
+    uint32_t loopCnt;
     DssM2MDrv_VirtContext *virtContext= NULL;
     DssM2M_DrvQueObj *qObj = NULL;
     DssM2M_DrvBufManObj *bmObj = NULL;
@@ -1431,26 +1507,39 @@ static void Dss_wbPipeDmaCompletionCbFxn(DssM2MDrv_InstObj *instObj)
     if (FVID2_SOK == retVal)
     {
         GT_assert(DssTrace, (NULL != instObj->commRegs));
-        GT_assert(DssTrace, (NULL != instObj->pipeRegs));
+        for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
+        {
+            GT_assert(DssTrace,
+                    (NULL != instObj->pipeRegs[virtContext->pipeId[loopCnt]]));
+        }
         GT_assert(DssTrace, (NULL != instObj->ovrRegs));
         GT_assert(DssTrace, (NULL != instObj->wbRegs));
+
         if (Fvid2Utils_getNumQElem(bmObj->currQ) == 0U)
         {
             qObj = (DssM2M_DrvQueObj *) Fvid2Utils_dequeue(bmObj->reqQ);
             GT_assert(DssTrace, (NULL != qObj));
-            CSL_dssVidPipeEnable(instObj->pipeRegs, (uint32_t) FALSE);
+            for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
+            {
+                CSL_dssVidPipeEnable(instObj->pipeRegs[virtContext->pipeId[loopCnt]],
+                                     (uint32_t) FALSE);
+            }
             CSL_dssWbPipeEnable(instObj->wbRegs, (uint32_t) FALSE);
 
-            retVal = Dss_m2mDrvPrgramDctrl(qObj->virtContext);
             retVal += Dss_m2mDrvPrgramDisp(qObj->virtContext);
+            retVal += Dss_m2mDrvPrgramDctrl(qObj->virtContext);
             retVal += Dss_m2mDrvPrgramWbPipe(qObj->virtContext);
 
             if (FVID2_SOK == retVal)
             {
-                CSL_dssVidPipeSetBuffAddr(instObj->pipeRegs,
-                                          FVID2_FID_TOP,
-                                          qObj->inFrm->addr[0U],
-                                          qObj->inFrm->addr[1U]);
+                for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
+                {
+                    CSL_dssVidPipeSetBuffAddr(
+                            instObj->pipeRegs[qObj->inFrm[loopCnt]->chNum],
+                            FVID2_FID_TOP,
+                            qObj->inFrm[loopCnt]->addr[0U],
+                            qObj->inFrm[loopCnt]->addr[1U]);
+                }
                 CSL_dssWbPipeSetBuffAddr(instObj->wbRegs,
                                          FVID2_FID_TOP,
                                          qObj->outFrm->addr[0U],
@@ -1460,10 +1549,16 @@ static void Dss_wbPipeDmaCompletionCbFxn(DssM2MDrv_InstObj *instObj)
             {
                 /* Queue back in case of failure */
                 Fvid2Utils_queue(bmObj->reqQ, &qObj->qElem, qObj);
+                GT_0trace(DssTrace, GT_ERR,
+                          "Programming Failed: DSS Pipe/Disp/WB Pipe\r\n");
             }
 
             CSL_dssWbPipeEnable(instObj->wbRegs, (uint32_t) TRUE);
-            CSL_dssVidPipeEnable(instObj->pipeRegs, (uint32_t) TRUE);
+            for (loopCnt = 0U ; loopCnt < virtContext->numPipe ; loopCnt++)
+            {
+                CSL_dssVidPipeEnable(instObj->pipeRegs[virtContext->pipeId[loopCnt]],
+                                     (uint32_t) TRUE);
+            }
         }
     }
 
index 1d963aafc812ac797e2f3d9cc3a3b88aad3a4f3d..47aa0ce794b8b75b91027aac901811d1aec22d79 100755 (executable)
@@ -262,7 +262,7 @@ int32_t Dss_m2mDrvPrgramDctrl(DssM2MDrv_VirtContext *context)
                     {
                         layerCfg.layerEnable = TRUE;
                         layerCfg.layerNum = instCfg->ovlLayerParams.pipeLayerNum[loopCnt];
-                        layerCfg.inputPipe = instObj->pipeId;
+                        layerCfg.inputPipe = loopCnt;
                         CSL_dssOverlaySetLayerConfig(
                                             instObj->ovrRegs,
                                             (const CSL_DssOverlayLayerCfg *) &layerCfg);
index bcb3e5321fe6ffcf3f6fbd52edc8dce0fc73a91f..8c59484dde687e84e9978784e5c911354d87c4eb 100755 (executable)
@@ -86,16 +86,16 @@ int32_t Dss_m2mDrvPrgramDisp(DssM2MDrv_VirtContext *context);
  * Display IOCTLs
  */
 static int32_t Dss_m2mDrvValidateDispParams(DssM2MDrv_InstObj *instObj,
-                                            const Dss_DispParams *dispParams);
+                                            const Dss_PipeCfgParams *pipeCfg);
 
 int32_t Dss_m2mDrvIoctlSetDssPipeParams(DssM2MDrv_VirtContext *context,
-                                        const Dss_DispParams *pipeCfg);
+                                        const Dss_PipeCfgParams *pipeCfg);
 
 int32_t Dss_m2mDrvIoctlSetPipeMflagParams(DssM2MDrv_VirtContext *context,
-                                  const Dss_DispPipeMflagParams *mFlagParams);
+                                  const Dss_PipeMflagParams *mFlagParams);
 
 int32_t Dss_m2mDrvIoctlSetPipeCsc(DssM2MDrv_VirtContext *context,
-                                  const CSL_DssCscCoeff *csc);
+                                  const Dss_PipeCscParams *csc);
 
 /* ========================================================================== */
 /*                            Global Variables                                */
@@ -251,105 +251,108 @@ int32_t Dss_m2mDrvPrgramDisp(DssM2MDrv_VirtContext *context)
 {
     int32_t retVal = FVID2_SOK;
     uint32_t copyCfg = (uint32_t) FALSE;
-    uint32_t layerNum;
+    uint32_t layerNum, pipeIdx;
     DssM2MDrv_InstObj *instObj;
     DssM2MDrv_DispPipeCfg *instCfg, *progCfg;
     CSL_DssOverlayPipePosCfg overlayPosCfg;
 
     instObj = context->instObj;
-    instCfg = &context->instCfg.pipeCfg;
-    progCfg = &instObj->progCfg.pipeCfg;
-    GT_assert(DssTrace, (NULL != instObj->pipeRegs));
-    GT_assert(DssTrace, (NULL != instObj->ovrRegs));
-
-    /* Re-program DSS pipe only if channel/instance configurations
-       are different than programmed */
-    if (FVID2_SOK == retVal)
+
+    for (pipeIdx = 0U ; pipeIdx < context->numPipe ; pipeIdx++)
     {
-        /* Check DSS Pipeline configuration */
-        if (((uint32_t) FALSE) == Dss_m2mDrvDispPipeCfgChk(&instCfg->cfgParams,
-                                                           &progCfg->cfgParams))
+        instCfg = &context->instCfg.pipeCfg[pipeIdx];
+        progCfg = &instObj->progCfg.pipeCfg[pipeIdx];
+        /* Re-program DSS pipe only if channel/instance configurations
+           are different than programmed */
+        if (FVID2_SOK == retVal)
         {
-            if (FVID2_SOK == retVal)
-            {
-                /* Program: DSS Pipeline */
-                retVal = CSL_dssVidPipeSetConfig(instObj->pipeRegs,
-                            (const CSL_DssVidPipeCfg *)(&instCfg->cfgParams.pipeCfg),
-                            (const CSL_DssVidPipeVC1Cfg *)(&instCfg->cfgParams.vc1Cfg));
-            }
-            if (FVID2_SOK == retVal)
+            /* Check DSS Pipeline configuration */
+            if (((uint32_t) FALSE) == Dss_m2mDrvDispPipeCfgChk(&instCfg->cfgParams,
+                                                               &progCfg->cfgParams))
             {
-                /* Program: DMA, Alpha, Crop, Layer configurations */
-                CSL_dssVidPipeSetDmaConfig(instObj->pipeRegs,
-                            (const CSL_DssVidPipeDmaCfg *)(&instCfg->cfgParams.dmaCfg));
-
-                CSL_dssVidPipeSetAlphaConfig(instObj->pipeRegs,
-                            (const CSL_DssVidPipeAlphaCfg *)(&instCfg->cfgParams.alphaCfg));
+                if (FVID2_SOK == retVal)
+                {
+                    /* Program: DSS Pipeline */
+                    retVal = CSL_dssVidPipeSetConfig(instObj->pipeRegs[context->pipeId[pipeIdx]],
+                                (const CSL_DssVidPipeCfg *)(&instCfg->cfgParams.pipeCfg),
+                                (const CSL_DssVidPipeVC1Cfg *)(&instCfg->cfgParams.vc1Cfg));
+                }
+                if (FVID2_SOK == retVal)
+                {
+                    /* Program: DMA, Alpha, Crop, Layer configurations */
+                    CSL_dssVidPipeSetDmaConfig(instObj->pipeRegs[context->pipeId[pipeIdx]],
+                                (const CSL_DssVidPipeDmaCfg *)(&instCfg->cfgParams.dmaCfg));
+
+                    CSL_dssVidPipeSetAlphaConfig(instObj->pipeRegs[context->pipeId[pipeIdx]],
+                                (const CSL_DssVidPipeAlphaCfg *)(&instCfg->cfgParams.alphaCfg));
 
 #if defined (SOC_J721E)
-                CSL_dssVidPipeSetCropConfig(instObj->pipeRegs,
-                        (const Fvid2_EdgeCropConfig *)(&instCfg->cfgParams.cropParams.cropCfg),
-                        instCfg->cfgParams.cropParams.cropEnable);
+                    CSL_dssVidPipeSetCropConfig(instObj->pipeRegs[context->pipeId[pipeIdx]],
+                            (const Fvid2_EdgeCropConfig *)(&instCfg->cfgParams.cropParams.cropCfg),
+                            instCfg->cfgParams.cropParams.cropEnable);
 #endif
-                layerNum = CSL_dssOverlayGetEnabledPipeLayerNum(instObj->ovrRegs,
-                                                                instObj->pipeId);
-                GT_assert(DssTrace, (layerNum < CSL_DSS_OVERLAY_LAYER_MAX));
-                overlayPosCfg.layerPos.startX = instCfg->cfgParams.layerPos.startX;
-                overlayPosCfg.layerPos.startY = instCfg->cfgParams.layerPos.startY;
-                CSL_dssOverlaySetPipePosConfig(instObj->ovrRegs,
-                            (const CSL_DssOverlayPipePosCfg *)(&overlayPosCfg),
-                            layerNum);
-            }
-            if (FVID2_SOK == retVal)
-            {
-                copyCfg = (uint32_t) TRUE;
+                    layerNum = CSL_dssOverlayGetEnabledPipeLayerNum(instObj->ovrRegs,
+                                                                    context->pipeId[pipeIdx]);
+                    GT_assert(DssTrace, (layerNum < CSL_DSS_OVERLAY_LAYER_MAX));
+                    overlayPosCfg.layerPos.startX = instCfg->cfgParams.layerPos.startX;
+                    overlayPosCfg.layerPos.startY = instCfg->cfgParams.layerPos.startY;
+                    CSL_dssOverlaySetPipePosConfig(instObj->ovrRegs,
+                                (const CSL_DssOverlayPipePosCfg *)(&overlayPosCfg),
+                                layerNum);
+                }
+                if (FVID2_SOK == retVal)
+                {
+                    copyCfg = (uint32_t) TRUE;
+                }
             }
         }
-    }
-    if (FVID2_SOK == retVal)
-    {
-        /* Check DSS Pipeline MFlag configuration */
-        if (((uint32_t) FALSE) == Dss_m2mDrvDispMFlagCfgChk(&instCfg->mFlagParams,
-                                                            &progCfg->mFlagParams))
+        if (FVID2_SOK == retVal)
         {
-            if (FVID2_SOK == retVal)
+            /* Check DSS Pipeline MFlag configuration */
+            if (((uint32_t) FALSE) == Dss_m2mDrvDispMFlagCfgChk(&instCfg->mFlagParams,
+                                                                &progCfg->mFlagParams))
             {
-                /* Program: DSS Pipeline MFlag */
-                CSL_dssVidPipeSetMflagConfig(instObj->pipeRegs,
-                    (const CSL_DssVidPipeMFlagCfg *)(&instCfg->mFlagParams.mflagCfg));
-                copyCfg = (uint32_t) TRUE;
+                if (FVID2_SOK == retVal)
+                {
+                    /* Program: DSS Pipeline MFlag */
+                    CSL_dssVidPipeSetMflagConfig(instObj->pipeRegs[context->pipeId[pipeIdx]],
+                        (const CSL_DssVidPipeMFlagCfg *)(&instCfg->mFlagParams.mflagCfg));
+                    copyCfg = (uint32_t) TRUE;
+                }
             }
         }
-    }
-    if (FVID2_SOK == retVal)
-    {
-        /* Check DSS Pipeline Csc configuration */
-        if (((uint32_t) FALSE) == Dss_m2mDrvDispCscCfgChk(&instCfg->cscCoeff,
-                                                          &progCfg->cscCoeff))
+        if (FVID2_SOK == retVal)
         {
-            if (FVID2_SOK == retVal)
+            /* Check DSS Pipeline Csc configuration */
+            if (((uint32_t) FALSE) == Dss_m2mDrvDispCscCfgChk(&instCfg->cscCoeff,
+                                                              &progCfg->cscCoeff))
             {
-                /* Program: DSS Pipeline Csc */
-               CSL_dssVidPipeSetCSCCoeff(instObj->pipeRegs,
-                        (const CSL_DssCscCoeff *)(&instCfg->cscCoeff));
-                copyCfg = (uint32_t) TRUE;
+                if (FVID2_SOK == retVal)
+                {
+                    /* Program: DSS Pipeline Csc */
+                   CSL_dssVidPipeSetCSCCoeff(instObj->pipeRegs[context->pipeId[pipeIdx]],
+                            (const CSL_DssCscCoeff *)(&instCfg->cscCoeff));
+                    copyCfg = (uint32_t) TRUE;
+                }
             }
         }
-    }
-    if ((FVID2_SOK == retVal) && (((uint32_t) TRUE) == copyCfg))
-    {
-        /* Update instance configurations */
-        Fvid2Utils_memcpy(&progCfg, &instCfg, sizeof(DssM2MDrv_DispPipeCfg));
+        if ((FVID2_SOK == retVal) && (((uint32_t) TRUE) == copyCfg))
+        {
+            /* Update instance configurations */
+            Fvid2Utils_memcpy(&progCfg, &instCfg, sizeof(DssM2MDrv_DispPipeCfg));
+        }
     }
 
     return retVal;
 }
 
 static int32_t Dss_m2mDrvValidateDispParams(DssM2MDrv_InstObj *instObj,
-                                            const Dss_DispParams *dispParams)
+                                            const Dss_PipeCfgParams *pipeCfg)
 {
     int32_t retVal = FVID2_SOK;
+    const Dss_DispParams *dispParams;
 
+    dispParams = &pipeCfg->cfgParams;
     /* Not Checked: Interlaced to progressive or vice versa, not supported in M2M */
     /* Scaling ratio check */
     if(((dispParams->pipeCfg.inFmt.height * 16U) <
@@ -376,7 +379,7 @@ static int32_t Dss_m2mDrvValidateDispParams(DssM2MDrv_InstObj *instObj,
     if((dispParams->pipeCfg.inFmt.height != dispParams->pipeCfg.outHeight) ||
        (dispParams->pipeCfg.inFmt.width != dispParams->pipeCfg.outWidth))
     {
-        if(TRUE == Dss_dispIsVidLInst(instObj->pipeId))
+        if(TRUE == Dss_dispIsVidLInst(pipeCfg->pipeId))
         {
             GT_0trace(DssTrace,
                       GT_ERR,
@@ -424,7 +427,7 @@ static int32_t Dss_m2mDrvValidateDispParams(DssM2MDrv_InstObj *instObj,
 }
 
 int32_t Dss_m2mDrvIoctlSetDssPipeParams(DssM2MDrv_VirtContext *context,
-                                        const Dss_DispParams *pipeCfg)
+                                        const Dss_PipeCfgParams *pipeCfg)
 {
     int32_t retVal = FVID2_SOK;
 
@@ -433,6 +436,10 @@ int32_t Dss_m2mDrvIoctlSetDssPipeParams(DssM2MDrv_VirtContext *context,
     {
         retVal = FVID2_EBADARGS;
     }
+    else if (pipeCfg->pipeId >= CSL_DSS_VID_PIPE_ID_MAX)
+    {
+        retVal = FVID2_EBADARGS;
+    }
     else
     {
         retVal = Dss_m2mDrvValidateDispParams(context->instObj, pipeCfg);
@@ -440,8 +447,8 @@ int32_t Dss_m2mDrvIoctlSetDssPipeParams(DssM2MDrv_VirtContext *context,
         {
             /* upgrade configurations into context object and re-program HW module
                on buffer submission */
-            Fvid2Utils_memcpy(&context->instCfg.pipeCfg.cfgParams,
-                              pipeCfg,
+            Fvid2Utils_memcpy(&context->instCfg.pipeCfg[pipeCfg->pipeId].cfgParams,
+                              &pipeCfg->cfgParams,
                               sizeof(Dss_DispParams));
         }
     }
@@ -450,7 +457,7 @@ int32_t Dss_m2mDrvIoctlSetDssPipeParams(DssM2MDrv_VirtContext *context,
 }
 
 int32_t Dss_m2mDrvIoctlSetPipeMflagParams(DssM2MDrv_VirtContext *context,
-                                  const Dss_DispPipeMflagParams *mFlagParams)
+                                  const Dss_PipeMflagParams *mFlagParams)
 {
     int32_t retVal = FVID2_SOK;
 
@@ -459,12 +466,16 @@ int32_t Dss_m2mDrvIoctlSetPipeMflagParams(DssM2MDrv_VirtContext *context,
     {
         retVal = FVID2_EBADARGS;
     }
+    else if (mFlagParams->pipeId >= CSL_DSS_VID_PIPE_ID_MAX)
+    {
+        retVal = FVID2_EBADARGS;
+    }
     else
     {
         /* upgrade configurations into context object and re-program HW module
            on buffer submission */
-        Fvid2Utils_memcpy(&context->instCfg.pipeCfg.mFlagParams,
-                          mFlagParams,
+        Fvid2Utils_memcpy(&context->instCfg.pipeCfg[mFlagParams->pipeId].mFlagParams,
+                          &mFlagParams->mFlagCfg,
                           sizeof(Dss_DispPipeMflagParams));
     }
 
@@ -472,7 +483,7 @@ int32_t Dss_m2mDrvIoctlSetPipeMflagParams(DssM2MDrv_VirtContext *context,
 }
 
 int32_t Dss_m2mDrvIoctlSetPipeCsc(DssM2MDrv_VirtContext *context,
-                                  const CSL_DssCscCoeff *csc)
+                                  const Dss_PipeCscParams *csc)
 {
     int32_t retVal = FVID2_SOK;
 
@@ -481,12 +492,16 @@ int32_t Dss_m2mDrvIoctlSetPipeCsc(DssM2MDrv_VirtContext *context,
     {
         retVal = FVID2_EBADARGS;
     }
+    else if (csc->pipeId >= CSL_DSS_VID_PIPE_ID_MAX)
+    {
+        retVal = FVID2_EBADARGS;
+    }
     else
     {
         /* upgrade configurations into context object and re-program HW module
            on buffer submission */
-        Fvid2Utils_memcpy(&context->instCfg.pipeCfg.cscCoeff,
-                          csc,
+        Fvid2Utils_memcpy(&context->instCfg.pipeCfg[csc->pipeId].cscCoeff,
+                          &csc->csc,
                           sizeof(CSL_DssCscCoeff));
     }
 
index b71499d7d86033013c4843fa456a6f4cf9806d57..348e610faf7beef91a238e0c95137a946b8651b7 100755 (executable)
@@ -182,7 +182,7 @@ struct DssM2MDrv_WbPipeCfg_t
  */
 struct DssM2MDrv_moduleCfg_t
 {
-    DssM2MDrv_DispPipeCfg pipeCfg;
+    DssM2MDrv_DispPipeCfg pipeCfg[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
     /**< Display pipeline configuration parameters */
     DssM2MDrv_dctrlCfg dctrlCfg;
     /**< Display controller configuration parameters  */
@@ -223,7 +223,9 @@ struct DssM2MDrv_VirtContext_t
     /**< Linked List object for doneQ */
     uint32_t numBufQed;
     /**< Number of buffers Queued to HW */
-    uint32_t pipeId;
+    uint32_t numPipe;
+    /**< Number of Display pipe-lines used for given M2M/WB pipeline. */
+    uint32_t pipeId[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
     /**< ID DSS pipeline to use.
      *   See \ref CSL_DssVidPipeId for details */
     uint32_t overlayId;
@@ -243,7 +245,9 @@ struct DssM2M_DrvQueObj_t
     /**< FVID2 Utils queue element used in node addition */
     DssM2MDrv_VirtContext *virtContext;
     /**< Reference to the instance object for this queue object */
-    Fvid2_Frame *inFrm;
+    uint32_t numPipe;
+    /**< Number of DSS pipes used. This will be also equal to number of frames in inFrm */
+    Fvid2_Frame *inFrm[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
     /**< #FVID2_frame to read the incoming frame packets from memory */
     Fvid2_Frame *outFrm;
     /**< #FVID2_frame to store the outgoing frame packets to memory */
@@ -301,7 +305,7 @@ struct DssM2MDrv_InstObj_t
       *  See \ref DssM2MDrv_moduleCfg for details */
     CSL_dss_commRegs *commRegs;
     /**< Write-back Pipe registers */
-    CSL_dss_pipeRegs *pipeRegs;
+    CSL_dss_pipeRegs *pipeRegs[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
     /**< Write-back Pipe registers */
     CSL_dss_overlayRegs *ovrRegs;
     /**< Write-back Pipe registers */
@@ -309,7 +313,9 @@ struct DssM2MDrv_InstObj_t
     /**< Write-back Pipe registers */
     DssM2M_DrvBufManObj bmObj;
     /**< Buffer management object */
-    uint32_t pipeId;
+    uint32_t numPipe;
+    /**< Number of Display pipe-lines used for given M2M/WB pipeline. */
+    uint32_t pipeId[DSSM2M_NUM_PIPELINE_TO_USE_IN_M2M_MODE];
     /**< ID of DSS pipeline used. */
     uint32_t overlayId;
     /**< ID of DSS overlay used. */
@@ -353,13 +359,13 @@ struct DssM2MDrv_CommonObj_t
 /*                          Function Declarations                             */
 /* ========================================================================== */
 int32_t Dss_m2mDrvIoctlSetDssPipeParams(DssM2MDrv_VirtContext *context,
-                                               const Dss_DispParams *pipeCfg);
+                                        const Dss_PipeCfgParams *pipeCfg);
 
 int32_t Dss_m2mDrvIoctlSetPipeMflagParams(DssM2MDrv_VirtContext *context,
-                                  const Dss_DispPipeMflagParams *mFlagParams);
+                                  const Dss_PipeMflagParams *mFlagParams);
 
 int32_t Dss_m2mDrvIoctlSetPipeCsc(DssM2MDrv_VirtContext *context,
-                                         const CSL_DssCscCoeff *csc);
+                                  const Dss_PipeCscParams *csc);
 
 int32_t Dss_m2mDrvIoctlSetOverlayParams(DssM2MDrv_VirtContext *context,
                                     const Dss_DctrlOverlayParams *ovlParams);
@@ -395,7 +401,8 @@ uint32_t Dss_m2mDrvDispCscCfgChk(const CSL_DssCscCoeff *instCfg,
 
 int32_t Dss_m2mDrvPrgramDisp(DssM2MDrv_VirtContext *context);
 
-
+int32_t Dss_m2mDrvSetWbPipeDmaCfg(DssM2MDrv_InstObj *instObj,
+                                  const CSL_DssWbPipeDmaCfg *dmaCfg);
 /* ========================================================================== */
 /*                       Static Function Definitions                          */
 /* ========================================================================== */