v4l2: v4l2_compat: Add eventfd signaling to support polling
To support polling, we need to be able to signal when data is available to be read (POLLIN), as well as events (POLLPRI). Add the necessary calls to eventfd to allow signaling POLLIN. We signal POLLIN by writing writing to the eventfd, and clear it by reading from the eventfd, upon VIDIOC_DQBUF. Note that eventfd does not support signaling POLLPRI, so we don't yet support V4L2 events. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
5c5481911a
commit
8df593841d
5 changed files with 32 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <linux/videodev2.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <libcamera/camera.h>
|
||||
#include <libcamera/object.h>
|
||||
|
@ -451,6 +452,9 @@ int V4L2CameraProxy::vidioc_dqbuf(struct v4l2_buffer *arg)
|
|||
|
||||
currentBuf_ = (currentBuf_ + 1) % bufferCount_;
|
||||
|
||||
uint64_t data;
|
||||
::read(efd_, &data, sizeof(data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -529,6 +533,12 @@ int V4L2CameraProxy::ioctl(unsigned long request, void *arg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void V4L2CameraProxy::bind(int fd)
|
||||
{
|
||||
efd_ = fd;
|
||||
vcam_->bind(fd);
|
||||
}
|
||||
|
||||
struct PixelFormatPlaneInfo {
|
||||
unsigned int bitsPerPixel;
|
||||
unsigned int hSubSampling;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue