Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

eglCreateContext failed with EGL_BAD_MATCH

Open KiviWong opened this issue 4 years ago • 9 comments

IMPORTANT: Please use the following template to report the bug.

Before submitting:

  1. Search for similar issues.
  2. For Python issues, please test with the latest development wheel. It may be already fixed!

Describe the bug I try to run example code 'examples/python/gui/draw_webrtc.py' and encounter some rouble. The error message will be report below.

To Reproduce Steps to reproduce the behavior:

1 python3 draw_webrtc.py 2. See error

Expected behavior Show the website address :P

Screenshots image

Environment (please complete the following information):

  • Operating system: Ubuntu 18.04
  • Python version: python3.8
  • Open3D version: 0.13.0
  • Is this remote workstation?: yes
  • How did you install Open3D?: pip

KiviWong avatar Oct 22 '21 10:10 KiviWong

Does the remote workstation have a GPU?

errissa avatar Oct 22 '21 14:10 errissa

Does the remote workstation have a GPU?

Yes

image

KiviWong avatar Oct 25 '21 02:10 KiviWong

Are you running from a docker container or directly on the workstation? Also, please try running eglinfo (which can be installed from mesa-utils-extra debian package) and share that output.

errissa avatar Oct 25 '21 02:10 errissa

Are you running from a docker container or directly on the workstation? Also, please try running eglinfo (which can be installed from mesa-utils-extra debian package) and share that output.

I run on a remote machine by SSH, not in docker container. The remote machine's OS is Ubuntu 18.04.

The output of command 'eglinfo' is shown as follow:

image image

KiviWong avatar Oct 25 '21 02:10 KiviWong

Sorry for disturbing you again. Is there any way to solve this problem? @errissa

KiviWong avatar Oct 28 '21 07:10 KiviWong

Would you please try with the latest Open3D, 0.15.1.

errissa avatar Mar 09 '22 13:03 errissa

Same problem. I use the version of 0.15.2.

My environment is wsl with NVIDIA graphics driver and egl installed. It can display an app window correctly via MobaXterm X Server.

When I run python draw_webrtc.py, the output is

[Open3D INFO] WebRTC GUI backend enabled.
[Open3D INFO] Window window_0 created.
[Open3D INFO] EGL headless mode enabled.
FEngine (64 bits) created at 0x7fa773484010 (threading is enabled)
EGL(1.4)
eglCreateContext failed with EGL_BAD_MATCH
Segmentation fault

And if I type the code below in IPython,

import open3d as o3d
o3d.visualization.webrtc_server.enable_webrtc()
coord_frame = o3d.geometry.TriangleMesh.create_coordinate_frame()
o3d.visualization.draw(coord_frame)

the output is

[Open3D INFO] Window window_0 created.
[Open3D INFO] ICE servers: {"stun:stun.l.google.com:19302", "turn:user:[email protected]:3478", "turn:user:[email protected]:3478?transport=tcp"}
[Open3D INFO] EGL headless mode enabled.
FEngine (64 bits) created at 0x7f5aa0f5b010 (threading is enabled)
EGL(1.4)
eglCreateContext failed with EGL_BAD_MATCH
Segmentation fault

My eglinfo result is as follows:

EGL client extensions string:
    EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query
    EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses
    EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_device
    EGL_EXT_platform_wayland EGL_KHR_platform_wayland
    EGL_EXT_platform_x11 EGL_KHR_platform_x11 EGL_MESA_platform_xcb
    EGL_MESA_platform_gbm EGL_KHR_platform_gbm
    EGL_MESA_platform_surfaceless

GBM platform:
eglinfo: eglInitialize failed

Wayland platform:
error: XDG_RUNTIME_DIR not set in the environment.
error: XDG_RUNTIME_DIR not set in the environment.
eglinfo: eglInitialize failed

X11 platform:
EGL API version: 1.4
EGL vendor string: Mesa Project
EGL version string: 1.4
EGL client APIs: OpenGL OpenGL_ES
EGL extensions string:
    EGL_KHR_cl_event2 EGL_KHR_config_attribs
    EGL_KHR_context_flush_control EGL_KHR_create_context
    EGL_KHR_create_context_no_error EGL_KHR_fence_sync
    EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace
    EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image
    EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image
    EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync
    EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float
    EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image
    EGL_MESA_query_driver
Configurations:
     bf lv colorbuffer dp st  ms    vis   cav bi  renderable  supported
  id sz  l  r  g  b  a th cl ns b    id   eat nd gl es es2 vg surfaces
