From b77b936d420b2436cd83305464279eedf9ed38c4 Mon Sep 17 00:00:00 2001 From: Alexandre Courbot Date: Tue, 11 May 2021 20:15:17 +0900 Subject: [PATCH] virtio: video: encoder: make encoder own its VEA instance The current design of having the VEA instance outside of the encoder was mandated by the use of lifetimes on libvda Sessions, which have been removed from libvda. So it is now possible for the encoder to own its VEA instance. This makes sense in itself since there is no reason for the VEA instance to also be used by someone else, but is also required to add support for non-libvda encoder backends. BUG=b:169295147 TEST=arc.VideoEncodeAccel.h264_192p_i420_vm passes on hatch-arc-r Change-Id: Idb4356dde6124f00d87915da7da0910c7d816863 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2887526 Reviewed-by: Keiichi Watanabe Reviewed-by: David Staessens Tested-by: Keiichi Watanabe Commit-Queue: Alexandre Courbot --- devices/src/virtio/video/encoder/libvda_encoder.rs | 2 +- devices/src/virtio/video/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devices/src/virtio/video/encoder/libvda_encoder.rs b/devices/src/virtio/video/encoder/libvda_encoder.rs index 765d580369..c1ea2b0bb1 100644 --- a/devices/src/virtio/video/encoder/libvda_encoder.rs +++ b/devices/src/virtio/video/encoder/libvda_encoder.rs @@ -169,7 +169,7 @@ impl LibvdaEncoder { } } -impl Encoder for &LibvdaEncoder { +impl Encoder for LibvdaEncoder { type Session = LibvdaEncoderSession; fn query_capabilities(&self) -> Result { diff --git a/devices/src/virtio/video/mod.rs b/devices/src/virtio/video/mod.rs index 71111ddde7..80e7494d46 100644 --- a/devices/src/virtio/video/mod.rs +++ b/devices/src/virtio/video/mod.rs @@ -231,7 +231,7 @@ impl VirtioDevice for VideoDevice { return; } }; - let device = match encoder::EncoderDevice::new(&encoder) { + let device = match encoder::EncoderDevice::new(encoder) { Ok(d) => d, Err(e) => { error!("Failed to create encoder device: {}", e);