gpu_display: simplify GpuDisplay::open_x signature

Change-Id: I334004ac47466de2f8cd800e680a14cb7f75ef3c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4775759
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Frederick Mayle 2023-08-08 15:45:51 -07:00 committed by crosvm LUCI
parent 49806e44dc
commit 6a4aea4445
2 changed files with 3 additions and 6 deletions

View file

@ -1042,7 +1042,7 @@ impl DisplayBackend {
#[cfg(unix)]
DisplayBackend::Wayland(path) => GpuDisplay::open_wayland(path.as_ref()),
#[cfg(unix)]
DisplayBackend::X(display) => GpuDisplay::open_x(display.as_ref()),
DisplayBackend::X(display) => GpuDisplay::open_x(display.as_deref()),
DisplayBackend::Stub => GpuDisplay::open_stub(),
#[cfg(windows)]
DisplayBackend::WinApi(display_properties) => match wndproc_thread.take() {

View file

@ -326,14 +326,11 @@ pub struct GpuDisplay {
impl GpuDisplay {
/// Opens a connection to X server
pub fn open_x<S: AsRef<str>>(display_name: Option<S>) -> GpuDisplayResult<GpuDisplay> {
pub fn open_x(display_name: Option<&str>) -> GpuDisplayResult<GpuDisplay> {
let _ = display_name;
#[cfg(feature = "x")]
{
let display = match display_name {
Some(s) => gpu_display_x::DisplayX::open_display(Some(s.as_ref()))?,
None => gpu_display_x::DisplayX::open_display(None)?,
};
let display = gpu_display_x::DisplayX::open_display(display_name)?;
let wait_ctx = WaitContext::new()?;
wait_ctx.add(&display, DisplayEventToken::Display)?;