YoeDistro / yoe-distro

Embedded Linux distribution optimized for product development (based on OE/Yocto)
MIT License
193 stars 45 forks source link

raspberrypi4-64 : mesa-gl build fails with profile "yoe-glibc-systemd-eglfs" #637

Open daniel-dnil opened 2 years ago

daniel-dnil commented 2 years ago

First of all, compliments on the Yocto/OE setup done here. I think the design goals and how you've setup the build enviroment makes a lot of sense.

Been testing some different setups using a raspberrypi4-64 target, default settings works fine and I can build and boot a yoe-qt5-image. On master branch @ tag: 2021.12, I swapped from the default YOE_PROFILE = "yoe-glibc-systemd-wayland" to YOE_PROFILE = "yoe-glibc-systemd-eglfs" and attempting to build a new yoe-qt5-image, this results in a build failure in mesa-gl:

| FAILED: src/gbm/libgbm.so.1.0.0.p/main_backend.c.o
| aarch64-yoe-linux-clang -target aarch64-yoe-linux -mcpu=cortex-a72 -march=armv8-a+crc -mlittle-endian -Qunused-arguments -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/srv/scratch/yoe/build/tmp/work/cortexa72-yoe-linux/mesa-gl/2_21.3.1-r0/recipe-sysroot -Isrc/gbm/libgbm.so.1.0.0.p -Isrc/gbm -I../mesa-21.3.1/src/gbm -I../mesa-21.3.1/src/gbm/main -Iinclude -I../mesa-21.3.1/include -Isrc -I../mesa-21.3.1/src -Isrc/loader -I../mesa-21.3.1/src/loader -Isrc/util -I../mesa-21.3.1/src/util -I../mesa-21.3.1/src/gallium/include -fvisibility=hidden -fcolor-diagnostics -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -O0 -ffunction-sections -fdata-sections -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="21.3.1"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"' -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DUSE_XSHM -DHAVE_DRM_PLATFORM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE___BUILTIN_TYPES_COMPATIBLE_P -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_UINT128 -D_GNU_SOURCE -DUSE_GCC_ATOMIC_BUILTINS -DUSE_AARCH64_ASM -DMAJOR_IN_SYSMACROS -DHAS_SCHED_H -DHAS_SCHED_GETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_SYS_SHM_H -DHAVE_CET_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_GETRANDOM -DHAVE_QSORT_R -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_COMPRESSION -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DMESA_EXECMEM -DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_XLIB_XRANDR_EXT -DVK_USE_PLATFORM_DISPLAY_KHR -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=empty-body -Werror=incompatible-pointer-types -Werror=int-conversion -Wimplicit-fallthrough -Wno-missing-field-initializers -fno-math-errno -fno-trapping-math -Qunused-arguments -fno-common -Werror=format -Wformat-security -Werror=thread-safety -Wno-microsoft-enum-value -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/srv/scratch/yoe/build/tmp/work/cortexa72-yoe-linux/mesa-gl/2_21.3.1-r0=/usr/src/debug/mesa-gl/2_21.3.1-r0 -fdebug-prefix-map=/srv/scratch/yoe/build/tmp/work/cortexa72-yoe-linux/mesa-gl/2_21.3.1-r0=/usr/src/debug/mesa-gl/2_21.3.1-r0 -fdebug-prefix-map=/srv/scratch/yoe/build/tmp/work/cortexa72-yoe-linux/mesa-gl/2_21.3.1-r0/recipe-sysroot= -fdebug-prefix-map=/srv/scratch/yoe/build/tmp/work/cortexa72-yoe-linux/mesa-gl/2_21.3.1-r0/recipe-sysroot-native= -fno-omit-frame-pointer -fPIC -pthread '-DDEFAULT_BACKENDS_PATH="/usr/lib/gbm"' -MD -MQ src/gbm/libgbm.so.1.0.0.p/main_backend.c.o -MF src/gbm/libgbm.so.1.0.0.p/main_backend.c.o.d -o src/gbm/libgbm.so.1.0.0.p/main_backend.c.o -c ../mesa-21.3.1/src/gbm/main/backend.c
| In file included from ../mesa-21.3.1/src/gbm/main/backend.c:37:
| /srv/scratch/yoe/build/tmp/work/cortexa72-yoe-linux/mesa-gl/2_21.3.1-r0/recipe-sysroot/usr/include/xf86drm.h:40:10: fatal error: 'drm.h' file not found
| #include <drm.h>
|          ^~~~~~~
| 1 error generated.

I'm not quite sure why this is, there seems to be two copies of drm.h when building mesa-gl but none of them included in the search path of the compiler;

work/cortexa72-yoe-linux/mesa-gl/2_21.3.1-r0/recipe-sysroot/usr/include/drm/drm.h
work/cortexa72-yoe-linux/mesa-gl/2_21.3.1-r0/recipe-sysroot/usr/include/libdrm/drm.h

The source of this seems to be that in sources/meta-yoe/conf/distro/eglfs.inc the VC4 graphics are disabled and userland graphics are used instead;

# Use bcm userland graphics driver
DISABLE_VC4GRAPHICS = "1"

This then further changes the provider of libgl to mesa-gl instead of mesa in sources/meta-raspberrypi/conf/machine/include/rpi-default-providers.inc. If I comment out the DISABLE_VC4GRAPHICS = "1" in eglfs.inc the yoe-qt5-image image builds again since now mesa is used instead of mesa-gl again. Image also appears to work, at least the Qt demo apps works using -platform eglfs.

Not quite sure how this these mesa, mesa-gl, userland VC4 modules are supposed to work together so I'm at a loss of the proper fix here?

kraj commented 2 years ago

@daniel-dnil I think choice to use userland graphics for eglf case is not a hard requirement. So perhaps we should patch eglfs.inc to remove DISABLE_VC4GRAPHICS = "1" and use mesa graphics instead for eglfs case as well.