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

Slowdowns when scrolling with OpenGL video drivers with AMD graphics cards #8790

Closed
numanumaa opened this issue Mar 1, 2021 · 8 comments · Fixed by #8876
Closed

Slowdowns when scrolling with OpenGL video drivers with AMD graphics cards #8790

numanumaa opened this issue Mar 1, 2021 · 8 comments · Fixed by #8876

Comments

@numanumaa
Copy link

Version of OpenTTD

1.11.0-beta2 | Windows 10

Expected result

Graphics frame rate should remain a constant when scrolling across the map either with the arrow keys or the mouse. In the below .gif, I used the arrow keys to showcase a stable scrolling speed in the stable release 1.10.3.

stable

When forcing the win32 driver in 1.11.0-beta2, the scrolling also performs as expected and is represented below.

beta2

For reference, here is the log output when -ddriver=4 is appended to the executable (1.10.3 and 1.11.0-beta2 logs are identical).

dbg: [driver] Successfully loaded blitter '32bpp-anim'
dbg: [driver] Resolution for display: 1920x1017
dbg: [driver] Successfully loaded video driver 'win32'
dbg: [driver] Successfully probed sound driver 'xaudio2'
dbg: [driver] Detected DirectMusic ports:
dbg: [driver]  0: Microsoft MIDI Mapper [Emulated]
dbg: [driver]  1: Microsoft GS Wavetable Synth [Emulated]
dbg: [driver]  2: Microsoft Synthesizer
dbg: [driver] DMusic: Try to load DLS file C:\Windows\system32\drivers\GM.DLS
dbg: [driver] DMusic: Parsing DLS file
dbg: [driver] Successfully probed music driver 'dmusic'
dbg: [driver] DMusic: Entering playback thread
dbg: [driver] Successfully loaded blitter '32bpp-sse2-anim'
dbg: [driver] Threaded drawing enabled

Actual result

The graphics frame rate dips heavily when scrolling across the map with either the mouse or arrow keys when using the default win32-opengl video driver.

beta

Here is the log using -ddriver=4 again.

dbg: [driver] Successfully loaded blitter '32bpp-anim'
dbg: [driver] Resolution for display: 1920x1017
dbg: [driver] OpenGL driver: ATI Technologies Inc. - AMD Radeon(TM) Graphics (3.2.14757 Core Profile Context 20.11.2 27.20.14501.18003)
dbg: [driver] OpenGL: Detected AMD GPU, not using persistent buffer mapping due to performance problems
dbg: [driver] OpenGL shading language version: 4.60, texture units = 160
dbg: [driver] Successfully probed video driver 'win32-opengl'
dbg: [driver] Successfully probed sound driver 'xaudio2'
dbg: [driver] Detected DirectMusic ports:
dbg: [driver]  0: Microsoft MIDI Mapper [Emulated]
dbg: [driver]  1: Microsoft GS Wavetable Synth [Emulated]
dbg: [driver]  2: Microsoft Synthesizer
dbg: [driver] DMusic: Try to load DLS file C:\Windows\system32\drivers\GM.DLS
dbg: [driver] DMusic: Parsing DLS file
dbg: [driver] Successfully probed music driver 'dmusic'
dbg: [driver] DMusic: Entering playback thread
dbg: [driver] Successfully loaded blitter '40bpp-anim'

Results were the same on both my laptop and desktop. The results and logs above were from my laptop which contains an AMD Vega 6 iGPU. My desktop contains an AMD RX 5700 GPU. Both machines run Windows 10 Build 19042 and Radeon Software Version 20.11.2. Unfortunately, I do not have an Intel or Nvidia machine to test with.

I presume that this is an issue with AMD devices only, but I would like results from others before making that assumption.

This issue happens with any save game. This includes the flat map in the scenario editor. In the examples above, a brand new 256x256 map was used along with a new config file generated by 1.11.0-beta2.

Steps to reproduce

  1. Boot OpenTTD using the win32-opengl video driver
  2. Start a game
  3. Scroll the map with either the arrow keys or mouse
@numanumaa
Copy link
Author

Throwing in some more information:

I had a go with Arch Linux for a bit on my laptop (Vega 6 iGPU) and downloaded the 1.11.0-beta2 Linux general binaries. Afterwards, I started a game and could not replicate the issue using the sdl-opengl video drivers.

-ddriver=4 log:

