Skip to content

frontends/va: Write output to correct surface when film grain is enabled

Mark Thompson requested to merge jkqxz/mesa:film-grain-output-surface into main

AV1 decode in VAAPI offers two separate output surfaces when film grain is enabled: one output before film grain is applied (for use as the reference) and one output after (to actually give to the user) - see https://github.com/intel/libva/blob/master/va/va_dec_av1.h#L296-L304.

AMD hardware apparently only wants to write the post-grain output, but in the current implementation it incorrectly writes it to the pre-grain surface. Since users expect the output in the post-grain surface, they get random results because that surface hasn't been written at all. Fix this by writing the output to the post-grain surface when film grain is enabled.

Untested (no hardware). Intended to fix #6903 (closed).

This came from observing the submission of https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2022-November/304189.html to FFmpeg: that attempts to hack the decoder in libavcodec to assume that the post-grain output is written to the pre-grain surface if the vendor string contains certain substrings, which did not seem sensible to me.

Signed-off-by: Mark Thompson sw@jkqxz.net

Merge request reports