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

Tool previews laggy after hardware acceleration is turned on #3584

Closed
eishiya opened this issue Feb 20, 2023 · 6 comments · Fixed by #3587
Closed

Tool previews laggy after hardware acceleration is turned on #3584

eishiya opened this issue Feb 20, 2023 · 6 comments · Fixed by #3587
Assignees
Labels
bug Broken behavior.
Milestone

Comments

@eishiya
Copy link
Contributor

eishiya commented Feb 20, 2023

Tool previews, such as the stamp brush preview, become laggy after hardware acceleration is turned on, even if it's turned back off.
Restarting Tiled after turning hardware acceleration off and not turning it back on again "fixes" the issue, and the tool previews follow the mouse cursor without delay again.
The lag is slight, but it's enough to be quite annoying. It feels like it's perhaps a frame or so behind.

In this GIF, I first have a freshly started Tiled with no hardware acceleration, there's no lag. Then, I turn on hardware acceleration and the lag appears. Then, I turn it off and the lag persists.
cursorlag

Encountered on Tiled 1.9.1 and 2023.02.17 (Qt6) on Win10 x64.

@eishiya eishiya added the bug Broken behavior. label Feb 20, 2023
bjorn added a commit to bjorn/tiled-dev that referenced this issue Feb 23, 2023
The QOpenGLWidget causes the entire window to switch to an OpenGLSurface,
but it doesn't automatically switch back to a RasterSurface when the last
QOpenGLWidget is deleted again.

Closes mapeditor#3584
@bjorn bjorn added this to the Tiled 1.10 milestone Feb 23, 2023
@bjorn
Copy link
Member

bjorn commented Feb 23, 2023

It's an issue I had known about for a while, and I was about to reply it was a Qt issue, but then I found out a way to restore the non-OpenGL state so it should be fixed by #3587. :-)

bjorn added a commit to bjorn/tiled-dev that referenced this issue Feb 23, 2023
The QOpenGLWidget causes the entire window to switch to an
OpenGLSurface, but it doesn't automatically switch back to a
RasterSurface when the last QOpenGLWidget is deleted again.

Closes mapeditor#3584
@bjorn bjorn self-assigned this Feb 23, 2023
@eishiya
Copy link
Contributor Author

eishiya commented Feb 23, 2023

So if I understand correctly, the lag with hardware acceleration is a Qt issue and can't be fixed?
Glad to hear that at least the part where the lag sticks around into software rendering can be fixed.

@bjorn
Copy link
Member

bjorn commented Feb 23, 2023

So if I understand correctly, the lag with hardware acceleration is a Qt issue and can't be fixed?

It might be worth looking into whether it can be reduced, even when hardware acceleration is kept on. But I think this lag is mostly due to the vsync.

bjorn added a commit to bjorn/tiled-dev that referenced this issue Feb 24, 2023
This essentially disabled vsync, though with composited window managers
there should not be visible tearing anyway. It does seem to affect
animation timing as well though, which affects scrolling with arrow keys.

Related to issue mapeditor#3584
@bjorn
Copy link
Member

bjorn commented Feb 24, 2023

@eishiya You may want to test the builds of PR #3588 to test if it helps with the lag (it does in my case) and whether the additional stuttering when using arrow keys to scroll is too much (I think disabling vsync may have to be made optional...).

@eishiya
Copy link
Contributor Author

eishiya commented Feb 24, 2023

I don't see a difference with that build, the cursor is still laggy with hardware acceleration on. On the bright side, I also didn't notice additional stuttering with the arrow keys. I even tried turning vsync off in my GPU settings (with and without restarting Tiled), no effect.

On the bright side, turning hardware acceleration off removes the lag now, so that change works :D
FWIW I never actually use hardware acceleration myself, software rendering's been fine for me. I only noticed this while trying to reproduce the issue with Qt6 not rendering things correctly with hardware acceleration.

bjorn added a commit that referenced this issue Feb 28, 2023
The QOpenGLWidget causes the entire window to switch to an
OpenGLSurface, but it doesn't automatically switch back to a
RasterSurface when the last QOpenGLWidget is deleted again.

Closes #3584
@bjorn
Copy link
Member

bjorn commented Feb 28, 2023

I don't see a difference with that build, the cursor is still laggy with hardware acceleration on.

Ok, since it apparently doesn't work reliably and when it works there may be some stuttering, I'm leaving out that change for now, and just merged the change that properly disables hardware acceleration again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants