On Wed, Sep 24, 2025 at 01:56:30PM +0200, Michel Dänzer wrote: > On 24.09.25 11:32, Tseng, Chuan Yu (Max) wrote: > > [AMD Official Use Only - AMD Internal Distribution Only] > > > > n Wed, Sep 24, 2025 at 10:39:16AM +0200, Michel Dänzer wrote: > >>> On 24.09.25 10:34, Ville Syrjälä wrote: > >>>> On Mon, Sep 15, 2025 at 03:37:07PM +0000, Derek Foreman wrote: > >>>>> On 9/15/25 5:01 AM, Michel Dänzer wrote: > >>>>>> On 12.09.25 15:45, Derek Foreman wrote: > >>>>>>> On 9/12/25 2:33 AM, Chuanyu Tseng wrote: > >>>>>>>> Introduce a DRM interface for DRM clients to further restrict > >>>>>>>> the VRR Range within the panel supported VRR range on a > >>>>>>>> per-commit basis. > >>>>>>>> > >>>>>>>> The goal is to give DRM client the ability to do frame-doubling/ > >>>>>>>> ramping themselves, or to set lower static refresh rates for > >>>>>>>> power savings. > >>>>>>> I'm interested in limiting the range of VRR to enable HDMI's > >>>>>>> QMS/CinemaVRR features - ie: switching to a fixed rate for media > >>>>>>> playback without incurring screen blackouts/resyncs/"bonks" during > >>>>>>> the switch. > >>>>>>> > >>>>>>> I could see using an interface such as this to do the frame rate > >>>>>>> limiting, by setting the lower and upper bounds both to a media > >>>>>>> file's framerate. However for that use case it's not precise enough, > >>>>>>> as video may have a rate like 23.9760239... FPS. > >>>>>>> > >>>>>>> Would it be better to expose the limits as a numerator/denominator > >>>>>>> pair so a rate can be something like 24000/1001fps? > >>>>>> I was thinking the properties could allow directly specifying the > >>>>>> minimum and maximum number of total scanlines per refresh cycle, based > >>>>>> on the assumption the driver needs to program something along those > >>>>>> lines. > >>>>> > >>>>> Surprisingly, this would also not be precise enough for exact media > >>>>> playback, as the exact intended framerate might not result in an > >>>>> integer number of scan lines. When that happens a QMS/CinemaVRR > >>>>> capable HDMI source is expected to periodically post a frame with a > >>>>> single extra scan line to minimize the error. > >>>> > >>>> Intel VRR hardware has a "CMRR" feature where it can automagically > >>>> tweak the vtotal between frames to maintain a non integer average. > >>> > >>> Neat. > >>> > >>> > >>>> As for knobs to limit the min/max refresh rates, technically you > >>>> wouldn't need the max knob because that is ultimately defined by the > >>>> vtotal of the supplied timings. But I guess if you have a knob to > >>>> limit the min then a max knob might be convenient as well. > >>> > >>> It allows the compositor to limit the maximum refresh rate without > >>> changing the mode (which can involve visual glitches). > > > >> I think the driver should be able to handle the two cases in exactly the > >> same way (assuming nothing else in the mode changes). But I'm not opposed > >> to having a max alongside the min. > > Compositors want to avoid setting the DRM_MODE_ATOMIC_ALLOW_MODESET flag > under normal circumstances, because it may result in visual glitches.
If the driver can do the vtotal adjustment without a modeset (which it should if it can do the same thing for the max refresh rate property) then you don't need that flag. And for i915 we'd probably handle the property change just like a modeset, and after all the calculation are done the driver will just notice that a full modeset isn't required to get to the new state. > > > >> IMO the min and max could be straight integers, if specified as vtotals > >> (that's what the hardware takes for us at least). And for the CMRR thing > >> we'd need another property to indicate the target refresh rate somehow. > > > >> I suppose another option would be to have non-integer min/max, and then > >> enable CMRR if min==max==<non-integer value>. Not sure I quite like that > >> idea though. > > Do you see any issue with proposal 2 by Leo Li, specifying the limits as the > total duration of a refresh cycle in nanoseconds? If the limits don't > correspond to an integer number of scanlines, the driver should alternate > between the nearest integer numbers of scanlines to approximate the requested > duration on average. We can't do any kind of alternation for the min and max independently. those will always just be integer number of scanlines. With CMRR will automagically alternate between two vtotals to maintain the average. I suppose a time based property would work for us, we'd just have to convert it to scanlines anyway. > >> Also not sure what the rules for such properties should be. > >> Should they be allowed to be specified outside the legal range and the > >> driver just clamps them, or should that be an error? > > > > It's possible that compositor set the value which is not acceptable to sink > > vrr range. > > It would be better to clamp the false value. > > One downside of implicit clamping is that the resulting effective limits may > not be what the compositor expects. I suppose. Though if/when we get the DC balance stuff actually working the min/max vtotal will be changing dynamically all the time to maintain the balance. So in that case the compositor can't accurately know the exact vtotal for future frames anyway. But the absolute limits will be based on what the user specified. -- Ville Syrjälä Intel
