Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

>On Windows, DWM's display compositing adds one frame of latency to every window on screen. It's not possible to render a dragged object in any window that sticks to the mouse cursor without at least one frame of latency.

AFAIK you can bypass this by using dxgi flip model so no additional latency is incurred. There's still is going to be 1 frame of latency from the vsync though.

>You can prove this by enabling "Night light" in settings; watch the mouse cursor change colors as it transitions from hardware overlay to software rendering when you start dragging a window.

can't reproduce on my end. maybe the upped the night light implementation so the hardware cursor is tinted as well.



> AFAIK you can bypass this by using dxgi flip model so no additional latency is incurred.

Using the flip model only eliminates the latency if DWM promotes your window to a hardware overlay. On Nvidia systems this is simply not supported, so the latency is always there and it's impossible to get rid of it. Maybe DWM supports overlays on Intel or AMD, I'm not sure. It would be interesting for someone to test this.

> There's still is going to be 1 frame of latency from the vsync though.

Vsync does not inherently require any extra latency. You can render as close to vsync as you like to reduce the latency an arbitrary amount. That's what VR compositors do. All you need to do is ensure you can't flip during scanout and you can't get tearing.


My understanding is that promoting a window to hardware overlay is only supported on Kaby Lake and later Intel integrated graphics, and there it's a heuristic, so there's no way to guarantee getting it. You do have to be in flip mode, but in flip mode smooth resizing can't be done without artifacts. Currently druid downgrades to direct2d hwnd render targets during a live resize, but this feels hacky and is likely creating other problems.

I've spent a fair amount of time investigating this and have a mostly written blog post on it, but right now I'm kind of sick of the topic - it's a good illustration of how easily software evolves into stuff that's complex and broken.


Great info, thanks. I'd love to see that blog post.

I similarly got fed up with it after a bunch of investigation. I also have a speculative suspicion that the reason overlays aren't supported is that they were artificially omitted from the GeForce driver to support Nvidia's Quadro price discrimination. Ugh.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: