Add the minimal allow(dead_code) and feature declarations to allow the
clippy checks to pass for Windows with Rust 1.81.
BUG=b:365852007
TEST=tools/presubmit clippy_mingw64
Change-Id: I9ab776b07d8e9e14fe380d9b5ef1fa332788ff63
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/6013080
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
When DeviceRenderer is destroyed, ready_event and async_ready_event will
be both dropped, and CloseHandle will be called on the same HANDLE
twice.
Duplicate the event HANDLE before passing to the ex.async_event event
factory.
TEST=flat run battlestar; run a game and close a game in debug mode, no exception is caught
BUG=b:370552944
Change-Id: I3d7536e450af52e38e37556adcb16d42c73ef23f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5900813
Reviewed-by: Richard Zhang <rizhang@google.com>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
Virtio-snd on Windows will take a audio_client_guid on initialization.
A device index is also added so that logs can be differentiated between
multiple audio devices
TEST=ran emulator downstream
BUG=b:342181161
Change-Id: Ia156b3ad2a9cc447a7e350a1915762f23e25f9cb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5563959
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Ensure that every Cargo.toml dependency on a third-party crates.io crate
specifies at least a major version, or a minor version for 0.x crates,
to ensure that if a new major version is published, it cannot cause API
breaks.
The versions are selected to match the ones already in Cargo.lock, so
this should have no functional change, but it will help prevent new "*"
versions from being introduced via copy-and-paste.
For rationale, see the Cargo FAQ:
<https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies>
`minijail`, `audio_streams`, and `cras` are left as "*" for now, since
they have unusual situations (imported from a submodule and/or replaced
at build time with ebuild magic).
BUG=None
TEST=tools/dev_container tools/presubmit
TEST=verify Cargo.lock is unchanged
Change-Id: Ifa18199f812f01d2d10bfb4146b3353c1a76527c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5555656
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add a metrics_event package instead of relying on metric events provided
out of a vendor/ crate. The new API defines the same events as the
existing vendor API, except it removes any dependencies on downstream
details. To allow downstream projects to define their own events, the
new API adds a vendor metrics_event package to support downstream-only
event types.
BUG=b:332466813
TEST=./tools/dev_container ./tools/presubmit all
Change-Id: I766ad6ca2a0a437bb487e27fb84a4984f66c9770
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5400361
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
This seems to build fine upstream, so re-enable it to ensure it does not
get broken accidentally.
Change-Id: I1fcb5678ce33edb24d1aa047fa405b1d27100206
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5321440
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The standard library versions of these functions have been const since
Rust 1.63. Make our sync wrappers match.
Change-Id: I63ec097aa9fbb63735528827576f08ced2304a16
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5318701
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Nigthly is enabled as part of https://crrev.com/c/4950268
This change contains the formatting changes resulting from the switch.
BUG=b:302055317
TEST=dev_container presubmit format --no-delta
Change-Id: Idaf2b8bae2e09c624b19d9cd3dd5fc8e4d099b3c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5067088
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This includes:
* Audio capture support
* Device listener when no devices are connected
* Various refactors
BUG=b:275406212
TEST=ran tests, presubmits
Change-Id: I2c12ea9e042bc9a966702bb37158b32b1af811b1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4878756
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The build.rs file will be compiled for the host platform and cfg()
flags will reflect those of the host platform and not of the build
target.
Use CARGO_CFG_ environment variables instead.
BUG=b:240593511
TEST=CQ
Change-Id: Ib8b6c8e8bfb44ad83212bb2aa40a17a4e16a4adf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4518569
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
system_api bindings have been regenerated with protobuf 3.2; this should
be okay to land before the full ChromeOS system_api migration, since
crosvm always uses its own copy of the bindings rather than the ones
provided by the dev-rust/system_api package.
The protoc-rust crate is replaced with protobuf_codegen in 3.x.
BUG=b:277243607
BUG=b:279834784
TEST=tools/dev_container tools/presubmit
Change-Id: I6aad45ded2639d7506a7238800584bebab196455
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4405309
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
File backend will write audio playback to files. Every PCM playback
stream will have its own file.
Changes:
* Add playback_path and playback_size to virtio::snd::Parameters
* Add new file_backend file in virtio::snd
* Add virtio-snd arg help.
BUG=b:233542268
TEST=run crosvm with --virtio-snd backend=file and call aplay
Change-Id: Iaec01f52292f1181b0137fa3c8d8c2b2b9e7cc49
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4306260
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
These should be written as ChromeOS and ChromiumOS (without the space)
to match the updated branding. The copyright headers were already
migrated to the new style (https://crrev.com/c/3894243), but there were
some more instances left over.
BUG=None
TEST=tools/cargo-doc
Change-Id: I8c76aea2eb33b2e370ab71ee9b5cc0a4cfd00585
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4129934
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
TEST=presubmits and this code works downstream
BUG=b:258298873
Change-Id: I7369fb08af474d107d056da8538de86bbc03eeb8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4015562
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Richard Zhang <rizhang@google.com>
Since we will be allowing for multiple audio streams soon (1 playback and 1 capture), we will need a unique completion event name for each stream. Otherwise, if multiple streams are created around the same time, they would be listening for the same event, which would result in bugs where some streams would be notified when they shouldn't have.
This also prepares us for having >1 playback and >1 capture streams as well, if we ever want to have that.
Bug: 253509368
Test: ran emulator and verified sound still works
Change-Id: Id53a4c233579c0ffba750b6663111e6c02f02dfd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3997600
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
The future DeviceCapturer object will use a lot of the functionality for DeviceRenderer. This CL will refactor these methods so that they can be shareable.
TEST=In downstream branch, ran emulator, verified sound still works
BUG=b:253509368
Change-Id: I468eafeab0a9741332a360638b267366c06fe944
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3994883
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Richard Zhang <rizhang@google.com>
The most notable changes are:
* Playback Async support
* Audio Client flags to hide app from SndVol when audio session has
expired
* Updates to audio_streams and cros_async crates for playback async
support
BUG=b:256655413
TEST=Verified to work downstream
Change-Id: Ifbe9a15791feaa41d6e1d5eaf2c5824b2c7c25b8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3994882
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Replace the single new_with_manual_reset() call, which passed false to
create an auto-reset event, with a call to the more descriptive
new_auto_reset() function.
This allows the new_with_manual_reset() API to be removed.
BUG=b:231344063
TEST=tools/presubmit --all
Change-Id: I51d1fcbab161d10539c44689b31e2d86ad9e1527
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966482
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Trying to reconcile the difference between the linux and windows
implementations.
Code relying on the eventfd count must now use the linux specific
`EventExt` interface.
BUG=b:231344063
TEST=presubmits
Change-Id: I14eb50f7a02d766a00f27aca388823309633e193
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3864030
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Fix a few stray references to "CrosVM" and "CrosVm" so that we refer to
the crosvm project with consistent capitalization.
BUG=None
TEST=None
Change-Id: If5c3c131774d6e5da1d27466810642aec3cb42ac
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3938640
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.
This fulfills the request from legal and unifies our notices.
./tools/health-check has been updated to only accept this style.
BUG=b:246579983
TEST=./tools/health-check
Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Fixes a couple of files that were missing them.
BUG=b:242605601
TEST=./tools/health-check --fix
Change-Id: I620d6a939cb824e014002152584aacfc5dfdf7e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3835648
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
- Remove trailing ::{self} on all use statements
- Remove any resulting single-level use statements (e.g. use libc;)
- Reformat with `tools/fmt --nightly`
BUG=b:239937122
TEST=tools/dev_container tools/presubmit --all
Change-Id: I8afd1b0458ca6d08d9b41a24583f7d4148597ccb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3798973
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
crosvm is switching the import style to use one import per line.
While more verbose, this will greatly reduce the occurence of merge
conflicts going forward.
Note: This is using a nightly feature of rustfmt. So it's a one-off
re-format only. We are considering adding a nightly toolchain to
enable the feature permanently.
BUG=b:239937122
TEST=CQ
Change-Id: Id2dd4dbdc0adfc4f8f3dd1d09da1daafa2a39992
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784345
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This crate has been copied upstream verbatim. This crate is used as an
audio backend for playback (capture has not been implemented yet).
The next CLs are will upstream the usage of win_audio.
Bug: 232462411
Test: built and presubmits (although this crate won't be built locally or
presubmits yet)
Change-Id: Iae374b2b575fbd19b016cae403a00024896cba56
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3694097
Commit-Queue: Richard Zhang <rizhang@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>