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

mgba-qt doesn't work in Wayland #2190

Closed
jiangzhengwenjz opened this issue May 18, 2021 · 36 comments
Closed

mgba-qt doesn't work in Wayland #2190

jiangzhengwenjz opened this issue May 18, 2021 · 36 comments
Milestone

Comments

@jiangzhengwenjz
Copy link

jiangzhengwenjz commented May 18, 2021

Platform: Fedora 34 workstation (gcc 11.1.1-1)
Versions being tested: 86ec2d4 & 2d87cc1 (HEAD of master & 0.9)

The executables and libraries can be compiled and installed fine but mgba-qt simply doesn't work for me.

Here's what happened when I'm using XORG GNOME:
https://streamable.com/wi3h0a
(the terminal shows SDL Audio: Could not open SDL sound system) -> and audio won't play

And when I select GNOME (Wayland? ), the program reacts very differently. Before loading the ROM:
Imgur
After:
Imgur
And if you load the ROM again, it will result in a segmentation fault.
The audio is playing fine in this case.


Update May 18:
In Xorg it's working under unknown situations, tested 3 times (in 3 different sessions) and it's whitescreen -> flawless -> whitescreen. It's likely GNOME's fault so the problem is probably only for Wayland.


On the contrary, the SDL version is always working fine on my machine.

@jiangzhengwenjz jiangzhengwenjz changed the title mgba-qt doesn' mgba-qt doesn't work in Fedora 34 May 18, 2021
@endrift
Copy link
Member

endrift commented May 18, 2021

Please attach the report file generated by the report bug screen

@jiangzhengwenjz
Copy link
Author

jiangzhengwenjz commented May 18, 2021

@Testsr
Copy link

Testsr commented Jun 16, 2021

Copy of the above link's file.
report.zip

@endrift
Copy link
Member

endrift commented Jun 16, 2021

This is a duplicate of #1837 I believe, though that one got closed since the person who was "helping" me debug it on Sway was a huge asshole and didn't actually help.

@HorstBaerbel
Copy link

HorstBaerbel commented Dec 26, 2021

I can't even compile m-gba on Fedora 35. I installed a bunch of libraries, but ended up with:

