cursor-renderer/native: Handle GPU hotplug

Listen for GPU hotplug events to initialize their cursor support.

This fixes one reason for why DisplayLink devices may not be using a hardware
cursor. Particularly, when a DisplayLink device is hotplugged for the first
time such that EVDI creates a new DRM device node after gnome-shell has already
started, we used to forget to initialize the cursor support.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/1097
This commit is contained in:
Pekka Paalanen 2020-02-24 15:36:24 +02:00 committed by Jonas Ådahl
parent 4cc29cfb61
commit 8abdf16a39

View File

@ -2,6 +2,7 @@
/*
* Copyright (C) 2014 Red Hat
* Copyright 2020 DisplayLink (UK) Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@ -1626,6 +1627,13 @@ init_hw_cursor_support_for_gpu (MetaGpuKms *gpu_kms)
cursor_renderer_gpu_data->cursor_height = height;
}
static void
on_gpu_added_for_cursor (MetaBackend *backend,
MetaGpuKms *gpu_kms)
{
init_hw_cursor_support_for_gpu (gpu_kms);
}
static void
init_hw_cursor_support (MetaCursorRendererNative *cursor_renderer_native)
{
@ -1659,6 +1667,8 @@ meta_cursor_renderer_native_new (MetaBackend *backend)
g_signal_connect_object (monitor_manager, "monitors-changed-internal",
G_CALLBACK (on_monitors_changed),
cursor_renderer_native, 0);
g_signal_connect (backend, "gpu-added",
G_CALLBACK (on_gpu_added_for_cursor), NULL);
priv->backend = backend;
priv->hw_state_invalidated = TRUE;