gpu: allow unsandboxed implicit render server spawn

Allow virglrenderer to implicitly spawn a render_server process when a
render_server_socket is not provided and sandboxing is disabled.

BUG=None
TEST=cargo build --features=gpu,x,wl-dmabuf,virgl_renderer,virgl_renderer_next

Change-Id: Icb682ffbf5812675d3c0c8e5a3d11006ecd53e8d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4563457
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
This commit is contained in:
Ryan Neph 2023-05-24 11:13:19 -07:00 committed by crosvm LUCI
parent 6a96c5b7ad
commit 42ee99f25e
3 changed files with 6 additions and 1 deletions

View file

@ -1113,7 +1113,9 @@ impl Gpu {
GpuMode::ModeGfxstream => RutabagaComponentType::Gfxstream, GpuMode::ModeGfxstream => RutabagaComponentType::Gfxstream,
}; };
let use_render_server = rutabaga_server_descriptor.is_some(); // only allow virglrenderer to fork its own render server when crosvm sandboxing is disabled
let use_render_server = rutabaga_server_descriptor.is_some()
|| gpu_parameters.allow_implicit_render_server_exec;
let rutabaga_builder = RutabagaBuilder::new(component, gpu_parameters.capset_mask) let rutabaga_builder = RutabagaBuilder::new(component, gpu_parameters.capset_mask)
.set_display_width(display_width) .set_display_width(display_width)

View file

@ -67,6 +67,7 @@ pub struct GpuParameters {
// enforce that blob resources MUST be exportable as file descriptors // enforce that blob resources MUST be exportable as file descriptors
pub external_blob: bool, pub external_blob: bool,
pub system_blob: bool, pub system_blob: bool,
pub allow_implicit_render_server_exec: bool,
} }
impl Default for GpuParameters { impl Default for GpuParameters {
@ -89,6 +90,7 @@ impl Default for GpuParameters {
capset_mask: 0, capset_mask: 0,
external_blob: false, external_blob: false,
system_blob: false, system_blob: false,
allow_implicit_render_server_exec: false,
} }
} }
} }

View file

@ -93,6 +93,7 @@ pub fn create_gpu_device(
let is_sandboxed = cfg.jail_config.is_some(); let is_sandboxed = cfg.jail_config.is_some();
let mut gpu_params = cfg.gpu_parameters.clone().unwrap(); let mut gpu_params = cfg.gpu_parameters.clone().unwrap();
gpu_params.external_blob = is_sandboxed; gpu_params.external_blob = is_sandboxed;
gpu_params.allow_implicit_render_server_exec = !is_sandboxed;
let mut display_backends = vec![ let mut display_backends = vec![
virtio::DisplayBackend::X(cfg.x_display.clone()), virtio::DisplayBackend::X(cfg.x_display.clone()),