[PATCH v2 2/3] drm: Add variable refresh property to DRM CRTC
Kazlauskas, Nicholas
nicholas.kazlauskas at amd.com
Fri Oct 12 12:58:23 UTC 2018
On 10/12/2018 07:20 AM, Koenig, Christian wrote:
> Am 12.10.2018 um 11:21 schrieb Pekka Paalanen:
>> On Fri, 12 Oct 2018 07:35:57 +0000
>> "Koenig, Christian" <Christian.Koenig at amd.com> wrote:
>>
>>> Am 12.10.2018 um 09:23 schrieb Pekka Paalanen:
>>>> On Wed, 10 Oct 2018 09:35:50 -0400
>>>> "Kazlauskas, Nicholas" <nicholas.kazlauskas at amd.com> wrote:
>>>>
>>>>> The patches I've put out target this use case mostly because of the
>>>>> benefit for a relatively simple interface. VRR can and has been used in
>>>>> more ways that this, however.
>>>>>
>>>>> An example usecase that differs from this would actually be video
>>>>> playback. The monitor's refresh rate likely doesn't align with the video
>>>>> content rate. An API that exposes direct control over VRR (like the
>>>>> range, refresh duration, presentation timestamp) could allow the
>>>>> application to specify the content rate directly to deliver a smoother
>>>>> playback experience. For example, if you had a 24fps video and the VRR
>>>>> range was 40-60Hz you could target 48Hz via some API here.
>>>> The way that has been discussed to be implemented is that DRM page flips
>>>> would carry a target timestamp, which the driver will then meet as good
>>>> as it can. It is better to define an absolute target timestamp than a
>>>> frequency, because a timestamp can be used to synchronize with audio
>>>> and more. Mario Kleiner can tell you all about scientific use cases
>>>> that require accurate display timing, not just frequency.
>>> To summarize what information should be provided by the driver stack to
>>> make applications happy:
>>>
>>> 1. The minimum time a frame can be displayed, in other words the maximum
>>> frame rate.
>>> 2. The maximum time a frame can be displayed, in other words the minimum
>>> frame rate.
>>> 3. How much change of frame timing is allowed between frames to avoid
>>> luminescence flickering.
>>>
>>> Number 1 and 2 can also be used to signal the availability of VRR to
>>> applications, e.g. if they are identical we don't support VRR at all.
>> Hi Christian,
>>
>> "the maximum time a frame can be displayed" is perhaps not an
>> unambiguous definition. A frame can be shown indefinitely in any case.
>
> Good point. Please also note that I'm not an expert on the display stuff
> in general.
>
> My background comes more from implementing the VDPAU mediaplayer
> interface in mesa.
>
> So just throwing some ideas in here from the point of view of an
> userspace developer which wants to write a media player :)
>
>> The CRTC will simply start scanning out the same frame again if there
>> is no new one. I understand what you want to say, but perhaps some
>> different words will be in order.
>>
>> I do wonder if applications really want to know the maximum acceptable
>> slew rate in timings... maybe that should be left for the drivers to
>> apply. What I'm thinking is that we have the page flip timestamp with
>> the page flip events to tell when the new FB became active. That
>> information could be extended with a time range on when the very next
>> flip could take place. Applications are already computing that
>> prediction from the flip timestamp and fixed refresh rate, but it might
>> be nice to give them the driver's opinion explicitly. Maybe the
>> tolerable slew rate is not a constant.
>
> Well it depends. I agree that the kernel should probably enforce the
> slew rate to avoid flickering for the user.
>
> But it might be beneficial for the application to know things like this.
>
> What the application definitely needs to know is when a frame was
> actually displayed. E.g. application says I want to display this at
> point X and at some point later the kernel returns saying the frame was
> displayed at point N where in the ideal case N=X.
>
> Additional to that let's please use 64bit values and nanoseconds for
> every value we use here, and NOT fps, line numbers or similar :)
>
> Regards,
> Christian.
Flickering will really depend on the panel itself. A wider ranger is
more likely to exhibit the issue, but factors like topology, pixel
density and other display technology can affect this.
It can be hard for a driver to guess at all of this. For many panels
it'd be difficult to notice unless it's consistently jumping between the
min and max range.
Opening up an API that restricts how much the driver can change the
refresh rate in a VRR scenario seems a bit extreme, but there's probably
some applications that could benefit from this. I'd certainly want to
see the actual use case first, though. This still feels more like a
driver policy to me.
I agree with the nanosecond based timestamp API making the most logical
sense here from an API perspective. This does overlap a little bit with
the target vblank property that's already on the CRTC, perhaps.
The target vblank could be determined based on the timestamp. The driver
is likely to exceed the target presentation timestamp by a fair bit if
it was to just do this, however. VRR could be used in this case to get
closer to the timestamp. A naive implementation could iterate over every
rate in the range and take the one with the minimum difference, for
example.
>
>>
>> Other than that, yes, it sounds fine to me.
>>
>>
>> Thanks,
>> pq
>
Nicholas Kazlauskas
More information about the amd-gfx
mailing list