meta-raspberrypi icon indicating copy to clipboard operation
meta-raspberrypi copied to clipboard

mesa: update to 24.3.1

Open BassemMohsen opened this issue 1 year ago • 16 comments

Update to latest mesa 24.3.1 release Fixes DRAM DSI linking to missing library drm-rp1-dsi_dri.so

fixes #1389

  • Added new dependencies required by msea version update.
  • Removed DRI3 option as it's now removed from meson build options.

This PR will be completed when 24.3.1 is final official release. For now, I'm leaving it as work of progress to help whoever have issues with RPI5 DSI.

BassemMohsen avatar Nov 17 '24 15:11 BassemMohsen

Official mesa 24.3.0 is released, bbappend is updated with official release.

This looks promising too, but let's not live too much on the edge 🗡️ I will wait for 2025.

https://www.phoronix.com/news/Linux-6.13-Big-Super-RPi-V3D

BassemMohsen avatar Nov 22 '24 12:11 BassemMohsen

Is this work supposed to end up in oe-core?

PS: Nice work!

agherzan avatar Dec 04 '24 21:12 agherzan

Is this work supposed to end up in oe-core?

PS: Nice work!

Eventually Poky would update mesa, not sure which future version that will be.

Right now, DSI on RPI 5 with mesa from styhead with version 24.0.7 is unusable. As mentioned in the issue linked, Mesa Loader is hardcoded to try to load drm-rp1-dsi_dri.so which doesn't exist anywhere as userland library, it fails and uses software rendering fallback softpipe instead.

So, let's say this PR can live to help anyone wants to use DSI with RP1 chip on RaspberryPi 5

drm-rp1-dsi_dri.so exists in Raspbian os, I have no clue where did Raspbian os obtain such blob. One could port that blob but it's much dirtier and harder to satisfy drm-rp1-dsi_dri.so dependencies from Raspbian OS, different version for LLVM, libc .. etc

BassemMohsen avatar Dec 05 '24 09:12 BassemMohsen

Seems build have failed due to running a test test_security: But I can't really see that test function in Poky Styhead with the hash: 8ce494b9cf84e769ac72b201838c76fd2ff894c9

BassemMohsen avatar Dec 06 '24 09:12 BassemMohsen

Seems build have failed due to running a test test_security: But I can't really see that test function in Poky Styhead with the hash: 8ce494b9cf84e769ac72b201838c76fd2ff894c9

I see, RPI CI tests are ran against Poky master branch, not Styhead.

BassemMohsen avatar Dec 06 '24 09:12 BassemMohsen

The failing test is due to new requirement added in Poky on the whole layer to have SECURITY.md file, it's not related to my recipe updates though:

        Test that the layer has a SECURITY.md (or similar) file, either in the
        layer itself or at the top of the containing git repository.

https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository

Perhaps that's something for meta-raspberrypi maintainer to do

BassemMohsen avatar Dec 06 '24 09:12 BassemMohsen

Thank you so much for posting this! This got hardware acceleration for Weston on RPi5 w/ the official 7" display over DSI working. I'm currently on master/main for all other upstream layers (poky, meta-rpi, etc) and had to make a couple tweaks.

  • The Wayland Protocol recipe isn't needed on main as upstream Poky has gone to 1.38 already
  • I had to make a couple tweaks to the mesa bbappend. This is all likely a moot point as we are really just waiting for upstream to go to mesa 2.3.0 when it releases, but until then this is super helpful.
    • I made some tweaks to the removal of the dri3 package config option
    • the mesa-megadriver seems to make a ton of symlinks for different old libs to one new consolidated one. I'm not sure when this happened, but you need to skip dev-so to allow library symlinks in that package.
PACKAGECONFIG:append:rpi = " gallium gallium-llvm vc4 v3d ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11', '', d)} ${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'vulkan broadcom', '', d)}"
DRIDRIVERS:class-target:rpi = ""

# Remove unused patches
SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
           file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
"

SRC_URI[sha256sum] = "97813fe65028ef21b4d4e54164563059e8408d8fee3489a2323468d198bf2efc"
PV = "24.3.0"

# -Dglvnd is deprecated from true/false to enabled/disabled
PACKAGECONFIG[glvnd] = "-Dglvnd=enabled, -Dglvnd=disabled, libglvnd"

# DRI3 note:
# DRI3 Build option is removed from meson.
PACKAGECONFIG:remove = "dri3"
unset PACKAGECONFIG[dri3]

DEPENDS += " wayland-protocols llvm python3-pyyaml python3-pyyaml-native"

RDEPENDS:libgl-mesa += " llvm wayland-protocols"

FILES:libgbm += " ${libdir}/gbm/dri_gbm*.so"

FILES:libgl-mesa += " ${libdir}/libgallium*.so"

FILES:libgbm-dev += " ${includedir}/gbm.h"

DEPENDS += "libxshmfence"

# mesa-megadriver uses symlinks for compatibility
INSANE_SKIP:mesa-megadriver += "dev-so"

