]> asedeno.scripts.mit.edu Git - linux.git/commit
media: vb2: Keep dma-buf buffers mapped until they are freed
authorPawel Osciak <posciak@chromium.org>
Thu, 24 Jan 2019 09:51:55 +0000 (07:51 -0200)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 31 Jan 2019 11:28:44 +0000 (09:28 -0200)
commit2cc1802f62e562611e86f04d9dae1337c824991e
tree1f79b20a16b9036a30bda8e6fd76ccbc0b83a5a6
parent826ef7508833f8bae928ccae4071b6efa6ba6184
media: vb2: Keep dma-buf buffers mapped until they are freed

When using vb2 for video decoding, dequeued capture buffers may still
be accessed by the hardware: this is the case when they are used as
reference frames for decoding subsequent frames.

When the buffer is imported with dma-buf, it needs to be mapped before
access. Until now, it was mapped when queuing and unmapped when
dequeuing, which doesn't work for access as a reference frames.

One way to solve this would be to map the buffer again when it is
needed as a reference, but the mapping/unmapping operations can
seriously impact performance. As a result, map the buffer once (when it
is first needed when queued) and keep it mapped until it is freed.

Reviewed-on: https://chromium-review.googlesource.com/334103
[Paul: Updated for mainline and changed commit message]

Signed-off-by: Pawel Osciak <posciak@chromium.org>
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/common/videobuf2/videobuf2-core.c