mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
renderer/native: Refactor modeset boilerplate into new helpers
Extract some boilerplate into new functions for next patch. No functional change intended. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1561>
This commit is contained in:
parent
1fa7176d98
commit
45a9c386bb
@ -1892,6 +1892,48 @@ ensure_crtc_modes (CoglOnscreen *onscreen,
|
||||
}
|
||||
}
|
||||
|
||||
static MetaKmsUpdate *
|
||||
unset_disabled_crtcs (MetaBackend *backend,
|
||||
MetaKms *kms)
|
||||
{
|
||||
MetaKmsUpdate *kms_update = NULL;
|
||||
GList *l;
|
||||
|
||||
for (l = meta_backend_get_gpus (backend); l; l = l->next)
|
||||
{
|
||||
MetaGpu *gpu = l->data;
|
||||
GList *k;
|
||||
|
||||
for (k = meta_gpu_get_crtcs (gpu); k; k = k->next)
|
||||
{
|
||||
MetaCrtc *crtc = k->data;
|
||||
|
||||
if (meta_crtc_get_config (crtc))
|
||||
continue;
|
||||
|
||||
kms_update = meta_kms_ensure_pending_update (kms);
|
||||
meta_crtc_kms_set_mode (META_CRTC_KMS (crtc), kms_update);
|
||||
}
|
||||
}
|
||||
|
||||
return kms_update;
|
||||
}
|
||||
|
||||
static void
|
||||
post_pending_update (MetaKms *kms)
|
||||
{
|
||||
g_autoptr (MetaKmsFeedback) kms_feedback = NULL;
|
||||
|
||||
kms_feedback = meta_kms_post_pending_update_sync (kms);
|
||||
if (meta_kms_feedback_get_result (kms_feedback) != META_KMS_FEEDBACK_PASSED)
|
||||
{
|
||||
const GError *error = meta_kms_feedback_get_error (kms_feedback);
|
||||
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
|
||||
g_warning ("Failed to post KMS update: %s", error->message);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||
const int *rectangles,
|
||||
@ -1977,14 +2019,7 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||
|
||||
COGL_TRACE_BEGIN (MetaRendererNativePostKmsUpdate,
|
||||
"Onscreen (post pending update)");
|
||||
kms_feedback = meta_kms_post_pending_update_sync (kms);
|
||||
if (meta_kms_feedback_get_result (kms_feedback) != META_KMS_FEEDBACK_PASSED)
|
||||
{
|
||||
const GError *error = meta_kms_feedback_get_error (kms_feedback);
|
||||
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
|
||||
g_warning ("Failed to post KMS update: %s", error->message);
|
||||
}
|
||||
post_pending_update (kms);
|
||||
COGL_TRACE_END (MetaRendererNativePostKmsUpdate);
|
||||
}
|
||||
|
||||
@ -3128,41 +3163,12 @@ meta_renderer_native_finish_frame (MetaRendererNative *renderer_native)
|
||||
|
||||
if (renderer_native->pending_unset_disabled_crtcs)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = meta_backend_get_gpus (backend); l; l = l->next)
|
||||
{
|
||||
MetaGpu *gpu = l->data;
|
||||
GList *k;
|
||||
|
||||
for (k = meta_gpu_get_crtcs (gpu); k; k = k->next)
|
||||
{
|
||||
MetaCrtc *crtc = k->data;
|
||||
|
||||
if (meta_crtc_get_config (crtc))
|
||||
continue;
|
||||
|
||||
kms_update = meta_kms_ensure_pending_update (kms);
|
||||
meta_crtc_kms_set_mode (META_CRTC_KMS (crtc), kms_update);
|
||||
}
|
||||
}
|
||||
|
||||
kms_update = unset_disabled_crtcs (backend, kms);
|
||||
renderer_native->pending_unset_disabled_crtcs = FALSE;
|
||||
}
|
||||
|
||||
if (kms_update)
|
||||
{
|
||||
g_autoptr (MetaKmsFeedback) kms_feedback = NULL;
|
||||
|
||||
kms_feedback = meta_kms_post_pending_update_sync (kms);
|
||||
if (meta_kms_feedback_get_result (kms_feedback) != META_KMS_FEEDBACK_PASSED)
|
||||
{
|
||||
const GError *error = meta_kms_feedback_get_error (kms_feedback);
|
||||
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
|
||||
g_warning ("Failed to post KMS update: %s", error->message);
|
||||
}
|
||||
}
|
||||
post_pending_update (kms);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
Loading…
Reference in New Issue
Block a user