在线时间61 小时
UID3091481
注册时间2015-1-12
NXP金币25
TA的每日心情 | 无聊 2021-5-27 14:51 |
---|
签到天数: 2 天 连续签到: 1 天 [LV.1]初来乍到
中级会员
 
- 积分
- 298
- 最后登录
- 2025-7-3
|
本帖最后由 烟雨梦 于 2015-11-2 09:20 编辑
v4l2采集图像ov5642模组,15FPS 2048*1536,抓图过程中一直有概率失败,有时抓一两张图就报错有时抓个十几张图报错串口打印信息如下:
In MVC:mxc_streamoff
MVC: In mxc_free_frame_buf
In MVC:mxc_allocate_frame_buf - size=4718592
case VIDIOC_QUERYBUF
In MVC:mxc_v4l2_buffer_status
In MVC:mxc_mmap
pgoff=0x91800, start=0x42854000, end=0x42cd4000
case VIDIOC_QUERYBUF
In MVC:mxc_v4l2_buffer_status
In MVC:mxc_mmap
pgoff=0x92800, start=0x42cd4000, end=0x43154000
case VIDIOC_STREAMON
In MVC:mxc_streamon
padnavigator: page allocation failure. order:11, mode:0xd1
[<8002d4ac>] (unwind_backtrace+0x0/0xf0) from [<80085090>] (__alloc_pages_nodemask+0x500/0x568)
[<80085090>] (__alloc_pages_nodemask+0x500/0x568) from [<8002de70>] (__dma_alloc+0xec/0x2a4)
[<8002de70>] (__dma_alloc+0xec/0x2a4) from [<8002e0a0>] (dma_alloc_coherent+0x54/0x60)
[<8002e0a0>] (dma_alloc_coherent+0x54/0x60) from [<7f006180>] (csi_enc_enabling_tasks+0x48/0x328 [ipu_csi_enc])
[<7f006180>] (csi_enc_enabling_tasks+0x48/0x328 [ipu_csi_enc]) from [<7f01e354>] (mxc_streamon+0x94/0x1b8 [mxc_v4l2_capture])
[<7f01e354>] (mxc_streamon+0x94/0x1b8 [mxc_v4l2_capture]) from [<7f0208d8>] (mxc_v4l_do_ioctl+0x8dc/0x1310 [mxc_v4l2_capture])
[<7f0208d8>] (mxc_v4l_do_ioctl+0x8dc/0x1310 [mxc_v4l2_capture]) from [<8028d5d4>] (video_usercopy+0x1e4/0x310)
[<8028d5d4>] (video_usercopy+0x1e4/0x310) from [<8028ca14>] (v4l2_ioctl+0x44/0x4c)
[<8028ca14>] (v4l2_ioctl+0x44/0x4c) from [<800b9194>] (vfs_ioctl+0x7c/0xac)
[<800b9194>] (vfs_ioctl+0x7c/0xac) from [<800b97e4>] (do_vfs_ioctl+0x52c/0x57c)
[<800b97e4>] (do_vfs_ioctl+0x52c/0x57c) from [<800b9868>] (sys_ioctl+0x34/0x54)
[<800b9868>] (sys_ioctl+0x34/0x54) from [<80028f80>] (ret_fast_syscall+0x0/0x30)
Mem-info:
DMA per-cpu:
CPU 0: hi: 42, btch: 7 usd: 0
Normal per-cpu:
CPU 0: hi: 18, btch: 3 usd: 16
active_anon:5734 inactive_anon:365 isolated_anon:32
active_file:2122 inactive_file:4730 isolated_file:0
unevictable:0 dirty:1 writeback:0 unstable:0
free:20038 slab_reclaimable:661 slab_unreclaimable:978
mapped:4054 shmem:313 pagetables:174 bounce:0
DMA free:73184kB min:10356kB low:12944kB high:15532kB active_anon:3636kB inactive_anon:4kB active_file:780kB inactive_file:244kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:130048kB mlocked:0kB dirty:4kB writeback:0kB mapped:248kB shmem:4kB slab_reclaimable:112kB slab_unreclaimable:32kB kernel_stack:8kB pagetables:36kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 63 63 63
Normal free:6968kB min:5176kB low:6468kB high:7764kB active_anon:19300kB inactive_anon:1456kB active_file:7708kB inactive_file:18676kB unevictable:0kB isolated(anon):128kB isolated(file):0kB present:65024kB mlocked:0kB dirty:0kB writeback:0kB mapped:15968kB shmem:1248kB slab_reclaimable:2528kB slab_unreclaimable:3880kB kernel_stack:624kB pagetables:660kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0 0
DMA: 72*4kB 54*8kB 37*16kB 38*32kB 30*64kB 27*128kB 23*256kB 16*512kB 12*1024kB 7*2048kB 4*4096kB 1*8192kB 0*16384kB = 73184kB
Normal: 50*4kB 24*8kB 31*16kB 20*32kB 5*64kB 4*128kB 18*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB 0*8192kB 0*16384kB = 6968kB
7165 total pagecache pages
0 pages in swap cache
Swap cache stats: add 0, delete 0, find 0/0
Free swap = 0kB
Total swap = 0kB
49152 pages of RAM
20164 free pages
1761 reserved pages
1508 slab pages
8308 pages shared
0 pages swap cached
ERROR: v4l2 capture: Allocate dummy frame failed.
In MVC:mxc_poll
case VIDIOC_G_FMT
In MVC: mxc_v4l2_g_fmt type=1
type is V4L2_BUF_TYPE_VIDEO_CAPTURE
End of mxc_v4l2_g_fmt: v2f pix widthxheight 2048 x 1536
End of mxc_v4l2_g_fmt: crop_bounds widthxheight 2048 x 1536
End of mxc_v4l2_g_fmt: crop_defrect widthxheight 800 x 600
End of mxc_v4l2_g_fmt: crop_current widthxheight 2048 x 1536
[355] 高清************************
[356] video_config_vi stream on
[357] video_config_vi image size 4718592
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[358] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[359] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
get key: 0x69
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[360] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[361] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
closeTipsDlg now
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[362] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[363] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[364] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[365] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[366] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expired fd = 16
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
[367] vi_get_frame ch[0] VIDIOC_DQBUF failed errno:62 description:Timer expi
困扰了好几天了,各位大神帮忙分析下,谢谢!
config.out_width = 2048;
out_height = 1536;
config.frm_rate = 15;
config.buf_count = 2;
config.capturemode = 3;
上面是传给video_config_vi中config参数的配置,ch是通道号
static int video_config_vi( int ch, VIDEO_VI_CONF *config )
#define fd_v4l (g_video_vi[ch].dev.fd)
#define v4l_device (g_video_vi[ch].dev.dev_name)
int i , ret ;
struct v4l2_format fmt;
struct v4l2_streamparm parm;
struct v4l2_crop crop;
struct v4l2_buffer buf;
enum v4l2_buf_type type;
int input = VI_DEV_NO;
int g_TVersion = APP_get_tserial_version();
parm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
parm.parm.capture.timeperframe.numerator = 1;
parm.parm.capture.timeperframe.denominator = config->frm_rate;
parm.parm.capture.capturemode = config->capturemode; //<capture mode, 0-low resolution, 1-high resolution>
if (ioctl(fd_v4l, VIDIOC_S_PARM, &parm) < 0)
{
printf("video_config_vi VIDIOC_S_PARM failed\n");
return -1;
}
if (ioctl(fd_v4l, VIDIOC_S_INPUT, &input) < 0)
{
printf("video_config_vi VIDIOC_S_INPUT failed\n");
return -1;
}
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(fd_v4l, VIDIOC_G_CROP, &crop) < 0)
{
printf("video_config_vi VIDIOC_G_CROP failed\n");
return -1;
}
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
LOG_PRINTF("video_config_vi crop l %d, t %d, w %d, h %d\n", crop.c.left, crop.c.top,
crop.c.width, crop.c.height);
if (ioctl(fd_v4l, VIDIOC_S_CROP, &crop) < 0)
{
printf("video_config_vi VIDIOC_S_CROP failed\n");
return -1;
}
//设置视频格式
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
fmt.fmt.pix.width = config->out_width;
fmt.fmt.pix.height = config->out_height;
fmt.fmt.pix.bytesperline = config->out_width;
fmt.fmt.pix.priv = 0;
fmt.fmt.pix.sizeimage = 0;
if (ioctl(fd_v4l, VIDIOC_S_FMT, &fmt) < 0)
{
printf("video_config_vi set format failed\n");
return 0;
}
LOG_PRINTF("video_config_vi --crop l %d, t %d, w %d, h %d\n", crop.c.left,
crop.c.top, crop.c.width, crop.c.height);
g_video_vi[ch].width = crop.c.width ;
g_video_vi[ch].height = crop.c.height ;
//分配内存
struct v4l2_requestbuffers req;
memset(&req, 0, sizeof(req));
req.count = config->buf_count;
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
req.memory = V4L2_MEMORY_MMAP;
if (ioctl(fd_v4l, VIDIOC_REQBUFS, &req) < 0)
{
LOG_PRINTF("video_config_vi v4l_capture_setup: VIDIOC_REQBUFS failed\n");
return 0;
}
if(config->out_width==2048)
config->buf_count=req.count;
//将上面分配的内存转换成各个buf的虚拟地址
for (i = 0; i < config->buf_count; i++)
{
memset(&buf, 0, sizeof(buf));
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.index = i;
if (ioctl(fd_v4l, VIDIOC_QUERYBUF, &buf) < 0) {
LOG_PRINTF("video_config_vi VIDIOC_QUERYBUF error\n");
return -1;
}
g_video_vi[ch].frame_buf.len = buf.length ;
g_video_vi[ch].frame_buf.offset = (size_t)buf.m.offset ;
g_video_vi[ch].frame_buf.start = mmap(NULL,
buf.length,
PROT_READ |PROT_WRITE,
MAP_SHARED, fd_v4l,
buf.m.offset);
memset(g_video_vi[ch].frame_buf.start, 0xFF,
g_video_vi[ch].frame_buf.len);
memcpy( (char *)&g_video_vi[ch].frame_buf.buf, (char *)&buf, sizeof(buf) );
g_video_vi[ch].frame_buf.dev = &g_video_vi[ch].dev ;
}
//把buf从缓冲中读过来,供vi使用
for (i = 0; i < config->buf_count; i++)
{
memset(&buf, 0, sizeof(buf));
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = i;
buf.m.offset = g_video_vi[ch].frame_buf.offset;
if (ioctl(fd_v4l, VIDIOC_QBUF, &buf) < 0)
{
LOG_PRINTF("video_config_vi VIDIOC_QBUF error\n");
return -1;
}
}
g_video_vi[ch].buf_count = config->buf_count ;
//开启视频设备
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
ret = ioctl(fd_v4l, VIDIOC_STREAMON, &type) ;
if ( ret < 0)
{
LOG_PRINTF("video_config_vi VIDIOC_STREAMON error[%x]\n",ret);
return -1;
}
LOG_PRINTF("video_config_vi stream on\n");
//获取视频图像大小
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(fd_v4l, VIDIOC_G_FMT, &fmt) < 0)
{
LOG_PRINTF("video_config_vi get format failed\n");
return -1;
}
g_video_vi[ch].frame_buf.frame_size = fmt.fmt.pix.sizeimage;
LOG_PRINTF("video_config_vi image size %d", g_video_vi[ch].frame_buf.frame_size);
return 0 ;
#undef v4l_device
#undef fd_v4l
}
|
|