devices: gpu: Remove kiwi tubes

Let's remove the tubes:

1) gpu_device_service_tube - We diverge downstream nearly everywhere due
   to other tubes passed just like it. Reducing merge conflicts should
   happen maybe via structs, but we are already paying the cost anyway
   when code changes next to this tube (due to the other differing args)
2) gpu_main_display_tube - We will be moving this to the wndproc thread
   when upstreaming further work on it, so there is no need to keep the
   old version around.

BUG=b:243061269
TEST=presubmit, cargo build

Change-Id: I241922952d34a212dcb412bc1f0391f8473d8a61
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4033254
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Pujun Lun <lunpujun@google.com>
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Idan Raiter 2022-11-16 22:27:30 -08:00 committed by crosvm LUCI
parent 76cf0e6bf6
commit 7b846137b6
5 changed files with 4 additions and 78 deletions

View file

@ -213,7 +213,6 @@ fn build(
udmabuf: bool,
fence_handler: RutabagaFenceHandler,
#[cfg(feature = "virgl_renderer_next")] render_server_fd: Option<SafeDescriptor>,
#[cfg(feature = "kiwi")] gpu_device_service_tube: Tube,
) -> Option<VirtioGpu> {
let mut display_opt = None;
for display_backend in display_backends {
@ -249,8 +248,6 @@ fn build(
fence_handler,
#[cfg(feature = "virgl_renderer_next")]
render_server_fd,
#[cfg(feature = "kiwi")]
gpu_device_service_tube,
)
}
@ -1096,8 +1093,6 @@ pub struct Gpu {
udmabuf: bool,
#[cfg(feature = "virgl_renderer_next")]
render_server_fd: Option<SafeDescriptor>,
#[cfg(feature = "kiwi")]
gpu_device_service_tube: Option<Tube>,
context_mask: u64,
}
@ -1113,7 +1108,6 @@ impl Gpu {
external_blob: bool,
base_features: u64,
channels: BTreeMap<String, PathBuf>,
#[cfg(feature = "kiwi")] gpu_device_service_tube: Option<Tube>,
#[cfg(windows)] wndproc_thread: WindowProcedureThread,
) -> Gpu {
let mut display_params = gpu_parameters.display_params.clone();
@ -1192,8 +1186,6 @@ impl Gpu {
udmabuf: gpu_parameters.udmabuf,
#[cfg(feature = "virgl_renderer_next")]
render_server_fd,
#[cfg(feature = "kiwi")]
gpu_device_service_tube,
context_mask: gpu_parameters.context_mask,
}
}
@ -1209,8 +1201,6 @@ impl Gpu {
#[cfg(feature = "virgl_renderer_next")]
let render_server_fd = self.render_server_fd.take();
let event_devices = self.event_devices.split_off(0);
#[cfg(feature = "kiwi")]
let gpu_device_service_tube = self.gpu_device_service_tube.take()?;
build(
&self.display_backends,
@ -1226,8 +1216,6 @@ impl Gpu {
fence_handler,
#[cfg(feature = "virgl_renderer_next")]
render_server_fd,
#[cfg(feature = "kiwi")]
gpu_device_service_tube,
)
.map(|vgpu| Frontend::new(vgpu, fence_state))
}

View file

@ -293,8 +293,6 @@ pub struct VirtioGpu {
resources: Map<u32, VirtioGpuResource>,
external_blob: bool,
udmabuf_driver: Option<UdmabufDriver>,
#[cfg(feature = "kiwi")]
gpu_device_service_tube: Tube,
}
fn sglist_to_rutabaga_iovecs(
@ -338,7 +336,6 @@ impl VirtioGpu {
udmabuf: bool,
fence_handler: RutabagaFenceHandler,
#[cfg(feature = "virgl_renderer_next")] render_server_fd: Option<SafeDescriptor>,
#[cfg(feature = "kiwi")] gpu_device_service_tube: Tube,
) -> Option<VirtioGpu> {
let rutabaga = rutabaga_builder
.build(
@ -381,8 +378,6 @@ impl VirtioGpu {
resources: Default::default(),
external_blob,
udmabuf_driver,
#[cfg(feature = "kiwi")]
gpu_device_service_tube,
};
for event_device in event_devices {

View file

@ -127,8 +127,6 @@ pub struct GpuBackendConfig {
pub exit_evt_wrtube: SendTube,
// Event devices to send input events to.
pub event_devices: Vec<EventDevice>,
// Tube for service.
pub gpu_device_service_tube: Tube,
// GPU parameters.
pub params: GpuParameters,
}
@ -161,15 +159,8 @@ pub fn run_gpu_device(opts: Options) -> anyhow::Result<()> {
(&config.params.display_params[0]).into(),
)];
let wndproc_thread = virtio::gpu::start_wndproc_thread(
#[cfg(feature = "kiwi")]
config.params.display_params[0]
.gpu_main_display_tube
.clone(),
#[cfg(not(feature = "kiwi"))]
None,
)
.context("failed to start wndproc_thread")?;
let wndproc_thread =
virtio::gpu::start_wndproc_thread(None).context("failed to start wndproc_thread")?;
// Required to share memory across processes.
let external_blob = true;
@ -187,8 +178,6 @@ pub fn run_gpu_device(opts: Options) -> anyhow::Result<()> {
external_blob,
base_features,
/*channels=*/ Default::default(),
#[cfg(feature = "kiwi")]
Some(config.gpu_device_service_tube),
wndproc_thread,
)));

View file

@ -60,8 +60,6 @@ pub struct DisplayProperties {
pub is_fullscreen: bool,
pub window_width: u32,
pub window_height: u32,
#[cfg(feature = "kiwi")]
pub gpu_main_display_tube: Option<Arc<Mutex<Tube>>>,
}
impl From<&DisplayParameters> for DisplayProperties {

View file

@ -281,7 +281,6 @@ fn create_gpu_device(
gpu_device_tube: Tube,
resource_bridges: Vec<Tube>,
event_devices: Vec<EventDevice>,
#[cfg(feature = "kiwi")] gpu_device_service_tube: Tube,
) -> DeviceResult {
let gpu_parameters = cfg
.gpu_parameters
@ -290,15 +289,8 @@ fn create_gpu_device(
let display_backends = vec![virtio::DisplayBackend::WinApi(
(&gpu_parameters.display_params[0]).into(),
)];
let wndproc_thread = virtio::gpu::start_wndproc_thread(
#[cfg(feature = "kiwi")]
gpu_parameters.display_params[0]
.gpu_main_display_tube
.clone(),
#[cfg(not(feature = "kiwi"))]
None,
)
.expect("Failed to start wndproc_thread!");
let wndproc_thread =
virtio::gpu::start_wndproc_thread(None).expect("Failed to start wndproc_thread!");
let features = virtio::base_features(cfg.protection_type);
let dev = virtio::Gpu::new(
@ -312,8 +304,6 @@ fn create_gpu_device(
/* external_blob= */ false,
features,
BTreeMap::new(),
#[cfg(feature = "kiwi")]
Some(gpu_device_service_tube),
wndproc_thread,
);
@ -469,7 +459,6 @@ fn create_virtio_devices(
_dynamic_mapping_device_tube: Option<Tube>,
_inflate_tube: Option<Tube>,
_init_balloon_size: u64,
#[cfg(feature = "kiwi")] gpu_device_service_tube: Tube,
tsc_frequency: u64,
) -> DeviceResult<Vec<VirtioDeviceStub>> {
let mut devs = Vec::new();
@ -586,8 +575,6 @@ fn create_virtio_devices(
gpu_device_tube,
resource_bridges,
event_devices,
#[cfg(feature = "kiwi")]
gpu_device_service_tube,
)?);
}
@ -608,7 +595,6 @@ fn create_devices(
inflate_tube: Option<Tube>,
init_balloon_size: u64,
#[allow(unused)] ac97_device_tubes: Vec<Tube>,
#[cfg(feature = "kiwi")] gpu_device_service_tube: Tube,
tsc_frequency: u64,
) -> DeviceResult<Vec<(Box<dyn BusDeviceObj>, Option<Minijail>)>> {
let stubs = create_virtio_devices(
@ -621,8 +607,6 @@ fn create_devices(
dynamic_mapping_device_tube,
inflate_tube,
init_balloon_size,
#[cfg(feature = "kiwi")]
gpu_device_service_tube,
tsc_frequency,
)?;
@ -1995,32 +1979,6 @@ where
(None, None)
};
#[cfg(feature = "kiwi")]
{
if cfg.service_pipe_name.is_some() {
let (gpu_main_host_tube, gpu_main_display_tube) =
Tube::pair().exit_context(Exit::CreateTube, "failed to create tube")?;
control_tubes.push(TaggedControlTube::GpuServiceComm(gpu_main_host_tube));
let mut gpu_parameters = cfg
.gpu_parameters
.as_mut()
.expect("missing GpuParameters in config");
gpu_parameters.display_params.gpu_main_display_tube =
Some(Arc::new(Mutex::new(gpu_main_display_tube)));
}
};
// Create a ServiceComm tube to pass to the gpu device
#[cfg(feature = "kiwi")]
let gpu_device_service_tube = {
let (gpu_device_service_tube, gpu_device_service_host_tube) =
Tube::pair().exit_context(Exit::CreateTube, "failed to create tube")?;
control_tubes.push(TaggedControlTube::GpuDeviceServiceComm(
gpu_device_service_host_tube,
));
gpu_device_service_tube
};
let gralloc =
RutabagaGralloc::new().exit_context(Exit::CreateGralloc, "failed to create gralloc")?;
@ -2096,8 +2054,6 @@ where
/* inflate_tube= */ None,
init_balloon_size,
ac97_host_tubes,
#[cfg(feature = "kiwi")]
gpu_device_service_tube,
tsc_state.frequency,
)?;