wayland: Fix refresh interval reporting in presentation-time version 1
Version 1 of the presentation protocol requires that 0 be sent for the refresh rate for variable refresh rate. Fix this by checking the mode during the presentation event. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4227>
This commit is contained in:
parent
f459472cfe
commit
271c712146
@ -92,6 +92,12 @@ meta_wayland_output_get_monitor (MetaWaylandOutput *wayland_output)
|
|||||||
return wayland_output->monitor;
|
return wayland_output->monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaMonitorMode *
|
||||||
|
meta_wayland_output_get_monitor_mode (MetaWaylandOutput *wayland_output)
|
||||||
|
{
|
||||||
|
return wayland_output->mode;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_resource_destroy (struct wl_resource *res)
|
output_resource_destroy (struct wl_resource *res)
|
||||||
{
|
{
|
||||||
|
@ -33,6 +33,8 @@ const GList * meta_wayland_output_get_resources (MetaWaylandOutput *wayland_outp
|
|||||||
|
|
||||||
MetaMonitor * meta_wayland_output_get_monitor (MetaWaylandOutput *wayland_output);
|
MetaMonitor * meta_wayland_output_get_monitor (MetaWaylandOutput *wayland_output);
|
||||||
|
|
||||||
|
MetaMonitorMode * meta_wayland_output_get_monitor_mode (MetaWaylandOutput *wayland_output);
|
||||||
|
|
||||||
void meta_wayland_outputs_finalize (MetaWaylandCompositor *compositor);
|
void meta_wayland_outputs_finalize (MetaWaylandCompositor *compositor);
|
||||||
|
|
||||||
void meta_wayland_outputs_init (MetaWaylandCompositor *compositor);
|
void meta_wayland_outputs_init (MetaWaylandCompositor *compositor);
|
||||||
|
@ -323,6 +323,8 @@ meta_wayland_presentation_feedback_present (MetaWaylandPresentationFeedback *fee
|
|||||||
uint32_t seq_hi, seq_lo;
|
uint32_t seq_hi, seq_lo;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
const GList *l;
|
const GList *l;
|
||||||
|
MetaMonitorMode *mode;
|
||||||
|
gboolean is_vrr;
|
||||||
|
|
||||||
if (output == NULL)
|
if (output == NULL)
|
||||||
{
|
{
|
||||||
@ -337,7 +339,16 @@ meta_wayland_presentation_feedback_present (MetaWaylandPresentationFeedback *fee
|
|||||||
tv_sec_lo = time_s;
|
tv_sec_lo = time_s;
|
||||||
tv_nsec = (uint32_t) us2ns (time_us - s2us (time_s));
|
tv_nsec = (uint32_t) us2ns (time_us - s2us (time_s));
|
||||||
|
|
||||||
refresh_interval_ns = (uint32_t) (0.5 + s2ns (1) / frame_info->refresh_rate);
|
mode = meta_wayland_output_get_monitor_mode (output);
|
||||||
|
|
||||||
|
is_vrr = meta_monitor_mode_get_refresh_rate_mode (mode) ==
|
||||||
|
META_CRTC_REFRESH_RATE_MODE_VARIABLE;
|
||||||
|
|
||||||
|
/* The refresh rate interval is required to be 0 for vrr. */
|
||||||
|
if (is_vrr)
|
||||||
|
refresh_interval_ns = 0;
|
||||||
|
else
|
||||||
|
refresh_interval_ns = (uint32_t) (0.5 + s2ns (1) / frame_info->refresh_rate);
|
||||||
|
|
||||||
maybe_update_presentation_sequence (surface, frame_info, output);
|
maybe_update_presentation_sequence (surface, frame_info, output);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user