2298
- 收藏
- 点赞
- 分享
- 举报
鼠标层该怎么使用?
各位大神,请问hi3520d的鼠标该怎么用呢,现在要实现功能是在鼠标层显示鼠标,我的代码如下
[code]/* 1. open framebuffer device overlay 0 */
pstInfo->fd = open("/dev/fb3", O_RDWR, 0);
if(pstInfo->fd < 0)
{
printf("open %s failed!\n",file);
return HI_NULL;
}
bShow = HI_FALSE;
if (ioctl(pstInfo->fd, FBIOPUT_SHOW_HIFB, &bShow) < 0)
{
printf("FBIOPUT_SHOW_HIFB failed!\n");
return HI_NULL;
}
/* 2. set the screen original position */
stPoint.s32XPos = 150;
stPoint.s32YPos = 150;
if (ioctl(pstInfo->fd, FBIOPUT_SCREEN_ORIGIN_HIFB, &stPoint) < 0)
{
printf("set screen original show position failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#if 1
/* 3.set alpha */
stAlpha.bAlphaEnable = HI_FALSE;
stAlpha.bAlphaChannel = HI_FALSE;
stAlpha.u8Alpha0 = 0x0;
stAlpha.u8Alpha1 = 0xff;
stAlpha.u8GlobalAlpha = 0x80;
if (ioctl(pstInfo->fd, FBIOPUT_ALPHA_HIFB, &stAlpha) < 0)
{
printf("Set alpha failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#endif
/*all layer surport colorkey*/
stColorKey.bKeyEnable = HI_TRUE;
stColorKey.u32Key = 0x0;
if (ioctl(pstInfo->fd, FBIOPUT_COLORKEY_HIFB, &stColorKey) < 0)
{
printf("FBIOPUT_COLORKEY_HIFB!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 4. get the variable screen info */
if (ioctl(pstInfo->fd, FBIOGET_VSCREENINFO, &var) < 0)
{
printf("Get variable screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 5. modify the variable screen info
the screen size: IMAGE_WIDTH*IMAGE_HEIGHT
the virtual screen size: VIR_SCREEN_WIDTH*VIR_SCREEN_HEIGHT
(which equals to VIR_SCREEN_WIDTH*(IMAGE_HEIGHT*2))
the pixel format: ARGB1555
*/
usleep(4*1000*1000);
#if 1
var.xres_virtual = 48;
var.yres_virtual = 48;
var.xres = 48;
var.yres = 48;
#else
var.xres_virtual = 1280;
var.yres_virtual = 720*2;
var.xres = 1280;
var.yres = 720;
#endif
var.transp= g_a16;
var.red = g_r16;
var.green = g_g16;
var.blue = g_b16;
var.bits_per_pixel = 16;
var.activate = FB_ACTIVATE_NOW;
#if 1
/* 6. set the variable screeninfo */
if (ioctl(pstInfo->fd, FBIOPUT_VSCREENINFO, &var) < 0)
{
printf("Put variable screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#endif
/* 7. get the fix screen info */
if (ioctl(pstInfo->fd, FBIOGET_FSCREENINFO, &fix) < 0)
{
printf("Get fix screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
u32FixScreenStride = fix.line_length; /*fix screen stride*/
/* 8. map the physical video memory for user use */
pShowScreen = mmap(HI_NULL, fix.smem_len, PROT_READ|PROT_WRITE, MAP_SHARED, pstInfo->fd, 0);
if(MAP_FAILED == pShowScreen)
{
printf("mmap framebuffer failed!\n");
close(pstInfo->fd);
return HI_NULL;
}[/code]
fb3对应鼠标层,可是在设置可变参数时候出错了,提示:Put variable screen info failed!
我的用法是不是不对,思路就是直接操作鼠标层的显存。
[code]/* 1. open framebuffer device overlay 0 */
pstInfo->fd = open("/dev/fb3", O_RDWR, 0);
if(pstInfo->fd < 0)
{
printf("open %s failed!\n",file);
return HI_NULL;
}
bShow = HI_FALSE;
if (ioctl(pstInfo->fd, FBIOPUT_SHOW_HIFB, &bShow) < 0)
{
printf("FBIOPUT_SHOW_HIFB failed!\n");
return HI_NULL;
}
/* 2. set the screen original position */
stPoint.s32XPos = 150;
stPoint.s32YPos = 150;
if (ioctl(pstInfo->fd, FBIOPUT_SCREEN_ORIGIN_HIFB, &stPoint) < 0)
{
printf("set screen original show position failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#if 1
/* 3.set alpha */
stAlpha.bAlphaEnable = HI_FALSE;
stAlpha.bAlphaChannel = HI_FALSE;
stAlpha.u8Alpha0 = 0x0;
stAlpha.u8Alpha1 = 0xff;
stAlpha.u8GlobalAlpha = 0x80;
if (ioctl(pstInfo->fd, FBIOPUT_ALPHA_HIFB, &stAlpha) < 0)
{
printf("Set alpha failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#endif
/*all layer surport colorkey*/
stColorKey.bKeyEnable = HI_TRUE;
stColorKey.u32Key = 0x0;
if (ioctl(pstInfo->fd, FBIOPUT_COLORKEY_HIFB, &stColorKey) < 0)
{
printf("FBIOPUT_COLORKEY_HIFB!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 4. get the variable screen info */
if (ioctl(pstInfo->fd, FBIOGET_VSCREENINFO, &var) < 0)
{
printf("Get variable screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
/* 5. modify the variable screen info
the screen size: IMAGE_WIDTH*IMAGE_HEIGHT
the virtual screen size: VIR_SCREEN_WIDTH*VIR_SCREEN_HEIGHT
(which equals to VIR_SCREEN_WIDTH*(IMAGE_HEIGHT*2))
the pixel format: ARGB1555
*/
usleep(4*1000*1000);
#if 1
var.xres_virtual = 48;
var.yres_virtual = 48;
var.xres = 48;
var.yres = 48;
#else
var.xres_virtual = 1280;
var.yres_virtual = 720*2;
var.xres = 1280;
var.yres = 720;
#endif
var.transp= g_a16;
var.red = g_r16;
var.green = g_g16;
var.blue = g_b16;
var.bits_per_pixel = 16;
var.activate = FB_ACTIVATE_NOW;
#if 1
/* 6. set the variable screeninfo */
if (ioctl(pstInfo->fd, FBIOPUT_VSCREENINFO, &var) < 0)
{
printf("Put variable screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
#endif
/* 7. get the fix screen info */
if (ioctl(pstInfo->fd, FBIOGET_FSCREENINFO, &fix) < 0)
{
printf("Get fix screen info failed!\n");
close(pstInfo->fd);
return HI_NULL;
}
u32FixScreenStride = fix.line_length; /*fix screen stride*/
/* 8. map the physical video memory for user use */
pShowScreen = mmap(HI_NULL, fix.smem_len, PROT_READ|PROT_WRITE, MAP_SHARED, pstInfo->fd, 0);
if(MAP_FAILED == pShowScreen)
{
printf("mmap framebuffer failed!\n");
close(pstInfo->fd);
return HI_NULL;
}[/code]
fb3对应鼠标层,可是在设置可变参数时候出错了,提示:Put variable screen info failed!
我的用法是不是不对,思路就是直接操作鼠标层的显存。
我来回答
回答1个
时间排序
认可量排序
认可0
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2016-04-18 15:54:15
-
2019-06-19 11:43:32
-
2018-11-16 10:49:36
-
2018-01-10 15:13:07
-
2016-12-16 09:45:34
-
2019-01-04 09:46:46
-
2017-06-06 14:29:08
-
2016-04-19 19:15:11
-
2014-11-05 10:27:28
-
2020-08-27 17:43:25
-
2015-01-19 18:54:37
-
2024-07-16 14:03:30
-
2017-11-30 11:05:17
-
2021-01-06 15:42:52
-
2015-09-21 15:45:59
-
2015-08-06 16:31:00
-
2018-11-26 16:58:00
-
2019-01-16 16:40:35
-
2020-10-27 10:19:30
无更多相似问答 去提问
点击登录
-- 积分
-- 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币)
取消
确认