Commit graph

4815 commits

Author SHA1 Message Date
Takaya Saeki
a150978ca0 devices: virtio: video: make Worker async friendly
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>
2022-09-26 03:26:37 +00:00
Yiwei Zhang
2d1d44b6df handle new CV run ended message
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>
2022-09-23 16:58:44 +00:00
Ryan Neph
2a8339f85d rutabaga_gfx: make non-sandboxed opaque fd mapping explicit
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>
2022-09-22 21:43:19 +00:00
Mike Gerow
fa1e6e3249 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>
2022-09-22 21:42:39 +00:00
Pujun Lun
698d2dcc3a devices: add feature flags to render_server_fd.
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>
2022-09-22 20:21:59 +00:00
Pujun Lun
05e0443fe5 gpu: add a serializer for context mask.
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>
2022-09-22 16:34:19 +00:00
Pujun Lun
9a415a2559 gpu: don't use raw descriptors of resource bridges on Windows.
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>
2022-09-22 16:33:59 +00:00
Grzegorz Jaszczyk
572519253d audio: fix VirtioSnd re-activation
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>
2022-09-22 09:14:19 +00:00
Vineeth Pillai
aea39132e8 libcras_stub: Stub implementation
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>
2022-09-21 23:36:06 +00:00
Frederick Mayle
1c3ba38583 base: don't export platform specific Event types
TEST=cargo build && ./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64 --build-only
BUG=b:231344063

Change-Id: I125f4b200abdc6758bae93d98c590c2139fe915b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3864025
Auto-Submit: Frederick Mayle <fmayle@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-09-21 21:35:48 +00:00
Vineeth Pillai
ea67d8ba10 audio: Fix the unreachable pattern warning with audio_cras
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>
2022-09-21 21:27:14 +00:00
Pujun Lun
ea55d0fecd rutabaga_gfx: add an interface to enable GLES 3.1 for gfxstream.
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>
2022-09-21 21:21:14 +00:00
Dennis Kempin
7cd928d985 Remove ChromeOS only PR_SET_CORE_SCHED
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>
2022-09-21 20:51:16 +00:00
Pujun Lun
dd2c0a932a crosvm: move enum ProcessType to win_util.
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>
2022-09-21 19:28:49 +00:00
Daniel Verkamp
02214710df devices: vhost-user: remove incorrect get_config offset check
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>
2022-09-21 18:44:38 +00:00
Daniel Verkamp
c1c37179e1 crosvm: replace VhostUserWlOption with VhostUserOption
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>
2022-09-21 18:36:29 +00:00
recipe-roller
cb4d39b688 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8802391772360396401