dbg: [driver] Successfully loaded blitter '32bpp-anim'
dbg: [driver] Resolution for display: 1920x1025
dbg: [driver] SDL2: Mouse is at (170, 107), use display 0 (0, 0, 1920, 1080)
dbg: [driver] SDL2: using mode 1920x1025
dbg: [driver] SDL2: using driver 'x11'
dbg: [driver] OpenGL driver: AMD - AMD RENOIR (DRM 3.40.0, 5.11.2-arch1-1, LLVM 11.1.0) (4.6 (Compatibility Profile) Mesa 20.3.4)
dbg: [driver] OpenGL: Detected AMD GPU, not using persistent buffer mapping due to performance problems
dbg: [driver] OpenGL shading language version: 4.60, texture units = 192
dbg: [driver] Successfully probed video driver 'sdl-opengl'
dbg: [driver] Successfully probed sound driver 'sdl'
dbg: [driver] Fluidsynth: sf (null)
dbg: [driver] Fluidsynth: samplerate 44100
dbg: [driver] Successfully probed music driver 'fluidsynth'
dbg: [driver] Successfully loaded blitter '40bpp-anim'
dbg: [driver] SDL2: using mode 1920x1025
dbg: [driver] SDL2: using no threads

@TrueBrain TrueBrain added this to the 1.11.0 milestone Mar 2, 2021
@TrueBrain
Copy link
Member

TrueBrain commented Mar 8, 2021

Given the other reports we are getting, this is specific to certain GPUs only. Which means we need someone to drill down in OpenGL to figure out what is going on exactly that is causing these slowdowns. None of the devs can currently reproduce it on their hardware.

For now we will mitigate the issue a bit by giving the user the option to disable hardware acceleration (#8812 or #8816). It is not a solution, but at least it means you could play the game normally.

This just to give a small update on the current state of this issue :)

@TrueBrain TrueBrain removed this from the 1.11.0 milestone Mar 8, 2021
@LordAro LordAro changed the title Slowdowns when scrolling on win32-opengl video driver Slowdowns when scrolling with OpenGL video drivers with AMD graphics cards Mar 24, 2021
@SMCA25
Copy link

SMCA25 commented Mar 24, 2021

Just tested as suggested in #8890 with 1.11 RC1 portable:
(Windows 10 Build 19042.867, AMD Ryzen CPU, AMD Radeon RX 570 Series GPU, Radeon Software Version 20.9.1)
hardware acceleration enabled => panning laggy
output of -ddriver=4 is as follows:

dbg: [driver] Successfully loaded blitter '32bpp-anim'
dbg: [driver] Resolution for display: 3840x2130
dbg: [driver] OpenGL driver: ATI Technologies Inc. - Radeon RX 570 Series (3.2.14736 Core Profile Context 20.9.1 27.20.12029.1000)
dbg: [driver] OpenGL: Detected AMD GPU, not using persistent buffer mapping due to performance problems
dbg: [driver] OpenGL shading language version: 4.60, texture units = 160
dbg: [driver] Successfully probed video driver 'win32-opengl'
<snip>
dbg: [driver] Successfully probed sound driver 'xaudio2'
dbg: [driver] Detected DirectMusic ports:
dbg: [driver]  0: Microsoft MIDI Mapper [Emulated]
dbg: [driver]  1: Microsoft GS Wavetable Synth [Emulated]
dbg: [driver]  2: Microsoft Synthesizer
dbg: [driver] DMusic: Try to load DLS file C:\Windows\system32\drivers\GM.DLS
dbg: [driver] DMusic: Parsing DLS file
dbg: [driver] Successfully probed music driver 'dmusic'
dbg: [driver] DMusic: Entering playback thread
dbg: [driver] using thread for game-loop
dbg: [driver] Switching blitter from '32bpp-anim' to '40bpp-anim'...
dbg: [driver] Successfully loaded blitter '40bpp-anim'
dbg: [driver] Successfully switched to 40bpp-anim.
dbg: [grf] [av8_aviators_aircraft_set-2.21\pb_av8w.grf:5] LoadNewGRFFile: Unexpected sprite, disabling
dbg: [grf] NewGRF 44440A01 (av8_aviators_aircraft_set-2.21\pb_av8w.grf) not found; checksum FCEEC76CF44EC23E7FE9C88048CF11CC
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Starting playback
dbg: [driver] DMusic thread: volume change
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Starting playback
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Starting playback
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Starting playback

Same with hardware acceleration disabled, panning works smoothly:

dbg: [driver] Successfully loaded blitter '32bpp-anim'
dbg: [driver] Resolution for display: 3840x2130
dbg: [driver] Successfully probed video driver 'win32'
<snip>
dbg: [driver] Successfully probed sound driver 'xaudio2'
dbg: [driver] Detected DirectMusic ports:
dbg: [driver]  0: Microsoft MIDI Mapper [Emulated]
dbg: [driver]  1: Microsoft GS Wavetable Synth [Emulated]
dbg: [driver]  2: Microsoft Synthesizer
dbg: [driver] DMusic: Try to load DLS file C:\Windows\system32\drivers\GM.DLS
dbg: [driver] DMusic: Parsing DLS file
dbg: [driver] Successfully probed music driver 'dmusic'
dbg: [driver] DMusic: Entering playback thread
dbg: [driver] using thread for game-loop
dbg: [driver] Switching blitter from '32bpp-anim' to '32bpp-sse2-anim'...
dbg: [driver] Successfully loaded blitter '32bpp-sse2-anim'
dbg: [driver] Successfully switched to 32bpp-sse2-anim.
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Starting playback
dbg: [driver] DMusic thread: volume change
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Starting playback

