eglexternalplatform icon indicating copy to clipboard operation
eglexternalplatform copied to clipboard

Please consider standardizing how EGL external platform modules are discovered

Open smcv opened this issue 3 years ago • 1 comments

App-container technologies like Flatpak and Steam's Steam Linux Runtime need to understand NVIDIA's proprietary EGL driver finds external platforms, so that they can alter the search path as required for the "shape" of their containers, particularly if they are borrowing graphics drivers from the host system rather than shipping their own.

It would be useful if there was either a spec or an open-source reference implementation for how the external platforms are to be discovered, so that we can make sure that what we're doing is compatible.

The external platform modules seem to be designed to be non-NVIDIA-specific, so it would presumably also be helpful to have a spec that other ICD authors can implement.

My best guess at the spec is that it's the same as GLVND EGL ICDs, but with some names changed:

  • if $__EGL_EXTERNAL_PLATFORM_CONFIG_FILENAMES is set and we are not setuid, search exactly those JSON manifest files in that order, "most important" first;
  • else if $__EGL_EXTERNAL_PLATFORM_CONFIG_DIRS is set and we are not setuid, read *.json in those directories, "most important" first, with files earlier in lexicographic (strcmp) order treated as "most important" within each directory;
  • else search the hard-coded path /etc/egl/egl_external_platform.d:/usr/share/egl/egl_external_platform.d, again looking for *.json in lexicographic order;
  • each *.json file is in exactly the same format as a GLVND ICD JSON manifest, version 1.0, with a top-level object with keys including file_format_version (a string) and ICD (an object with keys including library_path)
  • the library_path can either be:
    • a bare filename with no /, interpreted as a SONAME in the system library search path (this is what's used in practice)
    • an absolute path, possibly containing special tokens like ${LIB}
    • a relative path, interpreted as relative to the JSON manifest, and possibly containing special tokens like ${LIB}

Is that guess correct?

smcv avatar Jan 05 '22 14:01 smcv

The Flatpak developers would also find it useful if the loader searched the XDG basedirs, similar to how Vulkan ICDs are located.

smcv avatar Jan 05 '22 14:01 smcv