A VA-API decode session's GPU copier (vaapi/gpu_copy.rs) kept the scratch of
every copy that failed once submitted, whether its wait failed or it ended in
an error, and made a new scratch for the next picture. A GPU that kept failing
grew the list by one dma-buf scratch a picture for the session's life. On rt,
where a lost device ends copies in an error, that was the path taken. Under a
failed wait the copier also wrote its arguments buffer again for the next
copy while the GPU might still be reading it, the same hazard the gatherer had
before 4bb5db49fc.
The copier now follows video_host::OutOfUse:
- A copy whose wait returned and that ended in an error is done on the GPU,
so the next picture's copy reuses its scratch and arguments.
- A copy whose wait failed has its scratch and its arguments kept out of use
while the session lives, and the next picture's copy makes new ones.
- At a second copy whose wait failed, the session's GPU copies end. That
copy's buffers stay where they lie. The ending is counted once as
video-gpu-copies-ended, which the degradation counts report, and logged
once a kind. Each later picture is declined, so it lands by the CPU's copy,
the landing's third way.
rt's wait never fails, so on rt these failed-wait paths are a guard.
What changes for the guest: a picture whose copy failed still fails. After a
second failed wait in a session, its later pictures land by the CPU's copy
instead of going to the GPU. The bytes are the same either way. The VA-API
test that ends a session's copies checks this on each picture declined after
the ending: a new session's copier copies that picture on the GPU, the cache
is read back, and it must match the CPU's copy byte for byte
(ReadBack::copy_coded_into, which the landing's third way runs). The copier's
existing test, now on the same helper (copy_as_the_cpu), checks every copied
picture the same way. On the host, a run of errored copies keeps no scratch
per picture.
The new code is listed in docs/conventions.md, docs/video/vaapi.md and
answer.rs's counted kinds. answer.rs also gains the three codes of 4bb5db49fc,
which it was missing.
Tests:
- On the stand-in device:
a_copy_whose_wait_fails_keeps_its_scratch_and_arguments_out_of_use,
a_second_copy_whose_wait_fails_ends_the_session_s_gpu_copies,
a_copy_that_ends_in_an_error_takes_its_scratch_and_arguments_again.
- On a VA-API host (ignored), with the test hooks fail_next_wait and
fail_next_copy:
a_picture_whose_copy_s_wait_fails_fails_and_a_second_ends_the_session_s_gpu_copies,
a_picture_whose_copy_ends_in_an_error_fails_and_its_scratch_is_taken_again.
(cherry picked from commit 658f749d30426f478cae3568c0270d5dbd8b9517)