eglGetDisplay(EGL_DEFAULT_DISPLAY) returns EGL_NO_DISPLAY

Bug #1674677 reported by Thomas Foster
36
This bug affects 7 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
Confirmed
High
Unassigned
nvidia-graphics-drivers-367 (Ubuntu)
Confirmed
High
Unassigned
nvidia-graphics-drivers-375 (Ubuntu)
Fix Released
High
Unassigned

Bug Description

I am using EGL to obtain offscreen rendering contexts, but upgrading this package today broke my application. I have written a small test case, that I expect to print "PASS":

```
#include <EGL/egl.h>
#include <iostream>

int main(int argc, char **argv) {
    EGLDisplay eglDpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    std::cout << ((eglDpy == EGL_NO_DISPLAY) ? "FAIL" : "PASS") << std::endl;
}
```

Build with e.g. `g++ egl_test.cpp -lEGL`. Using nvidia-375 (375.39-0ubuntu0.16.04.1), this test program will print "FAIL", because `eglGetDisplay(EGL_DEFAULT_DISPLAY)` returns `EGL_NO_DISPLAY`. If I install the 375.39 driver using Nvidia's installer, the test passes, so I think it is not an upstream issue.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: nvidia-375 375.39-0ubuntu0.16.04.1
ProcVersionSignature: Ubuntu 4.4.0-67.88-generic 4.4.49
Uname: Linux 4.4.0-67-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.1-0ubuntu2.5
Architecture: amd64
CurrentDesktop: MATE
Date: Tue Mar 21 12:41:31 2017
EcryptfsInUse: Yes
InstallationDate: Installed on 2016-10-11 (160 days ago)
InstallationMedia: Xubuntu 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160719)
SourcePackage: nvidia-graphics-drivers-375
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Thomas Foster (thomasvfoster) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nvidia-graphics-drivers-375 (Ubuntu):
status: New → Confirmed
Revision history for this message
helltone (gafunchal) wrote :

EGL seems to be completely broken in both the current version of the nvidia-367 package (which installs 375.39) on Ubuntu 16.04, and also the nvidia-375 package on Ubuntu 16.10. I can't get past the initialisation using eglGetDisplay, same as show in the testcase in the bug description.

Revision history for this message
Dario Limongi (limee) wrote :

Seems the EGL linking is broken, libEGL.so.1 doesn't link to anything (in both /usr/lib/nvidia-375 and /usr/lib32/nvidia-375).

These fixed my machine and could open an EGL display:

cd /usr/lib/nvidia-375
sudo ln -sf libEGL.so.1 libEGL.so.375.39

cd /usr/lib32/nvidia-375
sudo ln -sf libEGL.so.1 libEGL.so.375.39

Revision history for this message
Adrien Beau (adrienbeau) wrote :

I came to this issue from another route: ever since installing package nvidia-375, I have the following warnings every time APT runs the libc-bin trigger:

Processing triggers for libc-bin (2.23-0ubuntu7) ...
/sbin/ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link
/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link

The warning is correct:

$ ls -l /usr/lib/nvidia-375/libEGL.so*
lrwxrwxrwx 1 root root 11 mars 17 11:31 /usr/lib/nvidia-375/libEGL.so -> libEGL.so.1
-rw-r--r-- 1 root root 77264 févr. 1 04:35 /usr/lib/nvidia-375/libEGL.so.1
-rw-r--r-- 1 root root 20608 févr. 1 04:35 /usr/lib/nvidia-375/libEGL.so.375.39

$ ls -l /usr/lib32/nvidia-375/libEGL.so*
lrwxrwxrwx 1 root root 11 mars 17 11:30 /usr/lib32/nvidia-375/libEGL.so -> libEGL.so.1
-rw-r--r-- 1 root root 71688 févr. 1 04:15 /usr/lib32/nvidia-375/libEGL.so.1
-rw-r--r-- 1 root root 15940 févr. 1 04:15 /usr/lib32/nvidia-375/libEGL.so.375.39

