[i.MX]

i.MX6Q +PCIE+TW68 驱动显示等问题

[复制链接]
4839|8
手机看帖
扫描二维码
随时随地手机跟帖
lisim51|  楼主 | 2015-11-16 12:19 | 显示全部楼层 |阅读模式
我现在用IMX6Q+linux3.0.15 +PCIE+TW6865 做四个摄像头的采集,用的明远智睿的开发板,并参考明远智睿开发板的patch和飞思卡尔的四路环视的方案的patch打了补丁。在运行gst-launch v4l2src device=/dev/video0  ! 'video/x-raw-yuv, format=(fourcc)UYVY' ! mfw_isink disp-width=720 disp-height=480 & 命令式,可以正常的采集显示。但是用飞思卡尔提供的./mxc_v4l2_tvin.out -x 0 -ot 0 -ol 512 -ow 512 -oh 384 -m 2 & 命令执行时,出现错误。(注:mxc_v4l2_tvin.out 是飞思卡尔提供的经过修改的程序)。大侠帮忙分析一下是什么原因?我自己看打印出来的提示信息,mxc_v4l2_tvin.out命令执行时,分配用户内存出错。那么这两种命令在驱动调用方面有什么机制性的区别吗?能不能用gst-launch实现mxc_v4l2_tvin的功能?我的主要目的是得到四副图像的信息,放到buffer里进行后续图像处理。附一,gst-launch可执行的提示信息:
                                                                           gst-launch v4l2src device=/dev/video0  ! 'video/x-raw-
<launch v4l2src device=/dev/video0  ! 'video/x-raw-y                         uv, format=(fourcc)UYVY'
</video0  ! 'video/x-raw-yuv, format=(fourcc)UYVY' !                          mfw_isink disp-width=720
<v, format=(fourcc)UYVY' ! mfw_isink disp-width=720                          disp-height=480 &
[1] 3225
root@myzr /unit_tests$ MAX resolution 1024x600
MFW_GST_ISINK_PLUGIN 3.0.7 build on Jan 22 2015 12:41:31.
Setting pipeline to PAUSED ... @@@@@ video_open   minor=0  type=vid-cap  openned:0

video_open ID:1  dmaCH 0   request 1
fh kzalloc  successful!
60HZ VideoStandardDetect DMA_nCH 0  regDW 0x68  dwReg7

&&&&&&&&&&&&&&&  0Xe9fed000  open /dev/video0  minor0 type=vid-cap  video_opened=0x1  k:1   tvnorm::NTSC  0
????????????????????? CHECK fourcc
open minor=0  fh->DMA_nCH= 0x0 type=vid-cap
v4l2_prio_open ()  successful!
videobuf_queue_sg_init ()  successful!
TW68__querycap   QP  CALLED   !
TW68_s__querycap   GO   !
TW68_enum_input   i=e231be48  n:0 CALLED   !
TW68_enum_input   i=e231be48  n:1 CALLED   !
TW68_enum_input   i=e231be48  n:2 CALLED   !
TW68_enum_input   i=e231be48  n:3 CALLED   !
TW68_enum_input   i=e231be48  n:4 CALLED   !
TW68_g_std, _g_std v4l2_std_id =255
========TW68__enum_fmt_vid_cap  description 15 bpp RGB, le
========TW68__enum_fmt_vid_cap  description 16 bpp RGB, le
========TW68__enum_fmt_vid_cap  description 4:2:2 packed, YUYV
========TW68__enum_fmt_vid_cap  description 4:2:2 packed, UYVY
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 56595559
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 56595559
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
TW68 _try_fmt_vid_cap fmt::pixelformat 56595559  field: 4 _fmt: width 1  height 1
TW68 _try_fmt_vid_cap: width 48  height 32      720  480
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 56595559
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 56595559
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
TW68 _try_fmt_vid_cap fmt::pixelformat 56595559  field: 4 _fmt: width 32768  height 32768
TW68 _try_fmt_vid_cap: width 720  height 480      720  480
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 59565955
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
????????????????????? CHECK fourcc
Pipeline is live and does not neeTW68 input  nId:0   try_fmt:: 59565955
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
d PREROLL ...
TW68 _try_fmt_vid_cap fmt::pixelformat 59565955  field: 4 _fmt: width 1  height 1
TW68 _try_fmt_vid_cap: width 48  height 32      720  480
????????????????????? CHECK fourcc
Setting pipeline to PLAYING ...TW68 input  nId:0   try_fmt:: 59565955

TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
????????????????????? CHECK fourcc
New clock: GstSystemClockTW68 input  nId:0   try_fmt:: 59565955
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480

TW68 _try_fmt_vid_cap fmt::pixelformat 59565955  field: 4 _fmt: width 32768  height 32768
TW68 _try_fmt_vid_cap: width 720  height 480      720  480
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 50424752
TW68 fmt:: not YUV422 !!!!!!!!!!!!!!!!!!!
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 50424752
TW68 fmt:: not YUV422 !!!!!!!!!!!!!!!!!!!
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 50424752
TW68 fmt:: not YUV422 !!!!!!!!!!!!!!!!!!!
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 50424752
TW68 fmt:: not YUV422 !!!!!!!!!!!!!!!!!!!
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 4f424752
TW68 fmt:: not YUV422 !!!!!!!!!!!!!!!!!!!
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 4f424752
TW68 fmt:: not YUV422 !!!!!!!!!!!!!!!!!!!
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 4f424752
TW68 fmt:: not YUV422 !!!!!!!!!!!!!!!!!!!
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 4f424752
TW68 fmt:: not YUV422 !!!!!!!!!!!!!!!!!!!
_g_fmt_vid_cap: width 704  height 480
~~~~~~~~~~~~~TW68_s_fmt_vid_cap: 59565955  W:704 H:480  field:4
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 59565955
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
TW68 _try_fmt_vid_cap fmt::pixelformat 59565955  field: 4 _fmt: width 720  height 480
TW68 _try_fmt_vid_cap: width 720  height 480      720  480
????????????????????? CHECK fourcc
~~~~~~~~~~~~~TW68_s_fmt_vid_cap: fh->fmt   W:720 H:480  field:4
******** buffer_setup ####  CH0::   dwReg2: 0x8055500   deReg 0x8015400  
DecoderResize() :: nId:0, HDELAY=0xE,  H:240  W:720   HW 80F002D0  HDELAY0 E
********#### FM CH0::   dwReg2: 0x8055500   deReg 0x8015400  H:240 W:1440
#### buffer_setup:: W:720 H:480  frame size: 691200,  gbuffers: 2, ChannelOffset: 128  field pgn: 85  m_StartIdx 0  m_EndIdx 85
********#### buffer_setup CH0::  m_StartIdx 0X0  pgn85  m_dwCHConfig: 0x8015400   dwReg: 0x8015400   
#### buffer_setup:: VIDEO_SIZE_REG: 0x41,   0x80F002D0
********#### buffer_setup CH0::   dwReg2: 0x8055500   deReg 0x8015400  
res: get 2
TW6869[0]: videobuf_streamon(TW68_queue(fh)) DMA 0  q->streaming:1  streaming:0.
hwbuf allocator zone(692224) created
VS0 created. in fmt[UYVY] win(0,0-720,480:720x480) out win(0,0-720,480:720x480)
set deinterlace mode 0



附录2   mxc_v4l2_tvin.out 命令错误的提示信息:

./mxc_v4l2_tvin_liyq.out -x 0 -ot 0 -ol 0 -ow 512 -oh
<c_v4l2_tvin_liyq.out -x 0 -ot 0 -ol 0 -ow 512 -oh 3                         84 -m 2 &
[1] 3186
root@myzr /unit_tests$  @@@@@ video_open   minor=0  type=vid-cap  openned:0
video_open ID:1  dmaCH 0   request 1
fh kzalloc  successful!
60HZ VideoStandardDetect DMA_nCH 0  regDW 0x68  dwReg7

