Commit Graph

51 Commits

Author SHA1 Message Date
dependabot[bot]
8bcd13128a build(deps): bump the vhost-device group in /staging with 10 updates
Bumps the vhost-device group in /staging with 10 updates:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.4.10` | `4.4.11` |
| [libc](https://github.com/rust-lang/libc) | `0.2.150` | `0.2.151` |
| [anstream](https://github.com/rust-cli/anstyle) | `0.6.4` | `0.6.5` |
| [anstyle-parse](https://github.com/rust-cli/anstyle) | `0.2.2` | `0.2.3` |
| [anstyle-query](https://github.com/rust-cli/anstyle) | `1.0.0` | `1.0.2` |
| [anstyle-wincon](https://github.com/rust-cli/anstyle) | `3.0.1` | `3.0.2` |
| [once_cell](https://github.com/matklad/once_cell) | `1.18.0` | `1.19.0` |
| [rustix](https://github.com/bytecodealliance/rustix) | `0.38.26` | `0.38.28` |
| [syn](https://github.com/dtolnay/syn) | `2.0.39` | `2.0.40` |
| [winnow](https://github.com/winnow-rs/winnow) | `0.5.19` | `0.5.26` |


Updates `clap` from 4.4.10 to 4.4.11
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.10...v4.4.11)

Updates `libc` from 0.2.150 to 0.2.151
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.150...0.2.151)

Updates `anstream` from 0.6.4 to 0.6.5
- [Commits](https://github.com/rust-cli/anstyle/compare/anstream-v0.6.4...anstream-v0.6.5)

Updates `anstyle-parse` from 0.2.2 to 0.2.3
- [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-parse-v0.2.2...anstyle-parse-v0.2.3)

Updates `anstyle-query` from 1.0.0 to 1.0.2
- [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-query-v1.0.0...anstyle-query-v1.0.2)

Updates `anstyle-wincon` from 3.0.1 to 3.0.2
- [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-wincon-v3.0.1...anstyle-wincon-v3.0.2)

Updates `once_cell` from 1.18.0 to 1.19.0
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.18.0...v1.19.0)

Updates `rustix` from 0.38.26 to 0.38.28
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.26...v0.38.28)

Updates `syn` from 2.0.39 to 2.0.40
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.39...2.0.40)

Updates `winnow` from 0.5.19 to 0.5.26
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.5.19...v0.5.26)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: anstream
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: anstyle-parse
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: anstyle-query
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: anstyle-wincon
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: once_cell
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: syn
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: winnow
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-11 09:53:41 +05:30
Matias Ezequiel Vara Larsen
6a072fa02c sound: remove ControlMessage parameter from release()
This commit removes ControlMessage from the release() method. The
backends process the release() command immediately thus not requiring the
audio backend to notify guest later. The notification happens in the
device after the cmd is processed. This also removes the need of
handling descriptors in the audio backend. This commit fixes the tests
in pw.

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-12-08 10:57:00 +05:30
Matias Ezequiel Vara Larsen
a045950d74 sound: remove ControlMessage from set_param()
This commit removes ControlMessage in the set_param() method and
replaces it with the VirtioSndPcmSetParams structure that is already
parsed by the device. Both backends are able to handle that request
immediately so there is not need to pass ControlMessage to notify the
guest afterwards. By doing this, this commit removes any descriptor
manipulation from the audio backends. The commit fixes the test in pw.

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-12-08 10:57:00 +05:30
Matias Ezequiel Vara Larsen
4742cf1a28 sound/pipewire: stop threadloop during drop
The threadloop has to be stopped only when the audio backend is dropped
otherwise release() stops it and it is not started again. The threadloop
must be active all alone the life of the audio backend.

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-12-05 14:14:47 +02:00
Matias Ezequiel Vara Larsen
afdefc70af sound/pipewire: handle errors and propagate to device
This commit adds the corresponding handling and propagation of errors
that may happen when device communicate with the pw backend.

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-12-04 17:34:03 +01:00
Matias Ezequiel Vara Larsen
252494f782 sound/alsa: handle errors and propagate to device
This commit adds the corresponding handling and propagation of errors
that may happen when device communicates with the alsa backend.

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-12-04 17:34:03 +01:00
Matias Ezequiel Vara Larsen
7727895aec sound/alsa: remove runner thread
This commit removes the need for a runner thread to be created when the
alsa backend is instantiated. This thread is responsible for handling
control requests and communicating with worker threads for starting and
stopping playback/capturing streams. When the virtio-sound daemon gets a
control cmd, a msg is sent over a channel and the runner processes the
request. With this commit, we propose that we handle the msg immediately
without needing to use a thread. The following reasons have led to the
removal of this thread:

* to propagate the error to the device in case an operation fails
* to simplify the backend by removing an extra thread
* to prepare the backend to remove ControlMsg from the header of the
  set_param() and release() methods. Ideally, the audio backend shall
  know nothing about descriptors. By removing the use of a thread to
  handle the control request, notification to guest can happen
  immediately in the device instead of letting the audio backend to handle
  the notifications

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-12-04 17:34:03 +01:00
dependabot[bot]
b0a7a8b093 build(deps): bump the vhost-device group in /staging with 4 updates
Bumps the vhost-device group in /staging with 4 updates: [clap](https://github.com/clap-rs/clap), [errno](https://github.com/lambda-fairy/rust-errno), [linux-raw-sys](https://github.com/sunfishcode/linux-raw-sys) and [rustix](https://github.com/bytecodealliance/rustix).


Updates `clap` from 4.4.8 to 4.4.10
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.8...v4.4.10)

Updates `errno` from 0.3.7 to 0.3.8
- [Changelog](https://github.com/lambda-fairy/rust-errno/blob/main/CHANGELOG.md)
- [Commits](https://github.com/lambda-fairy/rust-errno/compare/v0.3.7...v0.3.8)

Updates `linux-raw-sys` from 0.4.11 to 0.4.12
- [Commits](https://github.com/sunfishcode/linux-raw-sys/compare/v0.4.11...v0.4.12)

Updates `rustix` from 0.38.25 to 0.38.26
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.25...v0.38.26)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: errno
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: linux-raw-sys
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-04 10:52:14 +05:30
Manos Pitsidianakis
842d1965e4 sound: remove duplicate ControlMessage definitions
Somehow slipped through the reviews. Thanks @MatiasVara for catching
this.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-12-01 14:57:46 +05:30
Viresh Kumar
00ad80d736 vhost-device: Don't return bool unnecessarily
Since everyone copied the first bits of code from the I2C crate, the
same issue is present almost everywhere. The returned value isn't
checked at all by the callers. Stop returning bool unnecessarily.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
2023-12-01 09:40:52 +01:00
Matias Ezequiel Vara Larsen
f34f7b9869 sound/pipewire: stop threadloop before destroying context
During release(), the threadloop has to be stopped before the context is
destroyed, otherwise the threadloop continues to execute thus ending in
crashes due to SIGABRT or SIGSEGV.

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-11-27 11:13:02 +05:30
dependabot[bot]
f7cbe50dd0 build(deps): bump the vhost-device group in /staging with 3 updates
Bumps the vhost-device group in /staging with 3 updates: [hashbrown](https://github.com/rust-lang/hashbrown), [proc-macro2](https://github.com/dtolnay/proc-macro2) and [serde](https://github.com/serde-rs/serde).


Updates `hashbrown` from 0.14.2 to 0.14.3
- [Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/hashbrown/compare/v0.14.2...v0.14.3)

Updates `proc-macro2` from 1.0.69 to 1.0.70
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.69...1.0.70)

Updates `serde` from 1.0.192 to 1.0.193
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.192...v1.0.193)

---
updated-dependencies:
- dependency-name: hashbrown
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: serde
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-27 10:40:38 +05:30
Erik Schilling
25c6ac3362 tree-wide: use new serve convenience function
This become available with the recent vhost-user-backend [1] updates and
allows to get rid of some boilerplate code.

[1] https://github.com/rust-vmm/vhost/pull/173

Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
2023-11-20 13:05:48 +05:30
dependabot[bot]
9a6d12389f build(deps): bump the vhost-device group in /staging with 2 updates
Bumps the vhost-device group in /staging with 2 updates: [rustix](https://github.com/bytecodealliance/rustix) and [toml](https://github.com/toml-rs/toml).


Updates `rustix` from 0.38.24 to 0.38.25
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v0.38.24...v0.38.25)

Updates `toml` from 0.8.2 to 0.8.8
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.2...toml-v0.8.8)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: toml
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-20 10:17:48 +05:30
dependabot[bot]
2e8dc1bb47 build(deps): bump the vhost-device group in /staging with 22 updates
Bumps the vhost-device group in /staging with 22 updates:

| Package | From | To |
| --- | --- | --- |
| [alsa](https://github.com/diwic/alsa-rs) | `0.7.1` | `0.8.1` |
| [clap](https://github.com/clap-rs/clap) | `4.4.6` | `4.4.8` |
| [env_logger](https://github.com/rust-cli/env_logger) | `0.10.0` | `0.10.1` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.49` | `1.0.50` |
| [tempfile](https://github.com/Stebalien/tempfile) | `3.8.0` | `3.8.1` |
| [num_enum](https://github.com/illicitonion/num_enum) | `0.7.0` | `0.7.1` |
| [futures-executor](https://github.com/rust-lang/futures-rs) | `0.3.28` | `0.3.29` |
| [errno](https://github.com/lambda-fairy/rust-errno) | `0.3.5` | `0.3.7` |
| [futures](https://github.com/rust-lang/futures-rs) | `0.3.28` | `0.3.29` |
| [hashbrown](https://github.com/rust-lang/hashbrown) | `0.14.1` | `0.14.2` |
| [indexmap](https://github.com/bluss/indexmap) | `2.0.2` | `2.1.0` |
| [proc-macro-crate](https://github.com/bkchr/proc-macro-crate) | `1.3.1` | `2.0.0` |
| [serde](https://github.com/serde-rs/serde) | `1.0.189` | `1.0.192` |
| [serde_spanned](https://github.com/toml-rs/toml) | `0.6.3` | `0.6.4` |
| [smallvec](https://github.com/servo/rust-smallvec) | `1.11.1` | `1.11.2` |
| [syn](https://github.com/dtolnay/syn) | `2.0.38` | `2.0.39` |
| [system-deps](https://github.com/gdesmott/system-deps) | `6.1.2` | `6.2.0` |
| [target-lexicon](https://github.com/bytecodealliance/target-lexicon) | `0.12.11` | `0.12.12` |
| [termcolor](https://github.com/BurntSushi/termcolor) | `1.3.0` | `1.4.0` |
| [toml_datetime](https://github.com/toml-rs/toml) | `0.6.3` | `0.6.5` |
| [toml_edit](https://github.com/toml-rs/toml) | `0.20.2` | `0.20.7` |
| [winnow](https://github.com/winnow-rs/winnow) | `0.5.17` | `0.5.19` |


Updates `alsa` from 0.7.1 to 0.8.1
- [Commits](https://github.com/diwic/alsa-rs/compare/v0.7.1...v0.8.1)

Updates `clap` from 4.4.6 to 4.4.8
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.4.6...v4.4.8)

Updates `env_logger` from 0.10.0 to 0.10.1
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.10.0...v0.10.1)

Updates `thiserror` from 1.0.49 to 1.0.50
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.49...1.0.50)

Updates `tempfile` from 3.8.0 to 3.8.1
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/commits)

Updates `num_enum` from 0.7.0 to 0.7.1
- [Commits](https://github.com/illicitonion/num_enum/compare/0.7.0...0.7.1)

Updates `futures-executor` from 0.3.28 to 0.3.29
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.28...0.3.29)

Updates `errno` from 0.3.5 to 0.3.7
- [Changelog](https://github.com/lambda-fairy/rust-errno/blob/main/CHANGELOG.md)
- [Commits](https://github.com/lambda-fairy/rust-errno/compare/v0.3.5...v0.3.7)

Updates `futures` from 0.3.28 to 0.3.29
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.28...0.3.29)

Updates `hashbrown` from 0.14.1 to 0.14.2
- [Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/hashbrown/compare/v0.14.1...v0.14.2)

Updates `indexmap` from 2.0.2 to 2.1.0
- [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/bluss/indexmap/compare/2.0.2...2.1.0)

Updates `proc-macro-crate` from 1.3.1 to 2.0.0
- [Release notes](https://github.com/bkchr/proc-macro-crate/releases)
- [Commits](https://github.com/bkchr/proc-macro-crate/compare/v1.3.1...v2.0.0)

Updates `serde` from 1.0.189 to 1.0.192
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.189...v1.0.192)

Updates `serde_spanned` from 0.6.3 to 0.6.4
- [Commits](https://github.com/toml-rs/toml/compare/serde_spanned-v0.6.3...serde_spanned-v0.6.4)

Updates `smallvec` from 1.11.1 to 1.11.2
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.11.1...v1.11.2)

Updates `syn` from 2.0.38 to 2.0.39
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.38...2.0.39)

Updates `system-deps` from 6.1.2 to 6.2.0
- [Release notes](https://github.com/gdesmott/system-deps/releases)
- [Commits](https://github.com/gdesmott/system-deps/compare/system-deps@6.1.2...system-deps@6.2.0)

Updates `target-lexicon` from 0.12.11 to 0.12.12
- [Commits](https://github.com/bytecodealliance/target-lexicon/compare/v0.12.11...v0.12.12)

Updates `termcolor` from 1.3.0 to 1.4.0
- [Commits](https://github.com/BurntSushi/termcolor/compare/1.3.0...1.4.0)

Updates `toml_datetime` from 0.6.3 to 0.6.5
- [Commits](https://github.com/toml-rs/toml/compare/toml_datetime-v0.6.3...toml_datetime-v0.6.5)

Updates `toml_edit` from 0.20.2 to 0.20.7
- [Commits](https://github.com/toml-rs/toml/compare/v0.20.2...v0.20.7)

Updates `winnow` from 0.5.17 to 0.5.19
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.5.17...v0.5.19)

---
updated-dependencies:
- dependency-name: alsa
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: num_enum
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: futures-executor
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: errno
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: futures
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: hashbrown
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: indexmap
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: proc-macro-crate
  dependency-type: indirect
  update-type: version-update:semver-major
  dependency-group: vhost-device
- dependency-name: serde
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: serde_spanned
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: smallvec
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: syn
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: system-deps
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: target-lexicon
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: termcolor
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: vhost-device
- dependency-name: toml_datetime
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: toml_edit
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
- dependency-name: winnow
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: vhost-device
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-16 11:26:18 +01:00
Erik Schilling
31154ea0da Update vhost-user-backend to 0.11 series
- Features were renamed from slave -> backend
- Generics got simplified
- Some write and read functions on Volatile slice got turned into
  standalone traits: ReadVolatile, WriteVolatile
- handle_event no longer returns a bool

Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
2023-11-14 10:48:19 +02:00
Manos Pitsidianakis
1212df9e26 sound/pipewire: add test harness for pipewire+dbus
Add test utility to launch a temporary dbus daemon, pipewire.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-11-10 17:44:32 +02:00
Matias Ezequiel Vara Larsen
4eb461ee3f sound/test: add tests for virtio_sound.rs
This commit adds simple tests for the structures in virtio_sound.rs. The
tests are split into two tests to fix a clippy error regarding the
cognitive complexity.

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-11-09 09:50:39 +02:00
Dorinda Bassey
31212150c1 sound: Add Test for vhost-device-sound
This PR adds test for uncovered code paths

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2023-11-07 11:15:06 +02:00
Matias Ezequiel Vara Larsen
7a00d935f9 sound/test: add tests for device.rs
This commit adds tests in test_sound_thread_failure to test that
process_control() returns Err() in the following four conditions:
    * control request with a single descriptor
    * control request in which first descriptor is write-only
    * control request in which second descriptor is read-only
    * control request with less than three descriptors for control requests
      that require three, e.g., PcmInfo, ChmapInfo

Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
2023-11-02 16:19:54 +01:00
Manos Pitsidianakis
3416215092 sound: add virtualization in Cargo.toml categories
Previous commit added categories to Cargo.toml, but the only value was
`multimedia::audio`.

Thanks @stefano-garzarella for noticing I missed this.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-11-02 10:39:25 +01:00
Manos Pitsidianakis
90f547e98c sound: add clippy lint checks
Add basic lints to deny unidiomatic or potentially bad code.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-11-02 10:46:49 +05:30
Manos Pitsidianakis
75ca1ee428 sound: add package.categories field to Cargo.toml
Suggested by lint https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-11-02 10:46:49 +05:30
Manos Pitsidianakis
7255036df6 sound/pipewire: prevent unsigned sub overflow
A subtraction between unsigned integers is made, which by default panics
on overflow. However, we don't really need to know the difference, only
that it is not zero or less.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-11-02 10:46:49 +05:30
Dorinda Bassey
0f1eab60ec sound/pipewire: Add Pipewire Capture
Add pipewire capture to enable capturing for pipewire backend

Co-authored-by: Dorinda Bassey <dbassey@redhat.com>
Co-authored-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2023-10-31 16:07:46 +05:30
Dorinda Bassey
a2d9b2e721 sound: Improve function definition
instead of consume() fn name, use read_output() fn which
is more appropriate and in sync with the write_input() fn.

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2023-10-30 16:34:06 +05:30
Manos Pitsidianakis
1921ec21d8 sound: Implement RX in ALSA backend
Add an RX code path that is similar to the existing TX code in the ALSA
backend.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-27 11:39:04 +01:00
Manos Pitsidianakis
d00014f5a6 sound: add Buffer::desc_len() method
Add a method to return the length of the descriptor memory region and
make `data_descriptor` field private.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-27 11:39:04 +01:00
Manos Pitsidianakis
31175bf66c sound: Add Direction enum
We use input/output direction values in many places, yet we lose Rust's
exhaustive static checks when matching for a stream's direction. This
commits adds a Direction enum and From/Into implementations for audio
backend respective direction types.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-27 16:04:31 +05:30
Manos Pitsidianakis
573e592037 sound: fix broken tests
Tests were not updated with changes in previous commits, so update them.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-25 12:53:44 +05:30
Albert Esteve
5993c1f6c1 staging: update coverage target
Signed-off-by: Albert Esteve <aesteve@redhat.com>
2023-10-24 19:09:41 +05:30
Manos Pitsidianakis
30d5cf4e10 sound: clean up and improve comments, definitions
- Add some documentation comments
- Rename TxState to IoState in preparation for RX implementation
- Fix inline rust code not being escaped properly in doc comments
- Rename some fields to make their function clearer
- Cleanup some error log messages
- Replace an old TODO comment about queue size with an explanation

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-24 11:08:26 +01:00
Manos Pitsidianakis
04f80fc8e9 sound: add latency_bytes field to IOMessage
The latency field specifies how long it will take until the device
finishes playing the I/O message's buffers.

Since the I/O message is dropped as soon as the last bytes are copied
over to the host's internal buffers, assume the message is dropped
almost after the host has started playing this buffer.

This solves the issue of a guest app exiting before the host has done
playing audio because it kept sending new buffers as fast as possible
without waiting (latency).

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-24 11:08:26 +01:00
Manos Pitsidianakis
2ba56bef25 sound/alsa: fix host hwparams calculation
The host's period and buffer sizes were not being calculated correctly.

This resulted in timing mismatches.

This commit calculates the correct sizes by taking the guest's
parameters into account.

Impossible cases when matching with stream parameters will lead to
unreachable!().

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-24 11:08:26 +01:00
Manos Pitsidianakis
84c58404b8 sound/alsa: fix consume() use for playback
Use of consume() method was incorrect. This commit fixes the buffer
bounds used with playback in ALSA.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-24 11:08:26 +01:00
Manos Pitsidianakis
c10b8e18c4 sound/alsa: stop actual playback after PCM_STOP
Queued buffers were played even after the guest issued PCM_STOP.

This commit:

- makes the ALSA worker threads respect the stopped status instead
- send a start signal to worker threads on PCM_START to handle
  pre-buffering
- reduce the time of playback callbacks holding the stream lock

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-24 11:08:26 +01:00
Manos Pitsidianakis
aa16ef0699 sound/pipewire: handle StreamWithIdNotFound consistently
When handling controlq messages, handle StreamWithIdNotFound the same
way on all methods:

- if we are passed a &mut ControlMessage, set it to
  VIRTIO_SND_S_BAD_MSG.
- if we are passed a stream_id, return StreamWithIdNotFound.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-24 11:08:26 +01:00
Manos Pitsidianakis
208a796061 sound/alsa: handle PCM state transition errors gracefully
Handle some state transition errors more gracefully by retrying ALSA
operations if possible. Also rewrite the PCM_RELEASE handler to make it
more clear.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-24 11:08:26 +01:00
Manos Pitsidianakis
33c977cc0f sound/alsa: Release buffers even on RELEASE err
If a PCM_RELEASE control request comes from the guest and the state
transition is invalid by spec standards, release the buffers anyway.
This doesn't change the current behavior.

When dealing with an unrelated vhost-user issue, the state transitions
became invalid because of unexpected errors in the virto-snd driver.
Making this change made the issue obvious while debugging. Plus, the
spec does not state rejecting a PCM lifecycle control request if the
transition is not possible. (The possible state transitions are
non-normative statements.)

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-24 11:08:26 +01:00
Albert Esteve
3921238555 video: add v4l2 mocks
Add v4l2 wrapper functions to be able
to mock (and test) v4l2r library responses
without the need of having a underlying video device.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
2023-10-24 11:17:33 +02:00
Albert Esteve
cb4ec6ad12 video: fill readme
Complete the README file for the video crate
with the help information for the CLI, and a
working example to run and test the device.

Signed-off-by: Albert Esteve <aesteve@redhat.com>
2023-10-24 11:17:33 +02:00
Albert Esteve
f84ea414e3 video: add tests
Add test for all modules, with dev-dependencies
(including rstest [1] for parametrized tests), and
infrastructure.

[1] - https://docs.rs/rstest/latest/rstest/

Signed-off-by: Albert Esteve <aesteve@redhat.com>
2023-10-24 11:17:33 +02:00
Albert Esteve
72dc2e78f2 video: add v4l2-decoder backend
Add new v4l2-decoder backend, that
uses v4l2r [1] for interactions with the
video device in the host. Specialized for
Linux systems.

[1] - https://github.com/Gnurou/v4l2r

Signed-off-by: Albert Esteve <aesteve@redhat.com>
2023-10-24 11:17:33 +02:00
Albert Esteve
5edf1dfb7b video: initial skeleton
Initial skeleton for virtio-video crate.
This crate is based on the v3 of the virtio-video
specs patch[1].

It has a big part of the infrastructure
required, although not all commands are implemented,
and does not have any backend available.

Includes support for async responses to the driver
(through VIDEO_EVENT) to QueueResource messages.

[1] -
https://lists.oasis-open.org/archives/virtio-dev/202002/msg00002.html

Related: #364
Signed-off-by: Albert Esteve <aesteve@redhat.com>
2023-10-24 11:17:33 +02:00
Dorinda Bassey
1ccb3b6e58 sound/pipewire: add safety comments
Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2023-10-24 14:19:24 +05:30
Dorinda Bassey
cae9fd0f79 sound/test: add testing module for sound
add testing modules

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2023-10-20 18:35:29 +05:30
Dorinda Bassey
d04d6b42fc sound: Return error if no memory configured
Add option to return error if no memory is configured

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2023-10-20 18:35:29 +05:30
Dorinda Bassey
ab33111ecb sound/Cargo.toml: update dependencies
Update dependencies and add support for xen builds

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2023-10-20 18:35:29 +05:30
Stefano Garzarella
994ffe1864 staging: add custom pipelines to run CI tests
Let's use custom pipelines to run CI tests in the nested worskpace.

We have included all the tests we usually run in the main workspace
(rust-vmm-ci/.buildkite/test_description.json), except for "commit-format"
which also covers commits for staging crates.

Let's add a `staging\coverage_config_x86_64.json` for testing coverage of
crates in staging.

All staging tests have `soft_fail = true` to prevent failures in staging
from affecting the CI of the main workspace.

Closes #478

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2023-10-17 16:35:55 +05:30
Manos Pitsidianakis
eb2e2227e4
Move vhost-device-sound to staging workspace
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-16 14:58:40 +03:00