Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 929992 - media-libs/mesa: Consider unconditionally enabling gles2
Summary: media-libs/mesa: Consider unconditionally enabling gles2
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-14 08:57 UTC by Mart Raudsepp
Modified: 2024-04-29 11:06 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mart Raudsepp gentoo-dev 2024-04-14 08:57:50 UTC
We don't have any good means to ensure GLES availability from drivers via libglvnd or virtuals. Given that nvidia-drivers just unconditionally provides gles2, it's need is widespread (even strongly preferred over "full" GL in case of e.g. webkit-gtk, mutter, gstreamer-1.24, gtk-4.14+ and more), please consider just unconditionally enabling it.

If not, we need to figure out some way to ensure working GLES2/GLES3 drivers.
Comment 1 Ionen Wolkens gentoo-dev 2024-04-14 09:08:16 UTC
Not super familiar with mesa but seconding this idea, adds no dependencies and don't think many would want to skip this (if really must, could package.use.force rather than drop USE then if someone really need this they could unforce it into an unsupported configuration).

Does need to force opengl as well, but sounds fine.

I also like the idea of preventing the alternate path here:

   if use opengl || use gles1 || use gles2; then
        emesonargs+=(
            -Degl=enabled
            -Dgbm=enabled
            -Dglvnd=true
        )
    else
        emesonargs+=(
            -Degl=disabled
            -Dgbm=disabled
            -Dglvnd=false
        )
    fi

Given currently packages expect mesa to always provide libgbm.so (since USE=gbm is gone), but gbm=disabled can remove it.
Comment 2 Ionen Wolkens gentoo-dev 2024-04-14 09:12:01 UTC
(In reply to Ionen Wolkens from comment #1)
> Does need to force opengl as well, but sounds fine.
Nevermind this bit, was looking at REQUIRED_USE but I missed it's behind "X?". Could stay optional I guess.

REQUIRED_USE="X? ( gles1? ( opengl ) gles2? ( opengl ) )"
Comment 3 Ionen Wolkens gentoo-dev 2024-04-14 09:29:17 UTC
(In reply to Ionen Wolkens from comment #2)
> (In reply to Ionen Wolkens from comment #1)
> > Does need to force opengl as well, but sounds fine.
> Nevermind this bit, was looking at REQUIRED_USE but I missed it's behind
> "X?". Could stay optional I guess.
> 
> REQUIRED_USE="X? ( gles1? ( opengl ) gles2? ( opengl ) )"

Oh wait, it's already forced anyway :) Well, more reasons to be fair for gles2 to be forced too I guess.
Comment 4 Matt Turner gentoo-dev 2024-04-23 17:37:32 UTC
Agreed.

I checked and since we always use libglvnd, media-libs/mesa's IUSE="gles1" and IUSE="gles2" flags add only a trivial increase in file size:

From USE="-gles1 -gles2" to USE="-gles1 gles2":

> ./usr/lib/dri/swrast_dri.so   (mode: -rwxr-xr-x, refs: 5, size: 22949840 → 23003056,   +53216 bytes, +0.23%)
> ./usr/lib64/dri/swrast_dri.so (mode: -rwxr-xr-x, refs: 5, size: 22692872 → 22746152,   +53280 bytes, +0.23%)

And from USE="-gles1 gles2" to USE="gles1 gles2":

> ./usr/lib/dri/swrast_dri.so   (mode: -rwxr-xr-x, refs: 5, size: 23003056 → 23027632,   +24576 bytes, +0.11%)
> ./usr/lib64/dri/swrast_dri.so (mode: -rwxr-xr-x, refs: 5, size: 22746152 → 22758440,   +12288 bytes, +0.05%)

Since ultimately we'll want to be able to disable OpenGL support entirely, I think tying these to IUSE=opengl (which is forced on currently and for the foreseeable future) is the right thing to do.
Comment 5 Larry the Git Cow gentoo-dev 2024-04-25 16:10:12 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=847bd6034a9b3d885de3419a53084595bef9e8ac

commit 847bd6034a9b3d885de3419a53084595bef9e8ac
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2024-04-25 15:27:43 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2024-04-25 16:02:58 +0000

    media-libs/mesa: Control GL ES support via IUSE=opengl
    
    Disabling GL ES support saves only a trivial amount of disk space and
    makes relying on GL ES availability difficult.
    
    Bug: https://bugs.gentoo.org/929992
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 media-libs/mesa/mesa-9999.ebuild | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)
Comment 6 Kostadin Shishmanov 2024-04-26 18:16:42 UTC
I think with this change some ebuilds will need to tweak their dependency on media-libs/mesa a bit, here are just some of them: 

    >=media-libs/mesa-9.1.6[abi_x86_64(-),gles2] required by (media-libs/libsdl2-2.28.5:0/0::gentoo, installed) USE="X custom-cflags dbus gles2 haptic joystick opengl pipewire sound threads udev video vulkan wayland -alsa (-aqua) -doc -fcitx4 -gles1 -ibus -jack -kms -libsamplerate -nas -oss -pulseaudio -sndio -static-libs -test -xscreensaver" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="mmx sse sse2 -3dnow" VIDEO_CARDS="(-vc4)"
                                          ^^^^^ 
    >=media-libs/mesa-9.1.6[abi_x86_64(-),egl(+),gles2,wayland] required by (media-libs/libsdl2-2.28.5:0/0::gentoo, installed) USE="X custom-cflags dbus gles2 haptic joystick opengl pipewire sound threads udev video vulkan wayland -alsa (-aqua) -doc -fcitx4 -gles1 -ibus -jack -kms -libsamplerate -nas -oss -pulseaudio -sndio -static-libs -test -xscreensaver" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="mmx sse sse2 -3dnow" VIDEO_CARDS="(-vc4)"
                                                 ^^^^^         
    >=media-libs/mesa-9.0[egl(+),gles2,wayland,abi_x86_64(-)] required by (media-libs/gst-plugins-base-1.22.11:1.0/1.0::gentoo, installed) USE="X egl gles2 introspection nls ogg opengl orc pango wayland -alsa -gbm -ivorbis -test -theora -vorbis" ABI_X86="(64) -32 (-x32)"
                                 ^^^^^                       
    media-libs/mesa[abi_x86_64(-),egl(+),wayland,X] required by (x11-apps/mesa-progs-8.5.0:0/0::gentoo, installed) USE="X wayland -gles2" ABI_X86="(64) -32 (-x32)"
Comment 7 Ionen Wolkens gentoo-dev 2024-04-26 18:25:17 UTC
Generally speaking, ebuilds shouldn't even depend on mesa unless they link with libgbm.

mesa is just one vendor, and they should at most only want libglvnd and leave the rest up to VIDEO_CARDS and such.
Comment 8 Ionen Wolkens gentoo-dev 2024-04-26 18:30:43 UTC
(In reply to Ionen Wolkens from comment #7)
> Generally speaking, ebuilds shouldn't even depend on mesa unless they link
> with libgbm.
(I say generally given there are some rare exceptions, like xorg-server using some headers only provided by mesa and not libglvnd)
Comment 9 Mike Lothian 2024-04-29 10:42:07 UTC
media-libs/gst-plugins-base
media-plugins/gst-plugins-vaapi

Need fixing
Comment 10 Mike Lothian 2024-04-29 11:03:51 UTC
Adding a (+) to the gles2 flag on the mesa dependency fixes it I think

A quick grep suggests:

dev-debug/apitrace
dev-games/ogre
dev-libs/efl
games-arcade/jazz2
games-engines/scummvm
gui-libs/wlroots
gui-wm/wayfire
gui-wm/sway
gui-wm/hyprland
kde-plasma/kinfocenter
kde-plasma/kwin
mate-base/mate-session-manager
media-libs/cogl
media-libs/libprojectm
media-libs/freeglut
media-libs/gst-plugins-base
media-plugins/gst-plugins-vaapi
media-tv/kodi
sys-apps/kmscon
www-plugins/lightspark
x11-apps/mesa-progs
x11-wm/muffin

Need fixing, it might be easier to revert the change until that can be done
Comment 11 Mike Lothian 2024-04-29 11:05:59 UTC
grep "media-libs/mesa" */*/*.ebuild | grep gles2 | grep -v "gles2(+)" | cut -d/ -f -2 | sort -u
Comment 12 Mike Lothian 2024-04-29 11:06:40 UTC
And these 3 for gles1 which is also in the above list

dev-debug/apitrace
games-engines/scummvm
media-libs/freeglut