Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eglCreateContext failed with EGL_BAD_MATCH #4186

Closed
KiviWong opened this issue Oct 22, 2021 · 12 comments
Closed

eglCreateContext failed with EGL_BAD_MATCH #4186

KiviWong opened this issue Oct 22, 2021 · 12 comments

Comments

@KiviWong
Copy link

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
@errissa
Copy link
Collaborator

errissa commented Oct 22, 2021

Does the remote workstation have a GPU?

@KiviWong
Copy link
Author

KiviWong commented Oct 25, 2021

Does the remote workstation have a GPU?

Yes

image

@errissa
Copy link
Collaborator

errissa commented Oct 25, 2021

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.

@KiviWong
Copy link
Author

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
Copy link
Author

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

@errissa
Copy link
Collaborator

errissa commented Mar 9, 2022

Would you please try with the latest Open3D, 0.15.1.

@B5paper
Copy link

B5paper commented Apr 24, 2022

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:password@34.69.27.100:3478", "turn:user:password@34.69.27.100: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
Copy link

B5paper commented Apr 27, 2022

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.

@FromBei-JingWithLove
Copy link
Contributor

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

@ssheorey
Copy link
Member

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

@capfish
Copy link

capfish commented Jan 6, 2023

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: microsoft/WSL#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

@ssheorey
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants