gpu_renderer: add syncfd flag for gfxstream

Add a gpu argument to control the syncfd of gfxstream implemented in
these CL: https://android-review.googlesource.com/q/topic:%22gfxstream-sync-fd%22+(status:open%20OR%20status:merged).
Default to enabled.

BUG=None
TEST=launch_cvd

Change-Id: Id4933b8654fc1b1bb73784bd8e1a85e73d0266d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2286237
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
diff --git a/src/main.rs b/src/main.rs
index 935e714..285fb90 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -217,6 +217,21 @@
                         });
                     }
                 },
+                #[cfg(feature = "gfxstream")]
+                "syncfd" => match v {
+                    "true" | "" => {
+                        gpu_params.gfxstream_use_syncfd = true;
+                    }
+                    "false" => {
+                        gpu_params.gfxstream_use_syncfd = false;
+                    }
+                    _ => {
+                        return Err(argument::Error::InvalidValue {
+                            value: v.to_string(),
+                            expected: String::from("gpu parameter 'syncfd' should be a boolean"),
+                        });
+                    }
+                },
                 "width" => {
                     gpu_params.display_width =
                         v.parse::<u32>()
@@ -1417,6 +1432,7 @@
                                   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.
+                                  syncfd[=true|=false] - If the gfxstream backend should support EGL_ANDROID_native_fence_sync
                                   "),
           #[cfg(feature = "tpm")]
           Argument::flag("software-tpm", "enable a software emulated trusted platform module device"),