Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 692206 (use-libglvnd) - [TRACKER] Enabling USE=libglvnd
Summary: [TRACKER] Enabling USE=libglvnd
Status: RESOLVED FIXED
Alias: use-libglvnd
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal enhancement with 4 votes (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard: Status: https://bugs.gentoo.org/69220...
Keywords: Tracker
Depends on: 606924 692168 692170 692208 692210 692212 695650 695652 697972 698168 698736 699054 702132 711560
Blocks:
  Show dependency tree
 
Reported: 2019-08-15 10:41 UTC by Maik
Modified: 2020-10-27 05:54 UTC (History)
18 users (show)

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


Attachments
Patch against cogl-1.22.2.ebuild removing test useflag. (cogl-1.22.2.ebuild-remove-test.patch,2.70 KB, patch)
2019-09-03 12:21 UTC, Maik
Details | Diff
194.patch (194.patch,6.97 KB, patch)
2019-11-30 10:46 UTC, Rick Harris
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maik 2019-08-15 10:41:11 UTC
I'm creating this bug entry to keep track of those ebuilds having fixed dependency on eselect-opengl so need changes to be able to switch to libglvnd systemwide.
Comment 1 sunmoon1997 2019-08-21 14:31:26 UTC
I have a personal overlay doing exactly this which works for me. 

My setup:
$ lspci -v | grep -i 'VGA'
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Desktop 9 Series) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller: NVIDIA Corporation TU104 [GeForce RTX 2070 SUPER] (rev a1) (prog-if 00 [VGA controller])

$ cat /etc/X11/xorg.conf.d/01-nvidia-offload.conf 
Section "ServerLayout"
    Identifier "layout"
    Option "AllowNVIDIAGPUScreens"
EndSection

$ glxinfo | grep -E 'OpenGL (vendor|renderer)'
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8 GT2) 

$ __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo  | grep -i nvidia
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
OpenGL core profile version string: 4.6.0 NVIDIA 435.17
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL version string: 4.6.0 NVIDIA 435.17
OpenGL shading language version string: 4.60 NVIDIA
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 435.17

This is really an *amazing* moment! 

