diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2020-06-22 18:51:20 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2020-06-25 23:41:29 +0900 |
commit | 9076e88fc3ca3d3ffbd1b0d80542db96708614e7 (patch) | |
tree | 9c57889d22b6b868519b3cd5644a1df0001dcb8e /src/qcam/assets/feathericons/home.svg | |
parent | edacd07c5e9a5080628e7cc4d057674f7f742ead (diff) |
v4l2: v4l2_compat: Support multiple open
Previously, since we acquired the libcamera camera upon open(), it was
impossible to support multiple open, as any subsequent opens would
return error because the camera would already be acquired.
To fix this, we first initialize the camera in the first call to
V4L2CameraProxy::open(), just to heat up the stream format cache. We
then add ownership by a V4L2CameraFile of a V4L2Camera via the
V4L2CameraProxy. All vidioc ioctls prior to reqbufs > 0 (except for
s_fmt) are able to access the camera without ownership. A call to
reqbufs > 0 (and s_fmt) will take ownership, and the ownership will be
released at reqbufs = 0. While ownership is assigned, the eventfd that
should be signaled (and cleared) by V4L2Camera and V4L2CameraProxy is
set to the V4L2CameraFile that has ownership, and is cleared when the
ownership is released. In case close() is called without a
reqbufs = 0 first, the ownership is also released on close().
We also use the V4L2CameraFile to contain all the information specific
to an open instance of the file. This removes the need to keep track of
such information within V4L2CameraProxy via multiple maps from int fd to
info.
Since V4L2 does not expect reqbufs 0 to ever return error, make
V4L2CameraProxy::freeBuffers() return void.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam/assets/feathericons/home.svg')
0 files changed, 0 insertions, 0 deletions