crosvm/media
Daniel Almeida 49d746a47c video: decoder: vaapi: raw_cap should not depend on rt_format
The raw capabilities should not depend on the value for rt_format.

Both in the Intel and Mesa implementations it can be seen that setting
VAConfigAttribRTFormat as a parameter to vaCreateConfig only serves as a
way to validate that the to-be-generated config supports it.

This means that the Intel implementation will only use it in
CheckAttribList, while Mesa will AND it with a precomputed bitmask of
supported values in vaCreateConfig.

Thus, creating one RawCaps instance per value of RT_FORMAT only serves
to create needless duplication.

Not only that, but it frequently makes the call to QUERY_CAPABILITIES
fail, as the resulting structures become too large to fit into the 1024
byte buffer.

Remove all traces of VA_RT_FORMAT_* from this code path. While we are at
it, note that the libva crate API for vaQuerySurfaceAttribute changed to
reflect that this call can return more than one attribute at once.

This is particularly important for VASurfaceAttribPixelFormat, as one
value per supported fourcc is returned. We now properly return one
instance of RawCaps per VA_FOURCC supported.

Also reflect that Surface attributes can be defined more than once

This is particularly the case with VASurfaceAttribPixelFormat, where the
driver will define one attrib per pixel format supported.

This can be seen in the Intel driver, for example, in
MediaLibvaCaps::QuerySurfaceAttributes.

The previous code assumed that a given attribute could only be defined
once, and thus used find(). It was refactored to use filter() instead.

The name of the method was changed to reflect that it can now return
more than one attribute per call. The return type was changed to Vec for
the same reason.

BUG=b:214478588
TEST="cargo test --package devices --lib --features video-decoder --features vaapi -- virtio::video::decoder::backend::vaapi::tests::test_get_capabilities --include-ignored"

Change-Id: I914376beb026e30b2a52ca8f7d01c81e6a9a2775
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3946301
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-10-28 06:33:31 +00:00
..
cros-codecs media: cros-codecs: Introduce the cros-codecs crate 2022-10-28 03:23:26 +00:00
ffmpeg
libva video: decoder: vaapi: raw_cap should not depend on rt_format 2022-10-28 06:33:31 +00:00
libvda media: libvda: allow to build without linking to libvda 2022-10-21 13:57:31 +00:00