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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3534>
This commit is contained in:
Dor Askayo 2024-01-19 02:00:35 +02:00 committed by Marge Bot
parent 8e39398d05
commit 98cdafdf0b

View File

@ -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,