mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
devices: gpu: gfxstream: Add ANGLE flag for Gfxstream
... to allow configuring Gfxstream host renderer based on whether or not the guest Android is using ANGLE as its native OpenGL driver. BUG=b:165022040 TEST=launch_cvd --gpu_mode=gfxstream Change-Id: I566ed1e7590f7f3db99960440421fd65bba08f7b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2466604 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Commit-Queue: Jason Macnak <natsu@google.com>
This commit is contained in:
parent
0c4bba741a
commit
046ed143a7
3 changed files with 33 additions and 1 deletions
|
@ -74,6 +74,8 @@ pub struct GpuParameters {
|
|||
pub renderer_use_glx: bool,
|
||||
pub renderer_use_surfaceless: bool,
|
||||
#[cfg(feature = "gfxstream")]
|
||||
pub gfxstream_use_guest_angle: bool,
|
||||
#[cfg(feature = "gfxstream")]
|
||||
pub gfxstream_use_syncfd: bool,
|
||||
#[cfg(feature = "gfxstream")]
|
||||
pub gfxstream_support_vulkan: bool,
|
||||
|
@ -101,6 +103,8 @@ impl Default for GpuParameters {
|
|||
renderer_use_glx: false,
|
||||
renderer_use_surfaceless: true,
|
||||
#[cfg(feature = "gfxstream")]
|
||||
gfxstream_use_guest_angle: false,
|
||||
#[cfg(feature = "gfxstream")]
|
||||
gfxstream_use_syncfd: true,
|
||||
#[cfg(feature = "gfxstream")]
|
||||
gfxstream_support_vulkan: true,
|
||||
|
@ -1143,6 +1147,7 @@ impl Gpu {
|
|||
.use_surfaceless(gpu_parameters.renderer_use_surfaceless);
|
||||
#[cfg(feature = "gfxstream")]
|
||||
let renderer_flags = renderer_flags
|
||||
.use_guest_angle(gpu_parameters.gfxstream_use_guest_angle)
|
||||
.use_syncfd(gpu_parameters.gfxstream_use_syncfd)
|
||||
.support_vulkan(gpu_parameters.gfxstream_support_vulkan);
|
||||
|
||||
|
|
|
@ -228,6 +228,12 @@ impl RendererFlags {
|
|||
self.set_flag(GFXSTREAM_RENDERER_FLAGS_NO_VK_BIT, !v)
|
||||
}
|
||||
|
||||
#[cfg(feature = "gfxstream")]
|
||||
pub fn use_guest_angle(self, v: bool) -> RendererFlags {
|
||||
const GFXSTREAM_RENDERER_FLAGS_GUEST_USES_ANGLE: u32 = 1 << 21;
|
||||
self.set_flag(GFXSTREAM_RENDERER_FLAGS_GUEST_USES_ANGLE, v)
|
||||
}
|
||||
|
||||
pub fn use_external_blob(self, v: bool) -> RendererFlags {
|
||||
self.set_flag(VIRGL_RENDERER_USE_EXTERNAL_BLOB, v)
|
||||
}
|
||||
|
|
23
src/main.rs
23
src/main.rs
|
@ -162,6 +162,8 @@ fn parse_gpu_options(s: Option<&str>) -> argument::Result<GpuParameters> {
|
|||
let mut vulkan_specified = false;
|
||||
#[cfg(feature = "gfxstream")]
|
||||
let mut syncfd_specified = false;
|
||||
#[cfg(feature = "gfxstream")]
|
||||
let mut angle_specified = false;
|
||||
|
||||
if let Some(s) = s {
|
||||
let opts = s
|
||||
|
@ -283,6 +285,24 @@ fn parse_gpu_options(s: Option<&str>) -> argument::Result<GpuParameters> {
|
|||
}
|
||||
}
|
||||
#[cfg(feature = "gfxstream")]
|
||||
"angle" => {
|
||||
angle_specified = true;
|
||||
match v {
|
||||
"true" | "" => {
|
||||
gpu_params.gfxstream_use_guest_angle = true;
|
||||
}
|
||||
"false" => {
|
||||
gpu_params.gfxstream_use_guest_angle = false;
|
||||
}
|
||||
_ => {
|
||||
return Err(argument::Error::InvalidValue {
|
||||
value: v.to_string(),
|
||||
expected: String::from("gpu parameter 'angle' should be a boolean"),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "gfxstream")]
|
||||
"vulkan" => {
|
||||
vulkan_specified = true;
|
||||
match v {
|
||||
|
@ -337,7 +357,7 @@ fn parse_gpu_options(s: Option<&str>) -> argument::Result<GpuParameters> {
|
|||
|
||||
#[cfg(feature = "gfxstream")]
|
||||
{
|
||||
if vulkan_specified || syncfd_specified {
|
||||
if vulkan_specified || syncfd_specified || angle_specified {
|
||||
match gpu_params.mode {
|
||||
GpuMode::ModeGfxStream => {}
|
||||
_ => {
|
||||
|
@ -1543,6 +1563,7 @@ writeback=BOOL - Indicates whether the VM can use writeback caching (default: fa
|
|||
egl[=true|=false] - If the virtio-gpu backend should use a EGL context for rendering.
|
||||
glx[=true|=false] - If the virtio-gpu backend should use a GLX context for rendering.
|
||||
surfaceless[=true|=false] - If the virtio-gpu backend should use a surfaceless context for rendering.
|
||||
angle[=true|=false] - If the guest is using ANGLE (OpenGL on Vulkan) as its native OpenGL driver.
|
||||
syncfd[=true|=false] - If the gfxstream backend should support EGL_ANDROID_native_fence_sync
|
||||
vulkan[=true|=false] - If the gfxstream backend should support vulkan
|
||||
"),
|
||||
|
|
Loading…
Reference in a new issue