4443
- 收藏
- 点赞
- 分享
- 举报
3516c hifb无法显示
各位大佬,由于需要图像调优,需要在3516C上通过hifb显示参数菜单进行图像调节,hifb_init函数如下所示:
HI_S32 OSD_MENU_HIFB_init()
{
HI_S32 s32Ret = HI_SUCCESS;
HIFB_LAYER_INFO_S stLayerInfo = {0};
HI_U8* pDst = NULL;
//HI_U32 x;
//HI_U32 y;
//HI_U32 i;
HI_CHAR image_name[128];
HI_BOOL bShow;
struct fb_var_screeninfo stVarInfo;
HI_CHAR file0[12] = "/dev/fb0";
HI_CHAR file1[12] = "/dev/fb1";
HI_CHAR file2[12] = "/dev/fb2";
int fd_hd;
int fd_sd;
int fd_4k;
HIFB_COLORKEY_S stColorKey;
/*
TDE2_RECT_S stSrcRect, stDstRect;
TDE2_SURFACE_S stSrc, stDst;
TDE_HANDLE s32Handle;
*/
fd_4k = open("/dev/fb0", O_RDWR, 0);
osdfb_4k = fd_4k;
if (osdfb_4k < 0)
{
SAMPLE_PRT("open %s failed!\n", file0);
return HI_NULL;
}
/*all layer surport colorkey*/
stColorKey.bKeyEnable = HI_TRUE;
stColorKey.u32Key = 0x0;
if (ioctl(osdfb_4k, FBIOPUT_COLORKEY_HIFB, &stColorKey) < 0)
{
SAMPLE_PRT("FBIOPUT_COLORKEY_HIFB!\n");
close(osdfb_4k);
return HI_NULL;
}
/****************************4K*********************/
s32Ret = ioctl(osdfb_4k, FBIOGET_VSCREENINFO, &stVarInfo);
if (s32Ret < 0)
{
SAMPLE_PRT("GET_VSCREENINFO failed!\n");
close(osdfb_4k);
return HI_NULL;
}
if (ioctl(osdfb_4k, FBIOPUT_SCREEN_ORIGIN_HIFB, &stPoint) < 0)
{
SAMPLE_PRT("set screen original show position failed!\n");
close(osdfb_4k);
return HI_NULL;
}
maxW = WIDTH_720;
maxH = HEIGHT_576;
stVarInfo.transp = s_a16;
stVarInfo.red = s_r16;
stVarInfo.green = s_g16;
stVarInfo.blue = s_b16;
stVarInfo.bits_per_pixel = 16;
stVarInfo.activate = FB_ACTIVATE_NOW;
stVarInfo.xres = stVarInfo.xres_virtual = maxW;
stVarInfo.yres = stVarInfo.yres_virtual = maxH;
s32Ret = ioctl(osdfb_4k, FBIOPUT_VSCREENINFO, &stVarInfo);
if (s32Ret < 0)
{
SAMPLE_PRT("PUT_VSCREENINFO failed!\n");
close(osdfb_4k);
return HI_NULL;
}
/************************HD*********************/
/************************SD***************************/
stLayerInfo.BufMode = HIFB_LAYER_BUF_ONE;//HIFB_LAYER_BUF_ONE HIFB_LAYER_BUF_NONE
stLayerInfo.u32Mask = HIFB_LAYERMASK_BUFMODE;
s32Ret = ioctl(osdfb_4k, FBIOPUT_LAYER_INFO, &stLayerInfo);
if (s32Ret < 0)
{
SAMPLE_PRT("PUT_LAYER_INFO failed!\n");
close(osdfb_4k);
return HI_NULL;
}
bShow = HI_TRUE;
// bShow = HI_FALSE;
if (ioctl(osdfb_4k, FBIOPUT_SHOW_HIFB, &bShow) < 0)
{
SAMPLE_PRT("FBIOPUT_SHOW_HIFB failed!\n");
close(osdfb_4k);
return HI_NULL;
}
if (HI_FAILURE == HI_MPI_SYS_MmzAlloc(&(stCanvasBuf.stCanvas.u32PhyAddr), ((void**)&pBuf),
NULL, NULL, maxW * maxH * 2))
{
SAMPLE_PRT("allocate memory (maxW*maxH*2 bytes) failed\n");
close(osdfb_4k);
return HI_NULL;
}
CanAddr = stCanvasBuf.stCanvas.u32PhyAddr;
stCanvasBuf.stCanvas.u32Height = maxH;
stCanvasBuf.stCanvas.u32Width = maxW;
stCanvasBuf.stCanvas.u32Pitch = maxW * 2;
stCanvasBuf.stCanvas.enFmt = HIFB_FMT_ARGB1555;
memset(pBuf, 0x00, stCanvasBuf.stCanvas.u32Pitch * stCanvasBuf.stCanvas.u32Height);
/*change bmp*/
if (HI_FAILURE == HI_MPI_SYS_MmzAlloc(&Phyaddr, ((void**)&pOSDRGB),
NULL, NULL, SAMPLE_IMAGE_WIDTH * SAMPLE_IMAGE_HEIGHT * 2))
{
SAMPLE_PRT("allocate memory failed\n");
HI_MPI_SYS_MmzFree(stCanvasBuf.stCanvas.u32PhyAddr, pBuf);
close(osdfb_4k);
return HI_NULL;
}
if(NULL != pOSDRGB){
memset(pOSDRGB,0x0,SAMPLE_IMAGE_WIDTH * SAMPLE_IMAGE_HEIGHT * 2);
}
return 0;
}
该函数运行成功且没有报错。 stCanvasBuf为全局变量,在此函数中应该已经赋值成功。
显示函数如下:
............
此处中间为菜单字符描画,运行时没有报错,故此省略
............
执行菜单刷新:
memcpy(pBuf,pOSDRGB,maxW*maxH*2);
stCanvasBuf.stCanvas.u32PhyAddr = CanAddr ;
stCanvasBuf.stCanvas.u32Height = maxH;
stCanvasBuf.stCanvas.u32Width = maxW;
stCanvasBuf.stCanvas.u32Pitch = maxW * 2;
stCanvasBuf.stCanvas.enFmt = HIFB_FMT_ARGB1555;
//stCanvasBuf.UpdateRect.x = 180;
//stCanvasBuf.UpdateRect.y = 180;
stCanvasBuf.UpdateRect.x = 0;
stCanvasBuf.UpdateRect.y = 0;
stCanvasBuf.UpdateRect.w = maxW;
stCanvasBuf.UpdateRect.h = maxH;
#if 1
s32Ret = ioctl(osdfb_4k, FBIO_REFRESH, &stCanvasBuf);
if (s32Ret < 0)
{
printf("errno=%d\n",errno);
SAMPLE_PRT("FBIO_REFRESH with %#x!\n",s32Ret);
HI_MPI_SYS_MmzFree(Phyaddr, pOSDRGB);
HI_MPI_SYS_MmzFree(stCanvasBuf.stCanvas.u32PhyAddr, pBuf);
// close(osdfb_4k);
// return HI_NULL;
}
函数执行到
s32Ret = ioctl(osdfb_4k, FBIO_REFRESH, &stCanvasBuf);
时报错,打印出的errno为1,查阅错误码意义为不支持该操作。
希望得到各位的解答,谢谢。
HI_S32 OSD_MENU_HIFB_init()
{
HI_S32 s32Ret = HI_SUCCESS;
HIFB_LAYER_INFO_S stLayerInfo = {0};
HI_U8* pDst = NULL;
//HI_U32 x;
//HI_U32 y;
//HI_U32 i;
HI_CHAR image_name[128];
HI_BOOL bShow;
struct fb_var_screeninfo stVarInfo;
HI_CHAR file0[12] = "/dev/fb0";
HI_CHAR file1[12] = "/dev/fb1";
HI_CHAR file2[12] = "/dev/fb2";
int fd_hd;
int fd_sd;
int fd_4k;
HIFB_COLORKEY_S stColorKey;
/*
TDE2_RECT_S stSrcRect, stDstRect;
TDE2_SURFACE_S stSrc, stDst;
TDE_HANDLE s32Handle;
*/
fd_4k = open("/dev/fb0", O_RDWR, 0);
osdfb_4k = fd_4k;
if (osdfb_4k < 0)
{
SAMPLE_PRT("open %s failed!\n", file0);
return HI_NULL;
}
/*all layer surport colorkey*/
stColorKey.bKeyEnable = HI_TRUE;
stColorKey.u32Key = 0x0;
if (ioctl(osdfb_4k, FBIOPUT_COLORKEY_HIFB, &stColorKey) < 0)
{
SAMPLE_PRT("FBIOPUT_COLORKEY_HIFB!\n");
close(osdfb_4k);
return HI_NULL;
}
/****************************4K*********************/
s32Ret = ioctl(osdfb_4k, FBIOGET_VSCREENINFO, &stVarInfo);
if (s32Ret < 0)
{
SAMPLE_PRT("GET_VSCREENINFO failed!\n");
close(osdfb_4k);
return HI_NULL;
}
if (ioctl(osdfb_4k, FBIOPUT_SCREEN_ORIGIN_HIFB, &stPoint) < 0)
{
SAMPLE_PRT("set screen original show position failed!\n");
close(osdfb_4k);
return HI_NULL;
}
maxW = WIDTH_720;
maxH = HEIGHT_576;
stVarInfo.transp = s_a16;
stVarInfo.red = s_r16;
stVarInfo.green = s_g16;
stVarInfo.blue = s_b16;
stVarInfo.bits_per_pixel = 16;
stVarInfo.activate = FB_ACTIVATE_NOW;
stVarInfo.xres = stVarInfo.xres_virtual = maxW;
stVarInfo.yres = stVarInfo.yres_virtual = maxH;
s32Ret = ioctl(osdfb_4k, FBIOPUT_VSCREENINFO, &stVarInfo);
if (s32Ret < 0)
{
SAMPLE_PRT("PUT_VSCREENINFO failed!\n");
close(osdfb_4k);
return HI_NULL;
}
/************************HD*********************/
/************************SD***************************/
stLayerInfo.BufMode = HIFB_LAYER_BUF_ONE;//HIFB_LAYER_BUF_ONE HIFB_LAYER_BUF_NONE
stLayerInfo.u32Mask = HIFB_LAYERMASK_BUFMODE;
s32Ret = ioctl(osdfb_4k, FBIOPUT_LAYER_INFO, &stLayerInfo);
if (s32Ret < 0)
{
SAMPLE_PRT("PUT_LAYER_INFO failed!\n");
close(osdfb_4k);
return HI_NULL;
}
bShow = HI_TRUE;
// bShow = HI_FALSE;
if (ioctl(osdfb_4k, FBIOPUT_SHOW_HIFB, &bShow) < 0)
{
SAMPLE_PRT("FBIOPUT_SHOW_HIFB failed!\n");
close(osdfb_4k);
return HI_NULL;
}
if (HI_FAILURE == HI_MPI_SYS_MmzAlloc(&(stCanvasBuf.stCanvas.u32PhyAddr), ((void**)&pBuf),
NULL, NULL, maxW * maxH * 2))
{
SAMPLE_PRT("allocate memory (maxW*maxH*2 bytes) failed\n");
close(osdfb_4k);
return HI_NULL;
}
CanAddr = stCanvasBuf.stCanvas.u32PhyAddr;
stCanvasBuf.stCanvas.u32Height = maxH;
stCanvasBuf.stCanvas.u32Width = maxW;
stCanvasBuf.stCanvas.u32Pitch = maxW * 2;
stCanvasBuf.stCanvas.enFmt = HIFB_FMT_ARGB1555;
memset(pBuf, 0x00, stCanvasBuf.stCanvas.u32Pitch * stCanvasBuf.stCanvas.u32Height);
/*change bmp*/
if (HI_FAILURE == HI_MPI_SYS_MmzAlloc(&Phyaddr, ((void**)&pOSDRGB),
NULL, NULL, SAMPLE_IMAGE_WIDTH * SAMPLE_IMAGE_HEIGHT * 2))
{
SAMPLE_PRT("allocate memory failed\n");
HI_MPI_SYS_MmzFree(stCanvasBuf.stCanvas.u32PhyAddr, pBuf);
close(osdfb_4k);
return HI_NULL;
}
if(NULL != pOSDRGB){
memset(pOSDRGB,0x0,SAMPLE_IMAGE_WIDTH * SAMPLE_IMAGE_HEIGHT * 2);
}
return 0;
}
该函数运行成功且没有报错。 stCanvasBuf为全局变量,在此函数中应该已经赋值成功。
显示函数如下:
............
此处中间为菜单字符描画,运行时没有报错,故此省略
............
执行菜单刷新:
memcpy(pBuf,pOSDRGB,maxW*maxH*2);
stCanvasBuf.stCanvas.u32PhyAddr = CanAddr ;
stCanvasBuf.stCanvas.u32Height = maxH;
stCanvasBuf.stCanvas.u32Width = maxW;
stCanvasBuf.stCanvas.u32Pitch = maxW * 2;
stCanvasBuf.stCanvas.enFmt = HIFB_FMT_ARGB1555;
//stCanvasBuf.UpdateRect.x = 180;
//stCanvasBuf.UpdateRect.y = 180;
stCanvasBuf.UpdateRect.x = 0;
stCanvasBuf.UpdateRect.y = 0;
stCanvasBuf.UpdateRect.w = maxW;
stCanvasBuf.UpdateRect.h = maxH;
#if 1
s32Ret = ioctl(osdfb_4k, FBIO_REFRESH, &stCanvasBuf);
if (s32Ret < 0)
{
printf("errno=%d\n",errno);
SAMPLE_PRT("FBIO_REFRESH with %#x!\n",s32Ret);
HI_MPI_SYS_MmzFree(Phyaddr, pOSDRGB);
HI_MPI_SYS_MmzFree(stCanvasBuf.stCanvas.u32PhyAddr, pBuf);
// close(osdfb_4k);
// return HI_NULL;
}
函数执行到
s32Ret = ioctl(osdfb_4k, FBIO_REFRESH, &stCanvasBuf);
时报错,打印出的errno为1,查阅错误码意义为不支持该操作。
希望得到各位的解答,谢谢。
我来回答
回答1个
时间排序
认可量排序
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2017-08-19 19:19:23
-
2015-07-08 21:40:32
-
2015-01-14 19:28:25
-
2015-01-27 17:14:47
-
2017-10-30 09:38:15
-
2014-06-22 21:46:32
-
2016-05-17 08:47:27
-
2015-03-15 18:07:41
-
2015-11-20 11:47:36
-
2015-12-17 17:29:47
-
2016-12-27 14:31:09
-
2016-04-18 09:01:33
-
2015-07-23 11:09:01
-
2015-05-05 10:41:24
-
2015-04-09 17:22:18
-
2015-03-30 09:07:31
-
2015-04-09 17:22:50
-
2015-01-16 17:08:33
-
2015-04-19 11:22:08
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
-
10求HI3519DV500_SDK_V2.0.1.1
-
5有偿求HI3516DV500 + OV5647驱动
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认