FLTK logo

Re: [fltk.coredev] Using NVidia's libEGL instead of Mesa's libEGL

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Using NVidia's libEGL instead of Mesa's libEGL "'Albrecht Schlosser' via fltk.coredev" 14:04 Apr 30  
  On 4/30/24 03:45 Gonzalo Garramuño wrote:
According to CMake's find_package(OpenGL), setting this should allow for a vendor neutral distribution of Wayland and EGL:

set(OpenGL_GL_PREFERENCE GLVND)

This should be the default (since CMake 3.10 or so), and we don't override this. You *can* specify it but you shouldn't need this because we require CMake 3.15 and that enables the according CMake policy.

find_package(OpenGL REQUIRED)

This seems to be the main issue. We don't use this directly (yet), our current code uses findLibrary() and is ... suboptimal.

I'll check this when time permits.

list(APPEND LIBRARIES OpenGL::OpenGL OpenGL::EGL)
target_link_libraries(mrv2 PUBLIC ${LIBRARIES} )

Same issue as above, we're not (yet) using the OpenGL targets in FLTK's CMake files. Our code predates the addition of GLVND support in CMake.

But it does not seem to work for me.  My application with FLTK and GLFW both latest (compiled on Rocky Linux 8.9 and running on Ubuntu 22.04.4 LTS) starts fine but always loads Mesa's libEGL.

Let's see what I can do to change this although I don't have any NVIDIA stuff installed because I don't use NVIDIA graphics.

However, it looks like I got 'GLVND' support on my system. From `apt list`:

libglvnd-core-dev/stable,now 1.6.0-1 amd64 [installed,automatic]
libglvnd-dev/stable,now 1.6.0-1 amd64 [installed,automatic]
libglvnd0/stable,now 1.6.0-1 amd64 [installed,automatic]
libglvnd0/stable,now 1.6.0-1 i386 [installed,automatic]

Whatever that means.

Google's Gemini told me about these variables:

The system searches for directories or files specified by environment variables:
__EGL_VENDOR_LIBRARY_FILENAMES: This variable takes a colon-separated list of JSON files describing available ICDs.
__EGL_VENDOR_LIBRARY_DIRS: This variable takes a colon-separated list of directories containing JSON files for ICDs.

Great explanation for someone who doesn't know what ICD means is this context!  :-(

Looks like "Installable Client Driver (OpenGL)" is meant here, rather than "Implantable Cardioverter Defibrillator" ;-)

I set them to:

> echo $__EGL_VENDOR_LIBRARY_DIRS
/usr/share/glvnd/

> echo $__EGL_VENDOR_LIBRARY_FILENAMES
10_nvidia.json:50_mesa.json

Does the file '10_nvidia.json' exist at the appropriate place?
My /usr/share/glvnd/ tree looks like:
$ tree /usr/share/glvnd/
/usr/share/glvnd/
└── egl_vendor.d
    └── 50_mesa.json

There's no 10_nvidia.json file for obvious reasons... (see above).

And then my application does not start and gives me the weird error:

GLFW ERROR: EGL: Failed to get EGL display: Success
ERROR: Cannot create window

OK, that's really weird, an ERROR because of "Success".

The reason I want load NVidia's EGL instead of Mesa's EGL is one of performance.  Mesa's EGL plays 4K movies at 16 FPS while NVidia's EGL plays them at a perfect 60 FPS.

Manolo and Albrecht, can you help?

I'm not sure, I have no idea what this OpenGL and GLVND stuff is all about.  Meanwhile I know a little more, but the (CMake) docs are more for users who KNOW what GLVND is and not for such users like me. ;-)

Anyway, I believe I can improve at least the usage of findOpenGL and thus hopefully enable the GLVND mode and maybe that solves your issues.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/54b7528f-d8ab-4e1a-8f26-3bd03f4f3f14%40aljus.de.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.