Bug 254450

Summary: devel/efl: use EGL as default backend (not OpenGL)
Product: Ports & Packages Reporter: Tomasz "CeDeROM" CEDRO <tomek>
Component: Individual Port(s)Assignee: freebsd-enlightenment (Nobody) <enlightenment>
Status: Closed FIXED    
Severity: Affects Some People CC: enlightenment, jbeich, peter, tomek
Priority: --- Flags: bugzilla: maintainer-feedback? (enlightenment)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Set OpenGL ES as default option in place of OpenGL. none

Description Tomasz "CeDeROM" CEDRO 2021-03-21 04:28:02 UTC
Hello world :-)

When trying to fix meson build for EFL / Enlightenment in order to make it work with Wayland it turned out that EGL should be used by default not the OpenGL [1].

If anyone have spare moment please verify on local build and update the port. If noone has free moment I will create a patch :-)

EGL works for me, maybe even better than OpenGL, and the project assumption is to use EGL by default. It also fixes some fullscreen issues on my desktop.

Thanks :-)
Tomek

[1] https://phab.enlightenment.org/D12217
Comment 1 Tomasz "CeDeROM" CEDRO 2021-03-21 04:30:15 UTC
My main concern before sending the patch is to verify if EGL works for you folks with no problem :-) Please verify in a free moment.. just a simple `make config` switch and rebuild/reinstall :-) Thanks :-)
Comment 2 Tomasz "CeDeROM" CEDRO 2022-01-11 13:34:34 UTC
Created attachment 230904 [details]
Set OpenGL ES as default option in place of OpenGL.

OpenGL ES is preferred backend by the upstream (in place of OpenGL). It also fixes screen hang on Enlightenment start when running on AMDGPU.
Comment 3 Tomasz "CeDeROM" CEDRO 2022-01-11 13:37:35 UTC
Please review and apply above patch that sets OpenGL ES as the default build option of the EFL port on FreeBSD (this is also preferred backend by the upstream). I have to rebuild it by hand on every EFL port update as OpenGL hangs screen on Enlightenment start when running on AMDGPU and that renders E/EFL unusable here (it does not occur on Intel DRM). Thanks :-)
Comment 4 Peter TKATCHENKO 2022-01-16 14:18:12 UTC
The actual ports version of EFL is outdated.
Please, check if the problem with OpenGL is still present on AMD using the last EFL version, and if EGL is still working correctly.
I'll consider the modification of backend for the next update of the EFL port.
Comment 5 Tomasz "CeDeROM" CEDRO 2022-01-16 14:41:05 UTC
I think EGL should be set as default.

Short story of EGL backend: EGL is portable works everywhere and is also base for Wayland/DRM/FB implementation, full OpenGL was aimed at GLX->X11 and seems to be artifact to be removed in future.

As stated by raster  on Jan 18 2021, 12:03 PM [1]

because our full opengl code was written with glx as the display system binding/abstraction. drm/wayland are not x. they don't have glx. egl is a portable binding that works across all of these. our gles code was written with egl as the binding as there is no glx one for it and thus is portable. if gl-es had been universal at the time when i wrote the gl and gles support.. i'd have just gone for egl + gles to save work and time and effort. it was not. egl+gles was universal on embedded systems. full opengl never existed universally there. glx+full opengl was universal on x11 desktops/laptops etc. - if they had any gl support. over time this changed. some embedded systems now can run a full gl implementation and ALL desktops/laptops now can also support egl+gles. so egl+gles is the universal "works everywhere" combination - works in x11, wayland and directly to drm/fb. i'd actually like to get rid of the glx/full gl code just to have less to maintain now as it's basically a historical artifact.

https://phab.enlightenment.org/D12217
Comment 6 Tomasz "CeDeROM" CEDRO 2022-01-16 14:46:21 UTC
You need to click "Show Older Changes" at https://phab.enlightenment.org/D12217 to see the full discussion.

Basically Wayland version of EGL can now build on FreeBSD. We need some parts of (Linux only) SystemD called eLoginD https://github.com/elogind/elogind that is supposed to be portable.
Comment 7 Tomasz "CeDeROM" CEDRO 2022-01-16 14:50:51 UTC
Quick fix to the current even outdated port is to simply switch backend to EGL. That will prevent breaking my AMDGPU system on pkg upgrade. Please consider.

