Exemplo n.º 1
0
/*****************************************************************************
description: 	this sample shows how to use TDE interface to draw graphic.
                
note	   :    for showing graphic layer, VO device should be enabled first.
				This sample draws graphic on layer G0 which belongs to HD VO device.
				(here we insmod HiFB.ko like 'insmod hifb.ko video="hifb:vram0_size=XXX" '
				 so opening hifb sub-device '/dev/fb0' means to opening G0,
				 and G0 was fixed binded to HD VO device in Hi3531)
*****************************************************************************/
int main()
{
	HI_S32 s32Ret = 0;
	VO_PUB_ATTR_S stPubAttr;
	VB_CONF_S stVbConf;

	stPubAttr.u32BgColor = 0x000000ff;
	stPubAttr.enIntfType = VO_INTF_BT1120;
    stPubAttr.enIntfSync = VO_OUTPUT_720P50;
	stPubAttr.bDoubleFrame = HI_FALSE;

	memset(&stVbConf, 0, sizeof(VB_CONF_S));
    stVbConf.u32MaxPoolCnt             = 16;
	stVbConf.astCommPool[0].u32BlkSize = 1280*720*2;
	stVbConf.astCommPool[0].u32BlkCnt  = 8;	
	
    /*1 enable Vo device HD first*/
	if(HI_SUCCESS != SAMPLE_COMM_SYS_Init(&stVbConf))
	{
		return -1;
	}
	if(HI_SUCCESS != SAMPLE_COMM_VO_StartDevLayer(VoDev, &stPubAttr, 25))
	{
		SAMPLE_COMM_SYS_Exit();
		return -1;
	}
	
	/*2 run tde sample which draw grahpic on HiFB memory*/
	s32Ret = TDE_DrawGraphicSample();
	if(s32Ret != HI_SUCCESS)
	{
		goto err;
	}

	err:
	SAMPLE_COMM_VO_StopDevLayer(VoDev);
	SAMPLE_COMM_SYS_Exit();

	return 0;
}		
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
	HI_S32 s32Ret = 0;
	VO_PUB_ATTR_S stPubAttr;
	VB_CONF_S stVbConf = {0};
    HI_U32 u32FrmRate;
	SAMPLE_VO_MODE_E stVoMode = VO_MODE_1MUX;
	stPubAttr.u32BgColor = 0x000000ff;
	stPubAttr.enIntfType = VO_INTF_CVBS;
    stPubAttr.enIntfSync = VO_OUTPUT_PAL;
	stPubAttr.bDoubleFrame = HI_FALSE;
    u32FrmRate = 25;

    if (argc < 2)
    {
        printf("Usage : %s  <intf>\n", argv[0]);
        printf("intf : \n");
        printf("\t0) CVBS(PAL).  Default\n");
        printf("\t1) BT1120(720P50).\n");        
    }
    else
    {
        if(*argv[1] == '1')
        {
			stPubAttr.enIntfType = VO_INTF_BT1120;
            stPubAttr.enIntfSync = VO_OUTPUT_720P50;
            u32FrmRate = 50;
        }
    }

    if(VO_INTF_CVBS == stPubAttr.enIntfType)
    {
        printf("now is cvbs output.\n");
    }
    else
    {
        printf("now is bt1120 output.\n");
    }

	stVbConf.u32MaxPoolCnt = 16;
	/*no need common video buffer!*/
	
    /*1 enable Vo device first*/
	if(HI_SUCCESS != SAMPLE_COMM_SYS_Init(&stVbConf))
	{
		return -1;
	}    

    s32Ret = SAMPLE_COMM_VO_StartDevLayer(VoDev, &stPubAttr, u32FrmRate);
	if(HI_SUCCESS != s32Ret)
	{
		SAMPLE_COMM_SYS_Exit();
		return -1;
	}

	if (HI_SUCCESS != SAMPLE_COMM_VO_StartChn(SAMPLE_VO_DEV_DSD0, &stPubAttr, stVoMode))
	{
		SAMPLE_COMM_SYS_Exit();
		return -1;
	}

	/*2 run tde sample which draw grahpic on HiFB memory*/
	s32Ret = TDE_DrawGraphicSample();
	if(s32Ret != HI_SUCCESS)
	{
		goto err;
	}

err:
    SAMPLE_COMM_VO_StopChn(SAMPLE_VO_DEV_DSD0, stVoMode);  
    SAMPLE_COMM_VO_StopDevLayer(SAMPLE_VO_DEV_DSD0);
    SAMPLE_COMM_SYS_Exit();

	return 0;
}		
Exemplo n.º 3
0
/*****************************************************************************
description: 	this sample shows how to use TDE interface to draw graphic.
                
note	   :    for showing graphic layer, VO device should be enabled first.
				This sample draws graphic on layer G0 which belongs to HD VO device.
				(here we insmod HiFB.ko like 'insmod hifb.ko video="hifb:vram0_size=XXX" '
				 so opening hifb sub-device '/dev/fb0' means to opening G0,
				 and G0 was fixed binded to HD VO device in Hi3520)
*****************************************************************************/
int main(int argc, char *argv[])
{
    HI_S32 s32Ret = 0;
    VO_PUB_ATTR_S stPubAttr;
    VB_CONF_S stVbConf;
    VO_CSC_S stCSC;

    if ( (argc < 2) || (1 != strlen(argv[1])))
    {
        SAMPLE_TDE_Usage(argv[0]);
        return HI_FAILURE;
    }

    stPubAttr.u32BgColor = 0x000000ff;
    stPubAttr.enIntfType = VO_INTF_BT656;
    stPubAttr.enIntfSync = VO_OUTPUT_PAL;

    if ((argc > 1) && *argv[1] == '1')  /* '0': VO_INTF_BT656, else: LCD */
    {
        stPubAttr.enIntfType = INTF_LCD;
        stPubAttr.enIntfSync = SYNC_LCD;

        stCSC.enCscMatrix = VO_CSC_MATRIX_BT709_TO_RGB_PC;
        stCSC.u32Contrast = 50;
        stCSC.u32Hue = 50;
        stCSC.u32Luma = 50;
        stCSC.u32Satuature = 50;
        HI_MPI_VO_SetVideoLayerCSC(0, &stCSC);
    }

    memset(&stVbConf, 0, sizeof(VB_CONF_S));
    stVbConf.u32MaxPoolCnt             = 16;
    /*no need common video buffer!*/

    /*1 enable Vo device first*/
    if (HI_SUCCESS != SAMPLE_COMM_SYS_Init(&stVbConf))
    {
        goto SAMPLE_TDE_ERR0;
    }
    if (HI_SUCCESS != SAMPLE_COMM_VO_StartDev(VoDev, &stPubAttr))
    {
        goto SAMPLE_TDE_ERR0;
    }

    /*2 run tde sample which draw grahpic on HiFB memory*/

    if (VO_INTF_BT656 == stPubAttr.enIntfType)
    {
        s32Ret = TDE_DrawGraphicSample(0);
    }
    else
    {
        s32Ret = TDE_DrawGraphicSample(1);
    }
    if (s32Ret != HI_SUCCESS)
    {
        goto SAMPLE_TDE_ERR1;
    }

SAMPLE_TDE_ERR1:
    SAMPLE_COMM_VO_StopDev(VoDev);
SAMPLE_TDE_ERR0:
    SAMPLE_COMM_SYS_Exit();
    return 0;
}