Simutrans Forum Archive
A complete record of the old Simutrans Forum.

[r8870 on linux] Screen tearing with autodpi

Started by Mak, November 18, 2020, 12:36:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


When running the latest stable version (r8870), as well as latest master from git mirror (eb0a86cb0 at the time of writing) with `-autodpi` flag, screen tearing occurs at some widths.

Without actually measuring all possible widths, I'd say tearing occurs on 50% of the possible widths.

These are some examples:
* width 1969-1976px tearing happens
* width 1977-1992px tearing doesn't happen
* width 1993-2000px tearing happens
* width 2001-2016px tearing doesn't happen

I'm using i3 and borderless window to measure this.
Also, some sizes are skipped automatically when the tearing jump occurs, e.g. after 1992, next window size is 1999 and not 1993px, but I'm able to resize to smaller (1993-1997px) width.


Since some SDL2 on some hardware does not like a width which is not a multiple of some power of 2, the window is usually wider than the requested width. (Otherwise the popular resolution 1366x768 would not work.) However, tearing does not happen on all systems and all graphic drivers or SDL2 versions.

So in your case it seems the resolution must be a multiple of 16, not 8.

Anyway, I will look into this, although I run Linux currently only in a VM and it might not happen there.


I believe I've found the issue: it seems like a line was left commented out by accident when fixing other issues.

I've attached the patch.


While this fixes the major glitch, there was still some tearing when resizing the window horizontally. I think I've fixed both errors now; check r9433.


This line was commented out, because it made SDL2 unusable on all 1366 wide Laptops, which is not a width of 16 but the third most common screen resolution out there. But the other changes made this work too. Thank you.