New EFL will need some more work. Simple replacement of package release does not build. Some patches needs to be introduced and provided to the upstream. Details below.

# make
===>  License BSD2CLAUSE LGPL21 accepted by the user
===>   efl-1.26.1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by efl-1.26.1 for building
===>  Extracting for efl-1.26.1
=> SHA256 Checksum OK for enlightenment/efl-1.26.1.tar.xz.
===>  Patching for efl-1.26.1
===>  Applying FreeBSD patches for efl-1.26.1 from /usr/ports/devel/efl/files
===>   efl-1.26.1 depends on executable: checkmk - found
===>   efl-1.26.1 depends on executable: luajit - found
===>   efl-1.26.1 depends on file: /usr/local/include/linux/videodev2.h - found
===>   efl-1.26.1 depends on executable: msgfmt - found
===>   efl-1.26.1 depends on package: libiconv>=1.14_11 - found
===>   efl-1.26.1 depends on package: meson>=0.57.1_1 - found
===>   efl-1.26.1 depends on executable: ninja - found
===>   efl-1.26.1 depends on package: pkgconf>=1.3.0_1 - found
===>   efl-1.26.1 depends on file: /usr/local/bin/python3.8 - found
===>   efl-1.26.1 depends on executable: update-mime-database - found
===>   efl-1.26.1 depends on package: gstreamer1-plugins-core>=1.4 - found
===>   efl-1.26.1 depends on package: gstreamer1-plugins>=1.4 - found
===>   efl-1.26.1 depends on package: xorgproto>=0 - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xcb.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xcursor.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xcomposite.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xdamage.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xext.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xfixes.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xi.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xinerama.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xrandr.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xrender.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xtst.pc - found
===>   efl-1.26.1 depends on file: /usr/local/libdata/pkgconfig/xscrnsaver.pc - found
===>   efl-1.26.1 depends on shared library: libgif.so - found (/usr/local/lib/libgif.so)
===>   efl-1.26.1 depends on shared library: libpng.so - found (/usr/local/lib/libpng.so)
===>   efl-1.26.1 depends on shared library: libtiff.so - found (/usr/local/lib/libtiff.so)
===>   efl-1.26.1 depends on shared library: libfreetype.so - found (/usr/local/lib/libfreetype.so)
===>   efl-1.26.1 depends on shared library: libfontconfig.so - found (/usr/local/lib/libfontconfig.so)
===>   efl-1.26.1 depends on shared library: libdbus-1.so - found (/usr/local/lib/libdbus-1.so)
===>   efl-1.26.1 depends on shared library: libcurl.so - found (/usr/local/lib/libcurl.so)
===>   efl-1.26.1 depends on shared library: libsndfile.so - found (/usr/local/lib/libsndfile.so)
===>   efl-1.26.1 depends on shared library: libfribidi.so - found (/usr/local/lib/libfribidi.so)
===>   efl-1.26.1 depends on shared library: libharfbuzz.so - found (/usr/local/lib/libharfbuzz.so)
===>   efl-1.26.1 depends on shared library: libopenjp2.so - found (/usr/local/lib/libopenjp2.so)
===>   efl-1.26.1 depends on shared library: libpoppler.so - found (/usr/local/lib/libpoppler.so)
===>   efl-1.26.1 depends on shared library: libspectre.so - found (/usr/local/lib/libspectre.so)
===>   efl-1.26.1 depends on shared library: libpulse.so - found (/usr/local/lib/libpulse.so)
===>   efl-1.26.1 depends on shared library: libraw.so - found (/usr/local/lib/libraw.so)
===>   efl-1.26.1 depends on shared library: libscim-1.0.so - found (/usr/local/lib/libscim-1.0.so)
===>   efl-1.26.1 depends on shared library: libwebp.so - found (/usr/local/lib/libwebp.so)
===>   efl-1.26.1 depends on shared library: libunwind.so - found (/usr/local/lib/libunwind.so)
===>   efl-1.26.1 depends on shared library: libcairo.so - found (/usr/local/lib/libcairo.so)
===>   efl-1.26.1 depends on shared library: libgdk_pixbuf-2.0.so - found (/usr/local/lib/libgdk_pixbuf-2.0.so)
===>   efl-1.26.1 depends on shared library: libglib-2.0.so - found (/usr/local/lib/libglib-2.0.so)
===>   efl-1.26.1 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
===>   efl-1.26.1 depends on shared library: librsvg-2.so - found (/usr/local/lib/librsvg-2.so)
===>   efl-1.26.1 depends on shared library: libpango-1.0.so - found (/usr/local/lib/libpango-1.0.so)
===>   efl-1.26.1 depends on shared library: libjpeg.so - found (/usr/local/lib/libjpeg.so)
===>   efl-1.26.1 depends on shared library: libintl.so - found (/usr/local/lib/libintl.so)
===>   efl-1.26.1 depends on shared library: libGL.so - found (/usr/local/lib/libGL.so)
===>   efl-1.26.1 depends on shared library: libgstreamer-1.0.so - found (/usr/local/lib/libgstreamer-1.0.so)
===>  Configuring for efl-1.26.1
The Meson build system
Version: 0.60.3
Source dir: /usr/ports/devel/efl/work/efl-1.26.1
Build dir: /usr/ports/devel/efl/work/efl-1.26.1/_build
Build type: native build
Project name: efl
Project version: 1.26.1
C compiler for the host machine: cc (clang 11.0.1 "FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)")
C linker for the host machine: cc ld.lld 11.0.1
C++ compiler for the host machine: c++ (clang 11.0.1 "FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)")
C++ linker for the host machine: c++ ld.lld 11.0.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -fvisibility=hidden: YES
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Wfloat-compare: NO
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wunused-parameter: YES
Compiler for C supports arguments -Wsign-compare: YES
Compiler for C supports arguments -Wno-missing-field-initializers: YES
meson.build:90: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
meson.build:91: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
Program env found: YES (/usr/bin/env)
Checking if "environ check" : compiles: NO
Message: x86 build - MMX + SSE3 enabled
Has header "immintrin.h" : YES
Checking if "open works with O_CLOEXEC" : compiles: YES
Checking if "strerror_r() returns char *" : compiles: NO
Library m found: YES
Library dl found: YES
Library rt found: YES
Run-time dependency threads found: YES
Has header "alloca.h" : NO
Has header "asm/hwcap.h" : NO
Has header "bsd/string.h" : NO
Has header "dirent.h" : YES
Has header "execinfo.h" : YES
Has header "mcheck.h" : NO
Has header "netinet/in.h" : YES
Has header "netinet/ssl.h" : NO
Has header "netinet/tcp.h" : YES
Has header "netinet/udp.h" : YES
Has header "net/if.h" : YES
Has header "stdlib.h" : YES
Has header "sys/auxv.h" : YES
Has header "sys/inotify.h" : YES
Has header "sys/ioctl.h" : YES
Has header "sys/mman.h" : YES
Has header "sys/types.h" : YES
Has header "sys/socket.h" : YES
Has header "sys/filio.h" : YES
Has header "arpa/inet.h" : YES
Has header "sys/epoll.h" : NO
Has header "sys/un.h" : YES
Has header "sys/wait.h" : YES
Has header "sys/resource.h" : YES
Has header "sys/times.h" : YES
Has header "longinfo.h" : NO
Has header "ieeefp.h" : YES
Has header "sys/timerfd.h" : NO
Has header "features.h" : NO
Has header "langinfo.h" : YES
Has header "locale.h" : YES
Has header "crt_externs.h" : NO
Has header "pthread.h" : YES
Header <alloca.h> has symbol "alloca" : NO
Header <execinfo.h> has symbol "backtrace" : YES
Header <execinfo.h> has symbol "backtrace_symbols" : YES
Header <unistd.h> has symbol "chown" : YES
Header <time.h> has symbol "clock_gettime" : YES
Header <dirent.h sys/types.h> has symbol "dirfd" : NO
Header <sys/stat.h> has symbol "fchmod" : YES
Header <fcntl.h> has symbol "fcntl" : YES
Header <unistd.h> has symbol "fork" : YES
Header <unistd.h> has symbol "fpathconf" : YES
Header <unistd.h> has symbol "geteuid" : YES
Header <unistd.h> has symbol "getpagesize" : YES
Header <sys/types.h> has symbol "getpwent" : NO
Header <pwd.h> has symbol "getpwent" : YES
Header <unistd.h> has symbol "getuid" : YES
Header <sys/types.h> has symbol "getxattr" : NO
Header <sys/xattr.h> has symbol "getxattr" : NO
Header <iconv.h> has symbol "iconv" : YES
Header <sys/types.h> has symbol "listxattr" : NO
Header <sys/xattr.h> has symbol "listxattr" : NO
Header <malloc.h> has symbol "malloc_info" : NO
Header <malloc.h> has symbol "malloc_usable_size" : YES
Header <sys/stat.h> has symbol "mkdirat" : YES
Header <sys/mman.h> has symbol "mmap" : YES
Header <mcheck.h> has symbol "mtrace" : NO
Header <sys/prctl.h> has symbol "prctl" : NO
Header <sys/procctl.h> has symbol "procctl" : YES
Header <stdlib.h> has symbol "realpath" : YES
Header <sys/types.h> has symbol "setxattr" : NO
Header <sys/xattr.h> has symbol "setxattr" : NO
Header <setjmp.h> has symbol "siglongjmp" : YES
Header <string.h> has symbol "strerror_r" : YES
Header <sys/time.h> has symbol "gettimeofday" : YES
Header <unistd.h> has symbol "execvp" : YES
Header <unistd.h> has symbol "pause" : YES
Header <math.h> has symbol "isfinite" : YES
Header <signal.h> has symbol "siginfo_t" : YES
Header <pthread.h> has symbol "pthread_getcpuclockid" : YES
Header <time.h> has symbol "pthread_getcpuclockid" : NO
Header <sys/timerfd.h> has symbol "timerfd_create" : NO
Header <sys/types.h> has symbol "kevent" : NO
Header <sys/event.h> has symbol "kevent" : YES
Header <sys/time.h> has symbol "kevent" : NO
Library dl found: YES
Header <dlfcn.h> has symbol "dlopen" with dependency -ldl: YES
Library dl found: YES
Header <dlfcn.h> has symbol "dlsym" with dependency -ldl: YES
Library m found: YES
Header <math.h> has symbol "lround" with dependency -lm: YES
Library malloc found: NO
Header <malloc.h> has symbol "mallinfo2" : NO
Library malloc found: NO
Header <malloc.h> has symbol "mallinfo" : NO
Library rt found: YES
Header <sys/mman.h> has symbol "shm_open" with dependency -lrt: YES
Header <sys/stat.h> has symbol "shm_open" with dependency -lrt: NO
Header <fcntl.h> has symbol "shm_open" with dependency -lrt: NO
Header <fcntl.h> has symbol "splice" : NO
Header <sched.h> has symbol "sched_getcpu" : NO
Library dl found: YES
Header <dlfcn.h> has symbol "dladdr" with dependency -ldl: YES
Header <sys/stat.h> has symbol "fstatat" : YES
Header <regex.h> has symbol "regcomp" : YES
Found pkg-config: /usr/local/bin/pkgconf (1.8.0)
Run-time dependency libjpeg found: YES 2.1.2
Checking for size of "int" : 4
Checking for size of "long" : 8
Library intl found: YES
Run-time dependency luajit found: YES 2.0.5
Header <pthread.h> has symbol "pthread_barrier_init" : YES
Header <pthread_np.h> has symbol "pthread_set_name_np" : YES
Header <pthread_np.h> has symbol "pthread_attr_setaffinity_np" : YES
Checking for size of "wchar_t" : 4
Checking for size of "uintptr_t" : 8
Has header "dirent.h" : YES (cached)
Header <alloca.h> has symbol "alloca" : NO (cached)
Has header "byteswap.h" : NO
Header <pthread.h> has symbol "pthread_spin_init" : YES
Configuring eina_config.h using configuration
Run-time dependency libunwind-generic found: YES 1.5.0
Run-time dependency iconv found: YES
Library execinfo found: YES
Run-time dependency zlib found: YES 1.2.11
Run-time dependency dbus-1 found: YES 1.12.20
Run-time dependency sndfile found: YES 1.0.31
Run-time dependency libpulse found: YES 14.2
Message: ecore_avahi disabled!
Message: eeze disabled!
Run-time dependency x11 found: YES 1.7.2
Run-time dependency xcb found: YES 1.14
Run-time dependency x11-xcb found: YES 1.7.2
Library Xcomposite found: YES
Library Xdamage found: YES
Library Xext found: YES
Library Xfixes found: YES
Library Xinerama found: YES
Library Xrandr found: YES
Library Xrender found: YES
Library Xtst found: YES
Library Xss found: YES
Library Xi found: YES
Library Xi found: YES
Header <X11/XKBlib.h> has symbol "XkbSetDetectableAutoRepeat" with dependencies x11, xcb: YES
Library Xcursor found: YES
Header <X11/Xcursor/Xcursor.h> has symbol "XcursorSupportsARGB" with dependencies x11, xcb: YES
Message: ecore_fb disabled!
Message: ecore_wl2 disabled!
Message: ecore_sdl disabled!
Message: ecore_buffer disabled!

