Following observed:
thread '<unnamed>' panicked at library/core/src/panicking.rs:156:5:
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
stack backtrace:
20: 0x7fbc13444397 - rutabaga_ffi::rutabaga_submit_command::{{closure}}::h396fa3925e07701c
21: 0x7fbc1342af28 - core::ops::function::FnOnce::call_once::h83bf6f55aff2e840
22: 0x7fbc13423a36 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h988a1c0089589129
23: 0x7fbc134292a8 - std::panicking::try::do_call::h83aa5cffd0c7a46a
24: 0x7fbc13444eeb - __rust_try
25: 0x7fbc13428c13 - std::panicking::try::hc36d232483e714b8
26: 0x7fbc13427c7d - std::panic::catch_unwind::h2433ece368f25877
27: 0x7fbc134442f0 - rutabaga_submit_command
Reason, according to the docs:
"data must be non-null and aligned even for
zero-length slices."
Add check to prevent hitting this case.
BUG=none
TEST=compile
Change-Id: Ic0d36055a13cd1cc9c65e7e12c0aef7aa95a58ce
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5718431
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
The library installed by Meson actually contains no symbols right now.
We have to:
1) Have Cargo place the libraries in the Meson build dir
2) Move the libraries from ${MESON_BUILD_DIR}/debug (where Cargo
places them) to ${MESON_BUILD_DIR} sp Meson custom target script
can reference them
3) Have meson install the libraries and generate pkg-config
BUG=b:344998548
TEST=link against FFI via gfxstream guest
Change-Id: I6536674fdb6ee3493433bf48ed233d6ca947e9aa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5631146
Reviewed-by: Kaiyi Li <kaiyili@google.com>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Fixes
warning: unused return value of `Box::<T>::from_raw` that must be used
--> src/lib.rs:285:18
|
285 | unsafe { Box::from_raw(*ptr) };
BUG=344998548
TEST=compilet
Change-Id: Ibb75410519f447c9ef19e1eff3ec79d01ab03c34
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5599140
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This is somewhat more modern than the Makefile. Both just invoke
cargo under the hood. The proper solution may come when Meson
starts supporting external crates:
https://github.com/mesonbuild/meson/issues/2173
Right now, this is a just a minimal version for developers. A known
issue is modifying dependent crates (rutabaga_gfx) doesn't cause
a rebuild. A solution is just `touch src/lib.rs` in ffi.
Also, `ninja -C build/ clean` isn't recommended. Just do cargo
clean.
BUG=344998548
TEST=meson setup build
ninja -C build/ install
Change-Id: Id5a142cc5cb5a8001198afc4d1cdbe800ec2ec23
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5599139
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
... which is useful for enabling/disabling features in Gfxstream
but which does not affect Crosvm/Rutabaga directly.
Bug: b/277618864
Test: cvd start --gpu_mode=gfxstream
Change-Id: If0aa51f410c1f53c72f4e71f531ce6d797a37052
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5318696
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
- Functions should be marked as unsafe, as the caller needs to
guarantee that the directory is a valid string.
- Comment fixes
BUG=324440526
TEST=cargo test
Change-Id: I43405fd2d63a8de3c9b73f349f7e8928373cf9ab
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5313625
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Andrew Walbran <qwandor@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This adds the plumbing to hook up the FFI snapshot API
to gfxstream.
Some 2D only checks were deleted as well.
BUG=324440526
TEST=cargo test
Change-Id: I052bdde1ce508684910c64463470e95f8b67b35f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5279413
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Get the directomy from the environement if available.
Test:
mkdir /tmp/out
cd rutabaga_gfx/ffi
CARGO_TARGET_DIR=/tmp/out cargo build
# Also try.
cargo build
Bug: b/317884283
Change-Id: I43fc7d17e4bef50e4afcd45144a2dc9bef273a6b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5237622
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Pierre Labatut <plabatut@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
If OnceCell is used, then rutabaga_init can only be called once per
process.
This commit fixes the ffi tests for me.
Change-Id: If31792d7679292e4bb63d7442a28effafb181b02
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5232199
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
While /usr is the usual place to put headers we should follow the lead
of the PREFIX set at install time, especially before this is widely
packaged. Therefor replace the static .pc file with one generated by
build.rs.
TEST=make prefix=$PREFIX install
Change-Id: I905422df37f89e31f3942af38a91ebc51f39e479
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5159307
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Crosvm enables unstable virglrenderer features based on the pkgconfig
flags. The virgl_renderer_next build flag isn't used anymore, remove it.
BUG=none
TEST=none
Suggested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Change-Id: I96ba36a9a8c1af9a252e8dcbe664cbf1597543a6
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5077248
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
The fact gfxstream exists on the system is implementation detail
of rutabaga_gfx. This will allow testing/packaging of rutabaga_gfx
without packaging gfxstream + AEMU base (for now).
BUG=296070975
TEST=compile
Change-Id: I65adfbc5e8c90aa5654c91392915833b1133133f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4860836
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Support passing guest fences to host for waiting by using extended
VIRTIO_GPU_CMD_SUBMIT_3D command that replaces previously unused
padding field with a new 'num_in_fences' field. The in-fence IDs
are prepended to the cmdbuf data. There is new corresponding
VIRTIO_GPU_F_FENCE_PASSING feature flag, it must be supported by
guest in order to activate fence passing on host. There is new
VIRTIO_GPU_FLAG_FENCE_SHAREABLE flag for VIRTIO_GPU_CMD_SUBMIT_3D
command that is set if job's fence is shareable.
Fence passing allows guest to offload dma-fence waiting to host,
removing unnecessary stalls in the GPU pipeline. Guest kernel doesn't
have to stall job submission anymore until all in-fences are signalled
on guest side.
This new feature improves GL/VL interop performance up to 2-3x times
for native contexts. It will also allow to share host GPU fences with
host display subsystem easily for explicit fencing of framebuffer flips
within the host kernel display driver, which is useful for virtio-wl.
TEST=none
BUG=b:253779836
Link: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1138
Change-Id: Ie547614c26ff5f3f75ccf203096e9087827be542
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4679609
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
To make potential Debian packaging easier, include links
to latest release.
BUG=b:296070975
TEST=compile
Change-Id: I13a49acb8ec2f677e3095c31e24ad9a6e2a9a1cc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4808252
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This revbumps rutabaga_gfx and rutabaga_gfx_ffi to
version 0.1.2
BUG=b:296070975
TEST=compile
Change-Id: I45d2930b0bee39a569def85354418d0b391e1d23
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4778941
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Removes the need of casts for API user.
BUG=b:273555494
TEST= compile
Change-Id: I32c545394e67546ea0bd118452bdbd430dd8735d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4763869
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Just random cleanup while browsing.
Change-Id: Idbbddab072abc0de36e03b7fac8fde263e1bcfec
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4753011
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
This will allow differentiating between the keymap, which must be
mapped read-only (this is enforced by at least Weston and Sway), with
all the other handles, which are writeable.
Add them the map_info field. Maybe in the future, they can be apart
of the virtio-spec (if we can't rely on the hypervisor only to enfore
the read-only attribute).
TEST=run a Wayland application in a VM with a wlroots host compositor
run gfxstream
Change-Id: Ie381806a5b7c5edf725caece9a4b02a7f5775ea1
Co-authored-by: Idan Raiter <idanr@google.com>
Tested-by: Ryan Neph <ryanneph@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4584252
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
* If $(DESTDIR)$(libdir) wasn't already a directory, the library
would be installed to that path, rather than inside that directory.
* The unversioned library links would be installed directly into
prefix rather than into libdir, where nothing would find them.
TEST=make install with prefix pointing to an empty/non-existent path.
Change-Id: If6e2844e0d854a53dd61a88b02f91334f3311eeb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4754156
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
- Group definitions in ways that make more logical sense
- rutabaga_fence -> *rutabaga_fence
- const correctness
BUG=b:273555494
TEST=compile
Change-Id: I2c3c715ee1b03b0441868a517545d34ff774c2de
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712928
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This adds a debug callback to rutabaga_gfx + gfxstream. This is
because VMMs often redirect logging to custom handlers, or even
abort on error. For gfxstream alone, for the unstable API
we have:
- METRICS_CALLBACK_ADD_INSTANT_EVENT
- METRICS_CALLBACK_ADD_INSTANT_EVENT_WITH_DESCRIPTOR
- METRICS_CALLBACK_ADD_VULKAN_OUT_OF_MEMORY_EVENT
- METRICS_CALLBACK_SET_ANNOTATION
- METRICS_CALLBACK_ABORT
Many of these can be converted to use this more generic debug
handler (just by extending the struct).
BUG=b:292548160
TEST=see debug output when booting a VMM with FFI bindings.
Change-Id: Id69bfc9e5fb4c5610f5108278aed37c31150c95a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712927
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Sometimes, it's desirable for rutabaga to tell the VMM something.
Currently, it's just fences, but in the future it may be messages
from gfxstream.
BUG=b:292548160
TEST=run VM
Change-Id: Ica13a83a4bb8ebab88e929b469143a4a7f35f43e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712926
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
For a stable rutabaga API, we should do this.
BUG=b:273555494
TEST=./rutabaga_test
Change-Id: I4cbb35324cff6dd5c1fafc06d91a3826d659cff8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4673245
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
A forward declaration should be enough and not clash with other
self-defintions. Similiar to what gfxstream does.
BUG=b:273555494
TEST=compile
Change-Id: Ib5dae74f0590337977466f8e5921111db713517f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4673244
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Recent capset name changes have caused test to
fail. Fix this.
BUG=b:273555494
TEST=./rutabaga_test
Change-Id: I875f8a6350970f90ae127eaeb527f3264db54236
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4673243
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
We should do this.
BUG=b:273555494
TEST=./rutabaga_test
Change-Id: I8fc3a7d0bd3802df8c57e3b15eb0bb3fd1371366
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4673241
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
talex5@ reports:
"When sending a pipe, the guest has to know what ID the host will
assign to it. The guest guesses, by adding 2 to the last ID it
knows about, and the host checks its guess. If it was wrong
(e.g. because the host created a new ID at the same time) then you
get a protocol error."
A solution is a separate namespace for Wayland read pipes.
BUG=b:259268477
TEST= - copy+paste still works
- didn't repro exact case, but should just work (TM)
Change-Id: I76938b8b8105289bbfa4c5891eb95f7035d5196a
For QEMU, rather than specifying the ambiguous arguments like
"use_gles" (which GLES? virgl or gfxstream) or "use_vulkan"
(which vulkan?), let's use the more clear capset names. For
example, one can just specify:
-device virtio-vga-rutabaga,capset_names=gfxstream-gles:cross-domain
For guest ANGLE:
-device virtio-vga-rutabaga,capset_names=gfxstream-vulkan
The problem is gfxstream labels everything it does has "gfxstream".
Further differentiation is needed for the proposed launcher flow
to work into all the things gfxstream does: cerealized vulkan,
gfxstream gles, host composer and Magma host drivers in the guest.
BUG=b:280681128
TEST=guest ANGLE + QEMU works
Change-Id: Ia7dba6e91585e1f9adaa1b26fb3bb523a8fa0957
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4517952
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This matches the latest gfxstream declarations. Having
everything as a single enum without separation between
fence/mem isn't too bad since adding a new type essentially
means creating a new OS (which happens rarely).
BUG=b:273555494
TEST=compile
Change-Id: I6c6dd957e443cb51c3c8109d514d15985636a2b3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4425451
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Useful for falling back to older methods of rendering when
needed.
BUG=b:273555494
TEST=rutabaga_test
Change-Id: Ic5b99e68f09f59c08bf29a2d42848c5451e4bbd8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4409070
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
It's more traditional to install headers this way.
BUG=b:273555494
TEST=compile
Change-Id: I9cbcee18adf488fe54a0630ab9229ae231b16692
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4409071
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
- Use spaces instead of tabs
- Use Clang format in Chromium build tools (also same one used
by gfxstream), i.e:
~/buildtools/linux64/clang-format -i rutabaga_gfx_ffi.h
BUG=b:273555494
TEST=rutabaga_test
Change-Id: I1aa4d87f1d694fe3200281dada33dcc915a0afd7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4409068
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
The base crate has some nifty abstractions but also
pulls in things like minijail, audio_streams and
various random items.
This prevents true cross-platform interoperatibility,
which requires the ability to upload to crates.io
with relative ease.
This change removes the base crate. The replacement
strategy is two fold:
- For things like SafeDescriptor which don't have
adequate solutions on crates.io, just copy it
internally. I think SafeDescriptor in particular --
since it works on bot Windows/Linux should probably
be made into a separate crate long-term since it is
generically valuable. Similarly for the Event and
WaitContext APIs. For now, live with the duplication.
- Otherwise, the nix crate does most of the Linux
specific items.
The cross-domain context type has a lot of dependencies
on Linux sockets / epoll. This is refactored to look more
like the Fuchsia solution, which uses std::sync::mspc
channels to connect to an utility Wayland FIDL library.
The rest of Rutabaga mostly relies just on SafeDescriptor
and the ability to clone it. rutabaga_gralloc allows
provides shared memory used via virtwl.
Another thing to call out is zerocopy is now strongly
versioned to the latest stable release on crates.io
I also got rid of #[cfg(feature = "virgl_renderer_next")]
on the renderer server fd, since it was complicating the
refactoring. SafeDescriptor works everywhere and adding
the #ifdef should be reserved for the lowest-levels of
platform specific code when possible.
Overall, this makes compiling on Fuchsia hosts much
simpler.
BUG=b:273555494
TEST= - run cross_domain context type, see Wayland apps
- note there is a previous bug in cross domain
when resizing windows, it occurs before this CL.
The reason seems to be raciness and can likely be fixed
gfxstream-like seqno.
- run gfxstream + virgl on Linux, verify everything works.
Change-Id: I7519f2b8ed0cd57c47980d4e76403057498cf064
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4353700
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This tracks librust-log-dev, which is at version 0.4.17-3 in the
Debian package tracker.
It may be possible to use another version too.
BUG=b:273555494
TEST=rutabaga_test
Change-Id: Ib0aaca5800f22960dad89b4e138a0dd5fefcb9c2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4353699
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
It doesn't work quite out of the box, even if you've built
gfxstream. The problem is 'sudo make install` in gfxstream
doesn't install anything, including pkg-config files. Those
interested in the FFI/gfxstream should just modify the
"GFXSTREAM_PATH" environment variable in build.rs until
b/246990929 is fixed.
BUG=b:273555494, b:246990929
TEST=build and run with gfxstream feature
Change-Id: I53af69ae39f12d15a1d8307ea7ae3c2b6cec1114
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4370739
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>