&&&&&&&&&&&&&&&  0Xe9fed000  open /dev/video0  minor0 type=vid-cap  video_opened=0x1  k:1   tvnorm::NTSC  0
????????????????????? CHECK fourcc
open minor=0  fh->DMA_nCH= 0x0 type=vid-cap
v4l2_prio_open ()  successful!
videobuf_queue_sg_init ()  successful!
TW68__querycap   QP  CALLED   !
TW68_s__querycap   GO   !
TW68_enum_input   i=e2265e48  n:0 CALLED   !
TW68_enum_input   i=e2265e48  n:1 CALLED   !
TW68_enum_input   i=e2265e48  n:2 CALLED   !
TW68_enum_input   i=e2265e48  n:3 CALLED   !
TW68_enum_input   i=e2265e48  n:4 CALLED   !
TW68_g_std, _g_std v4l2_std_id =255
~~~~~~~~~~~~~TW68_s_fmt_vid_cap: 59565955  W:704 H:480  field:4
????????????????????? CHECK fourcc
TW68 input  nId:0   try_fmt:: 59565955
TW68 _try_fmt_vid_cap  tvnormf 0 ->name PAL  id FF   maxh 480
TW68 _try_fmt_vid_cap fmt::pixelformat 59565955  field: 4 _fmt: width 720  height 480
TW68 _try_fmt_vid_cap: width 720  height 480      720  480
????????????????????? CHECK fourcc
~~~~~~~~~~~~~TW68_s_fmt_vid_cap: fh->fmt   W:720 H:480  field:4
_g_fmt_vid_cap: width 720  height 480
VIDIOC_G_FMT failed ******** buffer_setup ####  CH0::   dwReg2: 0x8055500   deReg 0x8015400  

DecoderResize() :: nId:0, HDELAY=0xE,  H:240  W:720   HW 80F002D0  HDELAY0 E
********#### FM CH0::   dwReg2: 0x8055500   deReg 0x8015400  H:240 W:1440
#### buffer_setup:: W:720 H:480  frame size: 691200,  gbuffers: 4, ChannelOffset: 128  field pgn: 85  m_StartIdx 0  m_EndIdx 85
********#### buffer_setup CH0::  m_StartIdx 0X0  pgn85  m_dwCHConfig: 0x8015400   dwReg: 0x8015400   
#### buffer_setup:: VIDEO_SIZE_REG: 0x41,   0x80F002D0
VIDIOC_QBUF error ********#### buffer_setup CH0::   dwReg2: 0x8055500   deReg 0x8015400  
USERPTR is currently not supported
buffer_prepare  OOPS
free_buffer, state: 0
TW6869[0]:  DMA_nCH:0   videobuf_streamoff delete video timeout   
res_free  res: put 2
TW6869[0]:0 videobuf_streamoff q->streaming:0  return err:ffffffea

start_capturing failed
video_release ()  CALLED  minor:0  DMA_nCH: 0    video_fieldcount 0x0 !
video_release  CALLED   !  dev->video_opened: 0x0
kfree(fh->cap.read_buf);  CALLED   !
videobuf_mmap_free  CALLED   !
v4l2_prio_close  CALLED   HZ:100  !
video_release   kfree(fh);  CALLED   !




相关帖子

lisim51|  楼主 | 2015-11-16 16:44 | 显示全部楼层
看tw68-video.c中的代码,应该是下面这部分有问题,内核内存转到用户内存有问题?应该怎么解决?

