Issues linking functions from <eglext.h> for cross process egl streaming

I’ve been working on a program that requires access of an EGL stream across processes. I’m working on passing an EGLNativeFileDescriptor via unix domain socket but I’ve been having a problem getting the methods for generating the file descriptor to work.

I can see that the methods are declared in eglext.h yet including the file isn’t enough. I can declare an EGLNativeFileDescriptor, but trying to use the eglGetStreamFileDescriptor method doesn’t work, and the compiler complains that it was not declared. I can see it’s declaration nested between some #ifdef 's in eglext.h

If I add the following

#define EGL_EGLEXT_PROTOTYPES //Add this before eglext.h
#include <egl.h>
#include <eglext.h>

I can compile but I get a linker error for using eglGetStreamFileDescriptor and I can’t seem to find anything that would indicate what linker flag I might be missing and there is no documentation I can find on it.

So I took a look at the example /usr/src/nvidia/graphics_demos/eglstreamcube and saw this block of code which seems to be the secret for getting the compiler to compile and link:

// Extensions used by this demo
#define EXTENSION_LIST(T) \
    T( PFNEGLQUERYSTREAMKHRPROC,           eglQueryStreamKHR ) \
    T( PFNEGLQUERYSTREAMU64KHRPROC,        eglQueryStreamu64KHR ) \
    T( PFNEGLSTREAMCONSUMERACQUIREKHRPROC, eglStreamConsumerAcquireKHR ) \
    T( PFNEGLSTREAMCONSUMERRELEASEKHRPROC, eglStreamConsumerReleaseKHR ) \
    T( PFNEGLCREATESTREAMKHRPROC,          eglCreateStreamKHR ) \
    T( PFNEGLDESTROYSTREAMKHRPROC,         eglDestroyStreamKHR ) \
    T( PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC, \
                        eglStreamConsumerGLTextureExternalKHR ) \
    T( PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC, \
                        eglGetStreamFileDescriptorKHR )

#define EXTLST_DECL(tx, x) static tx x = NULL;
#define EXTLST_ENTRY(tx, x) { (extlst_fnptr_t *)&x, #x },

EXTENSION_LIST(EXTLST_DECL)
typedef void (*extlst_fnptr_t)(void);
static const struct {
    extlst_fnptr_t *fnptr;
    char const *name;
} extensionList[] = { EXTENSION_LIST(EXTLST_ENTRY) };

I don’t really understand what is going on in here. Copying and pasting this block into the top of my source makes it compile and link but the program immediately terminates. What am I missing? If I need to do something like the large block of code above, can someone please explain to me what is going on? Thank you!

This is a repost from the topic Problems getting EGL stream transferred to another process on same machine but it seems to be too old to get any attention from posters. I really appreciate any help I can get. I’ve searched high and low and dug through the make files for all examples using EGLNativeFileDescriptors but I can’t find any missing linker flag that is the culprit and I can’t make any sense of the code block directly above as to how it makes the program compile and link. And I have no idea why it crashes. Thank you

Hi,
The steps in the post should be valid on r32.4.3. We suggest use EGLStream producer/consumer in this usecase. Please give it a try.