Draft: Send content frame rate surface hints#18038
Conversation
6db2d13 to
ad37b44
Compare
Dudemanguy
left a comment
There was a problem hiding this comment.
Obviously still a draft but just some small things.
| @@ -1,3 +1,5 @@ | |||
| fs = import('fs') | |||
There was a problem hiding this comment.
You shouldn't need to use this module.
| uint32_t den = wl->current_content_frame_rate_den ? | ||
| wl->current_content_frame_rate_den : 1; |
There was a problem hiding this comment.
Wouldn't it better to just initialize the value as 0/1 so you wouldn't need this check?
| struct voctrl_content_frame_rate { | ||
| uint32_t numerator; | ||
| uint32_t denominator; | ||
| }; |
There was a problem hiding this comment.
Instead of this you could just use a uint32_t array.
There was a problem hiding this comment.
I would prefer to use double as in all other code. This needs to be converted only in wayland_common.
There was a problem hiding this comment.
Sure either way is fine with me.
| }; | ||
|
|
||
| if (track && track->vo_c && !track->image) { | ||
| double fps = track->vo_c->filter->container_fps; |
There was a problem hiding this comment.
Shouldn't we use estimated fps, if available? Container value is often invalid.
There was a problem hiding this comment.
Yeah this rate should be what mpv is actually presenting at so estimated-vf-fps is the right value to use here.
There was a problem hiding this comment.
Of course it's different in display-resync mode, but as I understand we prefer content framerate as target and on top of that display-resync would work.
There was a problem hiding this comment.
Hmm, I guess I'm not sure if reporting 23.976 in display-sync mode would confuse the compositor or not with this protocol. The content rate is that 23.976 number but we're technically drawing every vblank in that mode.
There was a problem hiding this comment.
Well, I think, it should mostly be used for frame rate adaptation on compositor side, so that it should presentation limit us, but I have not read it at all, so there is that.
Mpv player detects content fps via demux/decoder metadata, rationalized with FFmpeg
av_d2q()and calls set_frame_rate(num, den) to sends the content frame rate (a rational frame rate numerator / denominator) using a new wp-content-frame-rate-v1 protocol to the compositor.A new Wayland protocol, wp_content_frame_rate_v1 is floated here https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/518
Mutter implementation can be found here https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/5091