renderer/native: Fold mode unsetting into renamed unset_modes()

We had a function called "reset_modes()" on MetaRendererNative, but what
it expected to do was to unset all modes on all CRTCs. Despite this, it
had code to unset modes on unconfigured CRTCs, probably because it was
used for multiple things in the past.

Make this a bit easier to follow by renaming the function
"unset_modes()" and fold the function doing the unsetting into the
function itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3318>
This commit is contained in:
Jonas Ådahl 2023-10-09 16:11:05 +08:00 committed by Marge Bot
parent 3d318e18b5
commit a4e1afc648
3 changed files with 30 additions and 37 deletions

View File

@ -291,7 +291,7 @@ meta_monitor_manager_native_apply_monitors_config (MetaMonitorManager *ma
MetaBackend *backend = meta_monitor_manager_get_backend (manager); MetaBackend *backend = meta_monitor_manager_get_backend (manager);
MetaRenderer *renderer = meta_backend_get_renderer (backend); MetaRenderer *renderer = meta_backend_get_renderer (backend);
meta_renderer_native_reset_modes (META_RENDERER_NATIVE (renderer)); meta_renderer_native_unset_modes (META_RENDERER_NATIVE (renderer));
} }
manager->screen_width = META_MONITOR_MANAGER_MIN_SCREEN_WIDTH; manager->screen_width = META_MONITOR_MANAGER_MIN_SCREEN_WIDTH;

View File

@ -897,39 +897,6 @@ meta_renderer_native_queue_mode_set_update (MetaRendererNative *renderer_native,
meta_kms_update_free (new_kms_update); meta_kms_update_free (new_kms_update);
} }
static void
unset_disabled_crtcs (MetaRendererNative *renderer_native)
{
MetaRenderer *renderer = META_RENDERER (renderer_native);
MetaBackend *backend = meta_renderer_get_backend (renderer);
GList *l;
meta_topic (META_DEBUG_KMS, "Disabling all disabled CRTCs");
for (l = meta_backend_get_gpus (backend); l; l = l->next)
{
MetaGpu *gpu = l->data;
MetaKmsDevice *kms_device =
meta_gpu_kms_get_kms_device (META_GPU_KMS (gpu));
GList *k;
g_autoptr (MetaKmsFeedback) kms_feedback = NULL;
MetaKmsUpdate *kms_update = NULL;
for (k = meta_gpu_get_crtcs (gpu); k; k = k->next)
{
MetaCrtc *crtc = k->data;
if (meta_crtc_get_config (crtc))
continue;
kms_update = ensure_mode_set_update (renderer_native, kms_device);
meta_crtc_kms_set_mode (META_CRTC_KMS (crtc), kms_update);
}
}
post_mode_set_updates (renderer_native);
}
static CoglDmaBufHandle * static CoglDmaBufHandle *
meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer, meta_renderer_native_create_dma_buf (CoglRenderer *cogl_renderer,
CoglPixelFormat format, CoglPixelFormat format,
@ -2032,9 +1999,35 @@ on_power_save_mode_changed (MetaMonitorManager *monitor_manager,
} }
void void
meta_renderer_native_reset_modes (MetaRendererNative *renderer_native) meta_renderer_native_unset_modes (MetaRendererNative *renderer_native)
{ {
unset_disabled_crtcs (renderer_native); MetaRenderer *renderer = META_RENDERER (renderer_native);
MetaBackend *backend = meta_renderer_get_backend (renderer);
GList *l;
meta_topic (META_DEBUG_KMS, "Unsetting all CRTC modes");
for (l = meta_backend_get_gpus (backend); l; l = l->next)
{
MetaGpu *gpu = l->data;
MetaKmsDevice *kms_device =
meta_gpu_kms_get_kms_device (META_GPU_KMS (gpu));
GList *k;
g_autoptr (MetaKmsFeedback) kms_feedback = NULL;
MetaKmsUpdate *kms_update = NULL;
for (k = meta_gpu_get_crtcs (gpu); k; k = k->next)
{
MetaCrtc *crtc = k->data;
g_warn_if_fail (!meta_crtc_get_config (crtc));
kms_update = ensure_mode_set_update (renderer_native, kms_device);
meta_crtc_kms_set_mode (META_CRTC_KMS (crtc), kms_update);
}
}
post_mode_set_updates (renderer_native);
} }
static MetaGpuKms * static MetaGpuKms *

View File

@ -66,7 +66,7 @@ void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native,
MetaRendererView *view, MetaRendererView *view,
ClutterFrame *frame); ClutterFrame *frame);
void meta_renderer_native_reset_modes (MetaRendererNative *renderer_native); void meta_renderer_native_unset_modes (MetaRendererNative *renderer_native);
gboolean meta_renderer_native_send_modifiers (MetaRendererNative *renderer_native); gboolean meta_renderer_native_send_modifiers (MetaRendererNative *renderer_native);