lifeisafractal avatar Dec 10 '24 02:12 lifeisafractal

Thank you so much for posting this! This got hardware acceleration for Weston on RPi5 w/ the official 7" display over DSI working. I'm currently on master/main for all other upstream layers (poky, meta-rpi, etc) and had to make a couple tweaks.

  • The Wayland Protocol recipe isn't needed on main as upstream Poky has gone to 1.38 already

  • I had to make a couple tweaks to the mesa bbappend. This is all likely a moot point as we are really just waiting for upstream to go to mesa 2.3.0 when it releases, but until then this is super helpful.

    • I made some tweaks to the removal of the dri3 package config option
    • the mesa-megadriver seems to make a ton of symlinks for different old libs to one new consolidated one. I'm not sure when this happened, but you need to skip dev-so to allow library symlinks in that package.
PACKAGECONFIG:append:rpi = " gallium gallium-llvm vc4 v3d ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11', '', d)} ${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'vulkan broadcom', '', d)}"
DRIDRIVERS:class-target:rpi = ""

# Remove unused patches
SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
           file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
"

SRC_URI[sha256sum] = "97813fe65028ef21b4d4e54164563059e8408d8fee3489a2323468d198bf2efc"
PV = "24.3.0"

# -Dglvnd is deprecated from true/false to enabled/disabled
PACKAGECONFIG[glvnd] = "-Dglvnd=enabled, -Dglvnd=disabled, libglvnd"

# DRI3 note:
# DRI3 Build option is removed from meson.
PACKAGECONFIG:remove = "dri3"
unset PACKAGECONFIG[dri3]

DEPENDS += " wayland-protocols llvm python3-pyyaml python3-pyyaml-native"

RDEPENDS:libgl-mesa += " llvm wayland-protocols"

FILES:libgbm += " ${libdir}/gbm/dri_gbm*.so"

FILES:libgl-mesa += " ${libdir}/libgallium*.so"

FILES:libgbm-dev += " ${includedir}/gbm.h"

DEPENDS += "libxshmfence"

# mesa-megadriver uses symlinks for compatibility
INSANE_SKIP:mesa-megadriver += "dev-so"

Thanks @lifeisafractal , I'm glad you found this helpful.

I was building against styhead, that's why I needed the wayland protocol receipe bump. I could remove it and bump mesa to 24.3.1 since it's also released with some bug fixes.

Thanks for posting changes, I will adopt your changes in the main PR next week.

I see you added a new build time depends. DEPENDS += "libxshmfence" Why is this required if you are building for wayland/weston and not x11?

BassemMohsen avatar Dec 10 '24 10:12 BassemMohsen

I could remove it and bump mesa to 24.3.1 since it's also released with some bug fixes.

Thanks for the heads up on 24.3.1. I'll bump to that in my local layer to be on a released version.

I see you added a new build time depends. DEPENDS += "libxshmfence" Why is this required if you are building for wayland/weston and not x11?

That was originally brought in as a dependency through the dri3 packageconfig setup, which was removed. To be honest, I'm not sure why it was required in the build, I was getting a meson build config error on it missing, so I added it. I didn't dig any deeper once I got things building. If I look deeper into it and find anything I'll report back here.

lifeisafractal avatar Dec 10 '24 14:12 lifeisafractal

@BassemMohsen your patch applies clearly on Scarthgap and works fine. I've tested in today. Congrats again for the great work!

Do you plan to open a GitHub pull request for branch scarthgap? I need this and if you don't have the time I will be happy to open it for you.

leon-anavi avatar Dec 10 '24 16:12 leon-anavi

@BassemMohsen your patch applies clearly on Scarthgap and works fine. I've tested in today. Congrats again for the great work!

Do you plan to open a GitHub pull request for branch scarthgap? I need this and if you don't have the time I will be happy to open it for you.

A bit busy with some CES demos this week.

Sure, I will open a new PR for Scarthgap this Saturday. also update the PR with all the comments and to the new minor mesa release 24.3.1

can also base it on top of PR #1391 that adds SECURITY.md file, so it passes all the CI checks.

BassemMohsen avatar Dec 12 '24 12:12 BassemMohsen

Pumped mesa to latest and greatest. Rebased on latest master branch to fix CI check for SECURITY.md

BassemMohsen avatar Dec 14 '24 14:12 BassemMohsen

@agherzan, @kraj, the checks are failing because of older Python version on the build machine:

RuntimeError: Sorry, python 3.9.0 or later is required for this version of bitbake

Could you please have a look? This is unrelated to the particular change in meta-raspberrypi but it is blocking the auto-merge (rebase).

leon-anavi avatar Apr 14 '25 08:04 leon-anavi

@agherzan, @kraj, the checks are failing because of older Python version on the build machine:

RuntimeError: Sorry, python 3.9.0 or later is required for this version of bitbake

Could you please have a look? This is unrelated to the particular change in meta-raspberrypi but it is blocking the auto-merge (rebase).

Hey Leon

You are right, I will rebase both pull requests this week.

BassemMohsen avatar Apr 14 '25 08:04 BassemMohsen

@agherzan, @kraj, the checks are failing because of older Python version on the build machine:

RuntimeError: Sorry, python 3.9.0 or later is required for this version of bitbake

Could you please have a look? This is unrelated to the particular change in meta-raspberrypi but it is blocking the auto-merge (rebase).

Hey Leon

You are right, I will rebase both pull requests this week.

The issue is not caused by your pull request. Yocto release 5.2 (walnascar) requires Ubuntu 22.04 (LTS) and later. But the dockerfile for the GitHub workflow in meta-raspberrypi branch master is still based on Ubuntu 20.04: https://github.com/agherzan/meta-raspberrypi/blob/master/.github/workflows/docker-images/yocto-builder/Dockerfile#L5

leon-anavi avatar Apr 14 '25 08:04 leon-anavi

I opened a GitHub pull request to upgrade the Dockerfile from Ubuntu 20.04 to 22.04 because it is compatible with the Yocto Project release Walnascar and provides a newer Python version: https://github.com/agherzan/meta-raspberrypi/pull/1458

leon-anavi avatar Apr 14 '25 14:04 leon-anavi

@BassemMohsen your patch applies clearly on Scarthgap and works fine. I've tested in today. Congrats again for the great work!

Do you plan to open a GitHub pull request for branch scarthgap? I need this and if you don't have the time I will be happy to open it for you.

@leon-anavi Hi, I had a question when I try to compile for scarthgap I get this error: | ../mesa-24.2.8/meson.build:861:12: ERROR: Dependency "libclc" not found, tried pkgconfig and cmake

do I need to include any packages or meta-clang or something?

crl-manoj avatar Jul 15 '25 22:07 crl-manoj

@BassemMohsen your patch applies clearly on Scarthgap and works fine. I've tested in today. Congrats again for the great work! Do you plan to open a GitHub pull request for branch scarthgap? I need this and if you don't have the time I will be happy to open it for you.

@leon-anavi Hi, I had a question when I try to compile for scarthgap I get this error: | ../mesa-24.2.8/meson.build:861:12: ERROR: Dependency "libclc" not found, tried pkgconfig and cmake

do I need to include any packages or meta-clang or something?

This PR is picking activity now, I can try to build it and test it tomorrow.

To answer your question, documentation says, you can compile mesa with GCC, "or" clang https://docs.mesa3d.org/install.html#compiler

There's new mesa version also, perhaps we can jump to latest and greatest directly if there's an interest?

https://docs.mesa3d.org/relnotes/25.1.6.html

BassemMohsen avatar Jul 17 '25 08:07 BassemMohsen

Hi @BassemMohsen,

@BassemMohsen your patch applies clearly on Scarthgap and works fine. I've tested in today. Congrats again for the great work! Do you plan to open a GitHub pull request for branch scarthgap? I need this and if you don't have the time I will be happy to open it for you.

@leon-anavi Hi, I had a question when I try to compile for scarthgap I get this error: | ../mesa-24.2.8/meson.build:861:12: ERROR: Dependency "libclc" not found, tried pkgconfig and cmake do I need to include any packages or meta-clang or something?

This PR is picking activity now, I can try to build it and test it tomorrow.

To answer your question, documentation says, you can compile mesa with GCC, "or" clang https://docs.mesa3d.org/install.html#compiler

There's new mesa version also, perhaps we can jump to latest and greatest directly if there's an interest?

https://docs.mesa3d.org/relnotes/25.1.6.html

I've picked up your work and updated Mesa to 25.1.3 and opened another PR for Scarthgap. Here is the GitHub pull request: https://github.com/agherzan/meta-raspberrypi/pull/1484

There is a single failing test that I need to fix and to get it merged.

Best regards, Leon

leon-anavi avatar Jul 17 '25 08:07 leon-anavi

@BassemMohsen @leon-anavi Thanks for the great work. I am trying to integrate the mesa 24.3.1 to scarthgap build. Will keep posted. (hoping that it works after adding meta-clang layer)

My build info for Compute Module 5

Build Configuration: BB_VERSION = "2.8.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "aarch64-poky-linux" DISTRO_VERSION = "5.0.11" TUNE_FEATURES = "aarch64 crypto cortexa76" TARGET_FPU = "" meta-clang = "scarthgap:aef850f7fa53121c74b244b7ae40d31fb9809ccf"

crl-manoj avatar Jul 17 '25 11:07 crl-manoj

@crl-manoj keep us updated, and let me know if you need support.

BassemMohsen avatar Jul 17 '25 12:07 BassemMohsen

@BassemMohsen merged through different PR, please check and close this one.

shr-project avatar Aug 12 '25 16:08 shr-project

Sure, Thanks for help and support !

BassemMohsen avatar Aug 13 '25 10:08 BassemMohsen