Skip to content
  • Alexandre Courbot's avatar
    726daf6b
    media: v4l2-mem2mem: always call poll_wait() on queues · 726daf6b
    Alexandre Courbot authored
    
    
    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: default avatarAlexandre Courbot <gnurou@gmail.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
    726daf6b
    media: v4l2-mem2mem: always call poll_wait() on queues
    Alexandre Courbot authored
    
    
    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: default avatarAlexandre Courbot <gnurou@gmail.com>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Loading