wayland: Remove unreachable condition

The value returned from clutter_frame_get_target_presentation_time()
is always same as the value returned from
clutter_frame_get_min_render_time_allowed() when they are called
consecutively because both functions effectively return the value of
frame->has_target_presentation_time. This is with the assumption
that this variable is only ever modified by the same thread that
also executes on_after_update().

As such, a case where the former returns FALSE after the latter
returned TRUE is not possible, which means the line that sets
"target_presentation_time_us = 0;" is effectively unreachable.

Acknowledging this fact allows the call to
clutter_frame_get_target_presentation_time() to be moved outside the
"else" case and into the "if" condition itself. This is done in
preparation for the next commits.

No change in behavior.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3521>
This commit is contained in:
Dor Askayo 2023-09-24 18:09:44 +03:00
parent a2397e6b80
commit 83713a38bb

View File

@ -298,6 +298,7 @@ on_after_update (ClutterStage *stage,
FrameCallbackSource *frame_callback_source;
GSource *source;
int64_t min_render_time_allowed_us;
int64_t target_presentation_time_us;
if (!META_IS_BACKEND_NATIVE (backend))
{
@ -312,20 +313,17 @@ on_after_update (ClutterStage *stage,
if (meta_frame_native_had_kms_update (frame_native) ||
!clutter_frame_get_min_render_time_allowed (frame,
&min_render_time_allowed_us))
&min_render_time_allowed_us) ||
!clutter_frame_get_target_presentation_time (frame,
&target_presentation_time_us))
{
g_source_set_ready_time (source, -1);
emit_frame_callbacks_for_stage_view (compositor, stage_view);
}
else
{
int64_t target_presentation_time_us;
int64_t source_ready_time_us;
if (!clutter_frame_get_target_presentation_time (frame,
&target_presentation_time_us))
target_presentation_time_us = 0;
if (g_source_get_ready_time (source) != -1 &&
frame_callback_source->target_presentation_time_us <
target_presentation_time_us)