Adds a script that copies the bindings we need upstream. We cannot
use the original repository, as it's part of the large platform2 git
repository, and the original build.rs depends on ChromeOS tooling to
generate these bindings.
So instead, this change adds a script that can be called from a
chromiumos checkout of crosvm to update the upstream bindings.
This allows us to enable certain features that talk to ChromeOS
dbus services. They won't be functional upstream, but at least we
can compile and test the code.
To make things more consistent, we no longer replace the crate
with the ChromeOS version when building for ChromeOS.
BUG=b:244618505
TEST=presubmit
Change-Id: I504cbf6d12b0cb50d9935f5e49b7fa72b692d45c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3919814
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
BUG: b:244618109
TEST: Presubmit and built with the feature on windows and linux.
Change-Id: Idf9ae87243eb0a7c7b9a6ff525406f1430b49c20
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3916339
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Add the infrastructre for GDB 'p'/'P' packets, used by the client to get
or set individual registers.
Implement a back-end using KVM_{G,S}ET_ONE_REG on AArch64, enabling the
client to access the architecture's numerous system registers.
Add stubs for x86 to please the compiler; leave them unimplemented as,
although the ioctl is available, the architecture doesn't seem to make
use of it.
BUG=b:222222882
BUG=b:240711627
BUG=chromium:1141812
TEST=tools/dev_container ./tools/run_tests
Change-Id: I01968275e88e9d0098de40b3f78e2cd3a61b75da
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3785468
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Generalize and move it out of the decoder for potential future use in
the encoder module.
A ffmpeg.rs module is introduced to accommodate any video-related code
that requires the ffmpeg feature flag, similar to what we have for
libvda.
BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices
Change-Id: I341d6d238b5593d16cbdc8dd8c96eb2fa4e143fe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911109
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Since re-enumerating all the formats supported by FFmpeg in our bindings
would be a rather large effort, it looks like a good compromise here is
to allow the user to create an AvPixelFormat from the raw enum values
exposed by bindgen.
Add a helper that checks that the value is in range of valid formats and
convert it into our enum wrapper.
BUG=b:239897269
TEST=cargo test --features ffmpeg -p ffmpeg
Change-Id: I3c1433e9d76d645b7615bde81433e1df2cfa3910
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911108
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Notable changes:
1. Use "W" methods during window creation and message dispatching
to ensure unicode characters are sent to the window.
2. In DisplayEventDispatcher::dispatch(), filter() and map() will
be ignored if we don't call collect(). We replace map() with a
for loop to make this clearer.
Other changes are due to linter/formatter warnings, etc.
Bug=b:213150276
TEST=cargo b -p gpu_display --features win64 --no-default-features
Change-Id: I767aec208d8afd7d7cb86039d08ba8ec8369da81
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3913991
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
- We now have ::empty() for flags instead of ::none().
- PhysicalDeviceType was changed to vulkan_enum which is not Ord, so we
have to change BTreeMap to HashMap.
- The abstract holders for MemoryType or QueueFamily are gone, so more
index tracking is required. Some constructors take indices now.
- Physical devices are proper objects now, and are enumerated via the
instance. To keep things simple, this CL only replaces with equivalent
logic, but the next one should replace device indices entirely with
device UUIDs.
- Device memory errors were condensed into a single DeviceMemoryError
type. We also need to handle the VulkanError type from
enumerate_physical_devices.
BUG=b:244622199
TEST=presubmit
Change-Id: I1bba7e652ca67ecc5d9c10ddba3e1da35185078b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3913993
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This reverts commit fa1e6e3249.
Reason for revert: This turns out to have been a bug in the kernel that can be addressed with the following patch:
```
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 2d7ea5480ec3..71b412f820c7 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -328,6 +328,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
pr_info("Disabled fast string operations\n");
setup_clear_cpu_cap(X86_FEATURE_REP_GOOD);
setup_clear_cpu_cap(X86_FEATURE_ERMS);
+ setup_clear_cpu_cap(X86_FEATURE_FSRM);
}
}
```
Original change's description:
> x86: cpuid: clear FSRM bit
>
> This seems to cause an unexpected fault under Bruschetta, and possibly
> any other software using Ice Lake's Fast Short REP MOVs.
>
> This is a port of a patch from AOSP[1].
>
> [1]: https://android-review.googlesource.com/c/platform/external/crosvm/+/2138413
>
> BUG=b:228795137
> TEST=deployed to brya board, bruschetta bootup no longer hangs after
> entering smpboot
>
> Change-Id: Ifb4e8af104ee8e2945598ea4c06001cbd98c40e9
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3913990
> Auto-Submit: Mike Gerow <gerow@google.com>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Bug: b:228795137
Change-Id: I7bd8be1b33315dddb5b73df62303bd967ac0573e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3916337
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Mike Gerow <gerow@google.com>
This MSR seems to be the responsibility of the hypervisor to set up even
when booting with BIOS/firmware in the guest. When it is missing, the
configuration of IA32_MISC_ENABLE will be inconsistent with CPUID bits
like ERMS and FSRM, which report fast REP MOVSB behavior as well.
Specificially, this avoids a problem with newer Linux kernels when
booted in crosvm with a BIOS where the ERMS feature is masked out due to
the IA32_MISC_ENABLE bit being unset but the FSRM feature is not masked
out, leading to a normally impossible combination of CPUID features that
the memmove code did not expect.
BUG=b:228795137
TEST=Boot Linux with OVMF on brya
Change-Id: I9e9e8301d8cb3d1f0f0d0c7d2137ff3286f35c1d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3919374
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Mike Gerow <gerow@google.com>
Some types have a typo on them. For the FFI case we don't currently use
the definition so it should be safe to rename.
BUG=b:244622199
TEST=presubmit
Change-Id: I9e3c29755f0c4479b54bef206f9173ab22030ab9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3913992
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Idan Raiter <idanr@google.com>
http://crrev.com/c/3911103 renamed a member of BufferInfo, but did not
update the video code that uses it.
BUG=b:3911103
TEST=cargo build --features "video-decoder,video-encoder,ffmpeg,vaapi,libvda"
Change-Id: Icc8c5c2f564ea2fdaeee12abe57cfd29c8373a72
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3920255
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
It used to use File instead. In VirtioGpu::export_fence() and
VirtioGpu::export_resource(), we had to turn SafeDescriptor into
File, which is not supported on Windows (to avoid converting a
SafeDescriptor that is not a file handle to a File). To make them
more platform-agnostic, we replace them with SafeDescriptor.
BUG=b:213149288
TEST=presubmit
Change-Id: I259bbc4d3461bc68b5a7a1e24d50bf77bdc6a5b0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911103
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
This wrapper type is useless as we can just implement the access traits
on KeyValueDeserializer directly.
BUG=b:218223240
TEST=cargo test -p serde_keyvalue
Change-Id: I5013b3fea2f0a2febf182a2fd42037d1cbdbe737
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3915037
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
The generic type used in read_config() and write_config() was only used
to check the offset against the size of that type; the backend device is
capable of checking this itself, so we can drop the type from the
function signatures.
Additionally, fix the config functions to use the offset rather than
reading/writing the whole config and copying out the relevant parts.
This makes the config function implementation identical for all
vhost/user/vmm/ code.
BUG=None
TEST=mount vhost-user-fs filesystem in guest
Change-Id: I22493f4e87bff68ef9d68f1d1a0feeb29ec059da
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867543
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Implement `run_async` method in `Worker` for the video device.
`run_async` is necessary for implementing vhost-user video device, which
prefers async wait loop.
For now, the async runner depends on the wrapper of WaitContext, which
the implementation of decoder device depends on, rather than making the
decoder device async. In addition, this commit does not unify the block
`run` and `run_async` yet.
BUG=b:179756087
TEST=cargo build succeeds.
Change-Id: Iec14a342bade14bf1f68ec0211da3dd2b52c85da
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783295
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Currently, the utility function `run_one` has its own logic to create
`FdExecutor` and `UringExecutor`. However, this logic duplicates that of
`Executor::new`. So when you update the logic of `Executor::new`, you
must also update `run_one`, which is easy to forget and error-prone.
This commit updates `run_one` to delegate the executor building logic to
`Executor::new`. Also, the error type of `run_one` has been updated to
match `Executor::new`.
BUG=None
TEST=`cargo build` and `cargo test -p cros_async` succeeds.
TEST=windows build succeeds
Change-Id: Ic90a064c4c9017ed14e2897bccf68f9e275e1fef
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3829220
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Update `Worker` of the video device to make it easier to add async run
method; separate the interrupt into two `SignalableInterrupt`s for the
command/event queues, and move `Event`s to outside `Worker`. These are
changes preparing for introducing `run_async` method to `Worker`.
`run_async` will need separate Interrupts for the command queue and the
event queue, and will not need `Event`s inside `Worker`.
BUG=b:179756087
TEST=simple_decoder test script (see the crosvm book) worked with and
without -p "pci=nomsi" guest kernel parameter, which triggers interrupt
resample by disabling MSI-X interrupt.
Change-Id: Ia169e11bb5ecf992f768ab65cfb19a7a9f8fc9f0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3850019
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
As announced in http://g/luci-announce/d5-USDV4YXQ, the run pass
and failure message will be changed as part of CQ -> CV migration.
This CL allows the tool to handle both old style and new style
messages.
Change-Id: Ia06c05eeff321b26af92dc67bd41747e60d9b071
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3914865
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
When sandboxing is disabled, rutabaga.external_blob is unset and blob
resources with RUTABAGA_MEM_HANDLE_TYPE_OPAQUE_FD can be mapped via
rutabaga.map() as VmMemorySource::ExternalMapping. This is already
implicitly allowed for the Virglrenderer component, which doesn't
recognize the OPAQUE_FD handle type upon export_blob() and automatically
falls back on the ExternalMapping path. Mesa CI currently relies on this
for testing Venus in Crosvm with the host lavapipe driver.
When sandboxing is enabled, rutabaga.external_blob is set and opaque
fds MUST be mapped from the hypervisor process via Vulkano as
`VmMemorySource::Vulkan` instead.
This CL makes non-sandboxed OPAQUE_FD mapping explicit, documents the
two mapping paths, and prepares for virglrenderer to support sandboxed
OPAQUE_FD mapping.
For the non-sandboxed configuration, Crosvm exports a RutabagaHandle
with handle of type RUTABAGA_MEM_HANDLE_TYPE_OPAQUE_FD upon blob
creation with virglrenderer. When mapped, the RutabagaHandle is dropped,
closing the cloned opaque_fd, and virgl_renderer_resource_map()
completes the mapping internally by looking up the resource_id and
dispatching to the context type from which it was created.
BUG=b:244591751
TEST=`deqp-vk -n dEQP-VK.memory.mapping.*` using venus with lavapipe host driver
TEST=CQ
Change-Id: I2ff32cf8868d6c9c1eb16480456cde98d376cc65
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3900320
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This seems to cause an unexpected fault under Bruschetta, and possibly
any other software using Ice Lake's Fast Short REP MOVs.
This is a port of a patch from AOSP[1].
[1]: https://android-review.googlesource.com/c/platform/external/crosvm/+/2138413
BUG=b:228795137
TEST=deployed to brya board, bruschetta bootup no longer hangs after
entering smpboot
Change-Id: Ifb4e8af104ee8e2945598ea4c06001cbd98c40e9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3913990
Auto-Submit: Mike Gerow <gerow@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
We want to hide this variable from platforms that don't use it.
BUG=b:213149288
TEST=presubmit
Change-Id: I0d44d2bc50843b86d82b4084f95c8d1a1f750aa6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3895401
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chia-I Wu <olv@google.com>
Apart from being used for arg parsing, GpuParameters is also sent
through a Tube on Windows. Since we've added a deserializer for
the context_mask field, we also need a serializer for it.
BUG=b:233676779
TEST=cargo test -p devices --features=all-linux
virtio::gpu::parameters::tests::context_mask_serialize_deserialize
Change-Id: Ic0a01acc07ac39b5962e3cfad970dae1ae8c8b27
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3906468
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Resource bridges are not supported on Windows, so we shouldn't try
to add their raw descriptors in Gpu::keep_rds().
Struct Gpu is updated to hold the ResourceBridges struct rather
than the Vec<Tube>.
BUG=b:213149288
TEST=presubmit
Change-Id: I6b71076d17057728b927d93462e3aee29f3ac8af
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911100
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Hitherto the activation could succeed only once since take() function on
Option "Takes the value out of the option, leaving a None in its place."
Above resulted with crosvm crash in guest suspend/resume scenario when
the activate was called more than once (for the second time snd_data
and stream_source_generators was None).
To overcome above issue use clone for snd_data. For
stream_source_generator the clone can't be
easily used due to missing Clone support for stream_source_generators
embed data types (e.g.
369 | struct AudioBuffer<'a> {
370 | buffer: &'a mut [u8],
| ^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for
`&mut [u8]`
and some other). Therefore for stream_source_generator move
create_stream_source_generators from new() to activate.
BUG=b:246728970
TEST=Perform multiple suspend/resume s2idle cycle for borealis VM and
make sure that 1) crosvm doesn't crash anymore 2) audio from borealis VM
is still working after VM suspend/resume cycles.
Change-Id: I8b27042e4cc0e5efb1d92756ac3b71a5a744f705
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3904649
Commit-Queue: Norman Bintang <normanbt@chromium.org>
Reviewed-by: Norman Bintang <normanbt@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Stub the required parts of libcras so that upstream builds with
audio_cras feature
BUG=b:244618503
TEST=cargo build --features audio_cras
Change-Id: I21eb3bcb9a61990740b1419f124401878619481e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911099
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vineeth Pillai <vineethrp@google.com>
Builds with audio_cras feature gets the following warning
warning: unreachable pattern
--> src/crosvm/sys/unix/device_helpers.rs:443:9
|
443 | _ => unreachable!(),
| ^
|
= note: `#[warn(unreachable_patterns)]` on by default
This is because the enum is fully matched when audio_cras is enabled.
Make the unreachable conditional based on the audio_cras feature.
TEST=None
BUG=None
Change-Id: I68f9d7e4571e043ba81ceef62ced075415398802
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911098
Commit-Queue: Vineeth Pillai <vineethrp@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
GLES 3.1 is not yet well tested with gfxstream backend on Windows
and we don't enable it by default. We control this via command
line arg for now.
BUG=b:213151426
TEST=presubmit
Change-Id: Ic3f8ac0e10ab988cc7bb4a5ab741ee6542617943
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911097
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Commit-Queue: Pujun Lun <lunpujun@google.com>
This feature is only available on ChromeOS and should live in
the downstream ChromeOS repository.
Note: This change should be reverted with the next ChromeOS merge.
BUG=b:244618505
TEST=None
Change-Id: I33d4e6c5feb4178ebf7cd946ea654dbd20291653
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3907532
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This is to keep consistency with Windows downstream code.
The conversion from ProcessType to EmulatorProcessType is moved to
the metrics crate as it is only used for generating metrics.
BUG=b:213146388
TEST=presubmit
Change-Id: Ia62f76835a1f162dd8bbc9e53fd671968c368473
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3908370
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
The offset field of the VHOST_USER_GET_CONFIG message indicates the
offset within the whole device configuration, not within the buffer in
the message, so offset does not need to be less than size.
BUG=None
TEST=connect fs device with modified read_config() impl
Change-Id: Ifabac14ec087da200a09f41aa3a0041e96cf56f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867542
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
The wl device specific version of this was identical to VhostUserOption,
which is used for all other vhost-user device types, so just use that
instead.
BUG=None
TEST=tools/presubmit --all
Change-Id: I0d5868b78bc8b84d24e901601a1a9a1037853ee2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3867539
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
After deserializing a value, do not consume the next character until we
confirm it is the expected delimiter, otherwise the "expected comma"
error will be reported with an extra offset of 1.
TEST=cargo test -p serde_keyvalues
Change-Id: Id3b80a256bfee51eb1125091dcb0114c2e4af226
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3905070
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
`anyhow::context` is more idiomatic way to handle errors than mapping an
error by `map_err(|e| anyhow!(...))`. However, main.rs uses the latter
right now.
This commit rewrites such error handling to the `.context` manner.
Note that this commit does not rewrite all `map_err` because some of
them requires refactoring various functions which return the unit type
as their error like `Result<..., ()>`. Because the unit type does not
implement `std::Error`, we cannot wrap it with `.context`.
BUG=None
TEST=build succeeds
Change-Id: I5829db1ed98bafd3d61a165172a009ab8db29d53
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3831834
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Takaya Saeki <takayas@chromium.org>
The previous implementation would silently not flush all buffers if not
enough output buffers were available. It would also unconditionally emit
the FlushCompleted event.
Fix this by retrying the flush whenever new output buffers are
available, and only exiting the flush state when there is nothing left
to flush.
BUG=b:214478588
TEST="cargo test --features=video-decoder,vaapi
virtio::video::decoder::backend::vaapi::tests::test_get_capabilities"
Change-Id: I47402d3e561ca98ba93462f448eb4eb76acd3eee
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783001
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Some codecs might need to return frames on flush. This is notably the
case on h264, as it has to output the frames in the DPB on flush, but
the current design makes it impossible.
Fix it by changing the signature of flush to allow for possibly
returning frames when flushing. These frames are appended to the ready
queue and outputted as soon as output buffers become available.
BUG=b:214478588 TEST="cargo test --features=video-decoder,vaapi
virtio::video::decoder::backend::vaapi::tests::test_get_capabilities"
Change-Id: Ifd982518bc09cbdd3c32da5409e348a3a2e0b91d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3783000
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Add tests for a unit type and an untagged enum.
TEST=cargo test -p serde_keyvalue
Change-Id: Ifb840e3270624ef0e54d69b7eba2e631ffcac4e5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3906752
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
* Fixes a regression where we stopped setting sparseness on Windows
disk images when they were opened.
* Simplifies how disk images are opened. io_concurrency is not
currently used and may be repurposed in a way that won't use the more
complicated code in disk image opening.
BUG=b:247582339
TEST=builds
Change-Id: I25dd71985d512e5d6991a74e4e1b01fa798856a9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3908372
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
We want to use this for the encoder too, so move it to a place that can
be accessed from both.
BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p devices video
Change-Id: I5f880a9907d0750249d50a8b36f8431f180c31a4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889332
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>