Hi Dmitry, On Wed, Oct 31, 2018 at 6:46 PM Hans Verkuil <hverkuil@xxxxxxxxx> wrote: > > On 10/30/2018 03:02 PM, Dmitry Vyukov wrote: [snip] > > > > Do I understand it correctly that when a process opens /dev/video* or > > /dev/media* it gets a private instance of the device? In particular, > > if several processes test this in parallel, will they collide? Or they > > will stress separate objects? > > It actually depends on the driver. M2M devices will give you a private > instance whenever you open it. Others do not, but you can call most ioctls > in parallel. But after calling REQBUFS or CREATE_BUFS the filehandle that > called those ioctls becomes owner of the device until the buffers are > released. So other filehandles cannot do any streaming operations (EBUSY > will be returned). FWIW, you can query whether the device is M2M or not by VIDIOC_QUERYCAP [1]. The capabilities field would have V4L2_CAP_VIDEO_M2M or V4L2_CAP_VIDEO_M2M_MPLANE set for M2M devices. [1] https://www.kernel.org/doc/html/latest/media/uapi/v4l/vidioc-querycap.html Best regards, Tomasz