From 98cdafdf0b564bf752b9e4abce934a21e8625394 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Fri, 19 Jan 2024 02:00:35 +0200 Subject: [PATCH] kms/impl-device: Use enum for deadline timer state The "disabled" state indicates that the deadline timer is disabled for the lifetime of the device, while the "inhibited" state indicates that it is disabled temporarily for the device. This distinction is needed to handle each state differently in a following commit. For now, only "disabled" is used. No change in behavior. Part-of: --- src/backends/native/meta-kms-impl-device.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c index cbedd54a4..0183363f3 100644 --- a/src/backends/native/meta-kms-impl-device.c +++ b/src/backends/native/meta-kms-impl-device.c @@ -75,6 +75,13 @@ typedef struct _CrtcDeadline } deadline; } CrtcFrame; +typedef enum _MetaDeadlineTimerState +{ + META_DEADLINE_TIMER_STATE_ENABLED, + META_DEADLINE_TIMER_STATE_DISABLED, + META_DEADLINE_TIMER_STATE_INHIBITED, +} MetaDeadlineTimerState; + typedef struct _MetaKmsImplDevicePrivate { MetaKmsDevice *device; @@ -100,7 +107,7 @@ typedef struct _MetaKmsImplDevicePrivate GHashTable *crtc_frames; - gboolean deadline_timer_inhibited; + MetaDeadlineTimerState deadline_timer_state; gboolean sync_file_retrieved; int sync_file; @@ -1403,7 +1410,7 @@ is_using_deadline_timer (MetaKmsImplDevice *impl_device) MetaKmsImplDevicePrivate *priv = meta_kms_impl_device_get_instance_private (impl_device); - if (priv->deadline_timer_inhibited) + if (priv->deadline_timer_state != META_DEADLINE_TIMER_STATE_ENABLED) { return FALSE; } @@ -1626,7 +1633,7 @@ meta_kms_impl_device_schedule_process (MetaKmsImplDevice *impl_device, g_warning ("Failed to determine deadline: %s", error->message); priv = meta_kms_impl_device_get_instance_private (impl_device); - priv->deadline_timer_inhibited = TRUE; + priv->deadline_timer_state = META_DEADLINE_TIMER_STATE_DISABLED; needs_flush: meta_kms_device_set_needs_flush (meta_kms_crtc_get_device (crtc), crtc); @@ -1957,7 +1964,7 @@ get_driver_info (int fd, } static void -maybe_inhibit_deadline_timer (MetaKmsImplDevice *impl_device) +maybe_disable_deadline_timer (MetaKmsImplDevice *impl_device) { MetaKmsImplDevicePrivate *priv = meta_kms_impl_device_get_instance_private (impl_device); @@ -1970,7 +1977,7 @@ maybe_inhibit_deadline_timer (MetaKmsImplDevice *impl_device) { if (g_strcmp0 (deadline_timer_deny_list[i], priv->driver_name) == 0) { - priv->deadline_timer_inhibited = TRUE; + priv->deadline_timer_state = META_DEADLINE_TIMER_STATE_DISABLED; break; } } @@ -2001,7 +2008,7 @@ meta_kms_impl_device_initable_init (GInitable *initable, priv->driver_description = g_strdup ("Unknown"); } - maybe_inhibit_deadline_timer (impl_device); + maybe_disable_deadline_timer (impl_device); priv->crtc_frames = g_hash_table_new_full (NULL, NULL,