devices: gpu: remove hung display from PollEvents

This display isn't typically used when the virt-wl device is
available and it can lead to hung fds during plug/unplug with
external displays and docks.

BUG=chromium:1027379, chromium:1027447
TEST=
Tested five times each on R79-12607.47.0 sarien:
  => without patch --> CPU usage goes to 100% after unplug
  => with patch --> CPU usages remains normal

Change-Id: Iea57f05002acc661f36b180e9e88c37b1f1b9047
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1977100
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
Gurchetan Singh 2019-12-18 18:14:44 -08:00 committed by Commit Bot
parent d0e2a253de
commit 78f6d4b134

View file

@ -511,7 +511,7 @@ struct Worker {
impl Worker {
fn run(&mut self) {
#[derive(PollToken)]
#[derive(PartialEq, PollToken)]
enum Token {
CtrlQueue,
CursorQueue,
@ -574,6 +574,14 @@ impl Worker {
process_resource_bridge.clear();
process_resource_bridge.resize(self.resource_bridges.len(), false);
// This display isn't typically used when the virt-wl device is available and it can
// lead to hung fds (crbug.com/1027379). Disable if it's hung.
for event in events.iter_hungup() {
if event.token() == Token::Display {
let _ = poll_ctx.delete(&*self.state.display().borrow());
}
}
for event in events.iter_readable() {
match event.token() {
Token::CtrlQueue => {