This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS: Vision SDK - Switching between pipelines VID1 & GFX1

Tool/software: TI-RTOS

Hi all,

We are using Dra7xx Customized board & Vision SDK 3 dot 1.

We  plan to use camera   in  VID1 pipeline and Graphics in  GFX pipeline.

How to switch between two pipelines from the application in VisionSDK ?

usecase:

Capture -> Display_Video

 DefLink_dispDist (A15) -> Display_Gfx

Regards,

Gokul

  • Hi Gokul,

    what do you mean by switching pipelines?

    You could change the channel numbers in each display link and switch the channels. Is that what you are looking for?

    Rgds,

    Brijesh

  • Hi Brijesh,


    Currently we plan to go with M4- as display-server & no display-sharing with a15 .
    Consider pipeline VID1 is used for camera & GFXx is used for HMI from A15 core.


    When camera signal is activated, we like to show camera data on display and once camera is de-activated we should get HMI data in the display.

    1 .How to handle the above case ?


    UseCase: weston_m4camera

    Capture -> Display_Video

    DefLink_dispDist (A15) -> Display_Gfx


    ovlyPrms->deltaLinesPerPanel = 0;
    ovlyPrms->alphaBlenderEnable = 0;
    ovlyPrms->backGroundColor = 0x10;
    ovlyPrms->colorKeyEnable = 1;
    ovlyPrms->colorKeySel = SYSTEM_DSS_DISPC_TRANS_COLOR_KEY_SRC;
    ovlyPrms->ovlyOptimization = SYSTEM_DSS_DISPC_OVLY_FETCH_ALLDATA;
    ovlyPrms->transColorKey = DRAW2D_TRANSPARENT_COLOR;

    /* Setting overlay pipe parameters */

    pipeOvlyPrms[0].pipeLine = SYSTEM_DSS_DISPC_PIPE_VID1;
    pipeOvlyPrms[0].globalAlpha = 0xFF;
    pipeOvlyPrms[0].preMultiplyAlpha = 0;
    pipeOvlyPrms[0].zorderEnable = TRUE;
    pipeOvlyPrms[0].zorder = SYSTEM_DSS_DISPC_ZORDER0;
    // pipeOvlyPrms[0].zorder = SYSTEM_DSS_DISPC_ZORDER3;

    pipeOvlyPrms[1].pipeLine = SYSTEM_DSS_DISPC_PIPE_VID2;
    pipeOvlyPrms[1].globalAlpha = 0xFF;
    pipeOvlyPrms[1].preMultiplyAlpha = 0;
    pipeOvlyPrms[1].zorderEnable = TRUE;
    pipeOvlyPrms[1].zorder = SYSTEM_DSS_DISPC_ZORDER1;

    pipeOvlyPrms[2].pipeLine = SYSTEM_DSS_DISPC_PIPE_VID3;
    pipeOvlyPrms[2].globalAlpha = 0xFF;
    pipeOvlyPrms[2].preMultiplyAlpha = 0;
    pipeOvlyPrms[2].zorderEnable = TRUE;
    pipeOvlyPrms[2].zorder = SYSTEM_DSS_DISPC_ZORDER2;

    pipeOvlyPrms[3].pipeLine = SYSTEM_DSS_DISPC_PIPE_GFX1;
    pipeOvlyPrms[3].globalAlpha = 0xff;
    pipeOvlyPrms[3].preMultiplyAlpha = 0;
    pipeOvlyPrms[3].zorderEnable = TRUE;
    pipeOvlyPrms[3].zorder = SYSTEM_DSS_DISPC_ZORDER3;


    2. With the global-alpha value equal to 0xff, only GFX -weston screen is visible. ( pipeOvlyPrms[3].globalAlpha = 0xff;)
    But if set to 127 both camera data & gfx is visible and if set to zero only camera is visible.


    Is is possible to configure this value at runtime ?


    Thanks & Regards,
    Gokul

  • Hi Gokul,

    You are on the right track. You could use alpha blending to make video pipeline transparent and opaque. Yes, you could change this parameter runtime and make video transparent or opaque.

    Regards,
    Brijesh
  • Hi Brijesh,

    We are trying to add few cases in my UC (usecases) for alpha-blending. We are trying to access DSS register & modify it.

    We are getting error as below.The file is present inside hlos.

    ../apps/src/hlos/adas/src/usecases/weston_m4camera/chains_m4camera_weston.c

    Please find my file in the attaachment.


    ****** Segmentation fault caught ....
    Faulty address is 0x58001074, called from 0xb6bbc6cf
    Totally Obtained 0 stack frames. signal number =11
    Signal number = 11, Signal errno = 0
    SI code = 1 (Address not mapped to object)
    Fault addr = 0x58001074
    [bt] Execution path:

    /******************************************************************************
    Copyright (c) [2012 - 2017] Texas Instruments Incorporated
    
    All rights reserved not granted herein.
    
    Limited License.
    
     Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
     license under copyrights and patents it now or hereafter owns or controls to
     make,  have made, use, import, offer to sell and sell ("Utilize") this software
     subject to the terms herein.  With respect to the foregoing patent license,
     such license is granted  solely to the extent that any such patent is necessary
     to Utilize the software alone.  The patent license shall not apply to any
     combinations which include this software, other than combinations with devices
     manufactured by or for TI ("TI Devices").  No hardware patent is licensed
     hereunder.
    
     Redistributions must preserve existing copyright notices and reproduce this
     license (including the above copyright notice and the disclaimer and
     (if applicable) source code license limitations below) in the documentation
     and/or other materials provided with the distribution
    
     Redistribution and use in binary form, without modification, are permitted
     provided that the following conditions are met:
    
     * No reverse engineering, decompilation, or disassembly of this software
       is permitted with respect to any software provided in binary form.
    
     * Any redistribution and use are licensed by TI for use only with TI Devices.
    
     * Nothing shall obligate TI to provide you with source code for the software
       licensed and provided to you in object code.
    
     If software source code is provided to you, modification and redistribution of
     the source code are permitted provided that the following conditions are met:
    
     * Any redistribution and use of the source code, including any resulting
       derivative works, are licensed by TI for use only with TI Devices.
    
     * Any redistribution and use of any object code compiled from the source code
       and any resulting derivative works, are licensed by TI for use only with TI
       Devices.
    
     Neither the name of Texas Instruments Incorporated nor the names of its
     suppliers may be used to endorse or promote products derived from this software
     without specific prior written permission.
    
     DISCLAIMER.
    
     THIS SOFTWARE IS PROVIDED BY TI AND TI�S LICENSORS "AS IS" AND ANY EXPRESS OR
     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     IN NO EVENT SHALL TI AND TI�S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    ******************************************************************************/
    
    /*******************************************************************************
     *  INCLUDE FILES
     *******************************************************************************
     */
    #include "weston_m4camera_priv.h"
    #include <src/hlos/adas/include/chains.h>
    #include <src/hlos/common/chains_common.h>
    #include <src/hlos/system/system_gbm_allocator.h>
    #include <src/include/chains_common_surround_view.h>
    #include <system_cfg.h>
    
    
    
    #include <stdio.h>
    #include <stdlib.h>
    
    
    #define CAPTURE_SENSOR_WIDTH      (1280)
    #define CAPTURE_SENSOR_HEIGHT     (720)
    #define LCD_DISPLAY_WIDTH         (800)
    #define LCD_DISPLAY_HEIGHT        (480)
    
    #define MAX_NUMBER_OF_CHANNELS    (1)
    #define ENCDEC_MAX_FRAME_WIDTH    (1280)
    #define ENCDEC_MAX_FRAME_HEIGHT   (720)
    //#define DECODE_DISPLAY_WIDTH      (640)
    //#define DECODE_DISPLAY_HEIGHT     (360)
    #define DECODE_DISPLAY_WIDTH      (800)
    #define DECODE_DISPLAY_HEIGHT     (480)
    #define DECODE_DISPLAY_STARTX     (0)
    #define DECODE_DISPLAY_STARTY     (0)
    #define WESTON_DISPLAY_WIDTH      (800)
    #define WESTON_DISPLAY_HEIGHT     (480)
    #define WESTON_DISPLAY_STARTX     (0)
    #define WESTON_DISPLAY_STARTY     (0)
    
    /**
     *******************************************************************************
     *
     *  \brief  Use-case object
     *
     *        This structure contains all the LinksId's and create Params.
     *        The same is passed to all create, start, stop functions.
     *
     *******************************************************************************
    */
    typedef struct {
    
        weston_m4cameraObj ucObj;
    	VideoSensorCreateAndStartAppPrm  vidSensorPrm;
    
        /**< Link Id's and device IDs to use for this use-case */
        UInt32  appCtrlLinkId;
    
       UInt32  captureOutWidth;
        UInt32  captureOutHeight;
    
        UInt32  displayWidth;
        UInt32  displayHeight;
    
        Chains_Ctrl *chainsCfg;
    
        UInt32 codecType;
    } Chains_NullSrcDisplayAppObj;
    
    /**
     *******************************************************************************
     *
     * \brief   Set link Parameters
     *
     *          It is called in Create function of the auto generated use-case file.
     *
     * \param pUcObj    [IN] Auto-generated usecase object
     * \param appObj    [IN] Application specific object
     *
     *******************************************************************************
    */
    Void weston_m4camera_SetAppPrms(weston_m4cameraObj *pUcObj, Void *appObj)
    {
    	 UInt32 displayWidth, displayHeight;
    
       // DisplayLink_CreateParams *pPrm_Video;
        DisplayLink_CreateParams *pPrm_Weston;
        DispDistSrcLink_CreateParams *pPrm;
        Chains_NullSrcDisplayAppObj *pObj
            = (Chains_NullSrcDisplayAppObj*)appObj;
    
        ChainsCommon_GetDisplayWidthHeight(
            pObj->chainsCfg->displayType,
            &pObj->displayWidth,
            &pObj->displayHeight
            );
    	
    	 ChainsCommon_GetDisplayWidthHeight(
            pObj->chainsCfg->displayType,
            &displayWidth,
            &displayHeight
            );
    	
     pObj->captureOutWidth  = CAPTURE_SENSOR_WIDTH;
        pObj->captureOutHeight = CAPTURE_SENSOR_HEIGHT;
    
    
       ChainsCommon_SingleCam_SetCapturePrms(&(pUcObj->CapturePrm),
                CAPTURE_SENSOR_WIDTH,
                CAPTURE_SENSOR_HEIGHT,
                pObj->captureOutWidth,
                pObj->captureOutHeight,
                pObj->chainsCfg->captureSrc
                );
    
    #if 0	
    	ChainsCommon_SetGrpxSrcPrms(&pUcObj->GrpxSrcPrm,
                                    displayWidth,
                                    displayHeight
                                    );	
    		
    	pUcObj->Display_GrpxPrm.rtParams.tarWidth       = displayWidth;
        pUcObj->Display_GrpxPrm.rtParams.tarHeight      = displayHeight;
        pUcObj->Display_GrpxPrm.rtParams.posX           = 0;
        pUcObj->Display_GrpxPrm.rtParams.posY           = 0;
        pUcObj->Display_GrpxPrm.displayId               = DISPLAY_LINK_INST_DSS_GFX1;
    		
    #endif
    
    	ChainsCommon_SetDisplayPrms(&pUcObj->Display_VideoPrm,
                                    NULL,
                                    pObj->chainsCfg->displayType,
                                    displayWidth,
                                    displayHeight
                                   );
    							   
        pPrm = &pUcObj->DispDistSrcPrm;
    
        sprintf((char *)(&pPrm->exportedName[0]), "gfx");
        pPrm->exportedWidth = WESTON_DISPLAY_WIDTH;
        pPrm->exportedHeight = WESTON_DISPLAY_HEIGHT;
        pPrm->exportedFramesPerSecond = 60;
    
        pPrm->numExportedDataFormats = 1;
        pPrm->exportedDataFormats[0] = SYSTEM_DF_ARGB32_8888;
    
      
        pPrm_Weston = &pUcObj->Display_GfxPrm;
        pPrm_Weston->rtParams.tarWidth       = WESTON_DISPLAY_WIDTH;
        pPrm_Weston->rtParams.tarHeight      = WESTON_DISPLAY_HEIGHT;
        pPrm_Weston->rtParams.posX           = WESTON_DISPLAY_STARTX;
        pPrm_Weston->rtParams.posY           = WESTON_DISPLAY_STARTY;
        pPrm_Weston->displayId               = DISPLAY_LINK_INST_DSS_GFX1;
    
        ChainsCommon_StartDisplayCtrl(
            pObj->chainsCfg->displayType,
            pObj->displayWidth,
            pObj->displayHeight
            );
    }
    
    /**
     *******************************************************************************
     *
     * \brief   Start the capture display Links
     *
     *          Function sends a control command to capture and display link to
     *          to Start all the required links . Links are started in reverce
     *          order as information of next link is required to connect.
     *          System_linkStart is called with LinkId to start the links.
     *
     * \param   pObj  [IN] Chains_VipSingleCameraViewObj
     *
     * \return  SYSTEM_LINK_STATUS_SOK on success
     *
     *******************************************************************************
    */
    Void weston_m4camera_StartApp(Chains_NullSrcDisplayAppObj *pObj)
    {
        ChainsCommon_statCollectorReset();
        ChainsCommon_memPrintHeapStatus();
    	
    	 //pObj->vidSensorPrm.captureSrcId = CHAINS_CAPTURE_SRC_OV10635;
        pObj->vidSensorPrm.captureSrcId = CHAINS_CAPTURE_SRC_VIDDEC_ADV7182 ;
        pObj->vidSensorPrm.isLVDSCaptMode = FALSE;
        pObj->vidSensorPrm.numLvdsCh = 0;
    
        System_linkControl(SYSTEM_LINK_ID_APP_CTRL,
                                    APP_CTRL_LINK_CMD_VIDEO_SENSOR_CREATE_AND_START,
                                    &pObj->vidSensorPrm,
                                    sizeof(VideoSensorCreateAndStartAppPrm),
                                    TRUE);
    	OSA_waitMsecs(1000);
     Vps_printf("\n APP_CTRL_LINK_CMD_VIDEO_SENSOR_CREATE_AND_START done \n" );
    
        weston_m4camera_Start(&pObj->ucObj);
    
        ChainsCommon_prfLoadCalcEnable(TRUE, FALSE, FALSE);
    }
    
    /**
     *******************************************************************************
     *
     * \brief   Delete the capture display Links
     *
     *          Function sends a control command to capture and display link to
     *          to delete all the prior created links
     *          System_linkDelete is called with LinkId to delete the links.
     *
     * \param   pObj   [IN]   Chains_VipSingleCameraViewObj
     *
     *******************************************************************************
    */
    Void weston_m4camera_StopAndDeleteApp(Chains_NullSrcDisplayAppObj *pObj)
    {
        weston_m4camera_Stop(&pObj->ucObj);
        weston_m4camera_Delete(&pObj->ucObj);
    
        ChainsCommon_StopDisplayCtrl();
    	
    	  System_linkControl(SYSTEM_LINK_ID_APP_CTRL,
                            APP_CTRL_LINK_CMD_VIDEO_SENSOR_STOP_AND_DELETE,
                            &pObj->vidSensorPrm,
                            sizeof(VideoSensorCreateAndStartAppPrm),
                            TRUE);
    
        /* Print the HWI, SWI and all tasks load */
        /* Reset the accumulated timer ticks */
        ChainsCommon_prfLoadCalcEnable(FALSE, TRUE, TRUE);
    }
    
    /**
     *******************************************************************************
     * \brief Run Time Menu string for codec Type Selection.
     *******************************************************************************
     */
    #if 0
    char chains_nullSrc_Display_codecTypeSelect[] = {
        "\r\n "
        "\r\n ========================================="
        "\r\n Chains Run-time Codec Type Selection Menu"
        "\r\n ========================================="
        "\r\n "
        "\r\n Enter '0' for MJPEG "
        "\r\n "
        "\r\n Enter '1' for H.264 "
        "\r\n "
        "\r\n Enter Choice: "
        "\r\n "
    };
    #endif
    /**
     *******************************************************************************
     *
     * \brief   Single Channel Capture Display usecase function
     *`
     *          This functions executes the create, start functions
     *
     *          Further in a while loop displays run time menu and waits
     *          for user inputs to print the statistics or to end the demo.
     *
     *          Once the user inputs end of demo stop and delete
     *          functions are executed.
     *
     * \param   chainsCfg       [IN]   Chains_Ctrl
     *
     *******************************************************************************
    */
    Void chains_m4camera_weston(Chains_Ctrl *chainsCfg)
    {
        char ch = 'a';
    	    volatile UInt32 temp;
        UInt32 done = FALSE;
        Chains_NullSrcDisplayAppObj chainsObj;
    
        chainsObj.chainsCfg = chainsCfg;
    #if 0
    {
        while(!done)
        {
            Vps_printf(chains_nullSrc_Display_codecTypeSelect);
            chainsObj.codecType = Chains_readChar();
    
            switch(chainsObj.codecType)
            {
                case '0':
                    done = TRUE;
                    break;
                case '1':
                    done = TRUE;
                    break;
                default:
                    Vps_printf("\nUnsupported option '%c'. Please try again\n",
                               chainsObj.codecType);
                    break;
            }
        }
    }
    #endif
        weston_m4camera_Create(&chainsObj.ucObj, &chainsObj);
    
        weston_m4camera_StartApp(&chainsObj);
    
        done = FALSE;
        while(!done)
        {
            ch = '1';
            ch = Chains_menuRunTime();
            switch(ch)
            {
                case '0':
                    done = TRUE;
                    break;
    
                case 'p':
                case 'P':
                    ChainsCommon_PrintStatistics();
                    weston_m4camera_printStatistics(&chainsObj.ucObj);
                    break;
    	   case 'h':
    	   case 'H':	
    
            temp = *((volatile UInt32 *) 0x58001074);
    	printf("DISPC_GLOBAL_ALPHA reg value is %x \n ",temp);
            *((volatile UInt32 *) 0x58001074) = temp & (UInt32) 0xFFFFFF00;
            temp = *((volatile UInt32 *) 0x58001074);
    	printf("Affet set DISPC_GLOBAL_ALPHA reg value is %x \n ",temp);
    	 break;	
                default:
                    Vps_printf("\nUnsupported option '%c'. Please try again\n", ch);
                    break;
            }
        }
    
        weston_m4camera_StopAndDeleteApp(&chainsObj);
    }
    
    

    while(!done)
    {
    ch = '1';
    ch = Chains_menuRunTime();
    switch(ch)
    {
    case '0':
    done = TRUE;
    break;

    case 'p':
    case 'P':
    ChainsCommon_PrintStatistics();
    weston_m4camera_printStatistics(&chainsObj.ucObj);
    break;
    case 'h':
    case 'H':

    temp = *((volatile UInt32 *) 0x58001074);
    printf("DISPC_GLOBAL_ALPHA reg value is %x \n ",temp);
    *((volatile UInt32 *) 0x58001074) = temp & (UInt32) 0xFFFFFF00;
    temp = *((volatile UInt32 *) 0x58001074);
    printf("Affet set DISPC_GLOBAL_ALPHA reg value is %x \n ",temp);
    // *((volatile UInt32 *) 0x4805D194) = (UInt32) 0x00002000;
    break;
    default:
    Vps_printf("\nUnsupported option '%c'. Please try again\n", ch);
    break;
    }

    Regards,

    Gokul

  • Hi Gokul,

    It looks like you are trying to access DSS register directly from Linux. This must not be done as this address is not accessible directly from userspace. it should be mapped and then can be accessed. The otherway is, you could use driver API to update alpha value.

    Regards,
    Brijesh
  • Yes Brijesh. Its my mistake, As i were thinking inside the sys-bios & did wrongly.

    Is better to modify DSS registers from the linux or can we send commands to M4 via System_linkControl API ?

    Regards,
    Gokul
  • Gokul,

    It depends on where you are controlling DSS from. If DSS is being configured and controlled from M4, then better to send command to M4 and then configure it. If it is controlled and configured by A15 running Linux then you could use Linux framework to update Alpha value.

    Rgds,
    Brijesh