depot_tools:
08bb5c487f
  08bb5c4 (gbeaty@chromium.org)
      Use the gerrit host when setting gitiles commit.

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: Ibb199c0f2eadaed563701b7f4b78a05e6218d8b7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911096
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-09-21 17:59:58 +00:00
Dennis Kempin
e749002260 DIR_METADATA: Add public buganizer component
Change-Id: If33e86b18834a4a6df0af4b9be2df59bc0b551c9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3911095
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-21 17:43:59 +00:00
Alexandre Courbot
86210e591e serde_keyvalue: fix error reporting offset
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>
2022-09-21 16:50:09 +00:00
Takaya Saeki
f6d446d209 main: prefer .context to map_err(|e| anyhow!(...))
`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>
2022-09-21 05:31:48 +00:00
Daniel Almeida
53523c943c video: decoder: vaapi: retry flush() if new buffers are available
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>
2022-09-21 03:24:28 +00:00
Daniel Almeida
e64a119bed video: decoder: vaapi: change flush() signature
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>
2022-09-21 03:15:59 +00:00
Daniel Almeida
ede5a80959 media: libva: Also export VASurfaceID
BUG=b:214478588
TEST="cargo test"

Change-Id: I4ab17409afd08f23ed3addd6463f150a6c768ccf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3782998
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-09-21 03:03:57 +00:00
Alexandre Courbot
aad77ff1e2 serde_keyvalue: add a few tests
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>
2022-09-21 02:57:52 +00:00
Noah Gold
90063081cb devices: simpler disk image opens + bug fix for Windows.
* 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>
2022-09-21 01:48:26 +00:00
Tatsuyuki Ishi
3af6d25d61 virtio: video: Move decoder utils to the root video module.
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>
2022-09-21 01:44:38 +00:00
Tatsuyuki Ishi
39108c7dfc virtio: video: Decouple EventQueue tests from the video-decoder feature.
We want to share this module between the encoder and decoder, so as a
prerequisite remove the test's dependency on decoder features by making
a test-local copy of the struct.

BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p devices video

Change-Id: I09726e2da823994d4a9000bb23a8f5dbed4fdbca
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3889331
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-09-21 01:44:38 +00:00
Alexandre Courbot
ca7b21ef91 crosvm: add more tests for the --gpu-display option
We never checked that the "hidden" and "refresh_rate" members are
properly set.

TEST=cargo test --features "gpu" parse_gpu

Change-Id: Ieb695cd19729c73c7e65a292f5575983473ea687
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3906751
Reviewed-by: Pujun Lun <lunpujun@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-21 00:10:17 +00:00
Alexandre Courbot
a3e5494937 crosvm: fix layout of --gpu-display help message
The help message appears broken and needs fixing.

TEST=crosvm run --help

Change-Id: Ib8d52f45da8636380b781076393079fa03f40384
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3906750
Reviewed-by: Pujun Lun <lunpujun@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
2022-09-21 00:09:58 +00:00
Dennis Kempin
d9de9f6457 infra: Use new --platform flag for run_tests
This will greatly speed up aarch64 runs since we can run
many tests with user-space emulation instead of using the slow
VM.

BUG=b:247139912
TEST=
x86: https://ci.chromium.org/swarming/task/5d7583a3a377d710
aarch64: https://ci.chromium.org/swarming/task/5d7584f7c890d010
armhf: https://ci.chromium.org/swarming/task/5d75859f0642a410

Change-Id: I73a476ce27f6d23d5cbf88841fa3eae5dc467b63
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3908369
Commit-Queue: Zihan Chen <zihanchen@google.com>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
2022-09-20 21:40:07 +00:00
Dennis Kempin
3164f92428 power_monitor: Enable feature in all-linux
To enable this feature, we copy the required proto file from
ChromeOS. Not a great solution, but better than leaving the
code uncompiled in upstream.

We could consider downloading the file from gitilies with
a fixed sha that is manually upreved. But unfortunately
downloading things in build.rs is not trivial without adding
a ton of dependencies for the reqwest crate.

BUG=b:244619797
TEST=presubmit

Change-Id: I401917134471909be80a281454bc64dd27799afe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3907373
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-20 21:06:47 +00:00
Dennis Kempin
16c3d76f5f Cleanup: Remove old, deprecated and no longer used files
Most of these are artifacts of previous developer tools or infra.

BUG=None
TEST=None

Change-Id: Iff379ec786e85c3ea2e89ae3c6100fa2de9422d3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3905069
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-20 21:05:57 +00:00
Daniel Verkamp
38d39953c7 Cargo.toml: enable wl-dmabuf feature for all-linux
Now that the libdrm linker issues are fixed, we can enable wl-dmabuf
testing in CI.

BUG=b:244618790
TEST=tools/dev_container tools/presubmit --all

Change-Id: Id4d3e979ab357518ad8804fde373345bb5a38c37
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3905093
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-20 20:30:43 +00:00
Daniel Verkamp
c56f161f93 rutabaga_gfx: add virglrenderer deps later
If the -ldrm option is added before the virglrenderer library in the
linker command line, the libdrm symbols will not be available, since
they aren't used and will be dropped by the linker. Move the
virglrenderer deps into a helper function to avoid duplication and call
it after the virglrenderer build to get the linker options in the right
order.

BUG=b:244618790
TEST=tools/dev_container tools/presubmit --all # with wl-dmabuf feature

Change-Id: I55cc96a28a1f02e7b6081d3cfa08bc3446b8e6a1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3905092
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-20 20:30:39 +00:00
Dennis Kempin
97da569f79 tools/run_tests: Split unit tests from integration tests
Changes how unit tests are executed. Instead of running all tests on
a selected target (i.e. host or a VM), we will select a platform to test
and run_tests will use a separate target for unit tests than for
integration tests.

e.g. instead of running all tests in the aarch64 vm:

./tools/run_tests --target=vm:aarch64

We can now run

./tools/run_tests --platform=aarch64

to run unit tests via user-space emulation on the host, and only
integration tests on the VM.

This will eventually apply to x86 testing as well, so tests can be
run in an unprivileged environment (e.g. podman).

A new TestOption has been added to mark unit tests that have system
interactions that require them to be run like integration tests in a VM.
These should be fixed.

You can also use --unit-tests and --integration-tests to run just one
type of tests. Running unit tests only takes a few seconds on most
platforms since we can use user-space emulation.

BUG=b:247139912
TEST=./tools/run_tests
./tools/run_tests -p aarch64
./tools/run_tests -p mingw64
./tools/run_tests -p armhf

Change-Id: Icd0c502623f1889906d199e752b3eccb7de76dc0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3902688
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-20 18:27:23 +00:00
recipe-roller
42610bff62 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8802483629905830705

recipe_engine:
f742d79674
  f742d79 (olivernewman@google.com)
      [test] Fix py3 incompatibilities

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I733d4643102833490c63b1f0e5656538ede9c2e4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3907370
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-09-20 17:48:23 +00:00
recipe-roller
0a41109552 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8802485516735975025

depot_tools:
512dfd676b
  512dfd6 (tperrotta@chromium.org)
      fetch: make --no-history and --no-hooks switches consistent

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: Ie5d4a8479b9f9420f2706e6b985bda5a75188ebe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3907368
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2022-09-20 17:15:07 +00:00
Tatsuyuki Ishi
b1815c4042 media: ffmpeg: Fix test_averror not compiling.
Broke in 03e1b667 ("media/ffmpeg: use bindgen-common.sh").

BUG=None
TEST=cargo test -p ffmpeg

Change-Id: I7e0bb5f9b41f785d63a92099130d183600a7985b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3907424
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Tatsuyuki Ishi <ishitatsuyuki@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
2022-09-20 07:59:27 +00:00
Tatsuyuki Ishi
f30d6fd9e8 media: ffmpeg: Add a separate flush helper for encoder.
The decoder and encoder uses different calls for flushing. Add a new
flush_encoder helper for that, and rename the existing one to
flush_decoder.

BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices

Change-Id: Id237424209dc8d64d43424570003d735ee164d36
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868598
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Tatsuyuki Ishi <ishitatsuyuki@google.com>
2022-09-20 04:27:00 +00:00
Tatsuyuki Ishi
8a2af8f2ff media: ffmpeg: Add bindings for encoding methods.
try_send_frame and try_receive_packet together forms the basis of the
(AVFrame-based) encoding API. This change adds helper methods for them,
with the return value being handled similarly to their decoding
counterpart.

TryReceiveFrameResult has been renamed to TryReceiveResult as the
encoding interface shares the handling of these return codes, and we'll
be sharing this logic between try_receive_packet and try_receive_frame.

BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices

Change-Id: I32c11053daed86c32067ac2b2a8f7218f6dbcd4f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868597
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-09-20 04:27:00 +00:00
Tatsuyuki Ishi
7b0dde4d8d media: ffmpeg: Add helpers to build an AvFrame with metadata and buffers
This API allows the user to allocate and set the buffer/data of an AvFrame.
This will be needed when using AvFrame as encoder input.

BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices

Change-Id: If2c46a1b19f5fb98a296ca42b1917f8260174c83
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868596
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-09-20 04:27:00 +00:00
Tatsuyuki Ishi
55d8d9b4eb media: ffmpeg: Add helpers for determining line and plane sizes.
These are wrappers of av_image_get_linesize and
av_image_fill_plane_sizes, and will be used for bounds checking and
mmap bounds calculation purposes.

It's kind of weird that one is singular and the other is plural, but
we should probably blame FFmpeg for not having a singular version of
av_image_fill_plane_sizes.

BUG=b:239897269
TEST=cargo test --features "video-decoder,ffmpeg" -p ffmpeg -p devices

Change-Id: I34104f5062089377aeab0d4a4ab0534837e56d6f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3868595
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-09-20 04:27:00 +00:00
Tatsuyuki Ishi
40ba620f0a media: ffmpeg: Add encoder context builder.
Similar to the decoder builder, add an encoder context builder.

The encoder requires a few more parameters to be set before calling
avcodec2_open, and the respective setters are provided here. As for
checking for the required fields, it looks like FFmpeg will check it and
error on avcodec2_open if any are missing anyway, so we'll avoid
duplicating that on the binding side.

BUG=b:239897269
TEST=cargo build --features ffmpeg -p ffmpeg

Change-Id: I448b56ba9bae9b38ce5c2fb540e9577a2dfcd83c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3856043
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-09-20 04:27:00 +00:00
Daniel Verkamp
e539372226 devices: virtio: block: impl DiskOption::open for Windows
Move the logic for locking and DiskFile creation into an implementation
of DiskOption::open(), matching the sys::unix structure. This will
allow future consolidation of the vhost-user devices.

For now, the Windows variant of DiskOption::open() only knows how to
create a SingleFileDisk (not qcow, composite, etc.); switching to
create_disk_file() is left as future work.

This also makes a few tweaks to the creation of the BlockAsync instance
in order to make the unix and windows versions more similar - compare:
- devices/src/virtio/vhost/user/device/block/sys/windows.rs
- devices/src/virtio/vhost/user/device/block/sys/unix.rs

No functional change intended.

BUG=None
TEST=tools/presubmit --all

Change-Id: Iadb1a8913a7445d7c091d0e359c7d8792704c35a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892136
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-09-20 03:42:20 +00:00
Clarissa Garvey
37672c8c0d CONTRIBUTING.md: Add unit testing guidelines
See rationale in the bug.

Bug: b:243053027
Change-Id: I5315781e360f6f2feea2adc58ec02bd11c7a7c70
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3898110
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Clarissa Garvey <clarissagarvey@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-09-19 23:16:00 +00:00
Dennis Kempin
acd262cb42 tools/x86vm: Small fixes to VM
- Check if ssh port is available before starting VM
- Move data dir to /tmp. Otherwise we may delete running images
  or pid files with `cargo clean`.
- Change CPU type to prevent vmx warnings.

BUG=247139912
TEST=./tools/run_tests --target=vm:x86_64

Change-Id: Id948ab9d67b2dddce8da663bb00b8924bc26c041
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3902687
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-19 22:04:20 +00:00
Pujun Lun
43fe5ca94e gpu: add plumbing code for Windows only objects.
We've seen third-party DLLs hooking into CreateWindowExA and
causing stack overflow (b:202288586, b:244141583). Adding the
offending DLLs to the blocklist fixed the issue, but it is hard
to know what other DLLs would cause the same issue in the wild.
Hence, we want to spawn WindowProcedureThread and create
windows as early as possible and then pass them all the way
down to GpuDisplay.

We are also passing the kiwi specific gpu_device_service_tube
along the stack.

BUG=b:213150276
TEST=presubmit

Change-Id: Ib1e3a4f11523ea36ede74c99f401c23a8c94a2c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892519
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2022-09-19 19:57:50 +00:00
Daniel Verkamp
835a85b983 devices: proxy: ensure device drop gets called
Explicitly drop the device object before calling libc::exit() so that
the Drop impl for the device has a chance to be called.

Change-Id: Id93447925f71340c78a1d80efdff5b1574801409
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3900327
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-19 18:27:00 +00:00
Daniel Verkamp
8e0a4cb345 devices: extend IrqLevelEvent documentation
Describe the resample event and how it is meant to be used by a device.

BUG=b:243465984
TEST=tools/cargo-doc

Change-Id: I0a2ad7b5593e0222e69c932fed20499f6d2fccbf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3892525
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-09-19 18:00:30 +00:00
Yiwei Zhang
b896f0a153 Revert "rutabaga_gfx: Support for cached mappings on msm"
This reverts commit 84e4fbc2be.

Reason for revert: cts regression in b/247131923

Original change's description:
> rutabaga_gfx: Support for cached mappings on msm
>
> This is a stop gap solution until we have some way for the kernel to
> report mapping info to crosvm.  But since on arm devices without FWB,
> the mapping attributes are the more restrictive of the S1 and S2
> mappings, for now we can just map them as cached in the S2 pgtables.
>
> BUG=b:239718180
> TEST=cts-tradefed run cts -m CtsVideoTestCases -t android.video.cts.VideoEncoderDecoderTest#testAvcGoog0Perf0320x0240
>
> Change-Id: Ib3f085fd8da768b58e7a6d8deadf3a16c7cbcc4c
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3832355
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Auto-Submit: Rob Clark <robdclark@chromium.org>
> Commit-Queue: Rob Clark <robdclark@chromium.org>
> Tested-by: Rob Clark <robdclark@chromium.org>

BUG=b:247131923
TEST=BasicVulkanGpuTest

Change-Id: I6566ab033840a5f9bd99dca7cbecfc1f42a5c363
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3903099
Commit-Queue: Yiwei Zhang <zzyiwei@chromium.org>
Auto-Submit: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-19 16:55:50 +00:00