Re: [PATCH 1/2] media: venus: vdec: signal EOS with a real buffer

From: Andrey Derkach

Date: Sat Dec 05 2026 - 13:04:20 EST


On Mon, Sep 28, 2026 at 11:40:14PM +0200, David Heidelberg wrote:
> Allocate a small buffer the first time a decoder instance is drained and
> use its device address for the EOS command, so the firmware gets an
> address that is mapped and outside the protected regions. The firmware
> then drains normally: all frames are returned and the last capture
> buffer carries V4L2_BUF_FLAG_LAST.

Tested on a Xiaomi Mi 9 SE (SDM712, sdm845-venus-v2, firmware
VIDEO.VE.5.0-00084), on the sdm670-mainline 7.3.7 tree with the phone's
device tree, which is not upstream yet. That tree sends address 0 for
the decoder EOS on HFI 4xx; I reverted that first, so the patch was
tested against the upstream EOS path.

With ffmpeg's h264_v4l2m2m, hevc_v4l2m2m and vp9_v4l2m2m decoders, a
1080p30 clip of 900 frames decodes to the end in each format, and every
frame, the last one included, matches ffmpeg's software decoder. No
driver or firmware errors are logged. With address 0, the HEVC drain
never finished and the end of a VP9 session crashed the firmware.

Tested-by: Andrey Derkach <gabin278@xxxxxxxxx> # Xiaomi Mi 9 SE (SDM712)

The encoder has the same problem on this firmware: V4L2_ENC_CMD_STOP
queues 0xdeadb000, the firmware rejects it with session error 1001, and
an SMMU fault and a firmware crash follow. Giving the encoder a buffer
the same way fixes it here: H.264, HEVC and VP8 encodes drain cleanly.
I can send that as a patch on top of this series.