The International Simutrans Forum

 

Author Topic: [r8870 on linux] Screen tearing with autodpi  (Read 364 times)

0 Members and 1 Guest are viewing this topic.

Offline Mak

  • *
  • Posts: 10
[r8870 on linux] Screen tearing with autodpi
« on: November 18, 2020, 12:36:17 AM »
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.


Online prissi

  • Developer
  • Administrator
  • *
  • Posts: 10327
  • Languages: De,EN,JP
Re: [r8870 on linux] Screen tearing with autodpi
« Reply #1 on: November 18, 2020, 04:58:03 AM »
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.

Offline Mak

  • *
  • Posts: 10
Re: [r8870 on linux] Screen tearing with autodpi
« Reply #2 on: November 23, 2020, 07:29:25 PM »
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.

Offline ceeac

  • Devotee
  • *
  • Posts: 214
Re: [r8870 on linux] Screen tearing with autodpi
« Reply #3 on: November 23, 2020, 08:57:16 PM »
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.

Offline Mak

  • *
  • Posts: 10
Re: [r8870 on linux] Screen tearing with autodpi
« Reply #4 on: November 23, 2020, 10:21:17 PM »
That did it. Thank you.

Online prissi

  • Developer
  • Administrator
  • *
  • Posts: 10327
  • Languages: De,EN,JP
Re: [r8870 on linux] Screen tearing with autodpi
« Reply #5 on: November 24, 2020, 12:20:28 AM »
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.
« Last Edit: November 24, 2020, 12:47:20 AM by prissi »