All the files appear to be valid ELF binaries, but with significant differences in size. I have no idea which one to remove and replace by a symlink.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nvidia-graphics-drivers-367 (Ubuntu):
status: New → Confirmed
Revision history for this message
Cody Planteen (planteen) wrote :

I have the same problem. Attempting to link against /usr/lib/nvidia-375/libEGL.so.375.39, /usr/lib/x86_64-linux-gnu/mesa-egl/libEGL.so.1.0.0, and /usr/lib/nvidia-375/libEGL_nvidia.so.375.39 instead of -lEGL does not fix it. It does not fix it as in eglGetDisplay() still returns EGL_NO_DISPLAY.

/usr/lib/nvidia-375$ ls -l *EGL*
lrwxrwxrwx 1 root root 23 Mar 17 04:31 libEGL_nvidia.so.0 -> libEGL_nvidia.so.375.39
-rw-r--r-- 1 root root 1079216 Jan 31 22:06 libEGL_nvidia.so.375.39
lrwxrwxrwx 1 root root 11 Mar 17 04:31 libEGL.so -> libEGL.so.1
-rw-r--r-- 1 root root 77264 Jan 31 20:35 libEGL.so.1
-rw-r--r-- 1 root root 20608 Jan 31 20:35 libEGL.so.375.39

It appears that libEGL.so.1 itself is an ELF:
/usr/lib/nvidia-375$ file libEGL.so.1
libEGL.so.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

Revision history for this message
Thomas Foster (thomasvfoster) wrote :

My understanding is that libEGL.so.1 is GLVND-based, where libEGL.375.39 is
non-GLVND. I think both of them are at some level wrappers around
libEGL_nvidia.so, which is much larger than either of the libEGL.so and I guess
contains the meat of Nvidia's EGL implementation.

The GLVND one looks up the EGL implementations present by inspecting the files
in /usr/share/glvnd/egl_vendor.d/. A similar mechanism declares Vulkan
implementations with JSON files in /usr/share/vulkan/icd.d/, and, sure enough,
the nvidia-375 package places nvidia_icd.json in /usr/share/vulkan/icd.d/.

However, nvidia-375 doesn't put anything in /usr/share/glvnd/egl_vendor.d/, so
libEGL.so.1 doesn't find out about libEGL_nvidia.so and can't forward to it.

If I create /usr/share/glvnd/egl_vendor.d/ and copy in 10_nvidia.json from
Nvidia's runfile installer, my test case passes.

Revision history for this message
Thomas Foster (thomasvfoster) wrote :

This suggests a change to the source package to copy 10_nvidia.json from the upstream package to /usr/share/glvnd/egl_vendor.d/. I think that libEGL.so.375.39 is vestigial and could be omitted, but that's optional; it doesn't seem to be doing any harm.

Revision history for this message
Thomas Foster (thomasvfoster) wrote :
Revision history for this message
Dario Limongi (limee) wrote :

Beware my fix comment had a mistake, the linking is the other way round
(you'll have to reinstall nvidia if you already did the wrong linking: sudo apt-get reinstall nvidia-375)

Fixed linking:

cd /usr/lib/nvidia-375
sudo ln -sf libEGL.so.375.39 libEGL.so.1

cd /usr/lib32/nvidia-375
sudo ln -sf libEGL.so.375.39 libEGL.so.1

Changed in nvidia-graphics-drivers-375 (Ubuntu):
importance: Undecided → High
Changed in nvidia-graphics-drivers-367 (Ubuntu):
importance: Undecided → High
Changed in hundredpapercuts:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package nvidia-graphics-drivers-375 - 375.39-0ubuntu3

---------------
nvidia-graphics-drivers-375 (375.39-0ubuntu3) zesty; urgency=medium

  [ Thomas Foster ]
  * debian/nvidia-375.install:
    - install glvnd EGL vendor configuration file (LP: #1674677)

 -- Alberto Milone <email address hidden> Wed, 05 Apr 2017 10:14:48 +0200

Changed in nvidia-graphics-drivers-375 (Ubuntu):
status: Confirmed → Fix Released
tags: added: trusty yakkety
Norbert (nrbrtx)
tags: removed: trusty yakkety
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.