Skip to content

Commit

Permalink
vhost-device-gpu: Import rutabaga crate
Browse files Browse the repository at this point in the history
The vhost-device-gpu crate is intended to utilize the rutabaga
crate Imported from crosvm
commit: 02110bc6fcc6af70329f410aef8859ec70dd9224
"rutabaga_gfx: fixes for crrev.com/c/5279413"

This import makes minimal changes to the crate needed for
vhost-device-gpu crate functionality.
(the build.rs is diferent than in crosvm)

Co-authored-by: Dorinda Bassey <[email protected]>
Co-authored-by: Matej Hrica <[email protected]>

Signed-off-by: Dorinda Bassey <[email protected]>
Signed-off-by: Matej Hrica <[email protected]>
  • Loading branch information
Dorinda Bassey committed Jun 6, 2024
1 parent 91471bb commit 5457676
Show file tree
Hide file tree
Showing 62 changed files with 12,096 additions and 0 deletions.
39 changes: 39 additions & 0 deletions staging/vhost-device-gpu/rutabaga_gfx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[package]
name = "rutabaga_gfx"
version = "0.1.3"
authors = ["The ChromiumOS Authors + Android Open Source Project"]
edition = "2021"
description = "Handling virtio-gpu protocols"
license-file = "LICENSE"

[features]
gfxstream = []
gfxstream_stub = []
virgl_renderer = []
minigbm = []
# To try out Vulkano, delete the following line and uncomment the line in "dependencies". Vulkano
# features are just a prototype and not integrated yet into the ChromeOS build system.
vulkano = []
x = []

[dependencies]
cfg-if = "1.0.0"
libc = "0.2.116"
remain = "0.2"
thiserror = "1.0.23"
zerocopy = { version = "0.7", features = ["derive"] }

log = "0.4"

# To build latest Vulkano, change version to git = "https://github.com/vulkano-rs/vulkano.git"
# vulkano = { version = "0.31.0", optional = true }

[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
nix = { version = "0.27.1", features = ["event", "feature", "fs", "mman", "socket", "uio", "ioctl"] }

[target.'cfg(windows)'.dependencies]
winapi = {version = "0.3", features = ["winnt", "handleapi", "processthreadsapi", "winbase"]}

[build-dependencies]
pkg-config = "0.3"
anyhow = "1.0.57"
27 changes: 27 additions & 0 deletions staging/vhost-device-gpu/rutabaga_gfx/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2023 The ChromiumOS Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
18 changes: 18 additions & 0 deletions staging/vhost-device-gpu/rutabaga_gfx/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use std::env;

fn main() -> Result<(), pkg_config::Error> {
// Skip installing dependencies when generating documents.
if env::var("CARGO_DOC").is_ok() {
return Ok(());
}

pkg_config::Config::new().probe("epoxy")?;
pkg_config::Config::new().probe("libdrm")?;
pkg_config::Config::new().probe("virglrenderer")?;

Ok(())
}
213 changes: 213 additions & 0 deletions staging/vhost-device-gpu/rutabaga_gfx/ffi/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions staging/vhost-device-gpu/rutabaga_gfx/ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "rutabaga_gfx_ffi"
version = "0.1.3"
authors = ["The ChromiumOS Authors + Android Open Source Project"]
edition = "2021"
description = "Handling virtio-gpu protocols with C API"
license-file = "LICENSE"

[lib]
name = "rutabaga_gfx_ffi"
crate-type = ["cdylib", "staticlib"]

[dependencies]
rutabaga_gfx = { path = "../", version = "0.1.3"}
libc = "0.2.93"
log = "0.4"
once_cell = "1.7"

[features]
minigbm = ["rutabaga_gfx/minigbm"]
gfxstream = ["rutabaga_gfx/gfxstream"]
virgl_renderer = ["rutabaga_gfx/virgl_renderer"]
vulkano = ["rutabaga_gfx/vulkano"]

[profile.dev]
lto = true
incremental = false

[workspace]
27 changes: 27 additions & 0 deletions staging/vhost-device-gpu/rutabaga_gfx/ffi/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2023 The ChromiumOS Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading

0 comments on commit 5457676

Please sign in to comment.