mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Add manual request completion to the MediaTek VCodec driver
@ 2025-11-28 19:16 Nicolas Dufresne
  2025-11-28 19:16 ` [PATCH v4 1/5] media: mc: add manual request completion Nicolas Dufresne
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Nicolas Dufresne @ 2025-11-28 19:16 UTC (permalink / raw)
  To: Sakari Ailus, Laurent Pinchart, Mauro Carvalho Chehab,
	Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Matthias Brugger,
	AngeloGioacchino Del Regno, Hans Verkuil
  Cc: linux-kernel, linux-arm-kernel, linux-mediatek, kernel,
	linux-media, Sebastian Fricke, Nicolas Dufresne, Hans Verkuil,
	Hans Verkuil

This set introduces the manual request completion API by the author Hans
Verkuil and implements it within the MediaTek VCodec driver.

Why is this needed?

The VCodec driver supports a hardware containing two separate cores, the
CORE and the LAT, these are working in a serial manner without this
series. This series solves two issues, the first being that the current
code runs into a problem, that occurs when the last request object is
unbound from the request, before the v4l2_ctrl_request_complete function
is called, causing an implicit transition to the COMPLETE state.
This issues has been found in applications which didn't attach the
controls for the very first request (which is supposed to enable the
driver to sniff out the correct formats, etc.).
The second issue is that the VCodec driver can not utilize the full
performance of both cores, when the LAT core has to wait for the CORE
core to finishing processing the decode. Thus by enabling the LAT core
to process the next bitstream, right after processing the last we can
increase the performance of the driver.
With the manual request completion API, we can separate the
completion of the request objects of a request and from the completion
of the request itself, which allows to send a new bitstream after the
LAT core has processed the previous and while the CORE core decodes the
previous bitstream, so both cores can work in a parallel manner, but
while keeping the request alive during both steps.

The request in VCodec have been extended with a kref that allows to
properly delay the completion of the request. This kref was necessary
to handle the re-entrant callbacks that occurs when the core worker
finishes the work before the lat worker function finishes.

Additionally, this series adds a small patch to avoid trying to handle a
scenario, which is not supported by the hardware and thus runs into a
timeout.

Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
Changes in v4:
- Patch 1&3: Applied the review comments, but ignored the media ref work
- Patch 4: Rewrote the delayed completion around a kref
- Link to v3: https://lore.kernel.org/r/20250604-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v3-0-603db4749d90@collabora.com

Changes in v3:
- Patch 1: Applied suggested documentation fixes to the manual completion API
- Patch 4: Moved MTK VCODEC request helper into the decoder driver
- Patch 4: Matched MTK driver namespaces
- Patch 4: Set MTK request to CORE_DONE state if LAT failed
- Patch 4: Dropped Angelo's Rb, its better to review again
- Link to v2: https://lore.kernel.org/r/20250410-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v2-0-5b99ec0450e6@collabora.com

Changes in v2:
- The implementation patch for V1 was using an outdated version of the
  "media: vcodec: Implement manual request completion" patch, update it
  to the most recent one which doesn't use the state machine globally
  but instead per request, thus having no conflicts between multiple
  concurrent threads
- The kernel test robot found an issue because a function which I only
  use locally was defined without the static keyword
- Link to v1: https://lore.kernel.org/r/20250314-sebastianfricke-vcodec_manual_request_completion_with_state_machine-v1-0-5e277a3d695b@collabora.com

---
Hans Verkuil (3):
      media: mc: add manual request completion
      media: vicodec: add support for manual completion
      media: mc: add debugfs node to keep track of requests

Nicolas Dufresne (1):
      media: mtk-vcodec: Don't try to decode 422/444 VP9

Sebastian Fricke (1):
      media: vcodec: Implement manual request completion

 drivers/media/mc/mc-device.c                       |  30 ++++++
 drivers/media/mc/mc-devnode.c                      |   5 +
 drivers/media/mc/mc-request.c                      |  47 ++++++++-
 .../mediatek/vcodec/decoder/mtk_vcodec_dec.c       |   4 +-
 .../mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h   |  17 +++
 .../vcodec/decoder/mtk_vcodec_dec_stateless.c      | 115 +++++++++++++++------
 drivers/media/test-drivers/vicodec/vicodec-core.c  |  21 +++-
 include/media/media-device.h                       |   9 ++
 include/media/media-devnode.h                      |   4 +
 include/media/media-request.h                      |  40 ++++++-
 10 files changed, 251 insertions(+), 41 deletions(-)
---
base-commit: 1f2353f5a1af995efbf7bea44341aa0d03460b28
change-id: 20250312-sebastianfricke-vcodec_manual_request_completion_with_state_machine-6362c7f80a14

Best regards,
-- 
Nicolas Dufresne <nicolas.dufresne@collabora.com>


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

end of thread, other threads:[~2025-12-01 10:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-28 19:16 [PATCH v4 0/5] Add manual request completion to the MediaTek VCodec driver Nicolas Dufresne
2025-11-28 19:16 ` [PATCH v4 1/5] media: mc: add manual request completion Nicolas Dufresne
2025-12-01 10:38   ` Hans Verkuil
2025-11-28 19:16 ` [PATCH v4 2/5] media: vicodec: add support for manual completion Nicolas Dufresne
2025-11-28 19:16 ` [PATCH v4 3/5] media: mc: add debugfs node to keep track of requests Nicolas Dufresne
2025-11-28 19:16 ` [PATCH v4 4/5] media: vcodec: Implement manual request completion Nicolas Dufresne
2025-11-28 19:16 ` [PATCH v4 5/5] media: mtk-vcodec: Don't try to decode 422/444 VP9 Nicolas Dufresne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®