ishitatsuyuki / LatencyFleX

Vendor agnostic latency reduction middleware. An alternative to NVIDIA Reflex.
Apache License 2.0
797 stars 20 forks source link

could this improve rendering latency for web browsers ? (2D GUIs) #1

Open LifeIsStrange opened 2 years ago

ishitatsuyuki commented 2 years ago

Unfortunately, I think there would be a lot of obstacles applying this to 2D GUIs. Here are some reasons:

LifeIsStrange commented 2 years ago

Regarding your first point: I haven't studied how latencyFlex/nvidia reflex works but assuming a frequent rerender is needed then the technique could potentially be only used for the partial updates or when the browser spam full repaints/invalidation? Whatever is the needed granularity of the algorithm, I assume browsers can detects the kinds of rerenderings being performed and automatically decide whether the technique is appropriate or not. A speculative optimization approach might even be useful (attempting to use latencyFlex algorithm opportunistically based on an heuristic, fallback to normal if does not yet improvements regarding metrics of interest) Disclaimer: I might say nonsensical things given my ignorance. Regarding your second point: If there were no good strategy for the deadline model, the technique could still be applied if the browser detect Adaptative sync support, which is extremely wide-spread (supported on most mid-range monitors nowadays) and there are analogue technologies on smartphones (e.g Iphones iirc). Some TVs even support it.

@kvark @nical @emilio friendly ping, I wonder wether you have thoughts to share on this topic

nical commented 2 years ago

I agree with ishitatsuyuki's assesment regarding how uneven browser workloads are and how vsync affects these things. Note that Firefox already does some things like refresh driver throttling when the end of the pipeline can't keep up with the start, although it's more to avoid catastrophic accumulation of gpu work than to fine tune latency.

LifeIsStrange commented 2 years ago

However, if Firefox could detect adaptative sync support that would mitigate the vsync issue no?

nical commented 2 years ago

In theory maybe, but you still have the problem of very uneven workloads. More importantly we already have some lower hanging (and more impactful) fruits to pick in terms of latency improvement including work in this year's roadmap. And variable refresh rate monitors are too uncommon as of today in proportion for us to dedicate more time than making sure it works as well as vsync.

nonetrix commented 9 months ago

If you really want lower latency for whatever reason in a web browser, you can always disable vsync in most browsers though flags or about:config to my understanding. I don't really know why it would be a issue in the context of a browser though, but browsers are so easy to run that you can get like 500+ FPS easily when I tested it to debug a issue with Chromium or maybe Firefox? not locking to my 2nd monitors refresh. It is a rather obscure thing to do so I had to do a lot of searching to figure out how to even do it, but it's something you can do