Skip to content

radeonsi/vcn: Fix MB/CTB calculation for slice encoding

David Rosca requested to merge nowrep/mesa:vcn-encslices into main

What does this MR do and why?

radeonsi/vcn: Fix MB/CTB calculation for slice encoding

We only support equal MB/CTB per slice (with last slice possibly
smaller) and this is not possible to fully describe with libva slice
structure constraints.
Report that we support arbitrary macroblocks per slice, verify if the
slice structure requested by application can be used, otherwise
divide the slices equally to achieve the requested number of slices.
Also stop reporting power of two structure support, as that implies
different size for each slice which cannot be supported.

This fixes issue where slice encoding is not available at all with some
applications (only supporting arbitrary macroblocks) or the number of slices
being different from the requested number.

Can be tested with:

ffmpeg -y -vaapi_device /dev/dri/renderD128 -f lavfi -i testsrc=size=1920x1080 -vf hwupload,scale_vaapi=format=nv12 -c:v hevc_vaapi -slices 3 -vframes 100 /tmp/out.h265

gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw,format=RGBA,width=1920,height=1080 ! vapostproc ! vah265enc num-slices=3 ! h265parse ! filesink location=/tmp/out.h265

Merge request reports