[mutter] renderer/native: Refactor modeset boilerplate into new helpers
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] renderer/native: Refactor modeset boilerplate into new helpers
- Date: Tue, 22 Dec 2020 10:44:25 +0000 (UTC)
commit 45a9c386bbc5a7f280cf931661f6d0c6ab78cfc6
Author: Kai-Heng Feng <kai heng feng canonical com>
Date: Mon Dec 21 14:34:43 2020 +0800
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>
src/backends/native/meta-renderer-native.c | 84 ++++++++++++++++--------------
1 file changed, 45 insertions(+), 39 deletions(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index 053460e000..91f213ad85 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]