media: v4l2-mem2mem: always call poll_wait() on queues
authorAlexandre Courbot <gnurou@gmail.com>
Tue, 1 Dec 2020 12:44:42 +0000 (13:44 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 4 Jan 2021 12:13:15 +0000 (13:13 +0100)
commit726daf6bafe9d1d9e5c36e1e2a4008941fbc28bd
tree0d6e3dae45179ebdedbd84a47114752f9afea217
parent575c52cc4cae8b35654ea2d934d04e649a95cc6f
media: v4l2-mem2mem: always call poll_wait() on queues

do_poll()/do_select() seem to set the _qproc member of poll_table to
NULL the first time they are called on a given table, making subsequent
calls of poll_wait() on that table no-ops. This is a problem for mem2mem
which calls poll_wait() on the V4L2 queues' waitqueues only when a
queue-related event is requested, which may not necessarily be the case
during the first poll.

For instance, a stateful decoder is typically only interested in
EPOLLPRI events when it starts, and will switch to listening to both
EPOLLPRI and EPOLLIN after receiving the initial resolution change event
and configuring the CAPTURE queue. However by the time that switch
happens and v4l2_m2m_poll_for_data() is called for the first time,
poll_wait() has become a no-op and the V4L2 queues waitqueues thus
cannot be registered.

Fix this by moving the registration to v4l2_m2m_poll() and do it whether
or not one of the queue-related events are requested.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-mem2mem.c