RFC for a render API to support adaptive sync and VRR

Manasi Navare manasi.d.navare at intel.com
Tue Apr 10 21:36:53 UTC 2018


On Tue, Apr 10, 2018 at 11:03:02AM -0400, Harry Wentland wrote:
> Adding Anthony and Aric who've been working on Freesync with DC on other OSes for a while.
> 
> On 2018-04-09 05:45 PM, Manasi Navare wrote:
> > Thanks for initiating the discussion. Find my comments below:
> > 
> > On Mon, Apr 09, 2018 at 04:00:21PM -0400, Harry Wentland wrote:
> >> Adding dri-devel, which I should've included from the start.
> >>
> >> On 2018-04-09 03:56 PM, Harry Wentland wrote:
> >>> === What is adaptive sync and VRR? ===
> >>>
> >>> Adaptive sync has been part of the DisplayPort spec for a while now and allows graphics adapters to drive displays with varying frame timings. VRR (variable refresh rate) is essentially the same, but defined for HDMI.
> >>>
> >>>
> >>>
> >>> === Why allow variable frame timings? ===
> >>>
> >>> Variable render times don't align with fixed refresh rates, leading to
> >>> stuttering, tearing, and/or input lag.
> >>>
> >>> e.g. (rc = render completion, dr = display refresh)
> >>>
> >>> rc       B          C            D            E      F
> >>> dr	A	B	C	C	D	E	F
> >>>
> >>>                     ^             ^        
> >>> 		  frame         missed     
> >>> 		 repeated	display    
> >>> 		  twice	        refresh   
> >>>
> >>>
> >>>
> >>> === Other use cases of adaptive sync ====
> >>>
> >>> Beside the variable render case, adaptive sync also allows adjustment of refresh rates without a mode change. One such use case would be 24 Hz video.
> >>>
> > 
> > One of the the advantages here when the render speed is slower than the display refresh rate, since we are stretching the vertical blanking interval
> > the display adapters will follow "draw fast and then go idle" approach. This gives power savings when render rate is lower than the display refresh rate.
> 
> Are you talking about a use case, such as an idle desktop, where the renders are quite sporadic?
>

I was refering to a case where the render rate is lower say 24Hz but the display rate is fixed 60Hz, that means we are pretty much displaying the same frame
twice. But with Adaptive Sync, the display rate would be lowered to 24hz and the vertical blanking time will be stretched where instead of drawing the
same frame twice, the system is now idle in that extra blanking time thus giving some power savings.
 
> >  
> >>>
> >>>
> >>> === A DRM render API to support variable refresh rates ===
> >>>
> >>> In order to benefit from adaptive sync and VRR userland needs a way to let us know whether to vary frame timings or to target a different frame time. These can be provided as atomic properties on a CRTC:
> >>>  * bool	variable_refresh_compatible
> >>>  * int	target_frame_duration_ns (nanosecond frame duration)
> >>>
> >>> This gives us the following cases:
> >>>
> >>> variable_refresh_compatible = 0, target_frame_duration_ns = 0
> >>>  * drive monitor at timing's normal refresh rate
> >>>
> >>> variable_refresh_compatible = 1, target_frame_duration_ns = 0
> >>>  * send new frame to monitor as soon as it's available, if within min/max of monitor's reported capabilities
> >>>
> >>> variable_refresh_compatible = 0/1, target_frame_duration_ns = > 0
> >>>  * send new frame to monitor with the specified target_frame_duration_ns
> >>>
> >>> When a target_frame_duration_ns or variable_refresh_compatible cannot be supported the atomic check will reject the commit.
> >>>
> > 
> > What I would like is two sets of properties on a CRTC or preferably on a connector:
> > 
> > KMD properties that UMD can query:
> > * vrr_capable -  This will be an immutable property for exposing hardware's capability of supporting VRR. This will be set by the kernel after 
> > reading the EDID mode information and monitor range capabilities.
> > * vrr_vrefresh_max, vrr_vrefresh_min - To expose the min and max refresh rates supported.
> > These properties are optional and will be created and attached to the DP/eDP connector when the connector
> > is getting intialized.
> > 
> 
> If we're talking about the properties from the EDID these might not necessarily align with a currently selected mode, which might have a refresh rate lower than the vrr_refresh_max, requiring us to cap it at that. In some scenarios we also might do low framerate compensation [1] where we do magic to allow the framerate to drop below the supported range.

Actually the way I have coded that currently is span through all the EDID modes and for each mode with the same resolution but different refresh rates supported, create a VRR field part of drm_mode_config structure that would have
refresh_max and min. So that way we store the max and min per mode as opposed to a per crtc/connector property.

> 
> I think if a vrr_refresh_max/min are exposed to UMD these should really be only for informational purposes, in which case it might make more sense to expose them through sysfs or even debugfs entries.

I think this range obtained from EDID monitor range descriptor should still be exposed through a property so that userspace does not request a target frame rate beyond whats supported.

Manasi

> 
> [1] https://www.amd.com/Documents/freesync-lfc.pdf
> 
> > Properties that you mentioned above that the UMD can set before kernel can enable VRR functionality
> > *bool vrr_enable or vrr_compatible
> > target_frame_duration_ns
> > 
> > The monitor only specifies the monitor range through EDID. Apart from this should we also need to scan the modes and check
> > if there are modes that have the same pixel clock and horizontal timings but variable vertical totals?
> > 
> 
> I'm not sure about the VRR spec, but for adaptive sync we should only consider the range limits specified in the EDID and allow adaptive sync for modes within that range.
> 
> > I have RFC patches for all the above mentioned. If we get a concensus/agreement on the above properties and method to check
> > monitor's VRR capability, I can submit those patches atleast as RFC.
> > 
> 
> That sounds great. I wouldn't mind trying those patches and then working together to arrive at something that works for both Intel and AMD. Who knows, maybe other driver guys are interested in this as well.
> 
> Harry
> 
> > Regards
> > Manasi
> > 
> >>>
> >>>
> >>> === Previous discussions ===
> >>>
> >>> https://lists.freedesktop.org/archives/dri-devel/2017-October/155207.html
> >>>
> >>>
> >>>
> >>> === Feedback and moving forward ===
> >>>
> >>> I'm hoping to get some feedback on this or continue the discussion on how adaptive sync / VRR might look like in the DRM ecosystem. Once there are no major concerns or objections left we'll probably start creating some patches to sketch this out a bit better and see how it looks in practice.
> >>>
> >>>
> >>>
> >>> Cheers,
> >>> Harry
> >>> _______________________________________________
> >>> amd-gfx mailing list
> >>> amd-gfx at lists.freedesktop.org
> >>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> >>>


More information about the amd-gfx mailing list