summary refs log tree commit diff
path: root/devices/src/virtio/video/encoder/mod.rs
diff options
context:
space:
mode:
authorKeiichi Watanabe <keiichiw@chromium.org>2019-12-06 22:24:40 +0900
committerCommit Bot <commit-bot@chromium.org>2020-05-23 09:54:13 +0000
commit57df6a0ab23c3b2ba233b9aa5886ecf47ba3f91f (patch)
tree11bc695e179762b6eac26302e6b89db55b251dba /devices/src/virtio/video/encoder/mod.rs
parentb2ca24c97b0084b805f7da28804b4c430c151ccb (diff)
downloadcrosvm-57df6a0ab23c3b2ba233b9aa5886ecf47ba3f91f.tar
crosvm-57df6a0ab23c3b2ba233b9aa5886ecf47ba3f91f.tar.gz
crosvm-57df6a0ab23c3b2ba233b9aa5886ecf47ba3f91f.tar.bz2
crosvm-57df6a0ab23c3b2ba233b9aa5886ecf47ba3f91f.tar.lz
crosvm-57df6a0ab23c3b2ba233b9aa5886ecf47ba3f91f.tar.xz
crosvm-57df6a0ab23c3b2ba233b9aa5886ecf47ba3f91f.tar.zst
crosvm-57df6a0ab23c3b2ba233b9aa5886ecf47ba3f91f.zip
devices: virtio: Initial implementation of virtio-video device
This CL adds a fundamental part of the virtio video device, which will
be shared between the encoder and the decoder.
Both devices uses the virtio-video protocol proposed as RFC v3 [1,2].
The corresponding driver code is at CL:2060327 and its children CLs.

The actual decoding and encoding logic will be implemented in different
CLs.

[1]: mail: https://markmail.org/thread/wxdne5re7aaugbjg
[2]: PDF: https://drive.google.com/file/d/1jOsS2WdVhL4PpcWLO8Zukq5J0fXDiWn-/view

BUG=b:147465619, b:140082257
TEST=cargo check --features=video-decoder,video-encoder
TEST=ARCVM started with --video-decoder --video-encoder

Cq-Depend: chromium:2203997
Change-Id: I01999eea218ba0f3aaed1558ca2311a57d0c6819
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1973973
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Diffstat (limited to 'devices/src/virtio/video/encoder/mod.rs')
-rw-r--r--devices/src/virtio/video/encoder/mod.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/devices/src/virtio/video/encoder/mod.rs b/devices/src/virtio/video/encoder/mod.rs
new file mode 100644
index 0000000..d6b8cef
--- /dev/null
+++ b/devices/src/virtio/video/encoder/mod.rs
@@ -0,0 +1,40 @@
+// Copyright 2020 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+//! Implementation of the the `Encoder` struct, which is responsible for translation between the
+//! virtio protocols and LibVDA APIs.
+
+use sys_util::PollContext;
+
+use crate::virtio::resource_bridge::ResourceRequestSocket;
+use crate::virtio::video::command::VideoCmd;
+use crate::virtio::video::device::{Device, Token, VideoCmdResponseType, VideoEvtResponseType};
+use crate::virtio::video::error::*;
+
+pub struct Encoder;
+
+impl Encoder {
+    pub fn new() -> Self {
+        Encoder {}
+    }
+}
+
+impl Device for Encoder {
+    fn process_cmd(
+        &mut self,
+        _cmd: VideoCmd,
+        _poll_ctx: &PollContext<Token>,
+        _resource_bridge: &ResourceRequestSocket,
+    ) -> VideoResult<VideoCmdResponseType> {
+        Err(VideoError::InvalidOperation)
+    }
+
+    fn process_event_fd(&mut self, _stream_id: u32) -> Option<VideoEvtResponseType> {
+        None
+    }
+
+    fn take_resource_id_to_notify_eos(&mut self, _stream_id: u32) -> Option<u32> {
+        None
+    }
+}