]> git.ipfire.org Git - thirdparty/linux.git/commit
media: rzg2l-cru: Rework rzg2l_cru_fill_hw_slot()
authorDaniel Scally <dan.scally+renesas@ideasonboard.com>
Thu, 18 Sep 2025 11:02:06 +0000 (12:02 +0100)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 19 May 2026 07:01:49 +0000 (09:01 +0200)
commit145b8d16cc4a450d2f890935dc7617b05caf566c
tree96cacbcb4fb807434c0de99504980c0f084b71c7
parent1b0e65a1bd7e2673ae40f0adc07349936a17d461
media: rzg2l-cru: Rework rzg2l_cru_fill_hw_slot()

The current implementation of rzg2l_cru_fill_hw_slot() results in the
artificial loss of frames. At present whenever a frame-complete IRQ
is received the driver fills the hardware slot that was just written
to with the address of the next buffer in the driver's queue. If the
queue is empty, that hardware slot's address is set to the address of
the scratch buffer to enable the capture loop to keep running. There
is a minimum of a two-frame delay before that slot will be written to
however, and in the intervening period userspace may queue more
buffers which could be used.

To resolve the issue rework rzg2l_cru_fill_hw_slot() so that it
iteratively fills all slots from the queue which currently do not
have a buffer assigned, until the queue is empty. The scratch
buffer is only resorted to in the event that the queue is empty and
the next slot that will be written to does not already have a buffer
assigned.

Signed-off-by: Daniel Scally <dan.scally+renesas@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c