mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 04:07:23 +00:00
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>
This commit is contained in:
parent
7e0206ee4a
commit
26f53eb732
1 changed files with 4 additions and 1 deletions
|
@ -76,7 +76,10 @@ impl Display {
|
|||
None => continue,
|
||||
}
|
||||
|
||||
let file = std::fs::File::open(device.devnode().unwrap())?;
|
||||
let file = std::fs::File::options()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.open(device.devnode().unwrap())?;
|
||||
let fd = file.as_raw_descriptor();
|
||||
|
||||
// Safe because fd represents a valid file descriptor and
|
||||
|
|
Loading…
Reference in a new issue