Am 09.08.2016 um 04:44 schrieb Michel Dänzer: > On 08/08/16 06:55 PM, Christian König wrote: >> [SNIP] >> Who said that games need to be able to enable/disable it in the >> kernel side? > The assumption is that some games (and maybe other apps, e.g. > compositors) won't work correctly with variable refresh rate. So there > needs to be some way for the user to decide whether or not to use it > for a given app. Completely agree on that, but this wasn't what I wanted to say. My issue here is why does the kernel needs to know about this? As far as I can see userspace should be able to handle this perfectly fine on it's own. > I was basically thinking out loud that doing this via different modes > might be quite natural, *if* games allowed choosing a specific mode. > But unfortunately they don't. For the video playback case, how do you > envision the video player app communicating the refresh rate of the > currently playing video to the kernel? Again the kernel doesn't need to know the refresh rate. All the kernel needs to know is when to do the page flip. So coming back to my example of a mode with 1920x1080 and 20-100Hz refresh rate a classic modeline would then look something like this: Modeline "1920x1080_dynamic" 302.50 1920 2072 2280 2640 1080 1083 1088 5735 -hsync +vsync Note the high vertical total scan lines. Those basically reduce the refresh rate from 100Hz (which this mode normally would have) down to only 20Hz. Now what userspace does on each page flip is specifying when this flip should happen, e.g. when the frame should be started to be scanned out. We can either specify this as frame counter + vertical line of the previous frame or as something like CLOCK_MONOTONIC (I think I would prefer CLOCK_MONOTONIC, but that's not a strong opinion). In other words you put the whole concept upside down. It's no longer the kernel which tells userspace when a vblank happened, but rather userspace tells the kernel when it should happen (together with the frame that should be displayed then). Regards, Christian.