4010
- 收藏
- 点赞
- 分享
- 举报
Hi3536 HDMI模式不出QT界面
HI_VOID *SAMPLE_HIFB_COMPRESS(void *pData)
{
HI_S32 s32Ret = HI_SUCCESS;
struct fb_var_screeninfo stVarInfo;
HI_CHAR file[12] = "/dev/fb0";
PTHREAD_HIFB_SAMPLE_INFO *pstInfo;
FILE *fp;
HI_BOOL bEnable;
HIFB_DDRZONE_S stDDRZonePara;
HIFB_LAYER_INFO_S stLayerinfo;
HIFB_BUFFER_S stCanvasBuf;
HI_CHAR *pcBuf;
HI_S32 i = 0;
pstInfo = (PTHREAD_HIFB_SAMPLE_INFO *)pData;
switch (pstInfo->layer)
{
case GRAPHICS_LAYER_G0:
strcpy(file, "/dev/fb0");
break;
case GRAPHICS_LAYER_G1:
strcpy(file, "/dev/fb1");
break;
default:
strcpy(file, "/dev/fb0");
break;
}
/* 1. open framebuffer device overlay 0 */
pstInfo->fd = open(file, O_RDWR, 0);
if(pstInfo->fd < 0)
{
SAMPLE_PRT("open %s failed!\n",file);
return HI_NULL;
}
s32Ret = ioctl (pstInfo->fd, FBIOGET_VSCREENINFO, &stVarInfo);
if (s32Ret < 0)
{
SAMPLE_PRT("FBIOGET_VSCREENINFO failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
stVarInfo.red = s_r32;
stVarInfo.green = s_g32;
stVarInfo.blue = s_b32;
stVarInfo.transp = s_a32;
stVarInfo.bits_per_pixel = 32;
stVarInfo.xres=WIDTH;
stVarInfo.yres=HEIGHT;
stVarInfo.activate=FB_ACTIVATE_NOW;
stVarInfo.xres_virtual=WIDTH;
stVarInfo.yres_virtual = HEIGHT;
stVarInfo.xoffset=0;
stVarInfo.yoffset=0;
s32Ret = ioctl (pstInfo->fd, FBIOPUT_VSCREENINFO, &stVarInfo);
if (s32Ret < 0)
{
SAMPLE_PRT("FBIOPUT_VSCREENINFO failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
s32Ret = ioctl(pstInfo->fd, FBIOGET_LAYER_INFO, &stLayerinfo);
if (s32Ret < 0)
{
SAMPLE_PRT("FBIOGET_LAYER_INFO failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
stLayerinfo.u32Mask = 0;
stLayerinfo.BufMode = HIFB_LAYER_BUF_NONE;
stLayerinfo.u32Mask |= HIFB_LAYERMASK_BUFMODE;
s32Ret = ioctl(pstInfo->fd, FBIOPUT_LAYER_INFO, &stLayerinfo);
if (s32Ret < 0)
{
SAMPLE_PRT("FBIOPUT_LAYER_INFO failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
stDDRZonePara.u32StartSection = 0;
stDDRZonePara.u32ZoneNums = 15;
s32Ret = ioctl(pstInfo->fd, FBIOPUT_MDDRDETECT_HIFB, &stDDRZonePara);
if (s32Ret < 0)
{
SAMPLE_PRT("FBIOPUT_MDDRDETECT_HIFB failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 2. open compress */
bEnable = HI_TRUE;
s32Ret = ioctl(pstInfo->fd, FBIOPUT_COMPRESSION_HIFB, &bEnable);
if (s32Ret < 0)
{
SAMPLE_PRT("FBIOPUT_COMPRESSION_HIFB failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
if (HI_FAILURE == HI_MPI_SYS_MmzAlloc(&(stCanvasBuf.stCanvas.u32PhyAddr), ((void**)&pcBuf),
NULL, NULL, WIDTH*HEIGHT*4))
{
SAMPLE_PRT("allocate memory failed\n");
close(pstInfo->fd);
return HI_NULL;
}
stCanvasBuf.stCanvas.u32Height = HEIGHT;
stCanvasBuf.stCanvas.u32Width = WIDTH;
stCanvasBuf.stCanvas.u32Pitch = WIDTH * 4;
stCanvasBuf.stCanvas.enFmt = HIFB_FMT_ARGB8888;
stCanvasBuf.UpdateRect.x = 0;
stCanvasBuf.UpdateRect.y = 0;
stCanvasBuf.UpdateRect.w = WIDTH;
stCanvasBuf.UpdateRect.h = HEIGHT;
#ifdef DRAWBMP
fp = fopen(SAMPLE_IMAGE2_PATH, "rb");
if (HI_NULL == fp)
{
SAMPLE_PRT("fopen file failed!\n");
HI_MPI_SYS_MmzFree(stCanvasBuf.stCanvas.u32PhyAddr, pcBuf);
close(pstInfo->fd);
return HI_NULL;
}
memset(pcBuf, 0, stCanvasBuf.stCanvas.u32Pitch * stCanvasBuf.stCanvas.u32Height);
fread(pcBuf, 1, stCanvasBuf.stCanvas.u32Pitch * stCanvasBuf.stCanvas.u32Height, fp);
fclose(fp);
#endif
s32Ret = ioctl(pstInfo->fd, FBIO_REFRESH, &stCanvasBuf);
if (s32Ret < 0)
{
SAMPLE_PRT("FBIO_REFRESH failed\n");
HI_MPI_SYS_MmzFree(stCanvasBuf.stCanvas.u32PhyAddr, pcBuf);
close(pstInfo->fd);
return HI_NULL;
}
while(1)
{
if ('q' == gs_cExitFlag)
{
printf("process exit...\n");
break;
}
#ifdef DRAWBOX
printf("process DRAWBOX...\n");
i++;
stCanvasBuf.UpdateRect.x = WIDTH / 4;
stCanvasBuf.UpdateRect.y = HEIGHT / 4;
stCanvasBuf.UpdateRect.w = WIDTH / 2;
stCanvasBuf.UpdateRect.h = HEIGHT / 2;
DrawBox(stCanvasBuf.UpdateRect.x, stCanvasBuf.UpdateRect.y,\
stCanvasBuf.UpdateRect.w, stCanvasBuf.UpdateRect.h, \
stCanvasBuf.stCanvas.u32Pitch, pcBuf, 0xffff0000);
sleep(2);
stCanvasBuf.UpdateRect.x = WIDTH * 3/8;
stCanvasBuf.UpdateRect.y = HEIGHT * 3/8;
stCanvasBuf.UpdateRect.w = WIDTH / 4;
stCanvasBuf.UpdateRect.h = HEIGHT / 4;
DrawBox(stCanvasBuf.UpdateRect.x, stCanvasBuf.UpdateRect.y,\
stCanvasBuf.UpdateRect.w, stCanvasBuf.UpdateRect.h, \
stCanvasBuf.stCanvas.u32Pitch, pcBuf, 0xff00ff00);
#endif
sleep(2);
}
HI_MPI_SYS_MmzFree(stCanvasBuf.stCanvas.u32PhyAddr, pcBuf);
close(pstInfo->fd);
return HI_NULL;
}
HI_S32 SAMPLE_HIFB_Compression(HI_VOID)
{
HI_S32 s32Ret = HI_SUCCESS;
pthread_t phifb0 = -1;
PTHREAD_HIFB_SAMPLE_INFO stInfo0;
HI_U32 u32PicWidth = WIDTH;
HI_U32 u32PicHeight = HEIGHT;
SIZE_S stSize;
VO_LAYER VoLayer = 0;
VO_PUB_ATTR_S stPubAttr;
VO_VIDEO_LAYER_ATTR_S stLayerAttr;
HI_U32 u32VoFrmRate;
VB_CONF_S stVbConf;
HI_U32 u32BlkSize;
/******************************************
step 1: init variable
******************************************/
memset(&stVbConf,0,sizeof(VB_CONF_S));
u32BlkSize = CEILING_2_POWER(u32PicWidth,SAMPLE_SYS_ALIGN_WIDTH)\
* CEILING_2_POWER(u32PicHeight,SAMPLE_SYS_ALIGN_WIDTH) *2;
stVbConf.u32MaxPoolCnt = 128;
stVbConf.astCommPool[0].u32BlkSize = u32BlkSize;
stVbConf.astCommPool[0].u32BlkCnt = 6;
/******************************************
step 2: mpp system init.
******************************************/
s32Ret = SAMPLE_COMM_SYS_Init(&stVbConf);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("system init failed with %d!\n", s32Ret);
goto SAMPLE_HIFB_NoneBufMode_0;
}
/******************************************
step 3: start vo hd0.
*****************************************/
s32Ret = HI_MPI_VO_UnBindGraphicLayer(GRAPHICS_LAYER_HC0, VoDev);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("UnBindGraphicLayer failed with %d!\n", s32Ret);
goto SAMPLE_HIFB_NoneBufMode_0;
}
s32Ret = HI_MPI_VO_BindGraphicLayer(GRAPHICS_LAYER_HC0, VoDev);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("BindGraphicLayer failed with %d!\n", s32Ret);
goto SAMPLE_HIFB_NoneBufMode_0;
}
stPubAttr.enIntfSync = VO_OUTPUT_720P50;
//stPubAttr.enIntfType = VO_INTF_VGA |VO_INTF_HDMI;
stPubAttr.enIntfType = VO_INTF_HDMI;
//stPubAttr.enIntfType = VO_INTF_VGA;
stPubAttr.u32BgColor = 0x00ff00;
stLayerAttr.bClusterMode = HI_FALSE;
stLayerAttr.bDoubleFrame = HI_FALSE;
stLayerAttr.enPixFormat = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
s32Ret = SAMPLE_COMM_VO_GetWH(stPubAttr.enIntfSync,&stSize.u32Width,\
&stSize.u32Height,&u32VoFrmRate);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("get vo wh failed with %d!\n", s32Ret);
goto SAMPLE_HIFB_NoneBufMode_0;
}
memcpy(&stLayerAttr.stImageSize,&stSize,sizeof(stSize));
stLayerAttr.u32DispFrmRt = 30 ;
stLayerAttr.stDispRect.s32X = 0;
stLayerAttr.stDispRect.s32Y = 0;
stLayerAttr.stDispRect.u32Width = stSize.u32Width;
stLayerAttr.stDispRect.u32Height = stSize.u32Height;
s32Ret = SAMPLE_COMM_VO_StartDev(VoDev, &stPubAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("start vo dev failed with %d!\n", s32Ret);
goto SAMPLE_HIFB_NoneBufMode_0;
}
#ifndef HDMI
if (stPubAttr.enIntfType & VO_INTF_HDMI)
{
s32Ret = SAMPLE_COMM_VO_HdmiStart(stPubAttr.enIntfSync);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("start HDMI failed with %d!\n", s32Ret);
//goto SAMPLE_HIFB_NoneBufMode_2;
}
}
#endif
VoLayer = SAMPLE_VO_LAYER_VHD0;
s32Ret = SAMPLE_COMM_VO_StartLayer(VoLayer, &stLayerAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("start vo layer failed with %d!\n", s32Ret);
goto SAMPLE_HIFB_NoneBufMode_1;
}
#ifdef HI_FPGA
/***************************************************
step 6: start HD1 with 1 windows and bind to vpss
***************************************************/
/**************start Dev****************************/
VoDev = SAMPLE_VO_DEV_DHD1;
//stVoPubAttr.enIntfSync = VO_OUTPUT_1080P30;
stPubAttr.enIntfSync = VO_OUTPUT_1024x768_60;
stPubAttr.enIntfType = VO_INTF_HDMI;
stPubAttr.u32BgColor = 0x000000ff;
s32Ret = SAMPLE_COMM_VO_StartDev(VoDev, &stPubAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_VO_StartDev failed!\n");
//goto END_PREVIEW_6;
}
/**************start Layer****************************/
VoLayer = SAMPLE_VO_LAYER_VHD1;
stLayerAttr.bClusterMode = HI_FALSE;
stLayerAttr.bDoubleFrame = HI_FALSE;
stLayerAttr.enPixFormat = SAMPLE_PIXEL_FORMAT;
s32Ret = SAMPLE_COMM_VO_GetWH(stPubAttr.enIntfSync, \
&stLayerAttr.stDispRect.u32Width, &stLayerAttr.stDispRect.u32Height, &stLayerAttr.u32DispFrmRt);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_PRT("failed with %#x!\n", s32Ret);
//goto END_PREVIEW_7;
}
stLayerAttr.stImageSize.u32Width = stLayerAttr.stDispRect.u32Width;
stLayerAttr.stImageSize.u32Height = stLayerAttr.stDispRect.u32Height;
s32Ret = SAMPLE_COMM_VO_StartLayer(VoLayer, &stLayerAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_PRT("SAMPLE_COMM_VO_StartLayer failed!\n");
//goto END_PREVIEW_8;
}
#endif
/******************************************
step 4: start hifb.
*****************************************/
stInfo0.layer = 0;
stInfo0.fd = -1;
stInfo0.ctrlkey = 3;
pthread_create(&phifb0, 0, SAMPLE_HIFB_COMPRESS, (void *)(&stInfo0));
//SAMPLE_HIFB_COMPRESSExx((void *)(&stInfo0));
//stInfo0.layer = 1;
//stInfo0.fd = -1;
//stInfo0.ctrlkey = 3;
//pthread_create(&phifb0, 0, SAMPLE_HIFB_COMPRESSEx, (void *)(&stInfo0));
//SAMPLE_HIFB_COMPRESSExx((void *)(&stInfo0));
while(1)
{
HI_CHAR ch;
printf("press 'q' to exit this sample.\n");
ch = getchar();
if (10 == ch)
{
continue;
}
getchar();
if ('q' == ch)
{
gs_cExitFlag = ch;
break;
}
else
{
printf("input invaild! please try again.\n");
}
}
if(-1 != phifb0)
{
pthread_join(phifb0,0);
}
SAMPLE_HIFB_NoneBufMode_2:
SAMPLE_COMM_VO_StopLayer(VoLayer);
SAMPLE_HIFB_NoneBufMode_1:
SAMPLE_COMM_VO_StopDev(VoDev);
SAMPLE_HIFB_NoneBufMode_0:
SAMPLE_COMM_SYS_Exit();
return s32Ret;
}
=======================================================
./sample_hifb &
cat /proc/umap/hifb0
layer name :layer_0
Open count :2
Show state :ON
Start position :(0, 0)
xres, yres :(1280, 720)
xres_virtual, yres_virtual :(1280, 720)
xoffset, yoffset :(0, 0)
fix.line_length :2560
Mem size: :32400 KB
Layer Scale (hw): :NO
ColorFormat: :ARGB1555
Alpha Enable :ON
AlphaChannel Enable :OFF
Alpha0, Alpha1 :0, 255
Alpha Global :255
Colorkey Enable :OFF
Colorkey value :0x0
Deflicker Mode: :NONE
Deflicker Level: :AUTO
Display Buffer mode :unkown
Displaying addr (register) :0x50233000
display buffer[0] addr :0x50233000
display buffer[1] addr :0x503f5000
displayrect :(1280, 720)
screenrect :(1280, 720)
device max resolution :1280, 720
IsNeedFlip(2buf) :NO
BufferIndexDisplaying(2buf) :0
refresh request num(2buf) :0
switch buf num(2buf) :0
union rect (2buf) :(0,0,0,0)
canavas updated addr :0x0
canavas updated (x, y, w, h) :(0,0,0,0)
canvas width :0
canvas height :0
canvas pitch :0
canvas format :RGB565
IsCompress :NO
Is DDR Dettect :NO
DDR Detect Zones :0
===========================================================
./sample_hifb
cat /proc/umap/hifb0
layer name :layer_0
Open count :1
Show state :ON
Start position :(0, 0)
xres, yres :(1280, 720)
xres_virtual, yres_virtual :(1280, 720)
xoffset, yoffset :(0, 0)
fix.line_length :5120
Mem size: :32400 KB
Layer Scale (hw): :NO
ColorFormat: :ARGB8888
Alpha Enable :ON
AlphaChannel Enable :OFF
Alpha0, Alpha1 :0, 255
Alpha Global :255
Colorkey Enable :OFF
Colorkey value :0x0
Deflicker Mode: :NONE
Deflicker Level: :AUTO
Display Buffer mode :single
Displaying addr (register) :0x53fb3000
display buffer[0] addr :0x50233000
display buffer[1] addr :0x505b7000
displayrect :(1280, 720)
screenrect :(1280, 720)
device max resolution :1280, 720
IsNeedFlip(2buf) :NO
BufferIndexDisplaying(2buf) :0
refresh request num(2buf) :0
switch buf num(2buf) :0
union rect (2buf) :(0,0,0,0)
canavas updated addr :0x53fb3000
canavas updated (x, y, w, h) :(0,0,1280,720)
canvas width :1280
canvas height :720
canvas pitch :5120
canvas format :ARGB8888
IsCompress :YES
Is DDR Dettect :YES
DDR Detect Zones :15
通过分析可以看出hifb0参数有异常
问题总结:
1、为什么HDMI模式输出时,前台打开fb0参数正常,后台打开则参数异常?
2、同样的代码切换为VGA模式,后台打开,则QT界面可以显示
我来回答
回答0个
时间排序
认可量排序
暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2016-08-11 15:52:57
-
2016-07-01 10:32:39
-
2017-12-15 15:32:41
-
2017-09-26 11:23:50
-
2016-08-31 17:33:37
-
2016-09-15 17:56:40
-
2017-10-12 14:55:58
-
2016-09-06 15:30:10
-
2017-09-17 01:46:14
-
2018-07-24 16:27:48
-
2017-04-06 18:35:30
-
2017-05-14 18:59:19
-
2016-08-16 10:57:17
-
2017-07-13 10:52:42
-
2016-09-28 16:32:38
-
2016-09-14 14:11:35
-
2018-04-20 10:46:43
-
2017-11-04 21:56:57
-
2016-08-09 10:19:58
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5RK3588的DPHY0接lt6911uxe转HDMI抓帧分辨率不对
-
20求rv1106板子的sdk包或者开发板资料
-
10ss928烧录uboot失败
-
10求助,3588调试imx586和ov50c40时,按照瑞芯微的单摄8k配置好设备树后,驱动配置的8k分辨率的,但是只能抓到4k的图,且颜色偏粉
-
50帮忙解决个交叉编译的问题
-
20帮忙交叉编译个源码
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认