kms/impl-device: Move error handling into ensure_deadline_timer_armed
No functional change intended. v2: * Fix coding style per CI. v3: * Fix ensure_deadline_timer_armed parameter indentation. (Jonas Ådahl) Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3964>
This commit is contained in:
@ -1361,11 +1361,11 @@ arm_crtc_frame_deadline_timer (CrtcFrame *crtc_frame,
|
|||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ensure_deadline_timer_armed (MetaKmsImplDevice *impl_device,
|
ensure_deadline_timer_armed (MetaKmsImplDevice *impl_device,
|
||||||
CrtcFrame *crtc_frame,
|
CrtcFrame *crtc_frame)
|
||||||
GError **error)
|
|
||||||
{
|
{
|
||||||
int64_t next_deadline_us;
|
int64_t next_deadline_us;
|
||||||
int64_t next_presentation_us;
|
int64_t next_presentation_us;
|
||||||
|
g_autoptr (GError) local_error = NULL;
|
||||||
|
|
||||||
if (crtc_frame->deadline.armed)
|
if (crtc_frame->deadline.armed)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1373,8 +1373,28 @@ ensure_deadline_timer_armed (MetaKmsImplDevice *impl_device,
|
|||||||
if (!meta_kms_crtc_determine_deadline (crtc_frame->crtc,
|
if (!meta_kms_crtc_determine_deadline (crtc_frame->crtc,
|
||||||
&next_deadline_us,
|
&next_deadline_us,
|
||||||
&next_presentation_us,
|
&next_presentation_us,
|
||||||
error))
|
&local_error))
|
||||||
|
{
|
||||||
|
MetaKmsImplDevicePrivate *priv =
|
||||||
|
meta_kms_impl_device_get_instance_private (impl_device);
|
||||||
|
|
||||||
|
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
|
||||||
|
{
|
||||||
|
meta_topic (META_DEBUG_KMS, "Could not determine deadline: %s",
|
||||||
|
local_error->message);
|
||||||
|
|
||||||
|
priv->deadline_timer_state = META_DEADLINE_TIMER_STATE_INHIBITED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||||
|
g_warning ("Failed to determine deadline: %s", local_error->message);
|
||||||
|
|
||||||
|
priv->deadline_timer_state = META_DEADLINE_TIMER_STATE_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
arm_crtc_frame_deadline_timer (crtc_frame,
|
arm_crtc_frame_deadline_timer (crtc_frame,
|
||||||
next_deadline_us,
|
next_deadline_us,
|
||||||
@ -2005,7 +2025,6 @@ meta_kms_impl_device_schedule_process (MetaKmsImplDevice *impl_device,
|
|||||||
{
|
{
|
||||||
CrtcFrame *crtc_frame;
|
CrtcFrame *crtc_frame;
|
||||||
g_autoptr (GError) error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
MetaKmsImplDevicePrivate *priv;
|
|
||||||
|
|
||||||
crtc_frame = ensure_crtc_frame (impl_device, crtc);
|
crtc_frame = ensure_crtc_frame (impl_device, crtc);
|
||||||
|
|
||||||
@ -2018,26 +2037,9 @@ meta_kms_impl_device_schedule_process (MetaKmsImplDevice *impl_device,
|
|||||||
if (crtc_frame->pending_page_flip)
|
if (crtc_frame->pending_page_flip)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ensure_deadline_timer_armed (impl_device, crtc_frame, &error))
|
if (ensure_deadline_timer_armed (impl_device, crtc_frame))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
priv = meta_kms_impl_device_get_instance_private (impl_device);
|
|
||||||
|
|
||||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED))
|
|
||||||
{
|
|
||||||
meta_topic (META_DEBUG_KMS, "Could not determine deadline: %s",
|
|
||||||
error->message);
|
|
||||||
|
|
||||||
priv->deadline_timer_state = META_DEADLINE_TIMER_STATE_INHIBITED;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
|
||||||
g_warning ("Failed to determine deadline: %s", error->message);
|
|
||||||
|
|
||||||
priv->deadline_timer_state = META_DEADLINE_TIMER_STATE_DISABLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
needs_flush:
|
needs_flush:
|
||||||
meta_kms_device_set_needs_flush (meta_kms_crtc_get_device (crtc), crtc);
|
meta_kms_device_set_needs_flush (meta_kms_crtc_get_device (crtc), crtc);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user