The workaround with disabled hardware acceleration thus seems to work, thank you for pointing this out.

@michicc
Copy link
Member

michicc commented Mar 24, 2021

Potentially also fixed by #8876, but needs confirmation from AMD users.

@LordAro
Copy link
Member

LordAro commented Mar 24, 2021

We've prepared some binaries for the change in #8876 that we hope improves or fixes things for people experiencing these scrolling issues. Can people try them out and report back?

https://www.openttd.org/downloads/openttd-branches/pr8876/latest.html

@RoqueDeicide
Copy link

Just tried out new binaries, panning now seems smooth, while it wasn't before.

@numanumaa
Copy link
Author

numanumaa commented Mar 25, 2021

We've prepared some binaries for the change in #8876 that we hope improves or fixes things for people experiencing these scrolling issues. Can people try them out and report back?
https://www.openttd.org/downloads/openttd-branches/pr8876/latest.html

It appears the issue has been fixed (at least for me). Tested it with my RX 5700 desktop and everything is performing as expected.
I used the openttd-20210320-pr8876-gaebad87e23-windows-win64 release specifically.

openttd

-ddriver=4 log for reference:

dbg: [driver] Successfully loaded blitter '32bpp-anim'
dbg: [driver] Resolution for display: 1920x1017
dbg: [driver] OpenGL driver: ATI Technologies Inc. - AMD Radeon RX 5700 XT (3.2.14757 Core Profile Context 20.11.2 27.20.14501.18003)
dbg: [driver] OpenGL: Using persistent buffer mapping
dbg: [driver] OpenGL shading language version: 4.60, texture units = 160
dbg: [driver] Successfully probed video driver 'win32-opengl'
dbg: [driver] Successfully probed sound driver 'xaudio2'
dbg: [driver] Win32-MIDI: Start: initializing
dbg: [driver] Win32-MIDI: Found 3 output devices:
dbg: [driver] MIDI port  0: CoolSoft MIDIMapper
dbg: [driver] MIDI port  1: Microsoft GS Wavetable Synth
dbg: [driver] MIDI port  2: VirtualMIDISynth #1
dbg: [driver] Win32-MIDI: Start: timer resolution is 5
dbg: [driver] Successfully loaded music driver 'win32'
dbg: [driver] using thread for game-loop
dbg: [driver] Switching blitter from '32bpp-anim' to '40bpp-anim'...
dbg: [driver] Successfully loaded blitter '40bpp-anim'
dbg: [driver] Successfully switched to 40bpp-anim.

@SMCA25
Copy link

SMCA25 commented Mar 25, 2021

Same for me: test with openttd-20210320-pr8876-gaebad87e23-windows-win64, hardware acceleration enabled ((Windows 10 Build 19042.867, AMD Ryzen CPU, AMD Radeon RX 570 Series GPU, Radeon Software Version 20.9.1).
Framerate is stable around 60 fps, panning is smooth
-ddriver=4 log:

dbg: [driver] Successfully loaded blitter '32bpp-anim'
dbg: [driver] Resolution for display: 3840x2066
dbg: [driver] OpenGL driver: ATI Technologies Inc. - Radeon RX 570 Series (3.2.14736 Core Profile Context 20.9.1 27.20.12029.1000)
dbg: [driver] OpenGL: Using persistent buffer mapping
dbg: [driver] OpenGL shading language version: 4.60, texture units = 160
dbg: [driver] Successfully probed video driver 'win32-opengl'
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [misc] String too long for destination buffer
dbg: [driver] Successfully probed sound driver 'xaudio2'
dbg: [driver] Detected DirectMusic ports:
dbg: [driver]  0: Microsoft MIDI Mapper [Emulated]
dbg: [driver]  1: Microsoft GS Wavetable Synth [Emulated]
dbg: [driver]  2: Microsoft Synthesizer
dbg: [driver] DMusic: Try to load DLS file C:\Windows\system32\drivers\GM.DLS
dbg: [driver] DMusic: Parsing DLS file
dbg: [driver] Successfully probed music driver 'dmusic'
dbg: [driver] DMusic: Entering playback thread
dbg: [driver] using thread for game-loop
dbg: [driver] Switching blitter from '32bpp-anim' to '40bpp-anim'...
dbg: [driver] Successfully loaded blitter '40bpp-anim'
dbg: [driver] Successfully switched to 40bpp-anim.
dbg: [grf] [av8_aviators_aircraft_set-2.21\pb_av8w.grf:5] LoadNewGRFFile: Unexpected sprite, disabling
dbg: [grf] NewGRF 44440A01 (av8_aviators_aircraft_set-2.21\pb_av8w.grf) not found; checksum FCEEC76CF44EC23E7FE9C88048CF11CC
dbg: [driver] DMusic thread: Stopping playback
dbg: [driver] DMusic thread: Starting playback
dbg: [driver] DMusic thread: volume change

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