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
This commit is contained in:
Pekka Paalanen 2020-02-24 15:13:42 +02:00 committed by Jonas Ådahl
parent 121c5d2a92
commit 4cc29cfb61

View File

@ -1602,17 +1602,8 @@ on_monitors_changed (MetaMonitorManager *monitors,
}
static void
init_hw_cursor_support (MetaCursorRendererNative *cursor_renderer_native)
init_hw_cursor_support_for_gpu (MetaGpuKms *gpu_kms)
{
MetaCursorRendererNativePrivate *priv =
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
GList *gpus;
GList *l;
gpus = meta_backend_get_gpus (priv->backend);
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;
@ -1620,7 +1611,7 @@ init_hw_cursor_support (MetaCursorRendererNative *cursor_renderer_native)
gbm_device = meta_gbm_device_from_gpu (gpu_kms);
if (!gbm_device)
continue;
return;
cursor_renderer_gpu_data =
meta_create_cursor_renderer_native_gpu_data (gpu_kms);
@ -1634,6 +1625,22 @@ init_hw_cursor_support (MetaCursorRendererNative *cursor_renderer_native)
cursor_renderer_gpu_data->cursor_width = width;
cursor_renderer_gpu_data->cursor_height = height;
}
static void
init_hw_cursor_support (MetaCursorRendererNative *cursor_renderer_native)
{
MetaCursorRendererNativePrivate *priv =
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
GList *gpus;
GList *l;
gpus = meta_backend_get_gpus (priv->backend);
for (l = gpus; l; l = l->next)
{
MetaGpuKms *gpu_kms = l->data;
init_hw_cursor_support_for_gpu (gpu_kms);
}
}
MetaCursorRendererNative *