mne-qt-browser icon indicating copy to clipboard operation
mne-qt-browser copied to clipboard

Some operations are extremely slow on Wayland

Open cbrnr opened this issue 3 months ago • 6 comments

Description of the problem

Some operations like dragging the rectangle in the overview bar or dragging a scrollbar indicator are extremely slow on Linux. Everything else behaves normally, for example clicking anywhere in the overview bar or in the scrollbar is instantaneous. Navigating with the arrow keys (up/down, left/right) is also snappy.

Steps to reproduce

Open the browser and drag the rectangle in the overview bar. Or drag a scrollbar indicator.

Expected results

There shouldn't be any performance issues. I've tried this on macOS, and it works normally.

Actual results

On my Linux system (using Wayland), these operations are extremely slow, to the point that I get a popup dialog with "python3 is not responding".

Additional information

Installing pyopengl has no effect.

Platform             Linux-6.15.9-arch1-1-x86_64-with-glibc2.42
Python               3.13.3 (main, Apr  9 2025, 04:03:52) [Clang 20.1.0 ]
Executable           /home/clemens/Projects/mne-qt-browser/.venv/bin/python
CPU                  AMD Ryzen 7 5800X 8-Core Processor (16 cores)
Memory               15.5 GiB

Core
├☑ mne               1.10.0 (latest release)
├☑ numpy             2.3.2 (unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl'))
├☑ scipy             1.16.1
└☑ matplotlib        3.10.5 (backend=qtagg)

Numerical (optional)
└☐ unavailable       sklearn, numba, nibabel, nilearn, dipy, openmeeg, cupy, pandas, h5io, h5py

Visualization (optional)
Fontconfig warning: using without calling FcInit()
├☑ qtpy              2.4.3 (PySide6=6.9.0)
├☑ pyqtgraph         0.13.7
├☑ mne-qt-browser    0.8.0.dev32+g62c9fe1
└☐ unavailable       pyvista, pyvistaqt, vtk, ipympl, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
└☐ unavailable       mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv

cbrnr avatar Aug 08 '25 16:08 cbrnr

I would have expected the problem to be lack of pyopengl. After you installed it, do you see the message "using pyopengl" in the terminal when the plot window launches? (i.e., are we certain that it's actually getting used?)

drammock avatar Aug 08 '25 16:08 drammock

No, I don't see anything. Should there be a message?

Using qt as 2D backend.
Fontconfig warning: using without calling FcInit()
qt.core.qobject.connect: QObject::connect(QStyleHints, QStyleHints): unique connections require a pointer to member function of a QObject subclass
Free RAM could not be determined because "psutil" is not installed. Setting precompute to False.

cbrnr avatar Aug 08 '25 20:08 cbrnr

No, I don't see anything. Should there be a message?

I see this:

In [3]: raw.plot()
Using qt as 2D backend.
Using pyopengl with version 3.1.9
Out[3]: <mne_qt_browser._pg_figure.MNEQtBrowser at 0x7d31026a0550>

drammock avatar Aug 08 '25 20:08 drammock

Free RAM could not be determined because "psutil" is not installed. Setting precompute to False

this is probably why you weren't seeing z-score as an option for overview mode here: https://github.com/mne-tools/mne-qt-browser/pull/343#issuecomment-3135236296

drammock avatar Aug 08 '25 20:08 drammock

No idea why I'm not seeing this, but I don't think pyopengl should be necessary in the first place. You only need it if you want to directly draw with OpenGL, but that's not the case for Qt. Can you try if it makes a difference if you uninstall it?

I have a very recent MESA graphics driver for my AMD GPU installed, so 2D/3D acceleration is definitely working.

Also, I'm using Wayland and not X11, maybe this makes a difference?

And yes, installing psutil enables the z-score option!

cbrnr avatar Aug 09 '25 08:08 cbrnr

Update: Indeed, Wayland is the culprit (as usual I'm almost inclined to say). If I fall back to X11 via export QT_QPA_PLATFORM=xcb, everything works as expected. If you want to try Wayland, you can export QT_QPA_PLATFORM=wayland instead.

cbrnr avatar Aug 09 '25 08:08 cbrnr