summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJason Macnak <natsu@google.com>2019-11-20 16:25:49 -0800
committerCommit Bot <commit-bot@chromium.org>2019-12-11 16:58:39 +0000
commitbf19558be57556bb92696827c31c1f0cba035801 (patch)
treee0bffda439e8db7e7763e897e22828a10d97752b /src/main.rs
parent8d3f9ba350137a3f423a4241067cf96762e518bf (diff)
downloadcrosvm-bf19558be57556bb92696827c31c1f0cba035801.tar
crosvm-bf19558be57556bb92696827c31c1f0cba035801.tar.gz
crosvm-bf19558be57556bb92696827c31c1f0cba035801.tar.bz2
crosvm-bf19558be57556bb92696827c31c1f0cba035801.tar.lz
crosvm-bf19558be57556bb92696827c31c1f0cba035801.tar.xz
crosvm-bf19558be57556bb92696827c31c1f0cba035801.tar.zst
crosvm-bf19558be57556bb92696827c31c1f0cba035801.zip
Makes gpu renderer flags configurable via command line
BUG=b:134086390
TEST=built crosvm and booted cuttlefish locally with gpu

Change-Id: I4d816ddb52a2eadd06088d204d95118289a3f587
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1927873
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: Jason Macnak <natsu@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 7f12841..d630d6c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -122,6 +122,62 @@ fn parse_gpu_options(s: Option<&str>) -> argument::Result<GpuParameters> {
 
         for (k, v) in opts {
             match k {
+                "egl" => match v {
+                    "true" | "" => {
+                        gpu_params.renderer_use_egl = true;
+                    }
+                    "false" => {
+                        gpu_params.renderer_use_egl = false;
+                    }
+                    _ => {
+                        return Err(argument::Error::InvalidValue {
+                            value: v.to_string(),
+                            expected: "gpu parameter 'egl' should be a boolean",
+                        });
+                    }
+                },
+                "gles" => match v {
+                    "true" | "" => {
+                        gpu_params.renderer_use_gles = true;
+                    }
+                    "false" => {
+                        gpu_params.renderer_use_gles = false;
+                    }
+                    _ => {
+                        return Err(argument::Error::InvalidValue {
+                            value: v.to_string(),
+                            expected: "gpu parameter 'gles' should be a boolean",
+                        });
+                    }
+                },
+                "glx" => match v {
+                    "true" | "" => {
+                        gpu_params.renderer_use_glx = true;
+                    }
+                    "false" => {
+                        gpu_params.renderer_use_glx = false;
+                    }
+                    _ => {
+                        return Err(argument::Error::InvalidValue {
+                            value: v.to_string(),
+                            expected: "gpu parameter 'glx' should be a boolean",
+                        });
+                    }
+                },
+                "surfaceless" => match v {
+                    "true" | "" => {
+                        gpu_params.renderer_use_surfaceless = true;
+                    }
+                    "false" => {
+                        gpu_params.renderer_use_surfaceless = false;
+                    }
+                    _ => {
+                        return Err(argument::Error::InvalidValue {
+                            value: v.to_string(),
+                            expected: "gpu parameter 'surfaceless' should be a boolean",
+                        });
+                    }
+                },
                 "width" => {
                     gpu_params.display_width =
                         v.parse::<u32>()
@@ -980,6 +1036,9 @@ writeback=BOOL - Indicates whether the VM can use writeback caching (default: fa
                                   Possible key values:
                                   width=INT - The width of the virtual display connected to the virtio-gpu.
                                   height=INT - The height of the virtual display connected to the virtio-gpu.
+                                  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.
                                   "),
           #[cfg(feature = "tpm")]
           Argument::flag("software-tpm", "enable a software emulated trusted platform module device"),