[Query] Clearing V4L2_BUF_FLAG_MAPPED flag on a videobuf2 buffer after munmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

So, I've been trying to test the REQBUFS(0) from libv4l2 with my
omap4iss device, and I've hit the following problem:

So, I basically do the basic IOCTL sequence:

open(/dev/video0)
VIDIOC_QUERYCAP
VIDIOC_ENUM_FMT
VIDIOC_ENUM_FRAMESIZES
VIDIOC_ENUM_FRAMEINTERVALS
VIDIOC_S_FMT (w = 640, h = 480, pixfmt = V4L2_PIX_FMT_YUYV, type =
V4L2_BUF_TYPE_VIDEO_CAPTURE)
VIDIOC_S_PARM (capability = V4L2_CAP_TIMEPERFRAME, timeperframe = 1/30)
VIDIOC_REQBUFS (count = 6, MMAP)
  Loop for 6 times:
    VIDIOC_QUERYBUF (to get buff length)
    mmap(length)
  Loop for 6 times:
    VIDIOC_QBUF(index = 0-5)
VIDIOC_STREAMON
  (Loop to poll, DQBUF and QBUF the same buffer)
VIDIOC_STREAMOFF
  Loop for 6 times:
    munmap()
VIDIOC_REQBUFS (count = 0, MMAP)

... And in this call, it fails on libv4l2 level, since it checks all
buffers to see
if they're mapped, by doign QUERYBUF on each index, and checking for
"V4L2_BUF_FLAG_MAPPED" flag.

Now, digging deep into how this flag is populated, I noticed the following:

I notice that in "drivers/media/video/videobuf2-core.c", inside:
vb2_querybuf()
  -> __fill_v4l2_buffer()

There's this condition:
	if (vb->num_planes_mapped == vb->num_planes)
		b->flags |= V4L2_BUF_FLAG_MAPPED;

The problem is that, even if i did a munmap, the count of vb->num_planes_mapped
is not decreased... :/

How's this supposed to work? Do I need to do something in my driver to avoid
this flag to be set?

Regards,
Sergio
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux