From 8abdf16a3992e3332f2378ea7c65e6e251e418e0 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 24 Feb 2020 15:36:24 +0200 Subject: [PATCH] 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 --- src/backends/native/meta-cursor-renderer-native.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c index cf500f07c..b400a8740 100644 --- a/src/backends/native/meta-cursor-renderer-native.c +++ b/src/backends/native/meta-cursor-renderer-native.c @@ -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;