Skip to content

Add pegasus frontend - #21

Draft
jecaro wants to merge 2 commits into
mainfrom
fe/pegasus
Draft

Add pegasus frontend#21
jecaro wants to merge 2 commits into
mainfrom
fe/pegasus

Conversation

@jecaro

@jecaro jecaro commented Feb 7, 2026

Copy link
Copy Markdown
Owner

Draft PR to trying to make pegasus-frontend work. The configuration builds fine however pegasus fails to starts with:

[root@circuix:/home/pi]# systemctl stop retroarch

[root@circuix:/home/pi]# pegasus-fe
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted                    (core dumped) pegasus-fe

It looks like it works fine on raspbian. Then there is no reason it cannot work on circuix. One needs to dig in the compilation options and the command they use to run it.

@moonbit5

moonbit5 commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Hi Jecaro – yes this is the same error I received when compiling pegasus.

I was made aware of this patch which is for KMS https://github.com/mmatyas/pegasus-frontend/tree/master/etc/rpi4

Although it says rpi4 it might still be relevant for rpi3.

I have tried adding the patch but I'm unable to build, and unsure where I'm going wrong due to my experience with nixos.

I was also told to start pegasus with the following command: export QT_QPA_EGLFS_HIDECURSOR=1 ; pegasus-fe -platform eglfs

@jecaro

jecaro commented Feb 9, 2026

Copy link
Copy Markdown
Owner Author

Indeed it doesn't build. Adding this overlay:

                    (final: prev: {
                      pegasus-frontend = prev.pegasus-frontend.overrideAttrs (old: {
                        patches = [ "${old.src}/etc/rpi4/kms_launch_fix.diff" ];
                      });
                    })

the configuration fails with:

