<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 20, 2019 at 6:07 PM Zebediah Figura <<a href="mailto:z.figura12@gmail.com">z.figura12@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 4/20/19 10:56 AM, Damjan Jovanovic wrote:<br>
> <br>
> <br>
> On Sat, Apr 20, 2019 at 5:44 PM Zebediah Figura <<a href="mailto:z.figura12@gmail.com" target="_blank">z.figura12@gmail.com</a> <br>
> <mailto:<a href="mailto:z.figura12@gmail.com" target="_blank">z.figura12@gmail.com</a>>> wrote:<br>
> <br>
>     On 4/20/19 10:31 AM, Damjan Jovanovic wrote:<br>
>      ><br>
>      ><br>
>      > On Sat, Apr 20, 2019 at 4:52 PM Zebediah Figura<br>
>     <<a href="mailto:z.figura12@gmail.com" target="_blank">z.figura12@gmail.com</a> <mailto:<a href="mailto:z.figura12@gmail.com" target="_blank">z.figura12@gmail.com</a>><br>
>      > <mailto:<a href="mailto:z.figura12@gmail.com" target="_blank">z.figura12@gmail.com</a> <mailto:<a href="mailto:z.figura12@gmail.com" target="_blank">z.figura12@gmail.com</a>>>> wrote:<br>
>      ><br>
>      >     On 4/20/19 8:15 AM, Damjan Jovanovic wrote:<br>
>      >      > Recent changes to qcap/v4l.c resulted in the removal of mmap()<br>
>      >      > for v4l2 devices, but read() is optional for device<br>
>     drivers and<br>
>      >      > some don't support it. This isn't a major problem with the<br>
>      >      > presense of libv4l2 though, as it can emulate read() on top of<br>
>      >      > mmap(). However the code checks whether the device can read(),<br>
>      >      > and if not, doesn't even try to use it, even though it can.<br>
>      >      ><br>
>      >      > Fix this by only warning that read() is being emulated, and<br>
>      >      > continuing with libv4l2 if available.<br>
>      >      ><br>
>      >      > Also clarifies the logging.<br>
>      >      ><br>
>      >      > Signed-off-by: Damjan Jovanovic <<a href="mailto:damjan.jov@gmail.com" target="_blank">damjan.jov@gmail.com</a><br>
>     <mailto:<a href="mailto:damjan.jov@gmail.com" target="_blank">damjan.jov@gmail.com</a>><br>
>      >     <mailto:<a href="mailto:damjan.jov@gmail.com" target="_blank">damjan.jov@gmail.com</a> <mailto:<a href="mailto:damjan.jov@gmail.com" target="_blank">damjan.jov@gmail.com</a>>>><br>
>      >      > ---<br>
>      >      >   dlls/qcap/v4l.c | 13 ++++++++-----<br>
>      >      >   1 file changed, 8 insertions(+), 5 deletions(-)<br>
>      >      ><br>
>      >      ><br>
>      >      ><br>
>      ><br>
>      >     This doesn't seem right; libv4l2 should massage the result of<br>
>      >     VIDIOC_QUERYCAP to include V4L2_CAP_READWRITE. See<br>
>      >   <br>
>       <<a href="https://git.linuxtv.org/v4l-utils.git/tree/lib/libv4l2/libv4l2.c#n1210" rel="noreferrer" target="_blank">https://git.linuxtv.org/v4l-utils.git/tree/lib/libv4l2/libv4l2.c#n1210</a>>.<br>
>      ><br>
>      ><br>
>      > On FreeBSD 11.2 with libv4l-1.6.3_4, that is certainly NOT the<br>
>     case. It<br>
>      > could be a newer or not yet released feature.<br>
>      ><br>
>      ><br>
>      ><br>
> <br>
>     It's been the case since libv4l2 0.5:<br>
>     <<a href="https://git.linuxtv.org/v4l-utils.git/commit/lib/libv4l2/libv4l2.c?id=0215f2ac08c3ad0dc66ad8036f4e186a5e8f56d6" rel="noreferrer" target="_blank">https://git.linuxtv.org/v4l-utils.git/commit/lib/libv4l2/libv4l2.c?id=0215f2ac08c3ad0dc66ad8036f4e186a5e8f56d6</a>><br>
> <br>
>     If FreeBSD is using 1.6.3, then I think something else is wrong. Are<br>
>     you<br>
>     sure that libv4l2 is actually being loaded?<br>
> <br>
> <br>
> int v4l2_ioctl(int fd, unsigned long int request, ...)<br>
> {<br>
> ...<br>
>          if (devices[index].convert == NULL)<br>
>                  goto no_capture_request;<br>
> <br>
> <your code nippet from above><br>
> <br>
> no_capture_request:<br>
> <br>
> <br>
> <br>
> So the code that would set that flag, is skipped if the .convert field <br>
> is NULL.<br>
> <br>
> When is it NULL?<br>
> <br>
> <br>
> <br>
<br>
If my reading of the code is correct, only when v4l2_fd_open() is called <br>
manually with V4L2_DISABLE_CONVERSION. Obviously we don't do that.<br>
<br>
Perhaps setting LIBV4L2_LOG_FILENAME might give some hints as to what's <br>
going wrong?<br>
<br>
<br></blockquote><div><br></div><div>int v4l2_fd_open(int fd, int v4l2_flags)<br>{</div><div>...<br></div><div><The actual ioctl() returns cap.capabilities = 0x84a00001, cap.device_caps = 0x04a00000></div><div></div><div><br></div><div>        if (cap.capabilities & V4L2_CAP_DEVICE_CAPS)<br>                cap.capabilities = cap.device_caps;<br>        if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) ||<br>            !(cap.capabilities & (V4L2_CAP_STREAMING | V4L2_CAP_READWRITE))) {<br>                goto no_capture;<br>        }<br><br></div><div><div>0x000000001 = V4L2_CAP_VIDEO_CAPTURE <br></div><div>0x00200000 = V4L2_CAP_EXT_PIX_FORMAT<br></div><div>0x00800000 = V4L2_CAP_META_CAPTURE<br></div><div>0x040000000 = V4L2_CAP_STREAMING<br></div><div>0x800000000 = V4L2_CAP_DEVICE_CAPS</div><div class="gmail-adL"><br></div><div class="gmail-adL">So cap.capabilities have all those flags set, but cap.device_caps lacks V4L2_CAP_VIDEO_CAPTURE.</div><div class="gmail-adL">cap.capabilities is overwritten by cap.device_caps, thus V4L2_CAP_VIDEO_CAPTURE is cleared.</div><div class="gmail-adL">Since libv4l2 only manages devices with V4L2_CAP_VIDEO_CAPTURE set, and that flag is now missing, the first condition in the next "if" takes the goto, and .convert remains NULL.<br></div><div class="gmail-adL">With .convert NULL, libv4l2 no longer manages the device, so communication is directly between Wine and kernel.</div><div class="gmail-adL">Therefore the V4L2_CAP_READWRITE flag is not going to be set in v4l2_ioctl(), and libv4l2 cannot be made to do any conversions for us.</div><div class="gmail-adL"></div><div class="gmail-adL">But then again we can't use a device without V4L2_CAP_VIDEO_CAPTURE either, libv4l2 or not.</div><div class="gmail-adL"><br></div><div class="gmail-adL">I think the fundamental problem is that Wine is trying to use /dev/video1 which is broken, due to a bug in devenum that overwrites the working /dev/video0 registry entry with it, because their descriptions are the same.<br></div></div><div><br></div><div> </div></div></div></div></div></div>