src/lib/elput/meson.build:1:0: ERROR: Unknown variable "eeze".

A full log can be found at /usr/ports/devel/efl/work/efl-1.26.1/_build/meson-logs/meson-log.txt
===>  Script "configure" failed unexpectedly.
Please report the problem to enlightenment@FreeBSD.org [maintainer] and attach
the "/usr/ports/devel/efl/work/efl-1.26.1/_build/meson-logs/meson-log.txt"
including the output of the failure of your make command. Also, it might be
a good idea to provide an overview of all packages installed on your system
(e.g. a /usr/local/sbin/pkg-static info -g -Ea).
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/efl
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/efl
Comment 8 Peter TKATCHENKO 2022-01-16 15:38:36 UTC
The current EFL from git is building correctly on my CI host using 12.2 and 13.0 versions of FreeBSD. I use upstream-provided default configuration options from confs/freebsd.sh.
Unfortunately, there are some (minor) run-time problems with the last release of Enlightenment, so I'm waiting for fixes upstream before updating all ports at the same time. Probably, some fixes are not trivial, so we'll need to wait a little bit (I don't think it is *BSD-specific problems).
Do you think we really need to update the existing port, so all EFL users will need to update the package? As for me, I think it is not necessary. In general, it's OK for me to change the default backend during the next port update (even if the current version works correctly for me on NVIDIA and Intel GPU).
Comment 9 Tomasz "CeDeROM" CEDRO 2022-01-16 17:03:59 UTC
I have switched from laptop to desktop with AMDGPU. It took me some time to get into this EGL solution. If you could please build and run current port with no problem on nVidia then this switch would save amdgpu desktops right now and have EGL testing base already in place before Wayland works proceeds here on FreeBSD :-)

Also I had to lock efl because of these different options. That implies some dependency issues with libeio.

I can live for some time with that temporary setup (as I do with other things) but when solution is that simple and solves the problem right away we may give it a try :-)

I am working on some important project at work right now and already depleted free time to a workstation migration. But around february/march I should have more free time and I may get back to E+EGL+Wayland subject.. and I have more powerful machine than laptop with intel drm :-)
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-01-23 17:37:37 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=175b2222de51eb0e67f384342170f1da453f0b84

commit 175b2222de51eb0e67f384342170f1da453f0b84
Author:     Tomasz "CeDeROM" CEDRO <tomek@cedro.info>
AuthorDate: 2022-01-23 15:04:03 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2022-01-23 17:37:07 +0000

    devel/efl: Switch OPENGL default value to OPENGLES.

    This is what upstream recommends.

    PR:             254450

 devel/efl/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 11 Tomasz "CeDeROM" CEDRO 2022-01-23 18:11:08 UTC
TANK U SIR! =)