Many thanks to Arfrever Frehtes Taifersar Arahesis for sharing this.
Comment 2 sunmoon1997 2019-08-21 14:37:40 UTC
Sorry, I meant Maik in previous comment.:)
Comment 3 Christian Xia 2019-08-22 04:02:56 UTC
(In reply to sunmoon1997 from comment #1)
> I have a personal overlay doing exactly this which works for me. 
> 
> My setup:
> $ lspci -v | grep -i 'VGA'
> 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630
> (Desktop 9 Series) (prog-if 00 [VGA controller])
> 01:00.0 VGA compatible controller: NVIDIA Corporation TU104 [GeForce RTX
> 2070 SUPER] (rev a1) (prog-if 00 [VGA controller])
> 
> $ cat /etc/X11/xorg.conf.d/01-nvidia-offload.conf 
> Section "ServerLayout"
>     Identifier "layout"
>     Option "AllowNVIDIAGPUScreens"
> EndSection
> 
> $ glxinfo | grep -E 'OpenGL (vendor|renderer)'
> OpenGL vendor string: Intel Open Source Technology Center
> OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 630 (Coffeelake 3x8
> GT2) 
> 
> $ __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
> __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo  | grep -i nvidia
> server glx vendor string: NVIDIA Corporation
> client glx vendor string: NVIDIA Corporation
> OpenGL vendor string: NVIDIA Corporation
> OpenGL core profile version string: 4.6.0 NVIDIA 435.17
> OpenGL core profile shading language version string: 4.60 NVIDIA
> OpenGL version string: 4.6.0 NVIDIA 435.17
> OpenGL shading language version string: 4.60 NVIDIA
> OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 435.17
> 
> This is really an *amazing* moment! 
> 
> Many thanks to Arfrever Frehtes Taifersar Arahesis for sharing this.

Hello, could you share your personal overlay for this?

I tried to modify some related ebuilds, but I failed to get them work due to conflicts between app-eselect/eselect-opengl and media-libs/mesa.
Comment 4 sunmoon1997 2019-08-22 13:14:14 UTC
(In reply to Christian Xia from comment #3)
> (In reply to sunmoon1997 from comment #1)
...
> 
> Hello, could you share your personal overlay for this?
> 
> I tried to modify some related ebuilds, but I failed to get them work due to
> conflicts between app-eselect/eselect-opengl and media-libs/mesa.

Here is my personal repo[1]. I also added a step by step guide for enabling libglvnd for nvidia-drivers and xorg-server.

[1]: https://github.com/LuoJinghua/gentoo-overlay
Comment 5 Christian Xia 2019-08-22 15:42:39 UTC
(In reply to sunmoon1997 from comment #4)
> (In reply to Christian Xia from comment #3)
> > (In reply to sunmoon1997 from comment #1)
> ...
> > 
> > Hello, could you share your personal overlay for this?
> > 
> > I tried to modify some related ebuilds, but I failed to get them work due to
> > conflicts between app-eselect/eselect-opengl and media-libs/mesa.
> 
> Here is my personal repo[1]. I also added a step by step guide for enabling
> libglvnd for nvidia-drivers and xorg-server.
> 
> [1]: https://github.com/LuoJinghua/gentoo-overlay

Works like a charm! Thank you for your help :)

BTW, you've missed to submit some xorg-server-1.21 related patches to x11-base/xorg-server-1.20.5.

Fortunately, I've found these missing patches from xorg-server source repo commits.
Comment 6 Maik 2019-09-03 12:21:26 UTC
Created attachment 588884 [details, diff]
Patch against cogl-1.22.2.ebuild removing test useflag.

I've taken a deeper look at the ebuild and this seems quite absurd. It has dependencies to mesa[classic] and eselect-opengl when USE="test" but tests are disabled anyway with RESTRICT=test because those always fail(ed). Moreover, it uses
LIBGL_DRIVERS_PATH="${EROOT}/usr/$(get_libdir)/mesa", looks like some leftover from ancient times. At least I wouldn't know how that path could be used nowadays.
Conclusion: tests doesn't work anyway, is unmaintained, so just remove it. Attaching a patch doing so.
Comment 7 Maik 2019-09-03 12:22:11 UTC
Sorry wrong bug.
Comment 8 Marek Bartosiewicz 2019-09-10 09:03:33 UTC
@sunmoon1997
Could you update your overlay for nvidia-drivers-435.21?
Comment 9 Maik 2019-09-10 09:07:22 UTC
x11-drivers/nvidia-drivers-435.21 from official portage already contains the patch.
See bug #692170
Comment 10 Marek Bartosiewicz 2019-09-10 10:13:30 UTC
I'm not sure why, but I also needed to reemerge libepoxy before xorg-server.
Comment 11 Marek Bartosiewicz 2019-09-10 10:50:45 UTC
Seems to be working, can't confirm 100% as I'm logged in remotely right now. This is Dell Precision 5510:

[     4.391] (II) modeset(0): glamor X acceleration enabled on Mesa DRI Intel(R) HD Graphics P530 (Skylake GT2)
[     4.391] (II) modeset(0): glamor initialized
[     4.392] (II) modeset(0): Output eDP-1 has no monitor section
[     4.392] (II) modeset(0): Output DP-1 has no monitor section
[     4.396] (II) modeset(0): Output HDMI-1 has no monitor section
[     4.396] (II) modeset(0): Output DP-2 has no monitor section
[     4.400] (II) modeset(0): Output HDMI-2 has no monitor section
[     4.401] (II) modeset(0): EDID for output eDP-1
[     4.401] (II) modeset(0): Manufacturer: SHP  Model: 143e  Serial#: 0
[     4.401] (II) modeset(0): Year: 2015  Week: 40
[     4.401] (II) modeset(0): EDID Version: 1.4
[     4.401] (II) modeset(0): Digital Display Input
[     4.401] (II) modeset(0): 8 bits per channel
[     4.401] (II) modeset(0): Digital interface is DisplayPort
[     4.401] (II) modeset(0): Max Image Size [cm]: horiz.: 35  vert.: 19
[     4.401] (II) modeset(0): Gamma: 2.20
[     4.401] (II) modeset(0): No DPMS capabilities specified
[     4.401] (II) modeset(0): Supported color encodings: RGB 4:4:4 YCrCb 4:4:4
[     4.401] (II) modeset(0): Default color space is primary color space
[     4.401] (II) modeset(0): First detailed timing is preferred mode
[     4.401] (II) modeset(0): Preferred mode is native pixel format and refresh rate
...
[     4.410] (==) NVIDIA(G0): Depth 24, (==) framebuffer bpp 32
[     4.410] (==) NVIDIA(G0): RGB weight 888
[     4.410] (==) NVIDIA(G0): Default visual is TrueColor
[     4.410] (==) NVIDIA(G0): Using gamma correction (1.0, 1.0, 1.0)
[     4.410] (**) Option "AllowNVIDIAGpuScreens"
[     4.411] (**) NVIDIA(G0): Enabling 2D acceleration
[     4.411] (II) Loading sub module "glxserver_nvidia"
[     4.411] (II) LoadModule: "glxserver_nvidia"
[     4.411] (II) Loading /usr/lib64/xorg/modules/extensions/libglxserver_nvidia.so
[     4.454] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[     4.454]    compiled for 1.6.99.901, module version = 1.0.0
[     4.454]    Module class: X.Org Server Extension
[     4.454] (II) NVIDIA GLX Module  435.21  Sun Aug 25 08:14:27 CDT 2019
[     4.454] (II) NVIDIA: The X server supports PRIME Render Offload.
[     4.456] (II) NVIDIA(G0): NVIDIA GPU Quadro M1000M (GM107GL-A) at PCI:1:0:0 (GPU-0)
[     4.456] (--) NVIDIA(G0): Memory: 2097152 kBytes
[     4.456] (--) NVIDIA(G0): VideoBIOS: 82.07.82.00.29
[     4.456] (II) NVIDIA(G0): Detected PCI Express Link width: 16X
[     4.456] (II) NVIDIA(G0): Validated MetaModes:
[     4.456] (II) NVIDIA(G0):     "NULL"
[     4.456] (**) NVIDIA(G0): Virtual screen size configured to be 3840 x 2160
[     4.456] (WW) NVIDIA(G0): Unable to get display device for DPI computation.
[     4.456] (==) NVIDIA(G0): DPI set to (75, 75); computed from built-in default
[     4.456] (II) NVIDIA: Using 6144.00 MB of virtual memory for indirect memory
[     4.456] (II) NVIDIA:     access.
[     4.487] (II) NVIDIA(G0): Setting mode "NULL"
[     4.491] (==) NVIDIA(G0): Disabling shared memory pixmaps
[     4.491] (==) NVIDIA(G0): Backing store enabled
[     4.491] (==) NVIDIA(G0): Silken mouse enabled
[     4.491] (==) NVIDIA(G0): DPMS enabled
[     4.491] (II) Loading sub module "dri2"
[     4.491] (II) LoadModule: "dri2"
[     4.491] (II) Module "dri2" already built-in
[     4.491] (II) NVIDIA(G0): [DRI2] Setup complete
[     4.491] (II) NVIDIA(G0): [DRI2]   VDPAU driver: nvidia
[     4.494] (==) modeset(0): Backing store enabled
[     4.494] (==) modeset(0): Silken mouse enabled
[     4.555] (II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
[     4.555] (==) modeset(0): DPMS enabled
[     4.556] (II) modeset(0): [DRI2] Setup complete
[     4.556] (II) modeset(0): [DRI2]   DRI driver: i965
[     4.556] (II) modeset(0): [DRI2]   VDPAU driver: i965
[     4.556] (II) Initializing extension Generic Event Extension
[     4.556] (II) Initializing extension SHAPE
[     4.556] (II) Initializing extension MIT-SHM
[     4.556] (II) Initializing extension XInputExtension
[     4.556] (II) Initializing extension XTEST
[     4.556] (II) Initializing extension BIG-REQUESTS
[     4.556] (II) Initializing extension SYNC
[     4.556] (II) Initializing extension XKEYBOARD
[     4.556] (II) Initializing extension XC-MISC
[     4.556] (II) Initializing extension XFIXES
[     4.556] (II) Initializing extension RENDER
[     4.556] (II) Initializing extension RANDR
[     4.556] (II) Initializing extension COMPOSITE
[     4.556] (II) Initializing extension DAMAGE
[     4.556] (II) Initializing extension MIT-SCREEN-SAVER
[     4.556] (II) Initializing extension DOUBLE-BUFFER
[     4.556] (II) Initializing extension RECORD
[     4.556] (II) Initializing extension DPMS
[     4.556] (II) Initializing extension Present
[     4.556] (II) Initializing extension DRI3
[     4.556] (II) Initializing extension X-Resource
[     4.556] (II) Initializing extension XVideo
[     4.556] (II) Initializing extension XVideo-MotionCompensation
[     4.556] (II) Initializing extension GLX
[     4.557] (II) Initializing extension GLX
[     4.557] (II) Indirect GLX disabled.
[     4.570] (II) AIGLX: Loaded and initialized i965
[     4.570] (II) GLX: Initialized DRI2 GL provider for screen 0
[     4.570] (II) Initializing extension XFree86-VidModeExtension
[     4.570] (II) Initializing extension XFree86-DGA
[     4.570] (II) Initializing extension XFree86-DRI
[     4.570] (II) Initializing extension DRI2
[     4.570] (II) Initializing extension NV-GLX
[     4.570] (II) Initializing extension NV-CONTROL
[     4.576] (II) modeset(0): Damage tracking initialized
[     4.576] (II) modeset(0): Setting screen physical size to 1016 x 571
Comment 12 Marek Bartosiewicz 2019-09-10 11:13:31 UTC
Also, is this caused by libglvnd and eselect-opengl removal?

Emerging (3 of 11) dev-python/pycairo-1.18.1::gentoo
 * pycairo-1.18.1.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                                                  [ ok ]
>>> Unpacking source...
>>> Unpacking pycairo-1.18.1.tar.gz to /var/tmp/portage/dev-python/pycairo-1.18.1/work
>>> Source unpacked in /var/tmp/portage/dev-python/pycairo-1.18.1/work
>>> Preparing source in /var/tmp/portage/dev-python/pycairo-1.18.1/work/pycairo-1.18.1 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-python/pycairo-1.18.1/work/pycairo-1.18.1 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-python/pycairo-1.18.1/work/pycairo-1.18.1 ...
 * python2_7: running distutils-r1_run_phase distutils-r1_python_compile
python2.7 setup.py build
running build
running build_py
creating /var/tmp/portage/dev-python/pycairo-1.18.1/work/pycairo-1.18.1-python2_7/lib/cairo
copying cairo/__init__.py -> /var/tmp/portage/dev-python/pycairo-1.18.1/work/pycairo-1.18.1-python2_7/lib/cairo
copying cairo/__init__.pyi -> /var/tmp/portage/dev-python/pycairo-1.18.1/work/pycairo-1.18.1-python2_7/lib/cairo
copying cairo/py.typed -> /var/tmp/portage/dev-python/pycairo-1.18.1/work/pycairo-1.18.1-python2_7/lib/cairo
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
Package egl was not found in the pkg-config search path.
Perhaps you should add the directory containing `egl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'egl', required by 'cairo', not found
Command '['pkg-config', '--cflags-only-I', 'cairo']' returned non-zero exit status 1
Comment 13 Maik 2019-09-10 12:04:46 UTC
Might be. Like mentioned in https://bugs.gentoo.org/606924#c20 the mesa maintainers are currently soting out the pkgconfig files.
I'm on stable, so I have mesa-19.0.8 which provides the pkconfig files for egl etc. Might be subject to change and incomplete if you're on unstable.
Comment 14 Marek Bartosiewicz 2019-09-10 12:13:30 UTC
Yeah, I also had to reemerge cairo. It wasn't picked up by revdep-rebuild for some reason.
Comment 15 Maik 2019-09-10 12:16:08 UTC
Rather odd, I didn't have to reemerge anything. Did you switch gcc version recently?
Comment 16 Marek Bartosiewicz 2019-09-10 12:23:28 UTC
Nope, this is a new install with gcc-9.2.
@world was rebuild completely before I started to emerge xorg and nvidia-drivers. Had to do this in stages, because changing USE flags.
Comment 17 Marek Bartosiewicz 2019-09-11 08:27:45 UTC
Another configure failure:

Checking for libarchive wrapper for reading zip files and more    : yes
Checking for SDL2                                                 : yes
Checking for OSS                                                  : disabled
Checking for RSound audio output                                  : disabled
Checking for sndio audio input/output                             : disabled
Checking for PulseAudio audio output                              : yes
Checking for JACK audio output                                    : disabled
Checking for OpenAL audio output                                  : yes
Checking for OpenSL ES audio output                               : disabled
Checking for ALSA audio output                                    : yes
Checking for CoreAudio audio output                               : disabled
Checking for AudioUnit output for iOS                             : no
Checking for WASAPI audio output                                  : os-win32 not found
Checking for Cocoa                                                : disabled
Checking for DRM                                                  : yes
Checking for DRM Prime ffmpeg support                             : yes
Checking for GBM                                                  : disabled
Checking for wayland-scanner                                      : disabled
Checking for wayland-protocols                                    : disabled
Checking for Wayland                                              : disabled
Checking for X11                                                  : yes
Checking for Xv video output                                      : yes
Checking for OpenGL Cocoa Backend                                 : disabled
Checking for OpenGL X11 Backend                                   : yes
Checking for OpenGL X11 EGL Backend                               : no ('egl' not found)
You manually enabled the feature 'egl-x11', but the autodetection check failed.
 * ERROR: media-video/mpv-0.29.1-r1::gentoo failed (configure phase):
 *   configure failed
 *
 * Call stack:
 *     ebuild.sh, line  125:  Called src_configure
 *   environment, line 4201:  Called waf-utils_src_configure '--confdir=/etc/mpv' '--docdir=/usr/share/doc/mpv-0.29.1-r1' '--htmldir=/usr/share/doc/mpv-0.29.1-r1/html' '--disable-libmpv-shared' '--disable-libmpv-static' '--disable-static-build' '--disable-optimize' '--disable-debug-build' '--enable-html-build' '--disable-pdf-build' '--disable-cplugins' '--disable-zsh-comp' '--disable-test' '--disable-android' '--enable-iconv' '--disable-libsmbclient' '--enable-lua' '--disable-javascript' '--enable-libass' '--enable-libass-osd' '--enable-zlib' '--enable-libbluray' '--enable-dvdread' '--enable-dvdnav' '--disable-cdda' '--enable-uchardet' '--disable-rubberband' '--disable-lcms2' '--disable-vapoursynth' '--disable-vapoursynth-lazy' '--enable-libarchive' '--enable-libavdevice' '--enable-sdl2' '--disable-oss-audio' '--disable-rsound' '--disable-sndio' '--enable-pulse' '--disable-jack' '--enable-openal' '--disable-opensles' '--enable-alsa' '--disable-coreaudio' '--disable-cocoa' '--enable-drm' '--disable-gbm' '--disable-wayland-scanner' '--disable-wayland-protocols' '--disable-wayland' '--enable-x11' '--enable-xv' '--disable-gl-cocoa' '--enable-gl-x11' '--enable-egl-x11' '--disable-egl-drm' '--disable-gl-wayland' '--enable-vdpau' '--enable-vdpau-gl-x11' '--enable-vaapi' '--enable-vaapi-x11' '--disable-vaapi-wayland' '--disable-vaapi-drm' '--disable-caca' '--enable-jpeg' '--enable-shaderc' '--disable-rpi' '--disable-plain-gl' '--disable-mali-fbdev' '--enable-vulkan' '--disable-cuda-hwaccel' '--disable-tv' '--disable-tv-v4l2' '--disable-libv4l2' '--disable-audio-input' '--disable-dvbin' '--disable-apple-remote' '--enable-vaapi-glx' '--enable-vaapi-x-egl' '--disable-build-date'
 *   environment, line 5158:  Called die
 * The specific snippet of code:
 *       env "${CMD[@]}" || die "configure failed"
 *
 * If you need support, post the output of `emerge --info '=media-video/mpv-0.29.1-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-video/mpv-0.29.1-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-video/mpv-0.29.1-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-video/mpv-0.29.1-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1'
 * S: '/var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1'
Comment 18 Marek Bartosiewicz 2019-09-11 08:30:41 UTC
Checking for OpenGL X11 Backend
==>
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <stddef.h>

int main(int argc, char *argv[]) {
  glXCreateContext(NULL, NULL, NULL, True);
  glXQueryExtensionsString(NULL, 0);
  glXGetProcAddressARB("");
  glXGetCurrentDisplay();
  return 0;
}

<==
[1/2] Compiling build/.conf_check_8669a28b591d91ad04fdcd46293a7f95/test.c

['x86_64-pc-linux-gnu-gcc', '-O2', '-pipe', '-march=native', '-ftree-vectorize', '-D_ISOC99_SOURCE', '-D_GNU_SOURCE', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-std=c99', '-Wall', '-Werror=implicit-function-declaration', '-Wno-error=deprecated-declarations', '-Wno-error=unused-function', '-Wempty-body', '-Wdisabled-optimization', '-Wstrict-prototypes', '-Wno-format-zero-length', '-Werror=format-security', '-Wno-redundant-decls', '-Wvla', '-Wall', '-Wundef', '-Wmissing-prototypes', '-Wshadow', '-Wno-switch', '-Wparentheses', '-Wpointer-arith', '-Wno-pointer-sign', '-Wno-unused-result', '-pthread', '-DDEFAULT_DVD_DEVICE="/dev/sr0"', '-DDEFAULT_CDROM_DEVICE="/dev/sr0"', '-DHAVE_GPL=1', '-DHAVE_LIBAF=1', '-DHAVE_CPLAYER=1', '-DHAVE_LIBDL=1', '-DHAVE_ASM=1', '-DHAVE_LIBM=1', '-DHAVE_POSIX=1', '-DHAVE_POSIX_OR_MINGW=1', '-DHAVE_PTHREADS=1', '-DHAVE_GNUC=1', '-DHAVE_STDATOMIC=1', '-DHAVE_ATOMICS=1', '-DHAVE_LIBRT=1', '-DHAVE_ICONV=1', '-DHAVE_POSIX_SPAWN_NATIVE=1', '-DHAVE_POSIX_SPAWN=1', '-DHAVE_GLOB_POSIX=1', '-DHAVE_GLOB=1', '-DHAVE_FCHMOD=1', '-DHAVE_VT_H=1', '-DHAVE_GBM_H=1', '-DHAVE_GLIBC_THREAD_NAME=1', '-DHAVE_LINUX_FSTATFS=1', '-DHAVE_51=1', '-DHAVE_LUA=1', '-DHAVE_LIBASS=1', '-DHAVE_LIBASS_OSD=1', '-DHAVE_ZLIB=1', '-DHAVE_LIBBLURAY=1', '-DHAVE_DVDREAD=1', '-DHAVE_DVDNAV=1', '-DHAVE_DVDREAD_COMMON=1', '-DHAVE_UCHARDET=1', '-DHAVE_LIBARCHIVE=1', '-DHAVE_SDL2=1', '-DHAVE_PULSE=1', '-DHAVE_OPENAL=1', '-DHAVE_ALSA=1', '-DHAVE_DRM=1', '-DHAVE_DRMPRIME=1', '-DHAVE_X11=1', '-DHAVE_XV=1', '../test.c', '-c', '-o/var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1/build/.conf_check_8669a28b591d91ad04fdcd46293a7f95/testbuild/test.c.1.o']
[2/2] Linking build/.conf_check_8669a28b591d91ad04fdcd46293a7f95/testbuild/testprog

['x86_64-pc-linux-gnu-gcc', '-O2', '-pipe', '-march=native', '-ftree-vectorize', '-Wl,-O1', '-Wl,--as-needed', '-pthread', 'test.c.1.o', '-o/var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1/build/.conf_check_8669a28b591d91ad04fdcd46293a7f95/testbuild/testprog', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-lX11', '-lXss', '-lXext', '-lXinerama', '-lXrandr', '-ldl', '-Wl,-O1', '-Wl,--as-needed']
err: test.c.1.o:test.c:function main: error: undefined reference to 'glXCreateContext'
test.c.1.o:test.c:function main: error: undefined reference to 'glXQueryExtensionsString'
test.c.1.o:test.c:function main: error: undefined reference to 'glXGetProcAddressARB'
test.c.1.o:test.c:function main: error: undefined reference to 'glXGetCurrentDisplay'
collect2: error: ld returned 1 exit status

from /var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1: Test does not build: Traceback (most recent call last):
  File "/var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1/.waf3-2.0.9-10a533182bd85c3f45a157fb5d62db50/waflib/Configure.py", line 324, in run_build
    bld.compile()
  File "/var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1/.waf3-2.0.9-10a533182bd85c3f45a157fb5d62db50/waflib/Build.py", line 176, in compile
    raise Errors.BuildError(self.producer.error)
waflib.Errors.BuildError: Build failed
 -> task in 'testprog' failed with exit status 1 (run with -v to display more information)

from /var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1: The configuration failed
==>
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <stddef.h>

int main(int argc, char *argv[]) {
  glXCreateContext(NULL, NULL, NULL, True);
  glXQueryExtensionsString(NULL, 0);
  glXGetProcAddressARB("");
  glXGetCurrentDisplay();
  return 0;
}

<==
[1/2] Compiling build/.conf_check_4db92c8d471d8cf0f1d8867d6293555b/test.c

['x86_64-pc-linux-gnu-gcc', '-O2', '-pipe', '-march=native', '-ftree-vectorize', '-D_ISOC99_SOURCE', '-D_GNU_SOURCE', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-std=c99', '-Wall', '-Werror=implicit-function-declaration', '-Wno-error=deprecated-declarations', '-Wno-error=unused-function', '-Wempty-body', '-Wdisabled-optimization', '-Wstrict-prototypes', '-Wno-format-zero-length', '-Werror=format-security', '-Wno-redundant-decls', '-Wvla', '-Wall', '-Wundef', '-Wmissing-prototypes', '-Wshadow', '-Wno-switch', '-Wparentheses', '-Wpointer-arith', '-Wno-pointer-sign', '-Wno-unused-result', '-pthread', '-DDEFAULT_DVD_DEVICE="/dev/sr0"', '-DDEFAULT_CDROM_DEVICE="/dev/sr0"', '-DHAVE_GPL=1', '-DHAVE_LIBAF=1', '-DHAVE_CPLAYER=1', '-DHAVE_LIBDL=1', '-DHAVE_ASM=1', '-DHAVE_LIBM=1', '-DHAVE_POSIX=1', '-DHAVE_POSIX_OR_MINGW=1', '-DHAVE_PTHREADS=1', '-DHAVE_GNUC=1', '-DHAVE_STDATOMIC=1', '-DHAVE_ATOMICS=1', '-DHAVE_LIBRT=1', '-DHAVE_ICONV=1', '-DHAVE_POSIX_SPAWN_NATIVE=1', '-DHAVE_POSIX_SPAWN=1', '-DHAVE_GLOB_POSIX=1', '-DHAVE_GLOB=1', '-DHAVE_FCHMOD=1', '-DHAVE_VT_H=1', '-DHAVE_GBM_H=1', '-DHAVE_GLIBC_THREAD_NAME=1', '-DHAVE_LINUX_FSTATFS=1', '-DHAVE_51=1', '-DHAVE_LUA=1', '-DHAVE_LIBASS=1', '-DHAVE_LIBASS_OSD=1', '-DHAVE_ZLIB=1', '-DHAVE_LIBBLURAY=1', '-DHAVE_DVDREAD=1', '-DHAVE_DVDNAV=1', '-DHAVE_DVDREAD_COMMON=1', '-DHAVE_UCHARDET=1', '-DHAVE_LIBARCHIVE=1', '-DHAVE_SDL2=1', '-DHAVE_PULSE=1', '-DHAVE_OPENAL=1', '-DHAVE_ALSA=1', '-DHAVE_DRM=1', '-DHAVE_DRMPRIME=1', '-DHAVE_X11=1', '-DHAVE_XV=1', '../test.c', '-c', '-o/var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1/build/.conf_check_4db92c8d471d8cf0f1d8867d6293555b/testbuild/test.c.1.o']
[2/2] Linking build/.conf_check_4db92c8d471d8cf0f1d8867d6293555b/testbuild/testprog

['x86_64-pc-linux-gnu-gcc', '-O2', '-pipe', '-march=native', '-ftree-vectorize', '-Wl,-O1', '-Wl,--as-needed', '-pthread', 'test.c.1.o', '-o/var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1/build/.conf_check_4db92c8d471d8cf0f1d8867d6293555b/testbuild/testprog', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-lGL', '-lX11', '-lXss', '-lXext', '-lXinerama', '-lXrandr', '-ldl', '-Wl,-O1', '-Wl,--as-needed']
yes
-----------------------------------------------------------------
Checking for OpenGL X11 EGL Backend
['x86_64-pc-linux-gnu-pkg-config', 'egl', '--libs', '--cflags', 'egl']
err: Package egl was not found in the pkg-config search path.
Perhaps you should add the directory containing `egl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'egl', required by 'virtual:world', not found
Package 'egl', required by 'virtual:world', not found

from /var/tmp/portage/media-video/mpv-0.29.1-r1/work/mpv-0.29.1: The configuration failed
no ('egl' not found)
Comment 19 Maik 2019-09-11 08:52:14 UTC
Which mesa version/use flags?
Please post the output of
emerge -pv mesa
Comment 20 Marek Bartosiewicz 2019-09-11 10:10:35 UTC
[ebuild   R    ] media-libs/mesa-19.2.0_rc2::gentoo  USE="X classic dri3 egl gallium gbm libglvnd llvm opencl vaapi vdpau vulkan -d3d9 -debug -gles1 -gles2 -lm_sensors -osmesa -pax_kernel (-selinux) -test -unwind -valgrind -vulkan-overlay -wayland -xa -xvmc" ABI_X86="(64) -32 (-x32)" VIDEO_CARDS="i965 intel (-freedreno) -i915 -iris (-lima) -nouveau (-panfrost) -r100 -r200 -r300 -r600 -radeon -radeonsi (-vc4) -virgl (-vivante) -vmware" 0 KiB
Comment 21 Maik 2019-09-11 10:15:00 UTC
Ok, that clarifies it. All your breaking packages have nothing to do with USE="libglvnd" but this one:
https://bugzilla.redhat.com/show_bug.cgi?id=1744292
Please file a bug against the mesa package.
Comment 22 Marek Bartosiewicz 2019-09-12 16:22:03 UTC
PRIME render offload works beautifully:

marek@precision ~/GOG Games/Sunless Skies/game $ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia ./Sunless\ Skies.x86_64 
Set current directory to /home/marek/GOG Games/Sunless Skies/game
Found path: /home/marek/GOG Games/Sunless Skies/game/Sunless Skies.x86_64
Mono path[0] = '/home/marek/GOG Games/Sunless Skies/game/Sunless Skies_Data/Managed'
Mono config path = '/home/marek/GOG Games/Sunless Skies/game/Sunless Skies_Data/Mono/etc'
Preloaded 'ScreenSelector.so'
Unable to preload the following plugins:
	ScreenSelector.so
Display 0 'eDP-1 16"': 3840x2160 (primary device).
Logging to /home/marek/.config/unity3d/Failbetter Games/Sunless Skies/Player.log
marek@precision ~/GOG Games/Sunless Skies/game $ mc

marek@precision ~/GOG Games/Sunless Skies/game $ cat /home/marek/.config/unity3d/Failbetter\ Games/Sunless\ Skies/Player.log 
Desktop is 3840 x 2160 @ 60 Hz
Initialize engine version: 2018.2.21f1 (a122f5dc316d)
GfxDevice: creating device client; threaded=1
Renderer: Quadro M1000M/PCIe/SSE2
Vendor:   NVIDIA Corporation
Version:  4.5.0 NVIDIA 435.21
GLES:     0
 GL_AMD_multi_draw_indirect GL_AMD_seamless_cubemap_per_texture 
(...)

When I omit __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia then Intel card with Mesa 3D is selected.
Comment 23 Marek Bartosiewicz 2019-09-19 03:25:48 UTC
Is this the time to remove the overlay? Are patches in the main portage tree?

Calculating dependencies... done!
[ebuild  N     ] app-eselect/eselect-opengl-1.3.1-r4::gentoo  3 KiB
[ebuild     U #] media-libs/libglvnd-1.1.1-r1::gentoo [1.1.1::gentoo] ABI_X86="32 (64) (-x32)" 1 808 KiB
[ebuild   R    ] x11-base/xorg-server-1.20.5:0/1.20.5::ljh  USE="glamor ipv6 suid systemd udev xorg xvfb -debug -dmx -doc (-elogind) -kdrive (-libglvnd*) -libressl -minimal (-selinux) -static-libs -unwind -wayland -xcsecurity -xephyr -xnest" 5 984 KiB
[ebuild     U  ] dev-libs/libical-3.0.6:0/3::gentoo [3.0.5:0/3::gentoo] USE="berkdb introspection%* vala%* -doc -examples -static-libs -test (-glib%)" 860 KiB
[ebuild     UD ] media-libs/freeglut-3.0.0::gentoo [3.2.0::gentoo] USE="-debug -static-libs" ABI_X86="(64) -32 (-x32)" 410 KiB
[ebuild     U  ] gnome-base/gnome-desktop-3.32.2:3/17::gentoo [3.30.2.3:3/17::gentoo] USE="introspection (seccomp) udev -debug -gtk-doc% -test" 700 KiB
[blocks B      ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is blocking x11-base/xorg-server-1.20.5, media-libs/mesa-19.2.0_rc3)
[blocks B      ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is blocking x11-drivers/nvidia-drivers-435.21)
Comment 24 Matt Turner gentoo-dev 2019-09-19 03:58:52 UTC
(In reply to Marek Bartosiewicz from comment #23)
> Is this the time to remove the overlay? Are patches in the main portage tree?

Everything except the patch for media-libs/cogl. And I discovered that both libglvnd and mesa[libglvnd] are installing gl.pc, so we're getting that fixed in upstream Mesa, and it'll be in the 19.2.0 release.

So my plan is to unmask libglvnd in 19.2.0 and if everything goes well, force the flag on in 19.3.0 (and then at some point remove the flag and leave it always enabled)
Comment 25 Marek Bartosiewicz 2019-09-19 06:38:38 UTC
Thanks.

>> And I discovered that both libglvnd and mesa[libglvnd] are installing gl.pc

Which one should be installed?

 * media-libs/mesa-19.2.0_rc3:0::gentoo
 *      /usr/lib/pkgconfig/gl.pc
 *      /usr/lib64/pkgconfig/gl.pc
 *
 * Package 'media-libs/libglvnd-1.1.1-r1' NOT merged due to file
 * collisions. If necessary, refer to your elog messages for the whole
 * content of the above message.
Comment 26 Marek Bartosiewicz 2019-09-19 07:22:33 UTC
Strange:

checking for UDEV... yes
checking for udev_monitor_filter_add_match_tag... yes
checking for udev_enumerate_add_match_tag... yes
checking for DBUS... yes
checking for HAL... no
checking for glibc...... yes
checking for clock_gettime... yes
checking for a useful monotonic clock ...... yes
checking whether to track client ids... yes
checking for DRI2PROTO... yes
checking for DRI3PROTO... yes
checking for sigaction... yes
checking for XSHMFENCE... yes
configure: DRI3 enabled
checking for LIBDRM... yes
checking for XLIB... yes
checking for GL... no
configure: error: Package requirements (glproto >= 1.4.17 gl >= 9.2.0) were not met:

Package dependency requirement 'gl >= 9.2.0' could not be satisfied.
Package 'gl' has version '1.2', required version is '>= 9.2.0'

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables GL_CFLAGS
and GL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Comment 27 Marek Bartosiewicz 2019-09-19 07:23:56 UTC
This is x11-base/xorg-server-1.20.5::gentoo
Comment 28 Marek Bartosiewicz 2019-09-19 07:36:00 UTC
I needed to reemerge mesa, sorry for the noise. Removing overlays isn't so simple :)
All is good now.

[ebuild   R   #] media-libs/libglvnd-1.1.1-r1::gentoo  ABI_X86="32 (64) (-x32)" 1 808 KiB
[ebuild   R    ] media-libs/mesa-19.2.0_rc3::gentoo  USE="X classic dri3 egl gallium gbm libglvnd llvm opencl vaapi vdpau vulkan -d3d9 -debug -gles1 -gles2 -lm-sensors -osmesa -pax_kernel (-selinux) -test -unwind -valgrind -vulkan-overlay -wayland -xa -xvmc" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="i965 intel (-freedreno) -i915 -iris (-lima) -nouveau (-panfrost) -r100 -r200 -r300 -r600 -radeon -radeonsi (-vc4) -virgl (-vivante) -vmware" 0 KiB
[ebuild   R    ] x11-base/xorg-server-1.20.5:0/1.20.5::gentoo  USE="glamor ipv6 libglvnd suid systemd udev xorg xvfb -debug -dmx -doc (-elogind) -kdrive -libressl -minimal (-selinux) -static-libs -unwind -wayland -xcsecurity -xephyr -xnest" 0 KiB
[ebuild   R    ] x11-drivers/nvidia-drivers-435.21:0/435::gentoo  USE="X acpi driver gtk3 kms libglvnd multilib uvm -compat -static-libs -tools -wayland" ABI_X86="32 (64) (-x32)"  0 KiB
Comment 29 Marek Bartosiewicz 2019-09-19 07:47:22 UTC
Unfortunately seems that not all xorg patches are included, as prime render offload is disabled:

[     5.945] (**) Option "AllowNVIDIAGpuScreens"
[     5.945] (**) NVIDIA(G0): Enabling 2D acceleration
[     5.945] (II) Loading sub module "glxserver_nvidia"
[     5.945] (II) LoadModule: "glxserver_nvidia"
[     5.945] (II) Loading /usr/lib64/xorg/modules/extensions/libglxserver_nvidia.so
[     5.980] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[     5.980] (II) NVIDIA GLX Module  435.21  Sun Aug 25 08:14:27 CDT 2019
[     5.980] (II) NVIDIA: The X server does not support PRIME Render Offload.
Comment 30 Marek Bartosiewicz 2019-09-19 08:23:47 UTC
I added back 1.12 xorg-server patches from this overlay:
https://github.com/LuoJinghua/gentoo-overlay/tree/master/x11-base/xorg-server/files

as portage user patches:
 * Applying xorg-server-1.21-autobind-gpu.patch ...                                                                                                                                                                                   [ ok ]
 * Applying xorg-server-1.21-multigpu-00-7f962c70.patch ...                                                                                                                                                                           [ ok ]
 * Applying xorg-server-1.21-multigpu-01-37a36a6b.patch ...                                                                                                                                                                           [ ok ]
 * Applying xorg-server-1.21-multigpu-02-8b67ec7c.patch ...                                                                                                                                                                           [ ok ]
 * Applying xorg-server-1.21-multigpu-03-56c0a71f.patch ...                                                                                                                                                                           [ ok ]
 * Applying xorg-server-1.21-multigpu-04-b4231d69.patch ...                                                                                                                                                                           [ ok ]
 * User patches applied.

And I have PRIME offloading back:

[     6.136] (**) Option "AllowNVIDIAGpuScreens"
[     6.136] (**) NVIDIA(G0): Enabling 2D acceleration
[     6.136] (II) Loading sub module "glxserver_nvidia"
[     6.136] (II) LoadModule: "glxserver_nvidia"
[     6.136] (II) Loading /usr/lib64/xorg/modules/extensions/libglxserver_nvidia.so
[     6.183] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[     6.183] (II) NVIDIA GLX Module  435.21  Sun Aug 25 08:14:27 CDT 2019
[     6.183] (II) NVIDIA: The X server supports PRIME Render Offload.


That's why I was asking about those patches in main portage tree :)
Comment 31 Matt Turner gentoo-dev 2019-09-19 15:43:14 UTC
(In reply to Marek Bartosiewicz from comment #30) 
> That's why I was asking about those patches in main portage tree :)

That's separate from enabling glvnd (but valuable).

(In reply to Marek Bartosiewicz from comment #25)
> Thanks.
> 
> >> And I discovered that both libglvnd and mesa[libglvnd] are installing gl.pc
> 
> Which one should be installed?
> 
>  * media-libs/mesa-19.2.0_rc3:0::gentoo
>  *      /usr/lib/pkgconfig/gl.pc
>  *      /usr/lib64/pkgconfig/gl.pc
>  *
>  * Package 'media-libs/libglvnd-1.1.1-r1' NOT merged due to file
>  * collisions. If necessary, refer to your elog messages for the whole
>  * content of the above message.

The one from libglvnd. The fix for Mesa is now upstream (https://gitlab.freedesktop.org/mesa/mesa/commit/a1de3011f380b6ffd5583708b58e3f86d8d45ea9) and will be in the next RC for 19.2.0.
Comment 32 Alexander Tsoy 2019-09-25 20:03:42 UTC
(In reply to Matt Turner from comment #31)
...
> The one from libglvnd. The fix for Mesa is now upstream
> (https://gitlab.freedesktop.org/mesa/mesa/commit/
> a1de3011f380b6ffd5583708b58e3f86d8d45ea9) and will be in the next RC for
> 19.2.0.
This change was reverted in 19.2.0 :(
https://cgit.freedesktop.org/mesa/mesa/commit/?h=19.2&id=e59e9cd58a95d8dc9b06d09f2abed96ba7b1a1b9
Comment 33 Alexander Tsoy 2019-09-25 20:15:53 UTC
(In reply to Alexander Tsoy from comment #32)
Or maybe they just fail to make pkg.generate() conditional (if not with_glvnd or glvnd_missing_pc_files)?
Comment 34 Matt Turner gentoo-dev 2019-09-25 20:55:09 UTC
(In reply to Alexander Tsoy from comment #33)
> (In reply to Alexander Tsoy from comment #32)
> Or maybe they just fail to make pkg.generate() conditional (if not
> with_glvnd or glvnd_missing_pc_files)?

Yeah, it's just to handle the case where you have libglvnd that doesn't have the pkgconfig files. We don't want to end up in a state where no one is providing the files.

Shouldn't affect us though. glvnd 1.2.0 is in tree.

Go forth and test.
Comment 35 Alexander Tsoy 2019-09-25 21:51:09 UTC
(In reply to Matt Turner from comment #34)
> Go forth and test.
I already tested mesa-19.2.0 with libglvnd-1.2.0 before commenting here and still got file collision. OK, I'd better open a separate bug for this.
Comment 36 Matt Turner gentoo-dev 2019-09-25 22:16:36 UTC
I'm planning to commit a fix for cogl tonight and then unmask the libglvnd flag in a few days.
Comment 37 Marek Bartosiewicz 2019-09-29 05:54:20 UTC
What about these? Shall I report them as bugs? 

I have:
[ebuild   R    ] media-libs/mesa-19.2.0::gentoo  USE="X classic dri3 egl gallium gbm libglvnd llvm opencl vaapi vdpau vulkan -d3d9 -debug -gles1 -gles2 -lm-sensors -osmesa -pax_kernel (-selinux) -test -unwind -valgrind -vulkan-overlay -wayland -xa -xvmc" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="i965 intel (-freedreno) -i915 -iris (-lima) -nouveau (-panfrost) -r100 -r200 -r300 -r600 -radeon -radeonsi (-vc4) -virgl (-vivante) -vmware"

Newest i3-gaps fails, also I can't reinstall pango:

checking for x86_64-pc-linux-gnu-pkg-config... /usr/bin/x86_64-pc-linux-gnu-pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBSN... yes
checking for XCB... yes
checking for XCB_UTIL... yes
checking for XCB_UTIL_CURSOR... yes
checking for XCB_UTIL_KEYSYMS... yes
checking for XCB_UTIL_WM... yes
checking for XCB_UTIL_XRM... yes
checking for XKBCOMMON... yes
checking for YAJL... yes
checking for LIBPCRE... yes
checking for PANGOCAIRO... no
configure: error: Package requirements (cairo >= 1.14.4 pangocairo) were not met:

Package 'gl', required by 'cairo', not found
Package 'gl', required by 'cairo', not found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables PANGOCAIRO_CFLAGS
and PANGOCAIRO_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

pango:
DHAVE_FREETYPE    -O2 -pipe -march=native -ftree-vectorize -Wall -c -o testboundaries_ucd.o /var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests/testboundaries_ucd.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests -I..  -DSRCDIR=\"/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests\" -I/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4 -DG_DISABLE_CAST_CHECKS -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/libffi-3.3_rc0/include -pthread  -I/usr/include/freetype2 -I/usr/include/uuid   -I/usr/include/freetype2   -DHAVE_X -DHAVE_XFT -DHAVE_FREETYPE    -O2 -pipe -march=native -ftree-vectorize -Wall -c -o testcolor.o /var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests/testcolor.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests -I..  -DSRCDIR=\"/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests\" -I/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4 -DG_DISABLE_CAST_CHECKS -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/libffi-3.3_rc0/include -pthread  -I/usr/include/freetype2 -I/usr/include/uuid   -I/usr/include/freetype2   -DHAVE_X -DHAVE_XFT -DHAVE_FREETYPE    -O2 -pipe -march=native -ftree-vectorize -Wall -c -o testscript.o /var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests/testscript.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests -I..  -DSRCDIR=\"/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests\" -I/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4 -DG_DISABLE_CAST_CHECKS -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib64/libffi-3.3_rc0/include -pthread  -I/usr/include/freetype2 -I/usr/include/uuid   -I/usr/include/freetype2   -DHAVE_X -DHAVE_XFT -DHAVE_FREETYPE    -O2 -pipe -march=native -ftree-vectorize -Wall -c -o markup-parse.o /var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests/markup-parse.c
make[2]: *** No rule to make target '../pango/libpangocairo-1.0.la', needed by 'markup-parse'.  Stop.
make[2]: *** Waiting for unfinished jobs....
In file included from /var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/tests/markup-parse.c:33:
/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4/pango/pangocairo.h:26:10: fatal error: cairo.h: No such file or directory
   26 | #include <cairo.h>
      |          ^~~~~~~~~
compilation terminated.
make[2]: *** [Makefile:922: markup-parse.o] Error 1
make[2]: Leaving directory '/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4-abi_x86_64.amd64/tests'
make[1]: *** [Makefile:574: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/x11-libs/pango-1.42.4-r2/work/pango-1.42.4-abi_x86_64.amd64'
make: *** [Makefile:473: all] Error 2
Comment 38 Aidan Harris 2019-09-29 17:23:24 UTC
Marek, I think you might be seeing https://bugs.gentoo.org/645540

The only thing that could be a libglvnd issue here is:

> Package 'gl', required by 'cairo', not found

This is probably a red-herring though. I've just unmasked libglvnd in my profile and so far nothing has exploded (it actually fixed a couple of issues I was having so thank you to everyone that's worked on this).
Comment 39 Marek Bartosiewicz 2019-09-29 18:07:31 UTC
(In reply to Aidan Harris from comment #38)
> Marek, I think you might be seeing https://bugs.gentoo.org/645540
> 

Ah, thanks, I wasn't aware of that bug report. I'll try to reemerge those packages.
Comment 40 Marek Bartosiewicz 2019-09-30 05:31:32 UTC
Seems that I do have an ongoing problem with my system, namely I see the

Package 'gl', required by 'cairo', not found

failure on some more packages now. I tried to rebuild @world during the night and as of now, packages that failed are:

vte
gobject-introspection
librsvg
harfbuzz

and of course pango.

I'm at ~300 package out of 933 packages, will try to --resume --skipfirst.
Comment 41 Marek Bartosiewicz 2019-09-30 09:27:33 UTC
Yes!

Failing packages started emerging again during emerge -e @world:

completed emerge (2 of 105) media-libs/harfbuzz-2.6.1
completed emerge (4 of 105) x11-libs/pango-1.42.4-r2
completed emerge (5 of 105) dev-cpp/pangomm-2.42.0
completed emerge (9 of 105) x11-wm/i3-gaps-4.17.1

I suspect that reemerging those helped:
completed emerge (4 of 132) dev-util/vulkan-headers-1.1.114
completed emerge (19 of 132) media-libs/vulkan-layers-1.1.106

and of course other dependencies.
Comment 42 Rick Harris 2019-10-14 08:36:35 UTC
As per comment #17 media-libs/mesa[libglvnd] breaks media-video/mpv.

This is because the egl.pc file provided by media-libs/mesa vs. the egl.pc file provided by media-libs/libglvnd differ wildly.

For media-video/mpv it's just the 'Version:' string, but for other compiles it may well fail missing 'Requires' and 'Libs'.

== media-libs/mesa egl.pc ==
prefix=/usr
libdir=${prefix}/lib
includedir=${prefix}/include

Name: egl
Description: Mesa EGL Library
Version: 19.2.1
Requires.private: x11, xext, xdamage >=  1.1, xfixes, x11-xcb, xcb, xcb-glx >=  1.8.1, xcb-dri2 >=  1.8, xxf86vm, libdrm >=  2.4.75
Libs: -L${libdir} -lEGL
Libs.private: -lpthread -pthread -lm -ldl
Cflags: -I${includedir}



== media-libs/libglvnd egl.pc ==
prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=${prefix}/include

Name: egl
Description: EGL library and headers
Version: 1.5
Libs: -L${libdir} -lEGL
Cflags: -I${includedir}
Comment 43 Miroslaw Mieszczak 2019-10-18 10:52:02 UTC
There is same thing for other programs. For example tigervnc is depend on gl.pc provided by libglvnd or mesa.
It require version >=9.2, while libglvnd provide version 1.2.
Comment 44 Alexander Tsoy 2019-10-18 12:04:49 UTC
(In reply to Rick Harris from comment #42)
> As per comment #17 media-libs/mesa[libglvnd] breaks media-video/mpv.
Comment #17 was a different issue. But AFAIS mpv with USE="opengl wayland" would indeed fail to build (according to wscript):

        'name': '--gl-wayland',
        'desc': 'OpenGL Wayland Backend',
        'deps': 'wayland',
        'groups': [ 'gl' ],
        'func': check_pkg_config('wayland-egl', '>= 9.0.0',
                                 'egl',         '>= 9.0.0')

Please open a separate bug report if you can reproduce this build failure. I don't have wayland on any of my system yet.
Comment 45 Rick Harris 2019-10-29 16:08:50 UTC
(In reply to Alexander Tsoy from comment #44)
> (In reply to Rick Harris from comment #42)
> > As per comment #17 media-libs/mesa[libglvnd] breaks media-video/mpv.
> Comment #17 was a different issue. But AFAIS mpv with USE="opengl wayland"
> would indeed fail to build (according to wscript):
> 
>         'name': '--gl-wayland',
>         'desc': 'OpenGL Wayland Backend',
>         'deps': 'wayland',
>         'groups': [ 'gl' ],
>         'func': check_pkg_config('wayland-egl', '>= 9.0.0',
>                                  'egl',         '>= 9.0.0')
> 
> Please open a separate bug report if you can reproduce this build failure. I
> don't have wayland on any of my system yet.

Issue was fixed by /usr/portage/media-video/mpv/files/mpv-0.29.1-egl-bound.patch to use lower egl.pc version provided by libglvnd.

But we now have a new bug introduced by upstream mesa-19.2.2 and libglvnd-1.2.0 that causes xorg-server build failure as seen here in the comments -> https://aur.archlinux.org/packages/xorg-server-git/
Comment 46 Rick Harris 2019-10-29 16:47:34 UTC
Can confirm applying the patches for xorg-server and libglvnd listed at https://gitlab.freedesktop.org/xorg/xserver/issues/914 fix the issue.
Comment 47 Rick Harris 2019-11-01 23:58:47 UTC
media-video/vlc-3.0.8*[vaapi] fails to build with libglvnd needs following patch backported from master https://github.com/videolan/vlc/commit/995dfaf01b2a50f292f9c709845aa66e78444af5
Comment 48 Marek Bartosiewicz 2019-11-04 07:34:11 UTC
Hi, I'm not sure where to report this.
After libglvnd unmasking and recent removal of glamor USE flag I can't reemerge xorg-server, it fails with:

/bin/sh ../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include    -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Wimplicit -Wnonnull -Winit-self -Wmain -Wmissing-braces -Wsequence-point -Wreturn-type -Wtrigraphs -Warray-bounds -Wwrite-strings -Waddress -Wint-to-pointer-cast -Wpointer-to-int-cast -fno-strict-aliasing -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Wimplicit -Wnonnull -Winit-self -Wmain -Wmissing-braces -Wsequence-point -Wreturn-type -Wtrigraphs -Warray-bounds -Wwrite-strings -Waddress -Wint-to-pointer-cast -Wpointer-to-int-cast -fno-strict-aliasing -fno-strict-aliasing -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/usr/include/pixman-1 -I/usr/include/X11/dri -I/usr/include/libdrm -I/usr/include/freetype2  -I../include -I../include -I../Xext -I../composite -I../damageext -I../xfixes -I../Xi -I../mi -I../miext/sync -I../miext/shadow  -I../miext/damage -I../render -I../randr -I../fb -I../dbe -I../present -fvisibility=hidden  -O2 -pipe -march=native -ftree-vectorize -pthread -c -o glamor_lines.lo glamor_lines.c
In file included from /usr/include/EGL/eglplatform.h:122,
                 from /usr/include/epoxy/egl_generated.h:11,
                 from /usr/include/epoxy/egl.h:46,
                 from glamor_priv.h:43,
                 from glamor.c:37:
/usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
  222 | *GC;
      |  ^~
In file included from glamor.h:34,
                 from glamor_priv.h:32,
                 from glamor.c:37:
../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
  282 | } GC;
      |   ^~
In file included from /usr/include/EGL/eglplatform.h:122,
                 from /usr/include/epoxy/egl_generated.h:11,
                 from /usr/include/epoxy/egl.h:46,
                 from glamor_priv.h:43,
                 from glamor_core.c:36:
/usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
  222 | *GC;
      |  ^~
In file included from glamor.h:34,
                 from glamor_priv.h:32,
                 from glamor_core.c:36:
../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
  282 | } GC;
      |   ^~
In file included from /usr/include/EGL/eglplatform.h:122,
                 from /usr/include/epoxy/egl_generated.h:11,
                 from /usr/include/epoxy/egl.h:46,
                 from glamor_priv.h:43,
                 from glamor_composite_glyphs.c:25:
/usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
  222 | *GC;
      |  ^~
In file included from glamor.h:34,
                 from glamor_priv.h:32,
                 from glamor_composite_glyphs.c:25:
../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
  282 | } GC;
      |   ^~
In file included from /usr/include/EGL/eglplatform.h:122,
                 from /usr/include/epoxy/egl_generated.h:11,
                 from /usr/include/epoxy/egl.h:46,
                 from glamor_priv.h:43,
                 from glamor_font.c:23:
/usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
  222 | *GC;
      |  ^~
In file included from glamor.h:34,
                 from glamor_priv.h:32,
                 from glamor_font.c:23:
../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
  282 | } GC;
      |   ^~
In file included from /usr/include/EGL/eglplatform.h:122,
                 from /usr/include/epoxy/egl_generated.h:11,
                 from /usr/include/epoxy/egl.h:46,
                 from glamor_priv.h:43,
                 from glamor_copy.c:23:
/usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
  222 | *GC;
      |  ^~
In file included from glamor.h:34,
                 from glamor_priv.h:32,
                 from glamor_copy.c:23:
../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
  282 | } GC;
      |   ^~
In file included from /usr/include/EGL/eglplatform.h:122,
                 from /usr/include/epoxy/egl_generated.h:11,
                 from /usr/include/epoxy/egl.h:46,
                 from glamor_priv.h:43,
                 from glamor_image.c:23:
/usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
  222 | *GC;
      |  ^~
In file included from glamor.h:34,
                 from glamor_priv.h:32,
                 from glamor_image.c:23:
../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
  282 | } GC;
      |   ^~
make[1]: *** [Makefile:767: glamor_core.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:767: glamor.lo] Error 1
In file included from /usr/include/EGL/eglplatform.h:122,
                 from /usr/include/epoxy/egl_generated.h:11,
                 from /usr/include/epoxy/egl.h:46,
                 from glamor_priv.h:43,
                 from glamor_dash.c:23:
/usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
  222 | *GC;
      |  ^~
In file included from glamor.h:34,
                 from glamor_priv.h:32,
                 from glamor_dash.c:23:
../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
  282 | } GC;
      |   ^~
make[1]: *** [Makefile:767: glamor_composite_glyphs.lo] Error 1
make[1]: *** [Makefile:767: glamor_font.lo] Error 1
make[1]: *** [Makefile:767: glamor_copy.lo] Error 1
make[1]: *** [Makefile:767: glamor_image.lo] Error 1
make[1]: *** [Makefile:767: glamor_dash.lo] Error 1
libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Wimplicit -Wnonnull -Winit-self -Wmain -Wmissing-braces -Wsequence-point -Wreturn-type -Wtrigraphs -Warray-bounds -Wwrite-strings -Waddress -Wint-to-pointer-cast -Wpointer-to-int-cast -fno-strict-aliasing -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Wimplicit -Wnonnull -Winit-self -Wmain -Wmissing-braces -Wsequence-point -Wreturn-type -Wtrigraphs -Warray-bounds -Wwrite-strings -Waddress -Wint-to-pointer-cast -Wpointer-to-int-cast -fno-strict-aliasing -fno-strict-aliasing -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT -I/usr/include/pixman-1 -I/usr/include/X11/dri -I/usr/include/libdrm -I/usr/include/freetype2 -I../include -I../include -I../Xext -I../composite -I../damageext -I../xfixes -I../Xi -I../mi -I../miext/sync -I../miext/shadow -I../miext/damage -I../render -I../randr -I../fb -I../dbe -I../present -fvisibility=hidden -O2 -pipe -march=native -ftree-vectorize -pthread -c glamor_lines.c  -fPIC -DPIC -o .libs/glamor_lines.o
In file included from /usr/include/EGL/eglplatform.h:122,
                 from /usr/include/epoxy/egl_generated.h:11,
                 from /usr/include/epoxy/egl.h:46,
                 from glamor_priv.h:43,
                 from glamor_lines.c:23:
/usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
  222 | *GC;
      |  ^~
In file included from glamor.h:34,
                 from glamor_priv.h:32,
                 from glamor_lines.c:23:
../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
  282 | } GC;
      |   ^~
make[1]: *** [Makefile:767: glamor_lines.lo] Error 1
make[1]: Leaving directory '/var/tmp/portage/x11-base/xorg-server-1.20.5/work/xorg-server-1.20.5/glamor'
make: *** [Makefile:816: all-recursive] Error 1
 * ERROR: x11-base/xorg-server-1.20.5::gentoo failed (compile phase):
 *   emake failed

Is this relevant?

https://gitlab.freedesktop.org/xorg/xserver/issues/914
Comment 49 Marek Bartosiewicz 2019-11-04 10:25:24 UTC
Patches from https://gitlab.freedesktop.org/xorg/xserver/issues/914 helped :)
Comment 50 Pablo Cholaky 2019-11-11 05:46:25 UTC
(In reply to Marek Bartosiewicz from comment #49)
> Patches from https://gitlab.freedesktop.org/xorg/xserver/issues/914 helped :)

I guess you meant patches for libglvnd and xorg-server.

After those patches, did libglvnd worked for you? I mean, trying to use your secondary videocard?
Comment 51 Marek Bartosiewicz 2019-11-11 06:47:25 UTC
Yes, you need to patch both of them, and yes, Nvidia prime offload still worls OK for me.
Comment 52 J. Roeleveld 2019-11-12 16:58:42 UTC
Could you please list which patches need to go where to make this work?

Many thanks,

Joost
Comment 53 Alexander Tsoy 2019-11-12 17:15:43 UTC
(In reply to J. Roeleveld from comment #52)
> Could you please list which patches need to go where to make this work?
xorg-server (1.20*):
https://gitlab.freedesktop.org/xorg/xserver/commit/642c1f83b9ed2452ceb20457a4423a8f52a7a8c4.patch

libglvnd (I think only the last patch is really needed, and according to discussion in MR it will not be merged as is):
https://gitlab.freedesktop.org/glvnd/libglvnd/commit/6f52473dac08c44b081b792874b4ce73122096da.patch
https://gitlab.freedesktop.org/glvnd/libglvnd/commit/51233cc52cbcbe25f8461830913c06f5b5bc9508.patch
https://gitlab.freedesktop.org/glvnd/libglvnd/merge_requests/193.patch
Comment 54 Marek Bartosiewicz 2019-11-12 18:03:39 UTC
Yeah, exactly.
I used /etc/portage/patches/ functionality and put those in media-libs/ x11-base/ subdirectories.
Comment 55 Marek Bartosiewicz 2019-11-12 18:06:13 UTC
For Nvidia Optimus / Prime offload you need:

ls -la /etc/portage/patches/x11-base/xorg-server-1.20.5/

drwxr-xr-x 1 root root   682 11-04 09:43 .
drwxr-xr-x 1 root root    36 09-19 10:17 ..
-rw-r--r-- 1 root root   961 11-04 09:36 0001-meson-bump-gl-1.2.patch
-rw-r--r-- 1 root root  2339 11-04 09:37 0001-replace-MESA_EGL_NO_X11_HEADERS-hack-with-upstream-E.patch
-rw-r--r-- 1 root root 11183 09-10 11:21 xorg-server-1.21-autobind-gpu.patch
-rw-r--r-- 1 root root  8425 09-10 11:21 xorg-server-1.21-multigpu-00-7f962c70.patch
-rw-r--r-- 1 root root  2868 09-10 11:21 xorg-server-1.21-multigpu-01-37a36a6b.patch
-rw-r--r-- 1 root root  3746 09-10 11:21 xorg-server-1.21-multigpu-02-8b67ec7c.patch
-rw-r--r-- 1 root root  3859 09-10 11:21 xorg-server-1.21-multigpu-03-56c0a71f.patch
-rw-r--r-- 1 root root  1064 09-10 11:21 xorg-server-1.21-multigpu-04-b4231d69.patch

and

ls -la /etc/portage/patches/media-libs/libglvnd/

drwxr-xr-x 1 root root  202 11-04 11:13 .
drwxr-xr-x 1 root root   16 11-04 11:12 ..
-rw-r--r-- 1 root root 2780 11-04 11:13 193.patch
-rw-r--r-- 1 root root 2485 11-04 11:13 51233cc52cbcbe25f8461830913c06f5b5bc9508.patch
-rw-r--r-- 1 root root  770 11-04 11:13 6f52473dac08c44b081b792874b4ce73122096da.patch
Comment 56 Matt Turner gentoo-dev 2019-11-23 18:03:33 UTC
Just an update: I released xorg-server-1.20.6 and I plan to make a release of libglvnd-1.3.0 next week. At that point, I think those are in good shape and I'll just have to handle the couple of reverse dependencies before unmasking.
Comment 57 Anton Gubarkov 2019-11-25 20:36:05 UTC
(In reply to Marek Bartosiewicz from comment #48)
> Hi, I'm not sure where to report this.
> After libglvnd unmasking and recent removal of glamor USE flag I can't
> reemerge xorg-server, it fails with:
> 
> /bin/sh ../libtool  --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc
> -DHAVE_CONFIG_H -I. -I../include    -Wall -Wpointer-arith
> -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes
> -Wnested-externs -Wbad-function-cast -Wold-style-definition
> -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow
> -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op
> -Wimplicit -Wnonnull -Winit-self -Wmain -Wmissing-braces -Wsequence-point
> -Wreturn-type -Wtrigraphs -Warray-bounds -Wwrite-strings -Waddress
> -Wint-to-pointer-cast -Wpointer-to-int-cast -fno-strict-aliasing
> -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2
> -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs
> -Wbad-function-cast -Wold-style-definition -Wdeclaration-after-statement
> -Wunused -Wuninitialized -Wshadow -Wmissing-noreturn
> -Wmissing-format-attribute -Wredundant-decls -Wlogical-op -Wimplicit
> -Wnonnull -Winit-self -Wmain -Wmissing-braces -Wsequence-point -Wreturn-type
> -Wtrigraphs -Warray-bounds -Wwrite-strings -Waddress -Wint-to-pointer-cast
> -Wpointer-to-int-cast -fno-strict-aliasing -fno-strict-aliasing
> -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT
> -I/usr/include/pixman-1 -I/usr/include/X11/dri -I/usr/include/libdrm
> -I/usr/include/freetype2  -I../include -I../include -I../Xext -I../composite
> -I../damageext -I../xfixes -I../Xi -I../mi -I../miext/sync -I../miext/shadow
> -I../miext/damage -I../render -I../randr -I../fb -I../dbe -I../present
> -fvisibility=hidden  -O2 -pipe -march=native -ftree-vectorize -pthread -c -o
> glamor_lines.lo glamor_lines.c
> In file included from /usr/include/EGL/eglplatform.h:122,
>                  from /usr/include/epoxy/egl_generated.h:11,
>                  from /usr/include/epoxy/egl.h:46,
>                  from glamor_priv.h:43,
>                  from glamor.c:37:
> /usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
>   222 | *GC;
>       |  ^~
> In file included from glamor.h:34,
>                  from glamor_priv.h:32,
>                  from glamor.c:37:
> ../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
>   282 | } GC;
>       |   ^~
> In file included from /usr/include/EGL/eglplatform.h:122,
>                  from /usr/include/epoxy/egl_generated.h:11,
>                  from /usr/include/epoxy/egl.h:46,
>                  from glamor_priv.h:43,
>                  from glamor_core.c:36:
> /usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
>   222 | *GC;
>       |  ^~
> In file included from glamor.h:34,
>                  from glamor_priv.h:32,
>                  from glamor_core.c:36:
> ../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
>   282 | } GC;
>       |   ^~
> In file included from /usr/include/EGL/eglplatform.h:122,
>                  from /usr/include/epoxy/egl_generated.h:11,
>                  from /usr/include/epoxy/egl.h:46,
>                  from glamor_priv.h:43,
>                  from glamor_composite_glyphs.c:25:
> /usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
>   222 | *GC;
>       |  ^~
> In file included from glamor.h:34,
>                  from glamor_priv.h:32,
>                  from glamor_composite_glyphs.c:25:
> ../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
>   282 | } GC;
>       |   ^~
> In file included from /usr/include/EGL/eglplatform.h:122,
>                  from /usr/include/epoxy/egl_generated.h:11,
>                  from /usr/include/epoxy/egl.h:46,
>                  from glamor_priv.h:43,
>                  from glamor_font.c:23:
> /usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
>   222 | *GC;
>       |  ^~
> In file included from glamor.h:34,
>                  from glamor_priv.h:32,
>                  from glamor_font.c:23:
> ../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
>   282 | } GC;
>       |   ^~
> In file included from /usr/include/EGL/eglplatform.h:122,
>                  from /usr/include/epoxy/egl_generated.h:11,
>                  from /usr/include/epoxy/egl.h:46,
>                  from glamor_priv.h:43,
>                  from glamor_copy.c:23:
> /usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
>   222 | *GC;
>       |  ^~
> In file included from glamor.h:34,
>                  from glamor_priv.h:32,
>                  from glamor_copy.c:23:
> ../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
>   282 | } GC;
>       |   ^~
> In file included from /usr/include/EGL/eglplatform.h:122,
>                  from /usr/include/epoxy/egl_generated.h:11,
>                  from /usr/include/epoxy/egl.h:46,
>                  from glamor_priv.h:43,
>                  from glamor_image.c:23:
> /usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
>   222 | *GC;
>       |  ^~
> In file included from glamor.h:34,
>                  from glamor_priv.h:32,
>                  from glamor_image.c:23:
> ../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
>   282 | } GC;
>       |   ^~
> make[1]: *** [Makefile:767: glamor_core.lo] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make[1]: *** [Makefile:767: glamor.lo] Error 1
> In file included from /usr/include/EGL/eglplatform.h:122,
>                  from /usr/include/epoxy/egl_generated.h:11,
>                  from /usr/include/epoxy/egl.h:46,
>                  from glamor_priv.h:43,
>                  from glamor_dash.c:23:
> /usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
>   222 | *GC;
>       |  ^~
> In file included from glamor.h:34,
>                  from glamor_priv.h:32,
>                  from glamor_dash.c:23:
> ../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
>   282 | } GC;
>       |   ^~
> make[1]: *** [Makefile:767: glamor_composite_glyphs.lo] Error 1
> make[1]: *** [Makefile:767: glamor_font.lo] Error 1
> make[1]: *** [Makefile:767: glamor_copy.lo] Error 1
> make[1]: *** [Makefile:767: glamor_image.lo] Error 1
> make[1]: *** [Makefile:767: glamor_dash.lo] Error 1
> libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../include
> -Wall -Wpointer-arith -Wmissing-declarations -Wformat=2 -Wstrict-prototypes
> -Wmissing-prototypes -Wnested-externs -Wbad-function-cast
> -Wold-style-definition -Wdeclaration-after-statement -Wunused
> -Wuninitialized -Wshadow -Wmissing-noreturn -Wmissing-format-attribute
> -Wredundant-decls -Wlogical-op -Wimplicit -Wnonnull -Winit-self -Wmain
> -Wmissing-braces -Wsequence-point -Wreturn-type -Wtrigraphs -Warray-bounds
> -Wwrite-strings -Waddress -Wint-to-pointer-cast -Wpointer-to-int-cast
> -fno-strict-aliasing -DHAVE_DIX_CONFIG_H -Wall -Wpointer-arith
> -Wmissing-declarations -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes
> -Wnested-externs -Wbad-function-cast -Wold-style-definition
> -Wdeclaration-after-statement -Wunused -Wuninitialized -Wshadow
> -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wlogical-op
> -Wimplicit -Wnonnull -Winit-self -Wmain -Wmissing-braces -Wsequence-point
> -Wreturn-type -Wtrigraphs -Warray-bounds -Wwrite-strings -Waddress
> -Wint-to-pointer-cast -Wpointer-to-int-cast -fno-strict-aliasing
> -fno-strict-aliasing -D_DEFAULT_SOURCE -D_BSD_SOURCE -DHAS_FCHOWN
> -DHAS_STICKY_DIR_BIT -I/usr/include/pixman-1 -I/usr/include/X11/dri
> -I/usr/include/libdrm -I/usr/include/freetype2 -I../include -I../include
> -I../Xext -I../composite -I../damageext -I../xfixes -I../Xi -I../mi
> -I../miext/sync -I../miext/shadow -I../miext/damage -I../render -I../randr
> -I../fb -I../dbe -I../present -fvisibility=hidden -O2 -pipe -march=native
> -ftree-vectorize -pthread -c glamor_lines.c  -fPIC -DPIC -o
> .libs/glamor_lines.o
> In file included from /usr/include/EGL/eglplatform.h:122,
>                  from /usr/include/epoxy/egl_generated.h:11,
>                  from /usr/include/epoxy/egl.h:46,
>                  from glamor_priv.h:43,
>                  from glamor_lines.c:23:
> /usr/include/X11/Xlib.h:222:2: error: conflicting types for ‘GC’
>   222 | *GC;
>       |  ^~
> In file included from glamor.h:34,
>                  from glamor_priv.h:32,
>                  from glamor_lines.c:23:
> ../include/gcstruct.h:282:3: note: previous declaration of ‘GC’ was here
>   282 | } GC;
>       |   ^~
> make[1]: *** [Makefile:767: glamor_lines.lo] Error 1
> make[1]: Leaving directory
> '/var/tmp/portage/x11-base/xorg-server-1.20.5/work/xorg-server-1.20.5/glamor'
> make: *** [Makefile:816: all-recursive] Error 1
>  * ERROR: x11-base/xorg-server-1.20.5::gentoo failed (compile phase):
>  *   emake failed
> 
> Is this relevant?
> 
> https://gitlab.freedesktop.org/xorg/xserver/issues/914

I'm trying to repeat this success but I'm stuck with this error. I use xorg-server-1.20.6 that has the patches from the issue 914 and still I get the same errors.
Comment 58 Matt Turner gentoo-dev 2019-11-25 21:10:22 UTC
(In reply to Anton Gubarkov from comment #57)
> I'm trying to repeat this success but I'm stuck with this error. I use
> xorg-server-1.20.6 that has the patches from the issue 914 and still I get
> the same errors.

You also need the glvnd patch

From 51233cc52cbcbe25f8461830913c06f5b5bc9508 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Thu, 17 Oct 2019 11:51:37 -0400
Subject: [PATCH] egl: Sync with Khronos

    commit de3a5e867d906a04a5c37ee0d89e7f01d3598eb9
    Author: Ken Russell <kbrussel@alum.mit.edu>
    Date:   Sat Oct 12 05:44:43 2019 -0700

        Reserve enums 0x34A0..0x34AF for ANGLE project. (#93)

Closes: https://gitlab.freedesktop.org/glvnd/libglvnd/issues/193

which will be in the next release.
Comment 59 Anton Gubarkov 2019-11-26 13:28:39 UTC
(In reply to Matt Turner from comment #58)
> (In reply to Anton Gubarkov from comment #57)
> > I'm trying to repeat this success but I'm stuck with this error. I use
> > xorg-server-1.20.6 that has the patches from the issue 914 and still I get
> > the same errors.
> 
> You also need the glvnd patch
> 
> From 51233cc52cbcbe25f8461830913c06f5b5bc9508 Mon Sep 17 00:00:00 2001
> From: Adam Jackson <ajax@redhat.com>
> Date: Thu, 17 Oct 2019 11:51:37 -0400
> Subject: [PATCH] egl: Sync with Khronos
> 
>     commit de3a5e867d906a04a5c37ee0d89e7f01d3598eb9
>     Author: Ken Russell <kbrussel@alum.mit.edu>
>     Date:   Sat Oct 12 05:44:43 2019 -0700
> 
>         Reserve enums 0x34A0..0x34AF for ANGLE project. (#93)
> 
> Closes: https://gitlab.freedesktop.org/glvnd/libglvnd/issues/193
> 
> which will be in the next release.

Indeed. With this patch Xorg compiles and render offloading works fine. 

What I can't achieve is multi-monitor setup under Gnome 3.32. 
HDMI is wired to my Quadro only. The external monitor lights up and displays the background when gdm asks for password. As soon as I login the signal dies.

I can see in my logs:
ноя 26 16:09:20 PF16W6Y2 /usr/libexec/gdm-x-session[1673047]: (--) NVIDIA(GPU-0): SONY TV (DFP-2): connected
ноя 26 16:09:20 PF16W6Y2 /usr/libexec/gdm-x-session[1673047]: (--) NVIDIA(GPU-0): SONY TV (DFP-2): Internal TMDS
ноя 26 16:09:20 PF16W6Y2 /usr/libexec/gdm-x-session[1673047]: (--) NVIDIA(GPU-0): SONY TV (DFP-2): 600.0 MHz maximum pixel clock
ноя 26 16:09:20 PF16W6Y2 /usr/libexec/gdm-x-session[1673047]: (--) NVIDIA(GPU-0):
Comment 60 Rick Harris 2019-11-30 10:43:47 UTC
(In reply to Rick Harris from comment #46)
> Can confirm applying the patches for xorg-server and libglvnd listed at
> https://gitlab.freedesktop.org/xorg/xserver/issues/914 fix the issue.

Thanks for applying patches to fix.

Next one needed on from 193 is https://gitlab.freedesktop.org/glvnd/libglvnd/issues/194, will attach the patch for that.

If it's not included we end up with situations like in bug #699190.
Similar problem occurs for media-tv/kodi using libglvnd.

Thanks again :)
Comment 62 Larry the Git Cow gentoo-dev 2019-12-05 22:30:37 UTC
The bug has been referenced in the following commit(s):

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

commit c5a3bcfbd25b0e185169071cd08760ea0d2fcaa7
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2019-12-05 22:09:02 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2019-12-05 22:30:10 +0000

    profiles: Move USE=libglvnd to use.stable.mask
    
    ... and to profiles for arches without keywords.
    
    Bug: https://bugs.gentoo.org/692206
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 profiles/arch/alpha/use.mask  | 10 +++++++---
 profiles/arch/arm/use.mask    |  7 +++++++
 profiles/arch/arm64/use.mask  |  7 +++++++
 profiles/arch/hppa/use.mask   | 10 +++++++---
 profiles/arch/ia64/use.mask   |  7 ++++++-
 profiles/arch/m68k/use.mask   |  4 ++++
 profiles/arch/mips/use.mask   |  4 ++++
 profiles/arch/riscv/use.mask  |  6 +++++-
 profiles/arch/s390/use.mask   |  4 ++++
 profiles/arch/sh/use.mask     |  7 +++++++
 profiles/arch/sparc/use.mask  |  4 +++-
 profiles/base/use.mask        |  4 ----
 profiles/base/use.stable.mask |  4 ++++
 13 files changed, 65 insertions(+), 13 deletions(-)

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

commit eaeb3708a3f8da04bb6e3713c967e8a365563a5b
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2019-12-05 22:05:29 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2019-12-05 22:29:34 +0000

    profiles: Drop media-libs/libglvnd from package.mask
    
    Bug: https://bugs.gentoo.org/692206
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 profiles/package.mask | 5 -----
 1 file changed, 5 deletions(-)
Comment 63 Matt Turner gentoo-dev 2019-12-05 22:37:04 UTC
Okay, media-libs/libglvnd is unmasked and has KEYWORDS="~amd64 ~ppc ~ppc64 ~x86" initially. I'll request other architecture teams add keywords.

USE=libglvnd is in use.stable.mask, which means you'll be able to enable the flag if you're running unstable packages with that flag (mesa, xorg-server, nvidia-drivers, currently).

The plan is to
   (1) Test
   (2) Add more ~arch keywords
   (3) Stabilize
   (4) Remove IUSE=libglvnd and always require it

Obviously all of that depends on how many bugs we find :)
Comment 64 Matt Turner gentoo-dev 2020-01-17 22:50:33 UTC
(In reply to Matt Turner from comment #63)
> The plan is to
>    (1) Test
>    (2) Add more ~arch keywords

Done

>    (3) Stabilize

I think we'll stabilize with Mesa 19.3.

>    (4) Remove IUSE=libglvnd and always require it

And then use.force USE=libglvnd when 20.0 is stabilized or something like that.
Comment 65 Sergey Torokhov 2020-03-08 00:16:35 UTC
with today update:

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U  ] virtual/man-0-r3::gentoo [0-r2::gentoo] 0 KiB
[ebuild  N     ] media-libs/libglvnd-1.3.1::gentoo  USE="X -test" ABI_X86="32 (64) (-x32)" 698 KiB
[ebuild   R    ] x11-base/xorg-server-1.20.7:0/1.20.7::gentoo  USE="libglvnd* suid udev xorg xvfb -debug -dmx -doc -elogind -ipv6 -kdrive -libressl -minimal (-selinux) -static-libs -systemd -unwind -wayland -xcsecurity -xephyr -xnest" 0 KiB
[blocks B      ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is blocking x11-base/xorg-server-1.20.7)
[blocks B      ] media-libs/mesa[-libglvnd(-)] ("media-libs/mesa[-libglvnd(-)]" is blocking media-libs/libglvnd-1.3.1)


I use stable profile for system base packages such xorg-server and mesa.
Should I use mesa[libglvnd] to resolve issue or xorg-server[-libglvnd]?

By the way, where I could read about this new feature more?
It just instead of app-eselect/eselect-opengl package?
Comment 66 Matt Turner gentoo-dev 2020-03-08 00:32:50 UTC
(In reply to Sergey Torokhov from comment #65)
> with today update:
> 
> These are the packages that would be merged, in order:
> 
> Calculating dependencies... done!
> [ebuild     U  ] virtual/man-0-r3::gentoo [0-r2::gentoo] 0 KiB
> [ebuild  N     ] media-libs/libglvnd-1.3.1::gentoo  USE="X -test"
> ABI_X86="32 (64) (-x32)" 698 KiB
> [ebuild   R    ] x11-base/xorg-server-1.20.7:0/1.20.7::gentoo 
> USE="libglvnd* suid udev xorg xvfb -debug -dmx -doc -elogind -ipv6 -kdrive
> -libressl -minimal (-selinux) -static-libs -systemd -unwind -wayland
> -xcsecurity -xephyr -xnest" 0 KiB
> [blocks B      ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is
> blocking x11-base/xorg-server-1.20.7)
> [blocks B      ] media-libs/mesa[-libglvnd(-)]
> ("media-libs/mesa[-libglvnd(-)]" is blocking media-libs/libglvnd-1.3.1)
> 
> 
> I use stable profile for system base packages such xorg-server and mesa.
> Should I use mesa[libglvnd] to resolve issue or xorg-server[-libglvnd]?

Sorry about that. I just pushed a commit to enable USE=libglvnd by default for all Mesa versions. I would recommend enabling it everywhere.
 
> By the way, where I could read about this new feature more?
> It just instead of app-eselect/eselect-opengl package?

Basically, before libglvnd each OpenGL driver (nvidia-drivers, Mesa, ati-drivers when it existed) installed its own libGL.so. eselect-opengl allowed the user to switch symlinks from /usr/lib/libGL.so to point to their driver's libGL.so. Pretty hacky.

libglvnd now provides libGL.so, and with USE=libglvnd Mesa and nvidia-drivers will simply use that libGL.so, so no more conflicts and no more need for eselect-opengl :)
Comment 67 Thibaud CANALE 2020-03-08 11:01:14 UTC
Hello,

Just to keep tracks, bug 711780 is about order of recompiling packages.

Best regards,
Comment 68 Samuel Bernardo 2020-03-08 13:42:32 UTC
Upgrading into nvidia-drivers-440.59 I found the following dependencies block:
[blocks B     ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is blocking x11-drivers/nvidia-drivers-440.59)                                                                                                                                           
[blocks B     ] media-libs/mesa[-libglvnd(-)] ("media-libs/mesa[-libglvnd(-)]" is blocking media-libs/libglvnd-1.3.1)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                  
  (app-eselect/eselect-opengl-1.3.1-r4:0/0::gentoo, installed) pulled in by
    >=app-eselect/eselect-opengl-1.3.0 required by (x11-base/xorg-server-1.20.7:0/1.20.7::gentoo, installed) USE="dmx ipv6 kdrive suid systemd udev wayland xephyr xnest xorg xvfb -debug -doc -elogind -libglvnd -libressl -minimal (-selinux) -static-libs -unwi
nd -xcsecurity" ABI_X86="(64)"                                                                                                                                                                                                                                    
    >=app-eselect/eselect-opengl-1.3.0 required by (media-libs/mesa-20.0.0:0/0::gentoo, installed) USE="X classic dri3 egl gallium gbm gles2 llvm opencl vaapi vdpau wayland xvmc zstd -d3d9 -debug -gles1 -libglvnd -lm-sensors -osmesa (-selinux) -test -unwind 
-valgrind -vulkan -vulkan-overlay -xa" ABI_X86="(64) -32 (-x32)" VIDEO_CARDS="radeonsi (-freedreno) -i915 -i965 -intel -iris (-lima) -nouveau (-panfrost) -r100 -r200 -r300 -r600 -radeon (-vc4) -virgl (-vivante) -vmware"

I also forced mesa use flag libglvnd but because of dependencies emerge forces media-libs/mesa[-libglvnd(-)] ("media-libs/mesa[-libglvnd(-)]".
Comment 69 Matt Turner gentoo-dev 2020-03-09 00:12:32 UTC
(In reply to Samuel Bernardo from comment #68)
> Upgrading into nvidia-drivers-440.59 I found the following dependencies
> block:
> [blocks B     ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is
> blocking x11-drivers/nvidia-drivers-440.59)                                 
> 
> [blocks B     ] media-libs/mesa[-libglvnd(-)]
> ("media-libs/mesa[-libglvnd(-)]" is blocking media-libs/libglvnd-1.3.1)
> 
>  * Error: The above package list contains packages which cannot be
>  * installed at the same time on the same system.                           
> 
>                                                                             
> 
>   (app-eselect/eselect-opengl-1.3.1-r4:0/0::gentoo, installed) pulled in by
>     >=app-eselect/eselect-opengl-1.3.0 required by
> (x11-base/xorg-server-1.20.7:0/1.20.7::gentoo, installed) USE="dmx ipv6
> kdrive suid systemd udev wayland xephyr xnest xorg xvfb -debug -doc -elogind
> -libglvnd -libressl -minimal (-selinux) -static-libs -unwi
> nd -xcsecurity" ABI_X86="(64)"                                              
> 
>     >=app-eselect/eselect-opengl-1.3.0 required by
> (media-libs/mesa-20.0.0:0/0::gentoo, installed) USE="X classic dri3 egl
> gallium gbm gles2 llvm opencl vaapi vdpau wayland xvmc zstd -d3d9 -debug
> -gles1 -libglvnd -lm-sensors -osmesa (-selinux) -test -unwind 
> -valgrind -vulkan -vulkan-overlay -xa" ABI_X86="(64) -32 (-x32)"
> VIDEO_CARDS="radeonsi (-freedreno) -i915 -i965 -intel -iris (-lima) -nouveau
> (-panfrost) -r100 -r200 -r300 -r600 -radeon (-vc4) -virgl (-vivante) -vmware"
> 
> I also forced mesa use flag libglvnd but because of dependencies emerge
> forces media-libs/mesa[-libglvnd(-)] ("media-libs/mesa[-libglvnd(-)]".

Try now after emerge --sync, with emerge -uN.
Comment 70 Matt Turner gentoo-dev 2020-03-09 00:12:58 UTC
USE=libglvnd is enabled by default now. Closing tracker.
Comment 71 Benjamin Réveillé 2020-03-11 19:37:27 UTC
nvidia-drivers-340 does not know how to switch from eselect-opengl to libglvnd...
Should I just add -libglvnd to /etc/portage/make.conf (it works...) or will nvidia-drivers-340 ebuild also get a patch to work with libglvnd ?
Comment 72 Matt Turner gentoo-dev 2020-03-11 20:26:54 UTC
(In reply to Benjamin Réveillé from comment #71)
> nvidia-drivers-340 does not know how to switch from eselect-opengl to
> libglvnd...
> Should I just add -libglvnd to /etc/portage/make.conf (it works...) or will
> nvidia-drivers-340 ebuild also get a patch to work with libglvnd ?

As far as I'm aware (according to bug 711942) libglvnd is only available in versions >=390. v390 in gentoo however still lacks support, but it should be added.

For 340, indeed, you should set USE=-libglvnd. At the same time, I expect nvidia-drivers 340 to be removed at some point in the not-too-distant future...
Comment 73 Benjamin Réveillé 2020-03-14 17:22:11 UTC
(In reply to Matt Turner from comment #72)
> (In reply to Benjamin Réveillé from comment #71)
> > nvidia-drivers-340 does not know how to switch from eselect-opengl to
> > libglvnd...
> > Should I just add -libglvnd to /etc/portage/make.conf (it works...) or will
> > nvidia-drivers-340 ebuild also get a patch to work with libglvnd ?
> 
> As far as I'm aware (according to bug 711942) libglvnd is only available in
> versions >=390. v390 in gentoo however still lacks support, but it should be
> added.
> 
> For 340, indeed, you should set USE=-libglvnd. At the same time, I expect
> nvidia-drivers 340 to be removed at some point in the not-too-distant
> future...

Guess I'll be forced to upgrade my graphics card then...
Comment 74 Bruno Santos 2020-04-06 18:12:12 UTC
I use nvidia-drivers 390 and still getting the blockage...

[ebuild  N     ] acct-group/video-0::gentoo  0 KiB
[ebuild  N     ] app-eselect/eselect-opengl-1.3.1-r4::gentoo  0 KiB
[ebuild  N     ] x11-drivers/nvidia-drivers-390.132-r1:0/390::gentoo  USE="X acpi compat driver gtk3 multilib static-libs tools -kms -uvm -wayland" ABI_X86="32 (64) (-x32)" 0 KiB
[blocks B      ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is blocking media-libs/mesa-19.3.5, x11-base/xorg-server-1.20.7)
[blocks B      ] x11-drivers/nvidia-drivers[-libglvnd(-)] ("x11-drivers/nvidia-drivers[-libglvnd(-)]" is hard blocking x11-base/xorg-server-1.20.7)

Already emerged xorg-server and mesa with libglvnd enabled....

will nvidia-drivers v390 get support ?
Comment 75 Matt Turner gentoo-dev 2020-04-06 18:40:05 UTC
(In reply to Bruno Santos from comment #74)
> I use nvidia-drivers 390 and still getting the blockage...
> 
> [ebuild  N     ] acct-group/video-0::gentoo  0 KiB
> [ebuild  N     ] app-eselect/eselect-opengl-1.3.1-r4::gentoo  0 KiB
> [ebuild  N     ] x11-drivers/nvidia-drivers-390.132-r1:0/390::gentoo  USE="X
> acpi compat driver gtk3 multilib static-libs tools -kms -uvm -wayland"
> ABI_X86="32 (64) (-x32)" 0 KiB
> [blocks B      ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is
> blocking media-libs/mesa-19.3.5, x11-base/xorg-server-1.20.7)
> [blocks B      ] x11-drivers/nvidia-drivers[-libglvnd(-)]
> ("x11-drivers/nvidia-drivers[-libglvnd(-)]" is hard blocking
> x11-base/xorg-server-1.20.7)
> 
> Already emerged xorg-server and mesa with libglvnd enabled....
> 
> will nvidia-drivers v390 get support ?

Yes, it's in the unstable version 390.132-r2. I expect it to be stabilized soon, but go ahead and add it to your package.accept_keywords.
Comment 76 Kete Tefid 2020-04-11 15:41:13 UTC
Please consider that enabling this libglvnd breaks the functionality of primusrun, optirun and bumblebee in general. 

I wish you had enabled this with more precaution. You know that libglvnd is relevant in systems with more than one primary graphics card which means very likely those users rely on optimus/bumblebee. libglvnd breaks them, unless you have already adapted primusrun and bumblebee first before enabling this flag, which you did not.

What is more, it makes it impossible (through default ways) to remove libglvnd flag from a system once you update with it. No matter the backtrack I used, this is the output:

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] app-eselect/eselect-opengl-1.3.1-r4::gentoo  3 KiB
[ebuild   R    ] media-libs/mesa-19.3.5::gentoo  USE="X classic dri3 egl gallium gbm gles2 llvm vaapi vdpau -d3d9 -debug -gles1 -libglvnd* -lm-sensors -opencl -osmesa -pax_kernel (-selinux) -test -unwind -valgrind -vulkan -vulkan-overlay -wayland -xa -xvmc" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="i965 intel (-freedreno) -i915 -iris (-lima) -nouveau (-panfrost) -r100 -r200 -r300 -r600 -radeon -radeonsi (-vc4) -virgl (-vivante) -vmware" 0 KiB
[uninstall     ] media-libs/libglvnd-1.3.1::gentoo  USE="X -test" ABI_X86="32 (64) (-x32)" 
[blocks b      ] media-libs/mesa[-libglvnd(-)] ("media-libs/mesa[-libglvnd(-)]" is blocking media-libs/libglvnd-1.3.1)
[ebuild   R    ] x11-base/xorg-server-1.20.7:0/1.20.7::gentoo  USE="ipv6 suid udev xorg -debug -dmx -doc -elogind -kdrive -libglvnd* -libressl -minimal (-selinux) -static-libs -systemd -unwind -wayland -xcsecurity -xephyr -xnest -xvfb" 0 KiB
[ebuild   R    ] x11-drivers/nvidia-drivers-440.64:0/440::gentoo  USE="X acpi compat driver gtk3 kms multilib static-libs tools uvm -libglvnd* -wayland" ABI_X86="32 (64) (-x32)" 0 KiB
[blocks B      ] x11-drivers/nvidia-drivers[-libglvnd(-)] ("x11-drivers/nvidia-drivers[-libglvnd(-)]" is hard blocking x11-base/xorg-server-1.20.7)
[blocks B      ] app-eselect/eselect-opengl ("app-eselect/eselect-opengl" is blocking x11-drivers/nvidia-drivers-440.64, media-libs/mesa-19.3.5, x11-base/xorg-server-1.20.7)

Total: 4 packages (1 new, 3 reinstalls, 1 uninstall), Size of downloads: 3 KiB
Conflict: 3 blocks (2 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.

  (x11-drivers/nvidia-drivers-440.64:0/440::gentoo, ebuild scheduled for merge) pulled in by
    x11-drivers/nvidia-drivers[multilib] required by (games-util/steam-client-meta-0-r20200328:0/0::steam-overlay, installed) USE="flash pulseaudio steamruntime -steamfonts -steamvr -trayicon" ABI_X86="(64)" VIDEO_CARDS="intel nvidia"
    x11-drivers/nvidia-drivers[multilib] required by (games-util/steam-games-meta-0-r20191109:0/0::steam-overlay, installed) USE="steamruntime -mono -steamgames_bioshock_infinite -steamgames_defenders_quest -steamgames_dirt_rally -steamgames_dont_starve -steamgames_dwarfs -steamgames_hammerwatch -steamgames_ironclad_tactics -steamgames_journey_down -steamgames_narcissu -steamgames_painkiller -steamgames_portal -steamgames_shadow_mordor -steamgames_shatter -steamgames_source_engine -steamgames_te120 -steamgames_tf2 -steamgames_trine2 -steamgames_unwritten_tales -steamgames_voidexpanse -steamgames_witcher2" ABI_X86="(64)" VIDEO_CARDS="nvidia"
    >=x11-drivers/nvidia-drivers-390.25[abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_riscv_lp64d(-)?,abi_riscv_lp64(-)?,abi_s390_32(-)?,abi_s390_64(-)?] (>=x11-drivers/nvidia-drivers-390.25[abi_x86_32(-),abi_x86_64(-)]) required by (media-libs/nv-codec-headers-9.0.18.1:0/0::gentoo, installed) USE="" ABI_X86="32 (64) (-x32)"
    x11-drivers/nvidia-drivers required by (app-laptop/thinkfan-1.0.2:0/0::gentoo, installed) USE="nvidia yaml -atasmart" ABI_X86="(64)"
    x11-drivers/nvidia-drivers[tools,static-libs] required by (xfce-extra/xfce4-sensors-plugin-1.3.0-r1:0/0::gentoo, installed) USE="acpi libnotify lm-sensors -hddtemp" ABI_X86="(64)" VIDEO_CARDS="nvidia"
    x11-drivers/nvidia-drivers required by (x11-base/xorg-drivers-1.20-r1:0/0::gentoo, installed) USE="" ABI_X86="(64)" INPUT_DEVICES="evdev joystick synaptics -elographics -keyboard -libinput -mouse -vmmouse -void -wacom" VIDEO_CARDS="i965 intel nvidia -amdgpu -ast -dummy -fbdev (-freedreno) (-geode) -glint -i915 -mga -nouveau -nv (-omap) -qxl -r128 -radeon -radeonsi -siliconmotion (-tegra) (-vc4) -vesa -via -virtualbox -vmware"
    x11-drivers/nvidia-drivers[tools,static-libs] required by (app-admin/conky-1.10.8-r4:0/0::gentoo, installed) USE="X iconv ipv6 lua-cairo ncurses nvidia portmon pulseaudio thinkpad truetype wifi -apcupsd -cmus -curl -eve -hddtemp -ical -imlib -iostats -irc -lua-imlib -lua-rsvg -math -moc -mpd -mysql -nano-syntax -rss -systemd -vim-syntax -weather-metar -webserver -xmms2" ABI_X86="(64)"

  (app-eselect/eselect-opengl-1.3.1-r4:0/0::gentoo, ebuild scheduled for merge) pulled in by
    >=app-eselect/eselect-opengl-1.3.0 required by (media-libs/mesa-19.3.5:0/0::gentoo, ebuild scheduled for merge) USE="X classic dri3 egl gallium gbm gles2 llvm vaapi vdpau -d3d9 -debug -gles1 -libglvnd -lm-sensors -opencl -osmesa -pax_kernel (-selinux) -test -unwind -valgrind -vulkan -vulkan-overlay -wayland -xa -xvmc" ABI_X86="32 (64) (-x32)" VIDEO_CARDS="i965 intel (-freedreno) -i915 -iris (-lima) -nouveau (-panfrost) -r100 -r200 -r300 -r600 -radeon -radeonsi (-vc4) -virgl (-vivante) -vmware"
    >=app-eselect/eselect-opengl-1.3.0 required by (x11-base/xorg-server-1.20.7:0/1.20.7::gentoo, ebuild scheduled for merge) USE="ipv6 suid udev xorg -debug -dmx -doc -elogind -kdrive -libglvnd -libressl -minimal (-selinux) -static-libs -systemd -unwind -wayland -xcsecurity -xephyr -xnest -xvfb" ABI_X86="(64)"
    >=app-eselect/eselect-opengl-1.0.9 required by (x11-drivers/nvidia-drivers-440.64:0/440::gentoo, ebuild scheduled for merge) USE="X acpi compat driver gtk3 kms multilib static-libs tools uvm -libglvnd -wayland" ABI_X86="32 (64) (-x32)"
Comment 77 Kete Tefid 2020-04-11 16:38:55 UTC
Please see:
https://bugs.gentoo.org/716918
Comment 78 Matt Turner gentoo-dev 2020-04-11 18:30:32 UTC
(In reply to Kete Tefid from comment #76)
> Please consider that enabling this libglvnd breaks the functionality of
> primusrun, optirun and bumblebee in general. 
> 
> I wish you had enabled this with more precaution. You know that libglvnd is
> relevant in systems with more than one primary graphics card which means
> very likely those users rely on optimus/bumblebee. libglvnd breaks them,
> unless you have already adapted primusrun and bumblebee first before
> enabling this flag, which you did not.

I love the accusatory language. Always motivates me to help!

I assume your message was truncated and that's why the thanks for the ten years of maintaining X11 on Gentoo was missing. In any case, you're very welcome!
Comment 79 Kete Tefid 2020-04-11 18:53:22 UTC
(In reply to Matt Turner from comment #78)

> I love the accusatory language. Always motivates me to help!
> 
> I assume your message was truncated and that's why the thanks for the ten
> years of maintaining X11 on Gentoo was missing. In any case, you're very
> welcome!

Sorry if it sounded like that to you, but I did not want to accuse anyone. Also thank you all and anyone who has contributed to maintaining X11 with their time and money.

Please do not take my frustration (if it sounded so) as a disregard to the team's efforts. I did not mean so. 

Anyway, enabling libglvnd seems to have become a priority. Considering that Gentoo has been careful about stability and functionality, the current move of enabling libglvnd without considering every side-effect of it (as you can see to bumblebee users) was a little strange at least.

It would be very good if we could do something about bumblebee. The other distros have enabled it along with fixing the implementation of bumblebee and of course Gentoo can do so.
Comment 80 Nikolay Kichukov 2020-05-10 17:35:23 UTC
This worked nicely, well done, thanks!

However, if one tries to attach a second monitor to this configuration, it is only detected by the dGPU, but the iGPU does not know anything about it. Thus xrandr extension cannot enable it.

Is there an easy way to allow 'reverse PRIME' to detect and use the screens from dGPU? All displayport/hdmi outputs are only wired to the dGPU...

For now, I had to make a bios change to use only the discrete graphics adapter so that I can use the additional outputs.
Comment 81 Anton Gubarkov 2020-10-26 10:01:44 UTC
(In reply to Nikolay Kichukov from comment #80)
> This worked nicely, well done, thanks!
> 
> However, if one tries to attach a second monitor to this configuration, it
> is only detected by the dGPU, but the iGPU does not know anything about it.
> Thus xrandr extension cannot enable it.
> 
> Is there an easy way to allow 'reverse PRIME' to detect and use the screens
> from dGPU? All displayport/hdmi outputs are only wired to the dGPU...
> 
> For now, I had to make a bios change to use only the discrete graphics
> adapter so that I can use the additional outputs.

I have a similar config to yours. Once I got render offload via PRIME and libglvnd working, all I need to do to use external monitors for desktop extension:

1. find out the names/numbers of the providers:
anton@PF16W6Y2 ~ $ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x43 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 1 associated providers: 0 name:modesetting
Provider 1: id: 0x2b5 cap: 0x2, Sink Output crtcs: 4 outputs: 5 associated providers: 0 name:NVIDIA-G0

2. issue the xrandr command to activate reverse PRIME:
anton@PF16W6Y2 ~ $ xrandr --setprovideroutputsource NVIDIA-G0 modesetting

after this the monitor connected to my DP port appears in the Gnome displays control panel and can be used for mirroring or desktop extension. However I can't use different scaling factors for my 4K 15" internal panel (requires 200% scaling) and an external monitor (at 100% scaling).