Make Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LibLZMA (missing: LIBLZMA_LIBRARY LIBLZMA_INCLUDE_DIR
  LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindLibLZMA.cmake:89 (find_package_handle_standard_args)
  /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/lib64/cmake/minizip/minizip-config.cmake:39 (find_dependency)
  src/platform/cmake/FindFeature.cmake:15 (find_package)
  CMakeLists.txt:478 (find_feature)

Command line: cmake -DCMAKE_CONFIG=Release -DUSE_ZLIB=OFF -DUSE_LZMA=OFF ..

Any idea what could be wrong? There's no "liblzma-devel" I could install...

@jiangzhengwenjz
Copy link
Author

jiangzhengwenjz commented Dec 26, 2021

I can't even compile m-gba on Fedora 35. I installed a bunch of libraries, but ended up with:

Make Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LibLZMA (missing: LIBLZMA_LIBRARY LIBLZMA_INCLUDE_DIR
  LIBLZMA_HAS_AUTO_DECODER LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindLibLZMA.cmake:89 (find_package_handle_standard_args)
  /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/lib64/cmake/minizip/minizip-config.cmake:39 (find_dependency)
  src/platform/cmake/FindFeature.cmake:15 (find_package)
  CMakeLists.txt:478 (find_feature)

Command line: cmake -DCMAKE_CONFIG=Release -DUSE_ZLIB=OFF -DUSE_LZMA=OFF ..

Any idea what could be wrong? There's no "liblzma-devel" I could install...

Try lib64lzma-devel?

@HorstBaerbel
Copy link

HorstBaerbel commented Dec 26, 2021

Thanks. Afair it did not show up in dnf for me, but will check again tomorrow...

@endrift
Copy link
Member

endrift commented Dec 26, 2021

Try -DUSE_MINIZIP=OFF, since this looks like that's trying to pull in libLZMA for some reason. mGBA's USE_LZMA uses a version of the LZMA SDK that's bundled so it shouldn't do this.

@HorstBaerbel
Copy link

HorstBaerbel commented Dec 26, 2021

I just checked. lib64lzma-devel is not available via dnf. -DUSE_MINIZIP=OFF leads to:

CMake Error at /usr/lib64/cmake/libzip/libzip-targets.cmake:92 (message):
  The imported target "libzip::zipcmp" references the file

     "/usr/bin/zipcmp"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib64/cmake/libzip/libzip-targets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/lib64/cmake/libzip/libzip-config.cmake:42 (include)
  src/platform/cmake/FindFeature.cmake:15 (find_package)
  CMakeLists.txt:480 (find_feature)

@endrift
Copy link
Member

endrift commented Dec 26, 2021

That's an issue with libzip's CMake packaging. You'll need to install zipcmp and another tool. I don't know what the packages are called on Fedora.

@HorstBaerbel
Copy link

HorstBaerbel commented Dec 26, 2021

Installing "libzip-tools" and -DUSE_MINIZIP=OFF did the trick. Thanks!

@HorstBaerbel
Copy link

HorstBaerbel commented Dec 26, 2021

The SDL2 version seems to work, but the Qt version does not load the .gba or .elf from the command line or the menu

@HorstBaerbel
Copy link

HorstBaerbel commented Dec 26, 2021

If I can help with logs or debugging, tell me, endrift. I'll have some time on and off in the next days...

@HorstBaerbel
Copy link

HorstBaerbel commented Jan 22, 2022

According to my tests (newest git):

  • It starts if "useShareWidget = false;" is set in DisplayGL.cpp:126. A ROM can be loaded, audio plays, but nothing is displayed. Tiles display etc. work ok.
  • It starts if "useShareWidget = true;" is set in DisplayGL.cpp:126. A ROM can be loaded, crackling audio plays, the screen is corrupted with random content. Initially the window title bar is missing. It randomly appears after switching to different tasks/windows. Tiles display etc. work ok.
  • It works fine with "export QT_QPA_PLATFORM=xcb && mgba-qt". The state of the "useShareWidget" flag does not matter.

@HorstBaerbel
Copy link

HorstBaerbel commented Jan 22, 2022

This is with useShareWidget=true

2022-01-22.14-28-30.mp4

@HorstBaerbel
Copy link

HorstBaerbel commented Jan 22, 2022

With useShareWidget=false

2022-01-22.14-31-46.mp4

@endrift
Copy link
Member

endrift commented Jan 23, 2022

Looks like the OpenGL context is swapping, but nothing is being drawn to it for some reason. Hm...

@HorstBaerbel
Copy link

HorstBaerbel commented Feb 16, 2022

I was playing around a bit:

  • When useShareWidget=false and I pause/unpause the emulation the screen the display updates one (still) frame correctly
  • When useShareWidget=false and switching to Qt Software rendering it seems to render correctly for me

@endrift endrift changed the title mgba-qt doesn't work in Fedora 34 mgba-qt doesn't work in Wayland Feb 28, 2022
@endrift endrift added this to the mGBA 0.10.0 milestone Apr 22, 2022
@jsteinaker
Copy link

jsteinaker commented Jun 2, 2022

Looks like the OpenGL context is swapping, but nothing is being drawn to it for some reason. Hm...

Can reproduce it here, on updated Arch Linux, KDE Plasma running on Wayland. If I launch the emulator from a terminal window, it prints the line

QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined

Software (Qt) renderer works perfect and that line doesn't get printed to the terminal, but it's obviously CPU-intensive.

@HorstBaerbel
Copy link

HorstBaerbel commented Jun 2, 2022

When trying to switch the Display driver in settings I also get:

qt.qpa.wayland: Wayland does not support QWindow::requestActivate()

This a fresh Fedora 36 install running Wayland. I think I compiled with out OpenGL support.

@endrift
Copy link
Member

endrift commented Jun 2, 2022

Those warnings are unrelated. I have a solution I'm working on right now.

@HorstBaerbel
Copy link

HorstBaerbel commented Jun 2, 2022

Those warnings are unrelated. I have a solution I'm working on right now.

Cool. Let me if you need help beta-testing etc.

@endrift
Copy link
Member

endrift commented Jun 2, 2022

The branch is at https://github.com/endrift/mgba/tree/fix/wayland. If you're on GNOME, I'd love it tested. On KDE, for some reason, the menu disappears when you start a game. It also breaks macOS, so I need to work on that still.

@HorstBaerbel
Copy link

HorstBaerbel commented Jun 2, 2022

Yes, I'm on GNOME.
Built with:
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_CONFIG=Release -DUSE_LZMA=OFF -DUSE_MINIZIP=OFF ..
Output:

-- The C compiler identification is GNU 12.1.1
-- The CXX compiler identification is GNU 12.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0") 
-- Looking for strdup
-- Looking for strdup - found
-- Looking for strlcpy
-- Looking for strlcpy - not found
-- Looking for strndup
-- Looking for strndup - found
-- Looking for vasprintf
-- Looking for vasprintf - found
-- Looking for freelocale
-- Looking for freelocale - found
-- Looking for newlocale
-- Looking for newlocale - found
-- Looking for setlocale
-- Looking for setlocale - found
-- Looking for snprintf_l
-- Looking for snprintf_l - not found
-- Looking for uselocale
-- Looking for uselocale - found
-- Looking for popcount32
-- Looking for popcount32 - not found
-- Looking for futimens
-- Looking for futimens - found
-- Looking for futimes
-- Looking for futimes - found
-- Looking for localtime_r
-- Looking for localtime_r - found
-- Looking for include file xlocale.h
-- Looking for include file xlocale.h - not found
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Performing Test HAVE_PTHREAD
-- Performing Test HAVE_PTHREAD - Success
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Looking for include file pthread_np.h
-- Looking for include file pthread_np.h - not found
-- Looking for pthread_setname_np
-- Looking for pthread_setname_np - found
-- Looking for pthread_set_name_np
-- Looking for pthread_set_name_np - not found
-- Checking for one of the modules 'libedit'
-- Checking for one of the modules 'libavcodec'
-- Checking for one of the modules 'libavfilter'
-- Checking for one of the modules 'libavformat'
-- Checking for one of the modules 'libavutil'
-- Checking for one of the modules 'libswscale'
-- Checking for one of the modules 'libswresample'
-- Checking for one of the modules 'libzip'
CMake Warning at src/platform/cmake/FindFeature.cmake:91 (message):
  Requested module libzip missing for feature USE_LIBZIP.  Feature disabled.
Call Stack (most recent call first):
  CMakeLists.txt:484 (find_feature)


-- Checking for one of the modules 'epoxy'
CMake Warning at src/platform/cmake/FindFeature.cmake:91 (message):
  Requested module epoxy missing for feature USE_EPOXY.  Feature disabled.
Call Stack (most recent call first):
  CMakeLists.txt:485 (find_feature)


-- Checking for one of the modules 'SQLite3'
-- Checking for one of the modules 'sqlite3'
CMake Warning at src/platform/cmake/FindFeature.cmake:91 (message):
  Requested module SQLite3|sqlite3 missing for feature USE_SQLITE3.  Feature
  disabled.
Call Stack (most recent call first):
  CMakeLists.txt:487 (find_feature)


-- Checking for one of the modules 'libelf'
-- Checking for one of the modules 'Lua'
CMake Warning at src/platform/cmake/FindFeature.cmake:91 (message):
  Requested module Lua missing for feature USE_LUA.  Feature disabled.
Call Stack (most recent call first):
  CMakeLists.txt:743 (find_feature)


-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found SDL2: /usr/lib64/libSDL2.so  
-- Build type: Release
-- Platforms:
-- 	Game Boy Advance: ON
-- 	Game Boy: ON
-- Features:
-- 	Debuggers: ON
-- 	CLI debugger: ON
-- 	GDB stub: ON
-- 	GIF/Video recording: ON
-- 	Screenshot/advanced savestate support: ON
-- 	ZIP support: minizip (included)
-- 	7-Zip support: OFF
-- 	SQLite3 game database: ON
-- 	ELF loading support: ON
-- 	Discord Rich Presence support: ON
-- 	OpenGL support: OpenGL, OpenGL|ES 2, OpenGL|ES 3
-- Scripting support: ON
-- 	Lua: OFF
-- Frontends:
-- 	Qt: ON
-- 	SDL (2): ON
-- 	Python bindings: OFF
-- 	Examples: OFF
-- Test tools:
-- 	Profiling: OFF
-- 	Test harness: OFF
-- 	Test suite: OFF
-- 	Video test suite: OFF
-- 	ROM tester: OFF
-- Cores:
-- 	Libretro core: OFF
-- Libraries:
-- 	Static: OFF
-- 	Shared: ON
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:
    CMAKE_CONFIG

Compiled, ran. Switched to Display driver "OpenGL". Mouse vanished when hovering over mGBA. Restarted, could load a ROM, music plays, but display does not update. When I hover menu bar items I get "qt.qpa.wayland: Wayland does not support QWindow::requestActivate()" in the console. When I try to load new ROM the display gets updated with a single frame from the emulation.

@endrift
Copy link
Member

endrift commented Jun 7, 2022

@HorstBaerbel I've updated the branch. Please try again.

@HorstBaerbel
Copy link

HorstBaerbel commented Jun 7, 2022

Nice. Works fire with OpenGL! I get two

QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined

but else than that it is working fine.

@HorstBaerbel
Copy link

HorstBaerbel commented Jun 7, 2022

Ah, no wait. I had switched to X11... Need to retest...

@HorstBaerbel
Copy link

HorstBaerbel commented Jun 7, 2022

Nope, same problem as before with Gnome / Wayland.

@endrift
Copy link
Member

endrift commented Jun 7, 2022

Dang. That fixed it on KDE/Plasma for me, but it works on GNOME for some reason. What version of mutter is installed?

@HorstBaerbel
Copy link

HorstBaerbel commented Jun 7, 2022

What version of mutter is installed?

mutter.x86_64 42.2-1.fc36

@endrift
Copy link
Member

endrift commented Jun 8, 2022

Hm, are you sure you updated? Running that branch on a fresh Fedora 36 live image on an Intel GPU works, but going back to master doesn't. Can you confirm what commit you're on?

@HorstBaerbel
Copy link

HorstBaerbel commented Jun 8, 2022

On commit "65280a9665e5f24694a060ac6627a5b0748cd845 (HEAD -> fix/wayland)". It's better than before. Sometimes ROMs load and run, sometimes they don't. It's hit-and-miss. I'm running Qt 5.15.3 and and Nvidia GPU with the 510 proprietary driver, so it might also be a driver problem. Will retest with newer driver.

@endrift endrift closed this as completed in ae0c5e9 Jun 8, 2022
@atsen-dev
Copy link

atsen-dev commented Jul 25, 2022

Any update on this issue ?

@endrift
Copy link
Member

endrift commented Jul 25, 2022

It was closed because it was fixed. There hasn't been a release since however.

@atsen-dev
Copy link

atsen-dev commented Jul 25, 2022

OKay, did you know when we'll have a new release ?
Thanks

@endrift
Copy link
Member

endrift commented Jul 25, 2022

Early August hopefully. In the meantime you can use a development build or compile from source.

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

No branches or pull requests

6 participants