eglGetDisplay(EGL_DEFAULT_DISPLAY) fails on other user

Setup
I am under user tester with uid 1002. User muffin with uid 1000 is the “owner” of the X server. By that, I mean that DISPLAY=:0 xhost returns SI:localuser:muffin.

I need to run an application under user tester which calls eglGetDisplay(EGL_DEFAULT_DISPLAY).

Problem
eglGetDisplay(EGL_DEFAULT_DISPLAY) returns EGL_NO_DISPLAY.

Attempted solution
I ran xhost + under user muffin to authorize all users to access the X server. I can successfully launch xclock under user tester. However, eglGetDisplay(EGL_DEFAULT_DISPLAY) still returns EGL_NO_DISPLAY. I would expect the call to succeed. When I tried it on my PC (ubuntu 20.04 x86_64), it worked.

Is this something that you would expect would work on the Jetson Nano? Can you suggest a solution to my problem?

Hi,
Does it work if you set export DISPLAY=:0(or 1)?

Yes, I did set that variable (DISPLAY=:0), and have confirmed that /tmp/.X11-unix/X0 exists. It still doesn’t work. To reiterate, other X applications such as xclock or xterm work; presumably, these don’t use EGL.