NvBufSurfaceMapEglImage can't work with headless device

hi,

we need to use NvBufSurfaceMapEglImage() function, but we found it can’t work at headless device(for example below demo is executed on thor device via ssh, without a connected physical display(headless))

below is an example, we initialize egl according to argus demo, and then use NvBufSurfaceMapEglImage() fuction.
if we don’t set “export DISPLAY=:0”, it will return error like below
./nvbuf_headless_demo
[Demo] NvBufSurface created.
[EGL] display_initialize() success.
nvbufsurface: Failed to create EGLImage.
[Demo] NvBufSurfaceMapEglImage failed
if we set “export DISPLAY=:0”, it work normally.
[Demo] NvBufSurface created.
[EGL] display_initialize() success.
[Demo] NvBufSurfaceMapEglImage success
[Demo] Done.

I think if set “export DISPLAY=:0”, it will use xorg,is there any method that not use xorg, still can use NvBufSurfaceMapEglImage() function with headless device?
because we found sometimes xorg will crash, if xorg crash, we can’t initialize the egl successfully even though we set “export DISPLAY=:0”
we need to use egl+NvBufSurfaceImport to fulfil zero-copy function at inter-process, but xorg is not stable.

below is the demo compile method
g++ nvbuf_headless_demo.cpp -o nvbuf_headless_demo
-I/usr/src/jetson_multimedia_api/include
-L/usr/lib/aarch64-linux-gnu/nvidia -lEGL -lnvbufsurface

nvbuf_headless_demo.zip (1.2 KB)

Hi,
Thanks for the test sample. We will try to replicate it on developer kit and check.

Hi,
We are not able to extract the zip file:

nvidia@tegra-ubuntu:~$ unzip nvbuf_headless_demo.zip
Archive:  nvbuf_headless_demo.zip
   skipping: nvbuf_headless_demo.cpp  unsupported compression method 95

Please check if you can attach it directly.

demo.gz (10 KB)
please use this .gz file

Hi,
We don’t hit the issue on AGX Thor developer kit:

$ ssh nvidia@10.19.115.108
nvidia@10.19.115.108's password:
Welcome to Ubuntu 24.04.3 LTS (GNU/Linux 6.8.12-tegra aarch64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

Expanded Security Maintenance for Applications is not enabled.

51 updates can be applied immediately.
31 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status

Last login: Mon Nov 10 07:06:58 2025 from 172.29.101.87
nvidia@tegra-ubuntu:~$ ./nvbuf_headless_demo
[Demo] NvBufSurface created.
[EGL] display_initialize() success.
[Demo] NvBufSurfaceMapEglImage success
[Demo] Done.
nvidia@tegra-ubuntu:~$

Do you login through pure ssh command?

hi, Dane

i check it again. with pure ssh command, it is ok.
we use mobaxterm tool to lauch ssh, it will automaticlly open x11-Forwarding function.

you can reproduce this issue with below command
ssh -Y nvidia@10.19.115.108

Hi,
We don’s support X11 forwarding. Please run pure ssh command.

ok, we will disable x11 forwarding function.

so the currrent problem is when garbage output issue happen, Will it affect the initialization of egl?
i will open a new topic about the garbage output

hi, Dane
if egl don’t support x11 forwarding, do we need to disable X11Forwarding at /etc/ssh/sshd_config?

hi, Dane
./egl_display_info
=== EGL Display Initialization Test ===
[EGL] VENDOR = Mesa Project
[EGL] VERSION = 1.5
[EGL] CLIENT_APIS = OpenGL OpenGL_ES
[EGL] EXTENSIONS = EGL_ANDROID_blob_cache EGL_ANGLE_sync_control_rate EGL_EXT_buffer_age EGL_EXT_config_select_group EGL_EXT_create_context_robustness EGL_EXT_query_reset_notification_strategy EGL_EXT_surface_compression EGL_EXT_swap_buffers_with_damage 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_KHR_swap_buffers_with_damage EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_gl_interop EGL_MESA_query_driver EGL_MESA_x11_native_visual_id
[EGL] DEVICE DRIVER = (null)
[EGL] DEVICE EXT = EGL_MESA_device_software EGL_EXT_device_drm_render_node
=== EGL Display Test Finished ===
above is x11 forwarding的device
./egl_display_info
=== EGL Display Initialization Test ===
[EGL] VENDOR = NVIDIA
[EGL] VERSION = 1.5
[EGL] CLIENT_APIS = OpenGL_ES OpenGL
[EGL] EXTENSIONS = EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age EGL_EXT_client_sync EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_MESA_image_dma_buf_export EGL_EXT_output_base EGL_EXT_protected_content EGL_EXT_stream_acquire_mode EGL_EXT_sync_reuse EGL_IMG_context_priority EGL_KHR_config_attribs EGL_KHR_create_context_no_error EGL_KHR_context_flush_control EGL_KHR_create_context EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_partial_update EGL_KHR_swap_buffers_with_damage EGL_KHR_no_config_context 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 EGL_KHR_image_base EGL_KHR_reusable_sync EGL_KHR_stream EGL_KHR_stream_attrib EGL_KHR_stream_consumer_gltexture EGL_KHR_stream_cross_process_fd EGL_KHR_stream_fifo EGL_KHR_stream_producer_eglsurface EGL_KHR_surfaceless_context EGL_KHR_wait_sync EGL_NV_cuda_event EGL_NV_nvrm_fence_sync EGL_NV_quadruple_buffer EGL_NV_stream_consumer_eglimage EGL_NV_stream_cross_display EGL_NV_stream_cross_object EGL_NV_stream_cross_process EGL_NV_stream_cross_system EGL_NV_stream_dma EGL_NV_stream_flush EGL_NV_stream_metadata EGL_NV_stream_remote EGL_NV_stream_reset EGL_NV_stream_socket EGL_NV_stream_socket_inet EGL_NV_stream_socket_unix EGL_NV_stream_sync EGL_NV_stream_fifo_next EGL_NV_stream_fifo_synchronous EGL_NV_stream_consumer_gltexture_yuv EGL_NV_stream_attrib EGL_NV_stream_origin EGL_NV_system_time EGL_NV_output_drm_flip_event EGL_NV_triple_buffer EGL_NV_robustness_video_memory_purge EGL_WL_bind_wayland_display EGL_WL_wayland_eglstream
[EGL] DEVICE DRIVER = nvidia
[EGL] DEVICE EXT = EGL_NV_device_cuda EGL_EXT_device_drm EGL_EXT_device_drm_render_node EGL_EXT_device_query_name EGL_EXT_device_persistent_id
=== EGL Display Test Finished ===

this is disable x11 forwarding’s pure ssh device, it is the same with directly connect to monitor.

when garbage output issue happen, we can init the egl successfully on the monitor, so if we disable x11, we also can init the egl sucessfully.

now zero-copy don’t have any problem. let’s focus on the garbage output at below topic.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.