OSDN Git Service

media: rcar-vin: Use scratch buffer when not in running state
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Thu, 15 Oct 2020 23:14:04 +0000 (01:14 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 16 Nov 2020 09:31:10 +0000 (10:31 +0100)
commit90ed57851eef0d60320cf2c24536de9ab3183e0f
treea65b16a285c281e06c085eedceff6d3905efff17
parent8b77d1f99e6403a457c2482a88539726276ec01a
media: rcar-vin: Use scratch buffer when not in running state

In its early stages the VIN driver did not use an internal scratch
buffer. This leads to a unnecessary complex start and stop behavior,
specially for TB/BT. The driver now always allocates a scratch buffer to
deal with buffer under-runs, use the scratch buffer to also simplify
starting and stopping.

When capture is starting use the scratch buffer instead of a user-space
buffers while syncing the driver with the hardware state. This allows
the driver to know that no user-space buffer is given to the hardware
before the running state is reached.

When capture is stopping use the scratch buffer instead of leaving the
user-space buffers in place and add a check that all user-space buffers
are processed by the hardware before transitioning from the stopping to
stopped state. This allows the driver to know all user-space buffers
given to the hardware are fully processed.

This change in itself does not improve the driver much but it paves the
way for future simplifications and enhancements. One direct improvement
of this change is that TB/BT buffers returned to user-space while stopping
will always contain both fields, that was not guaranteed before.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/rcar-vin/rcar-dma.c