$ nixos-rebuild build --flake .#circuix-320x240
building the system configuration...
warning: Git tree '/home/jcquillet/development/circuix-sword' is dirty
error: Cannot build '/nix/store/w0pd384cci64pvjjaisz9lvh8chxqxv6-pegasus-frontend-0-unstable-2024-11-11.drv'.
       Reason: builder failed with exit code 2.
       Output paths:
         /nix/store/pz5sdcxpa0ish9lkk5ivlmk9nvkrwr98-pegasus-frontend-0-unstable-2024-11-11
       Last 25 log lines:
       > [ 57%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/model/gaming/CollectionListModel.cpp.o
       > [ 57%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/pegasus-backend_autogen/mocs_compilation.cpp.o
       > [ 57%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/model/device/DeviceInfo.cpp.o
       > [ 57%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/ScriptRunner.cpp.o
       > [ 58%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/Log.cpp.o
       > [ 59%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/FrontendLayer.cpp.o
       > [ 59%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/imggen/BlurhashProvider.cpp.o
       > [ 59%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/model/gaming/Collection.cpp.o
       > [ 59%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/parsers/MetaFile.cpp.o
       > [ 59%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/parsers/SettingsFile.cpp.o
       > [ 59%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/model/gaming/Game.cpp.o
       > [ 59%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/model/internal/GamepadAxisNavigation.cpp.o
       > [ 60%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/model/gaming/Assets.cpp.o
       > [ 60%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/PegasusAssets.cpp.o
       > [ 61%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/model/gaming/GameFileListModel.cpp.o
       > [ 60%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/ProcessLauncher.cpp.o
       > [ 61%] Building CXX object src/backend/CMakeFiles/pegasus-backend.dir/model/internal/GamepadButtonNavigation.cpp.o
       > /build/source/src/backend/ProcessLauncher.cpp:38:10: fatal error: private/qeglfsintegration_p.h: No such file or directory
       >    38 | #include <private/qeglfsintegration_p.h>
       >       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       > compilation terminated.
       > make[2]: *** [src/backend/CMakeFiles/pegasus-backend.dir/build.make:184: src/backend/CMakeFiles/pegasus-backend.dir/ProcessLauncher.cpp.o] Error 1
       > make[2]: *** Waiting for unfinished jobs....
       > make[1]: *** [CMakeFiles/Makefile2:1549: src/backend/CMakeFiles/pegasus-backend.dir/all] Error 2
       > make: *** [Makefile:146: all] Error 2
       For full logs, run:
         nix log /nix/store/w0pd384cci64pvjjaisz9lvh8chxqxv6-pegasus-frontend-0-unstable-2024-11-11.drv
error: Cannot build '/nix/store/dy0bvj6r1l83qdjvhf2vpyzfr6lwmcw8-system-path.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/pk7x4dqn3440whm1xb5qk455hi82jypc-system-path
error: Cannot build '/nix/store/4brl0alz9fyjh9qd68ylsy1d3mqm89fk-nixos-system-circuix-sd-card-25.11.20260102.64049ca.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/zp21svm636l3gn29hp2f888hwv1n3sz9-nixos-system-circuix-sd-card-25.11.20260102.64049ca

One private header from Qt is missing. These headers are not supposed to be used by programs AFAIK. That looks like a serious hack.

Now why is it not found? That could be because nix doesn't make them available, or put them in a non standard path. Another idea could be that for some reason, egl support is not included in nixos Qt. In which case one must override the Qt libs derivation to fix that.

@moonbit5

Copy link
Copy Markdown
Contributor

Some information from the pegasus-fe dev here:

That is indeed a private Qt header, and the patch is a hacky workaround, yes. On the Raspberry Pi 4 to launch games I had to access the EGL context, but Qt doesn't provide public interface for it, hence the patch.
I'm not familiar with the platform this repo uses, but the include path should be added by the QMake part of the patch, assuming that your Qt has been build with EGL support. You might want to check where qeglfsintegration_p.h is located in your Qt if yours work differently.

@mmatyas

mmatyas commented Feb 10, 2026

Copy link
Copy Markdown

Hello there! I'm the pegasus-fe dev.

If you're on Pi 3, you might not need this patch at all. It is for the KMS video driver that the Pi 4 used when it came out. Before, the Raspberries used the (I think proprietary) Broadcom driver, which didn't have the window handling issue the patch fixes. It's been a few years though, I think there's like 3 different kinds of video drivers by now; not sure which one is on the device.

Now I'm not familiar with the project, so I'll write in general here. Your issue is qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found., however, Available platform plugins are: ... xcb ...
This means that:

  • You've built or trying to run Pegasus on top of X11 (which is fine if that's what the device uses)
  • Your Qt does have the X11 platform plugin installed
  • But it cannot be dynamically loaded for some reason

This usually happens when the dependencies, like X11 shared libraries are missing (or you're not running an X11 program on top of X11). You can find the necessary dependencies here: https://doc.qt.io/archives/qt-5.15/linux-requirements.html. You can also export QT_DEBUG_PLUGINS=1 to show more errors, or see which dependencies are missing with ldd /path/to/xcbplugin.so (on desktop, typically located at /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so).

@jecaro

jecaro commented Feb 11, 2026

Copy link
Copy Markdown
Owner Author

Thanks for the details @mmatyas

This is the output I get trying to start pegasus with the command suggested by @moonbit5

[pi@circuix:~]$ pegasus-fe -platform eglfs
libEGL warning: failed to get driver name for fd -1

libEGL warning: MESA-LOADER: failed to retrieve device information

libEGL warning: failed to get driver name for fd -1

EGL library doesn't support Emulator extensions
Aborted                    (core dumped) pegasus-fe -platform eglfs

We don't run X11. We use the KMS driver, so it is likely that we need this patch as well. Now why that header is not found? This is what we need to find out. Looking at the output with export QT_DEBUG_PLUGINS=1, I can see that Qt is built with egl support tho

Found metadata in lib /nix/store/dqphmfcp3js95nj5wwpnj4ff5h0vwbdm-qtbase-5.15.18-bin/lib/qt-5.15.18/plugins/egldeviceintegrations/libqeglfs-emu-integration.so, metadata=
{
    "IID": "org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5",
    "MetaData": {
        "Keys": [
            "eglfs_emu"
        ]
    },
    "archreq": 0,
    "className": "QEglFSEmulatorIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("eglfs_emu")
QFactoryLoader::QFactoryLoader() looking at "/nix/store/dqphmfcp3js95nj5wwpnj4ff5h0vwbdm-qtbase-5.15.18-bin/lib/qt-5.15.18/plugins/egldeviceintegrations/libqeglfs-kms-egldevice-integration.so"
Found metadata in lib /nix/store/dqphmfcp3js95nj5wwpnj4ff5h0vwbdm-qtbase-5.15.18-bin/lib/qt-5.15.18/plugins/egldeviceintegrations/libqeglfs-kms-egldevice-integration.so, metadata=
{
    "IID": "org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5",
    "MetaData": {
        "Keys": [
            "eglfs_kms_egldevice"
        ]
    },
    "archreq": 0,
    "className": "QEglFSKmsEglDeviceIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("eglfs_kms_egldevice")
QFactoryLoader::QFactoryLoader() looking at "/nix/store/dqphmfcp3js95nj5wwpnj4ff5h0vwbdm-qtbase-5.15.18-bin/lib/qt-5.15.18/plugins/egldeviceintegrations/libqeglfs-x11-integration.so"
Found metadata in lib /nix/store/dqphmfcp3js95nj5wwpnj4ff5h0vwbdm-qtbase-5.15.18-bin/lib/qt-5.15.18/plugins/egldeviceintegrations/libqeglfs-x11-integration.so, metadata=
{
    "IID": "org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5",
    "MetaData": {
        "Keys": [
            "eglfs_x11"
        ]
    },
    "archreq": 0,
    "className": "QEglFSX11IntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("eglfs_x11")
QFactoryLoader::QFactoryLoader() checking directory path "/nix/store/v79aaya7nja1bs6idnw99ngbl37yksmc-pegasus-frontend-0-unstable-2024-11-11/bin/egldeviceintegrations" ...
loaded library "/nix/store/dqphmfcp3js95nj5wwpnj4ff5h0vwbdm-qtbase-5.15.18-bin/lib/qt-5.15.18/plugins/egldeviceintegrations/libqeglfs-emu-integration.so"
libEGL warning: failed to get driver name for fd -1

libEGL warning: MESA-LOADER: failed to retrieve device information

libEGL warning: failed to get driver name for fd -1

EGL library doesn't support Emulator extensions
Aborted                    (core dumped) pegasus-fe -platform eglfs

@jecaro

jecaro commented Feb 12, 2026

Copy link
Copy Markdown
Owner Author

Ok. I have patched pegasus-frontend to make it find that lost header. It does not build on CI tho because it takes too much space, and I didn't bother to push the result to the cache.

Anyway, it still crashes with a similar error.

Looking at the logs, I can see our version of Qt has those three EGL extensions: eglfs_x11 , eglfs_kms_egldevice, and eglfs_emu. Unfortunatly for what I read online, we need eglfs_kms which is not compiled in the Qt version we use 😞

So we're left with those two options:

  • add the right overlay to Qt to make it build the required extension
  • run X11

I still think it would be a shame to run X11, because the emulators run fine with KMS, and KMS is much lighter. But that could be tried anyway for a quick way to evaluate how usable the frontend is on our device.

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

Successfully merging this pull request may close these issues.

3 participants