Skip to content

Port virtio media simple device as a vhost user media device.#1895

Merged
ser-io merged 1 commit intogoogle:mainfrom
ser-io:virtio-media-use-new-SHMEM
Mar 5, 2026
Merged

Port virtio media simple device as a vhost user media device.#1895
ser-io merged 1 commit intogoogle:mainfrom
ser-io:virtio-media-use-new-SHMEM

Conversation

@ser-io
Copy link
Copy Markdown
Member

@ser-io ser-io commented Dec 15, 2025

Port virtio media reference device simple_device as a vhost user implementation.

First iteration of simple_device/src/simple_device.rs is the same as in virtio-media upstream https://github.com/chromeos/virtio-media/blob/main/device/src/devices/simple_device.rs.

cargo run --bin simple_device  -- --socket-path /tmp/simple_device.sock
cargo run --features "media" -- --log-level=debug run --cpus 4 --mem 4096 \
  --rwdisk /path/to/debian-12.img \
  --params "root=/dev/vda1" \
  --vhost-user media,socket=/tmp/simple_device.sock \
  /path/to/bzImage

v4l2-compliance -d0 -s

Bug: 445229097

@ser-io ser-io requested review from Databean and jemoreira December 15, 2025 22:34
@jemoreira
Copy link
Copy Markdown
Member

Port virtio media reference device simple_device as a vhost user implementation.

First iteration of simple_device/src/simple_device.rs is the same as in virtio-media upstream https://github.com/chromeos/virtio-media/blob/main/device/src/devices/simple_device.rs.

Why are you copying this code here instead of depending on it? Would it be possible to contribute changes upstream and only implement the cuttlefish-specific changes here?

@ser-io ser-io requested a review from adelva1984 December 18, 2025 19:05
@ser-io ser-io force-pushed the virtio-media-use-new-SHMEM branch from d42f8bd to db5b139 Compare January 22, 2026 22:14
@ser-io
Copy link
Copy Markdown
Member Author

ser-io commented Jan 22, 2026

Port virtio media reference device simple_device as a vhost user implementation.
First iteration of simple_device/src/simple_device.rs is the same as in virtio-media upstream https://github.com/chromeos/virtio-media/blob/main/device/src/devices/simple_device.rs.

Why are you copying this code here instead of depending on it? Would it be possible to contribute changes upstream and only implement the cuttlefish-specific changes here?

Removed the copy depending on the upstream implementation.

@ser-io ser-io force-pushed the virtio-media-use-new-SHMEM branch 3 times, most recently from 833efed to fadcf29 Compare January 24, 2026 00:20
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/Cargo.toml Outdated
@ser-io ser-io force-pushed the virtio-media-use-new-SHMEM branch from fadcf29 to 8b2a123 Compare January 24, 2026 00:33
@ser-io ser-io requested review from Databean and jemoreira January 24, 2026 00:34
@ser-io ser-io force-pushed the virtio-media-use-new-SHMEM branch from 8b2a123 to 774f02d Compare January 29, 2026 18:05
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/simple_device/src/main.rs Outdated
Comment thread base/cvd/MODULE.bazel Outdated
Copy link
Copy Markdown
Member

@Databean Databean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the comments apply in multiple places, like reducing map_err usage in favor of automatic conversion with From.

Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
@ser-io ser-io force-pushed the virtio-media-use-new-SHMEM branch 6 times, most recently from cdc74cb to 61f4245 Compare February 12, 2026 22:25
@ser-io ser-io requested a review from Databean February 12, 2026 22:27
@ser-io ser-io force-pushed the virtio-media-use-new-SHMEM branch from 61f4245 to 9771f15 Compare February 26, 2026 19:45
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/simple_device/src/main.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/vhu_media/src/lib.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/simple_device/src/main.rs Outdated
Comment thread base/cvd/cuttlefish/host/commands/vhost_user_media/simple_device/src/main.rs Outdated
Run the device.

```
RUST_LOG=trace cargo run --bin simple_device -- --socket-path /tmp/simple_device.sock

or

RUST_LOG=trace bazel run simple_device:simple_device -- --socket-path /tmp/simple_device.sock
```

Run the VM.

```
cargo run -- --log-level=debug run --cpus 4 --mem 4096 \
  --rwdisk /path/to/debian-12.img \
  --params "root=/dev/vda1" \
  --vhost-user media,socket=/tmp/simple_device.sock \
  /path/to/bzImage

v4l2-compliance -d0 -s
```

Bug: 445229097
@ser-io ser-io force-pushed the virtio-media-use-new-SHMEM branch from 9771f15 to 6d56a54 Compare March 2, 2026 21:51
@ser-io ser-io added this pull request to the merge queue Mar 5, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 5, 2026
@ser-io ser-io added this pull request to the merge queue Mar 5, 2026
Merged via the queue into google:main with commit bd4992b Mar 5, 2026
26 checks passed
@ser-io ser-io deleted the virtio-media-use-new-SHMEM branch March 6, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants