Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LifeIsStrange opened this issue Jan 5, 2022 · 6 comments

Comments

@LifeIsStrange
Copy link

No description provided.

@ishitatsuyuki
Copy link
Owner

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

  • Web browser workloads are highly uneven. Sometimes they don’t update at all, sometimes they do a partial update, once in a while they do a full repaint. It’s drastically different from video games where workload changes smoothly frame-to-frame.
  • 2D GUIs relies on VSync, and VSync heavily penalizes deadline misses. LatencyFleX currently assumes that missing the target time is OK, given that most games are ran inside FreeSync range or VSync off. I still haven’t decided what’s a good strategy to handle such an asymmetric deadline model.

@LifeIsStrange
Copy link
Author

LifeIsStrange commented Jan 6, 2022

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
Copy link

nical commented Jan 6, 2022

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
Copy link
Author

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

@nical
Copy link

nical commented Jan 6, 2022

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
Copy link

nonetrix commented Nov 11, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants