crosvm/media
Daniel Almeida 26f53eb732 media: libva: open DRM fd as O_RDWR
File::open() opens the file as O_RDONLY, which can cause issues with the
VA-API driver.

In particular for Intel hardware this will cause allocations to fail, as can
be seen in issue #1449 for intel-media-driver. These failed allocations may or
may not crash the VA-API driver, as the driver might eventually dereference a
NULL pointer.

Fix it by opening the DRM fd as O_RDWR. This is also in line with the examples
in libva-utils.

BUG=b:214478588
TEST=`cargo test --features "video-decoder,vaapi" -p devices vaapi::tests::test_get_capabilities -- --ignored` passes on AMD hardware.

Change-Id: Ie3cf2a6512157a3f23f943b54249eb2928082af9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3782999
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-08-24 01:15:19 +00:00
..
ffmpeg media: ffmpeg: upgrade to ffmpeg 5.0 libraries 2022-08-23 01:47:48 +00:00
libva media: libva: open DRM fd as O_RDWR 2022-08-24 01:15:19 +00:00
libvda
vp8