OE4T / meta-tegra

BSP layer for NVIDIA Jetson platforms, based on L4T
MIT License
390 stars 219 forks source link

wlroots based Wayland compositor #1209

Open VitaliiBlagodir opened 1 year ago

VitaliiBlagodir commented 1 year ago

Describe the bug The wlroots based Wayland compositor phoc fails to start on the NVIDIA Jetson AGX Xavier.

To Reproduce Steps to reproduce the behavior:

  1. Build meta-tegra branch kirkstone-l4t-r32.7.x commit e5e5f08e640ea3ed67ef72c49304636fe47e9719 with MACHINE=jetson-agx-xavier-devkit
  2. Add phoc_0.25.2.bb phoc_0.25.2.zip
  3. Add CORE_IMAGE_BASE_INSTALL += phoc to demo-image-weston.bb
  4. Build with bitbake argument bitbake demo-image-weston
  5. Flash
  6. Run WLR_BACKENDS=wayland phoc and get an error: undefined symbol: drmIsKMS This error is caused by missing symbol drmIsKMS in NVIDIA version of libdrm.so (libdrm_nvdc.so, installed to rootfs as /usr/lib/tegra/libdrm.so.2)

I removed from phoc source code phoc/subprojects/wlroots/backend/session/session.c (actually from wlroots source code, loaded as git submodule) the following lines

    if (!drmIsKMS(dev->fd)) {
        wlr_log(WLR_DEBUG, "Ignoring '%s': not a KMS device", path);
        wlr_session_close_file(session, dev);
        return NULL;
    }

and rebuilt phoc. After this phoc fails to start with the following error:

(phoc:6399): phoc-wlroots-CRITICAL **: 17:45:59.097: [render/allocator/gbm.c:183] PRIME export not supported

(phoc:6399): phoc-wlroots-CRITICAL **: 17:45:59.101: [render/allocator/allocator.c:134] Failed to create allocator

(phoc:6399): phoc-server-CRITICAL **: 17:45:59.101: Failed to create server: Could not create allocator

Additional context I've noticed multiple patches in meta-tegra/recipes-graphics/wayland for weston to run properly on Jetson.

Is there any change to get support of wlroots based Wayland compositor in meta-tegra?

kekiefer commented 1 year ago

Because with advancements in GBM buffer support it is starting to feel within reach, but we're not there yet. From the GBM side, we have an open alternate provider of tegra-gbm-backend (called tegra-udrm-gbm) which may get you a bit further there, or at least can be modified to make work if needed.

The current impediment is that NVIDIA's libdrm doesn't have a new enough API to support wlroots. It is possible that an older version of wlroots may fare better. Or maybe if you have the patience, you may be able to patch out the things that need the newer API, I don't know how extensive this is.

Edit: I should add that in my investigations here, I was not using phoc but instead sway from meta-wayland, so take this under consideration alongside my comment.

kekiefer commented 1 year ago

Also, it is worth noting that for the best GBM support, you will want to be on one of the current jetpack 5 (35.x) branches.

VitaliiBlagodir commented 1 year ago

@kekiefer Thank you for your input! The meta-wayland layer contains recipes for wlroots, sway, phoc and other wlroots based compositors. It will be helpful for us. Thanks! I don't have time for making wlroots work with NVIDIA's libdrm. Your note for using NVIDIA JetPack 5 sounds reasonable, but we can't switch to it until the OTA update of devices from JetPack 4 to JetPack 5 via Mender is possible.