83 lines
2.6 KiB
Diff
83 lines
2.6 KiB
Diff
From 4cc29cfb619102a8e7cd32731205c8018d83544e Mon Sep 17 00:00:00 2001
|
|
From: Pekka Paalanen <pekka.paalanen@collabora.com>
|
|
Date: Mon, 24 Feb 2020 15:13:42 +0200
|
|
Subject: [PATCH 06/48] cursor-renderer/native: Refactor init to per-gpu
|
|
|
|
Extract the code to initialize a single GPU cursor support into its own
|
|
function. The new function will be used by GPU hotplug in the future.
|
|
|
|
This is a pure refactoring without any behavioral changes.
|
|
|
|
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1097
|
|
---
|
|
.../native/meta-cursor-renderer-native.c | 45 +++++++++++--------
|
|
1 file changed, 26 insertions(+), 19 deletions(-)
|
|
|
|
diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c
|
|
index 39ebe646f..cf500f07c 100644
|
|
--- a/src/backends/native/meta-cursor-renderer-native.c
|
|
+++ b/src/backends/native/meta-cursor-renderer-native.c
|
|
@@ -1601,6 +1601,31 @@ on_monitors_changed (MetaMonitorManager *monitors,
|
|
force_update_hw_cursor (native);
|
|
}
|
|
|
|
+static void
|
|
+init_hw_cursor_support_for_gpu (MetaGpuKms *gpu_kms)
|
|
+{
|
|
+ MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
|
+ MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data;
|
|
+ struct gbm_device *gbm_device;
|
|
+ uint64_t width, height;
|
|
+
|
|
+ gbm_device = meta_gbm_device_from_gpu (gpu_kms);
|
|
+ if (!gbm_device)
|
|
+ return;
|
|
+
|
|
+ cursor_renderer_gpu_data =
|
|
+ meta_create_cursor_renderer_native_gpu_data (gpu_kms);
|
|
+
|
|
+ if (!meta_kms_device_get_cursor_size (kms_device, &width, &height))
|
|
+ {
|
|
+ width = 64;
|
|
+ height = 64;
|
|
+ }
|
|
+
|
|
+ cursor_renderer_gpu_data->cursor_width = width;
|
|
+ cursor_renderer_gpu_data->cursor_height = height;
|
|
+}
|
|
+
|
|
static void
|
|
init_hw_cursor_support (MetaCursorRendererNative *cursor_renderer_native)
|
|
{
|
|
@@ -1613,26 +1638,8 @@ init_hw_cursor_support (MetaCursorRendererNative *cursor_renderer_native)
|
|
for (l = gpus; l; l = l->next)
|
|
{
|
|
MetaGpuKms *gpu_kms = l->data;
|
|
- MetaKmsDevice *kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
|
|
- MetaCursorRendererNativeGpuData *cursor_renderer_gpu_data;
|
|
- struct gbm_device *gbm_device;
|
|
- uint64_t width, height;
|
|
-
|
|
- gbm_device = meta_gbm_device_from_gpu (gpu_kms);
|
|
- if (!gbm_device)
|
|
- continue;
|
|
-
|
|
- cursor_renderer_gpu_data =
|
|
- meta_create_cursor_renderer_native_gpu_data (gpu_kms);
|
|
-
|
|
- if (!meta_kms_device_get_cursor_size (kms_device, &width, &height))
|
|
- {
|
|
- width = 64;
|
|
- height = 64;
|
|
- }
|
|
|
|
- cursor_renderer_gpu_data->cursor_width = width;
|
|
- cursor_renderer_gpu_data->cursor_height = height;
|
|
+ init_hw_cursor_support_for_gpu (gpu_kms);
|
|
}
|
|
}
|
|
|
|
--
|
|
2.26.0.rc2
|
|
|