---------------------------------------------------------------------
0x01 32  0  8  8  8  8  0  0  0 0 0x21TC      a  y  y  y     win,pb,pix
0x02 32  0  8  8  8  8 24  0  0 0 0x21TC      a  y  y  y     win,pb,pix
0x03 32  0  8  8  8  8 24  8  0 0 0x21TC      a  y  y  y     win,pb,pix
0x04 32  0  8  8  8  8  0  0  2 1 0x21TC      a  y  y  y     win,pix
0x05 32  0  8  8  8  8  0  0  4 1 0x21TC      a  y  y  y     win,pix
0x06 32  0  8  8  8  8  0  0  8 1 0x21TC      a  y  y  y     win,pix
0x07 32  0  8  8  8  8 24  0  2 1 0x21TC      a  y  y  y     win,pix
0x08 32  0  8  8  8  8 24  0  4 1 0x21TC      a  y  y  y     win,pix
0x09 32  0  8  8  8  8 24  0  8 1 0x21TC      a  y  y  y     win,pix
0x0a 32  0  8  8  8  8 24  8  2 1 0x21TC      a  y  y  y     win,pix
0x0b 32  0  8  8  8  8 24  8  4 1 0x21TC      a  y  y  y     win,pix
0x0c 32  0  8  8  8  8 24  8  8 1 0x21TC      a  y  y  y     win,pix

Device platform:
eglinfo: eglInitialize failed

My nvidia-smi info:

Mon Apr 25 00:53:52 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.52       Driver Version: 511.79       CUDA Version: 11.6     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  On   | 00000000:01:00.0 Off |                  N/A |
|  0%   54C    P2    62W / 250W |   2409MiB / 11264MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1322      C   /python3.8                      N/A      |
+-----------------------------------------------------------------------------+

B5paper avatar Apr 24 '22 16:04 B5paper

I also did some experiments. Web RTC worked well on Ubuntu with GNOME desktop. However, when I typed the command sudo systemctl set-default multi-user.target and reboot the system, EGL couldn't initialize normally. It seems like that the problem is that EGL can't work in totally console mode.

B5paper avatar Apr 27 '22 08:04 B5paper

@B5paper Have you solved this problem? I have tested on ubuntu20.04, python draw_webrtc.py works fine.

FromBei-JingWithLove avatar Jul 20 '22 03:07 FromBei-JingWithLove

We now have CPU rendering support (in the latest master) for situations where the GPU is not available / too old, or drivers / libraries are not setup properly. Note that while everything should work, it will be slower than using a GPU. Please try it out if you are having problems in your system. (Linux only).

https://github.com/isl-org/Open3D/blob/master/docs/tutorial/visualization/cpu_rendering.rst

Please try with the latest development Python wheel from here: http://www.open3d.org/docs/latest/getting_started.html#development-version-pip

ssheorey avatar Aug 12 '22 21:08 ssheorey

Not a solution, but here's some more insight. As of now, nvidia/cuda doesn't support applications relying on OpenGL on WSL2 see: https://docs.nvidia.com/cuda/wsl-user-guide/index.html#features-not-yet-supported

I did have success following the above advice on CPU rendering and using a WSL2 Ubuntu20.04 machine with LIBGL_ALWAYS_SOFTWARE=true python my_open3d_script.py which used open3d.visualization.rendering.OffscreenRenderer (I also had to make sure I had a display available see: https://github.com/microsoft/WSL/issues/2855 for giving WSL access to a display) it's just obviously much slower than when I have a GPU available alas.

The exact error I saw when trying to run with the GPU was

>>> import open3d
>>> open3d.visualization.rendering.OffscreenRenderer(10,10)
[Open3D INFO] EGL headless mode enabled.
FEngine (64 bits) created at 0x7fc6acf6d010 (threading is enabled)
EGL(1.4)
eglCreateContext failed with EGL_BAD_MATCH
Segmentation fault

open3d version was 0.16

capfish avatar Jan 06 '23 02:01 capfish

Hi @KiviWong for remote Linux servers, you have these options:

  • Use CPU rendering with the environment variable OPEN3D_CPU_RENDERING=True . Slower than with
  • Use VirtualGL vglrun open3d_app_or_python_script. Provides full GPU acceleration. VirtualGL needs to be installed on the remote server.

Closing this issue, since this is about remote 3D remote apps in general and not specific to Open3D.

ssheorey avatar Feb 28 '23 22:02 ssheorey