From 23f0edd0ba22c3b03d0ce718c12a51f4aa751f6f Mon Sep 17 00:00:00 2001 From: Daniel Almeida Date: Thu, 15 Sep 2022 18:22:48 -0300 Subject: [PATCH] video: decoder: vaapi: use max_{width|height} from CodedCaps if no value is returned The max width and height from the coded side are the best approximation for the max width and height of the raw side if the actual values are not available in VA-API. In particular, it's extremely unlikely to have 1x1 as acceptable values for max_width and max_height. BUG=b:214478588 TEST=cargo test -p devices --features=video-decoder,vaapi virtio::video::decoder::backend::vaapi::tests::test_get_capabilities -- --include-ignored Change-Id: I6d9830b4da69f29f5e2e11c3fa688db4a7007726 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3901273 Reviewed-by: Keiichi Watanabe Reviewed-by: Alexandre Courbot Commit-Queue: Alexandre Courbot --- devices/src/virtio/video/decoder/backend/vaapi.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devices/src/virtio/video/decoder/backend/vaapi.rs b/devices/src/virtio/video/decoder/backend/vaapi.rs index 79c912af6e..7853268e63 100644 --- a/devices/src/virtio/video/decoder/backend/vaapi.rs +++ b/devices/src/virtio/video/decoder/backend/vaapi.rs @@ -243,7 +243,7 @@ impl VaapiDecoder { let max_width = match max_width.get(0) { Some(libva::GenericValue::Integer(i)) => *i as u32, Some(other) => panic!("Unexpected VAGenericValue {:?}", other), - None => 1, + None => coded_cap.max_width, }; let max_height = config.query_surface_attributes_by_type( @@ -252,7 +252,7 @@ impl VaapiDecoder { let max_height = match max_height.get(0) { Some(libva::GenericValue::Integer(i)) => *i as u32, Some(other) => panic!("Unexpected VAGenericValue {:?}", other), - None => 1, + None => coded_cap.max_height, }; raw_caps.push(RawCap {