If I understand correctly, the videobuf_iolock function is responsible for
+                mapping user pages to kernel. This works fine as long as user application allocates
+                memory/buffer using some standard API (malloc/memalign).
+
+                But it fails where; user application has allocated memory/buffer using ioremap
+                from another driver. The use case scenario is something -
+
+                        - Open V4L2 device (which supports scatter gather DMA)
+                        - Configure the parameters (especially .memory=V4L2_MEMORY_USERPTR)
+                        - Request and query the buffer
+                        - open another device which will be responsible for allocating memory
+                                Either using ioremap/dma_alloc_coherent/get_free_pages
+                        - Queue the buffers with buffer address received from previous step
+
+                Here it internally calls drv_prepare function, which call videobuf_iolock API for mapping the user pages to kernel and will create scatter-gather (dma->sglist) list. But this API returns from videobuf_dma_init_user_locked with -EFAULT.
+
+                I found the get_user_pages returns due to flag VM_IO and VM_PFNMAP for the corresponding vma.
+
+                Any suggestions on how can I achieve this?
+        */
+
+                err = videobuf_iolock(q,&buf->vb,&dev->ovbuf);  //
+                if (err< 0)
+                        goto oops;

使用特权

评论回复
FSL_TICS_Rita| | 2015-11-19 15:22 | 显示全部楼层
楼主你好,关于帖中的问题,你可以看到我们官网论坛上有相关的patch
https://community.freescale.com/docs/DOC-95143
https://community.freescale.com/docs/DOC-94541
同时你也看到我们的工程师推荐使用 gst-launch。你提到的./mxc_v4l2_tvin.out是unit_test中用来测试板子好使不好使的。这里还是建议你使用如下的:
please use this V4L2 program:

gst-launch v4l2src device=/dev/video0  ! 'video/x-raw-yuv, format=(fourcc)UYVY' ! mfw_isink disp-width=960 disp-height=540 &

gst-launch v4l2src device=/dev/video1  ! 'video/x-raw-yuv, format=(fourcc)UYVY' ! mfw_isink disp-width=960 disp-height=540 axis-left=960 &

gst-launch v4l2src device=/dev/video2  ! 'video/x-raw-yuv, format=(fourcc)UYVY' ! mfw_isink disp-width=960 disp-height=540 axis-top=540  &

gst-launch v4l2src device=/dev/video3  ! 'video/x-raw-yuv, format=(fourcc)UYVY' ! mfw_isink disp-width=960 disp-height=540 axis-top=540 axis-left=960 &

使用特权

评论回复
奇迹蜗牛| | 2015-11-21 09:44 | 显示全部楼层
看到你关于IMX6与四路摄像头的帖子,想请教一下这方面的知识,小弟也在弄这个。我遇到一个问题是,PCIE线连接板子和TW68之后,板子上电都打不开了。是怎么回事呀?谢谢啦

使用特权

评论回复
李香兰| | 2015-11-21 17:29 | 显示全部楼层
这个看着就很复杂啊

使用特权

评论回复
mini1986| | 2015-11-24 21:12 | 显示全部楼层
好帖,强烈地关注下,学习学习......

使用特权

评论回复
lishilong988917| | 2015-12-3 18:02 | 显示全部楼层
这儿有飞思卡尔的工程师麽?我也遇到了这个问题!当打上了论坛上的patch之后,应用程序无法使用V4L2_MEMORY_USERPTR的模式来采集视频,报错提示:USERPTR is currently not supported buffer_prepare  OOPS !望解答!

使用特权

评论回复
zhanzheng5350| | 2015-12-3 18:40 | 显示全部楼层
mark

使用特权

评论回复
hanjiangxuezhi| | 2016-4-25 09:34 | 显示全部楼层
FSL_TICS_Rita 发表于 2015-11-19 15:22
楼主你好,关于帖中的问题,你可以看到我们官网论坛上有相关的patch
https://community.freescale.com/docs ...

我现在使用gst-launch 这四条命令实现了图像的显示,如何使用gst-launch 命令实现录像和拍照?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

3

帖子

0

粉丝