mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jackson.lee" <jackson.lee@chipsnmedia.com>
To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	nicolas.dufresne@collabora.com, bob.beckett@collabora.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	jackson.lee@chipsnmedia.com, lafley.kim@chipsnmedia.com,
	b-brnich@ti.com, hverkuil@xs4all.nl, nas.chung@chipsnmedia.com
Subject: [PATCH v1 0/9] fix decoder corruption, stalls and seek issues
Date: Wed,  7 Oct 2026 10:59:37 +0900	[thread overview]
Message-ID: <20261007015946.53-1-jackson.lee@chipsnmedia.com> (raw)

From: Jackson Lee <jackson.lee@chipsnmedia.com>

This series fixes a set of decoder problems in the wave5 driver that show
up as corrupted output, stalled or crashed instances, and lost frames
across seeks. All of them carry a Fixes: tag.

Locking and job ownership
  1. Serialise removal of OUTPUT buffers between finish_decode(),
     streamoff_output() and the start_decode() error path.
  4. Acknowledge the interrupt only after it has been dispatched, so a
     completion the VPU adds meanwhile is no longer dropped and does not
     leave an instance waiting forever.
  5. Finish each m2m job exactly once. A second v4l2_m2m_job_finish() from
     the same context could clear curr_ctx under v4l2_m2m_try_run() and
     oops in the m2m worker.

Decode scheduling
  6. Issue DEC_PIC only when the ring buffer holds bitstream that no queued
     command will consume. The current check compares two unrelated
     counters, which sends commands against an empty ring or duplicates
     one already in flight and corrupts the output. A delayed work restarts
     an instance left idle with data still buffered.

Seek / flush
  2. Drop the consumed-byte tally on OUTPUT streamoff, so it is not
     credited to the first buffers queued after a seek.
  3. Wait between FLUSH retries instead of spending the retry budget in
     microseconds, and ignore dec_info when reading it failed.
  8. Re-establish the display flags from the vb2 buffer states after a
     flush, so buffers held by userspace are not decoded into.
  9. Do not reset the frame buffers on a CAPTURE streamoff that is only
     part of a seek.

Timestamps
  7. Hand OUTPUT timestamps to decoded pictures in decode order. One
     completion can consume several source buffers, and keeping only the
     last timestamp lost the others ("Too old frames, bug in decoder" in
     GStreamer).

Testing
-------
Tested on a TI J721S2 EVM (Wave521C, product code 0x521c, firmware
revision 363254) with GStreamer 1.24.13 and the v4l2h264dec/v4l2h265dec
elements.

fluster (GStreamer-H.264-V4L2-Gst1.0 / GStreamer-H.265-V4L2-Gst1.0):

  JVT-AVC_V1      77/135  (-j1 and -j3, identical per vector)
  JCT-VC-HEVC_V1 133/147  (-j1 and -j3, identical per vector)

The remaining AVC failures are interlaced, MBAFF/PAFF, FMO and SP slice
streams. 11 of the 14 HEVC failures are Main10 streams, which this SoC
does not decode ("no support for 10 bit depth"); the others are
PICSIZE_A_Bossen_1, PICSIZE_B_Bossen_1 and DELTAQP_A_BRCM_4.

No oops, call trace, workqueue warning or "invalid display frame index"
message was logged during the runs.

v4l2-compliance 1.28.1-5233, SHA: fc15e229d9d3:

  Total for wave5-dec device /dev/video0: 47, Succeeded: 47, Failed: 0, Warnings: 2
  Total for wave5-enc device /dev/video1: 47, Succeeded: 47, Failed: 0, Warnings: 0

Brandon Brnich (2):
  media: chips-media: wave5: Ensure Atomic Access to src_buf list
  media: chips-media: wave5: Stop FrameBuf Reset During Seek

Jackson Lee (7):
  media: chips-media: wave5: drop the consumed-byte tally on OUTPUT
    streamoff
  media: chips-media: wave5: wait before retrying a refused flush
  media: chips-media: wave5: ack the interrupt after dispatching it
  media: chips-media: wave5: finish a job only once
  media: chips-media: wave5: decode only when the ring holds unclaimed
    bitstream
  media: chips-media: wave5: stamp decoded pictures from a decode-order
    queue
  media: chips-media: wave5: restore the display flags after a flush

 .../chips-media/wave5/wave5-vpu-dec.c         | 312 +++++++++++++++---
 .../platform/chips-media/wave5/wave5-vpu.c    |  28 +-
 .../platform/chips-media/wave5/wave5-vpuapi.c |  18 +-
 .../platform/chips-media/wave5/wave5-vpuapi.h |  13 +
 4 files changed, 310 insertions(+), 61 deletions(-)


base-commit: 58348f64125e9a3e44d3abb275ca7f4e6c9641e5
-- 
2.43.0


             reply	other threads:[~2026-10-07  2:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07  1:59 Jackson.lee [this message]
2026-10-07  1:59 ` [PATCH v1 1/9] media: chips-media: wave5: Ensure Atomic Access to src_buf list Jackson.lee
2026-10-07  1:59 ` [PATCH v1 2/9] media: chips-media: wave5: drop the consumed-byte tally on OUTPUT streamoff Jackson.lee
2026-10-07  1:59 ` [PATCH v1 3/9] media: chips-media: wave5: wait before retrying a refused flush Jackson.lee
2026-10-07  1:59 ` [PATCH v1 4/9] media: chips-media: wave5: ack the interrupt after dispatching it Jackson.lee
2026-10-07  1:59 ` [PATCH v1 5/9] media: chips-media: wave5: finish a job only once Jackson.lee
2026-10-07  1:59 ` [PATCH v1 6/9] media: chips-media: wave5: decode only when the ring holds unclaimed bitstream Jackson.lee
2026-10-07  1:59 ` [PATCH v1 7/9] media: chips-media: wave5: stamp decoded pictures from a decode-order queue Jackson.lee
2026-10-07  1:59 ` [PATCH v1 8/9] media: chips-media: wave5: restore the display flags after a flush Jackson.lee
2026-10-07  1:59 ` [PATCH v1 9/9] media: chips-media: wave5: Stop FrameBuf Reset During Seek Jackson.lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261007015946.53-1-jackson.lee@chipsnmedia.com \
    --to=jackson.lee@chipsnmedia.com \
    --cc=b-brnich@ti.com \
    --cc=bob.beckett@collabora.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=hverkuil@xs4all.nl \
    --cc=lafley.kim@chipsnmedia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nas.chung@chipsnmedia.com \
    --cc=nicolas.dufresne@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®