All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv4 0/5] vb2: add buf_out_validate callback
@ 2019-01-16 12:01 hverkuil-cisco
  2019-01-16 12:01 ` [PATCHv4 1/5] " hverkuil-cisco
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: hverkuil-cisco @ 2019-01-16 12:01 UTC (permalink / raw)
  To: linux-media; +Cc: Sakari Ailus, Paul Kocialkowski

From: Hans Verkuil <hverkuil-cisco@xs4all.nl>

When queueing a buffer to a request the 'field' value is not validated.
That field is only validated when the _buf_prepare() is called,
which happens when the request is queued.

However, this validation should happen at QBUF time, since you want
to know about this as soon as possible. Also, the spec requires that
the 'field' value is validated at QBUF time.

This patch adds a new buf_out_validate callback to validate the
output buffer at buf_prepare time or when QBUF queues an unprepared
buffer to a request. This callback is mandatory for output queues
that support requests.

This issue was found by v4l2-compliance since it failed to replace
V4L2_FIELD_ANY by a proper field value when testing the vivid video
output in combination with requests.

This patch series adds a new buf_out_validate callback and implements
it for the three drivers that support requests for output queues:
vivid, vim2m and cedrus.

The final patch adds a check that this new callback is implemented
for output queues supporting requests since it is easy to forget.

Regards,

	Hans

Changes since v3:

- Implement the callback for the cedrus driver, add check that the
  callback is implemented when it is required.
- Previous versions claimed that there was also a problem when
  requests are not in use, but that turned out to be wrong. This is
  request specific.
- Call the new callback as well when preparing a buffer.
- When calling it from qbuf, only call it when queueing an unprepared
  buffer to a request. This is the actual fix.

Changes since v2:

- drop test whether the queue is an output queue. This callback is only
  called for output queues, so this test is not needed anymore.

Changes since v1:

- Renamed buf_validate to buf_out_validate since this is output
  specific.
- Clarify in the commit log of the first patch that this isn't
  request API specific, but fixes a long standing problem that
  just wasn't noticed until now.

Hans Verkuil (5):
  vb2: add buf_out_validate callback
  vim2m: add buf_out_validate callback
  vivid: add buf_out_validate callback
  cedrus: add buf_out_validate callback
  vb2: check that buf_out_validate is present

 .../media/common/videobuf2/videobuf2-core.c   | 22 ++++++++++++---
 .../media/common/videobuf2/videobuf2-v4l2.c   |  7 +++++
 drivers/media/platform/vim2m.c                | 27 +++++++++++--------
 drivers/media/platform/vivid/vivid-vid-out.c  | 23 +++++++++++-----
 .../staging/media/sunxi/cedrus/cedrus_video.c |  9 +++++++
 include/media/videobuf2-core.h                |  5 ++++
 6 files changed, 72 insertions(+), 21 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-01-25 15:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-16 12:01 [PATCHv4 0/5] vb2: add buf_out_validate callback hverkuil-cisco
2019-01-16 12:01 ` [PATCHv4 1/5] " hverkuil-cisco
2019-01-16 12:01 ` [PATCHv4 2/5] vim2m: " hverkuil-cisco
2019-01-16 12:01 ` [PATCHv4 3/5] vivid: " hverkuil-cisco
2019-01-16 12:01 ` [PATCHv4 4/5] cedrus: " hverkuil-cisco
2019-01-16 12:01 ` [PATCHv4 5/5] vb2: check that buf_out_validate is present hverkuil-cisco
2019-01-25 15:23   ` [PATCHv4.1 " Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.