Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EGLDevice backend #786

Open
wants to merge 1 commit into
base: master
from
Open

Add EGLDevice backend #786

wants to merge 1 commit into from

Conversation

@kchandra22134
Copy link

kchandra22134 commented Jun 15, 2016

This adds interface to graphics application to create EGLDisplay
directly over GPU device as enabled by EGLDevice extensions

Modifies in GLFW library to add egldevice-drm backend.

This includes modifying a few existing files and creating four new files which are
specific to the backend that we are adding. For eg. in our case these are
egldevice_platform.h, egldevice_init.c, egldevice_window.c, egldevice_monitor.c .

In the file "egl_context.c" change selects the EGL_SURFACE_TYPE config attribute value to
EGL_STREAM_BIT_KHR instead of EGL_WINDOW_BIT and specify the window surface to the surface which we created using EGLStreams.

Other files "egl_context.h" and "internal.h" has minor changes to include the header files.
Also there are changes in CMake code files to include the newly created files.

Links to the EGL extensions used:

  1. EGL_EXT_device_drm
    https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_device_drm.txt
  2. EGL_KHR_stream
    https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_stream.txt
  3. EGL_EXT_stream_consumer_egloutput
    https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_stream_consumer_egloutput.txt
  4. EGL_KHR_stream_producer_eglsurface
    https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_stream_producer_eglsurface.txt
This adds interface to graphics application to create EGLDisplay
directly over GPU device as enabled by EGLDevice extensions
@kchandra22134 kchandra22134 force-pushed the kchandra22134:master branch from 3792742 to 3f4662b Jun 17, 2016
@elmindreda

This comment has been minimized.

Copy link
Member

elmindreda commented Jul 11, 2016

This is an odd platform, but the impact on existing code is nicely small.

Are there any plans for input support? I won't reject it if there isn't, but it'd be good to know.

Is there any publicly available system where I could test this?

Do you know if you (personally or Nvidia) will be submitting updates as needed or if this is a one-time code drop? Again, I won't reject based on the answer but I need to know.

@elmindreda elmindreda added the Linux label Jul 31, 2016
@kchandra22134

This comment has been minimized.

Copy link
Author

kchandra22134 commented Aug 10, 2016

  • For testing this backend you can:
  • Use NVIDIA Linux GPU driver release 364.12 or later.
  • Use a Linux 4.1 or later kernel with DRM support enabled.
  • Stop the X server, or any other potential DRM client. This backend requires the ability to become DRM master in order to do modesets.

You can also refer to this: https://github.com/aritger/eglstreams-kms-example
where EGLDevice backend is demonstrated.

We have plans to submit more updates in this, as this is only the minimal functionality required to run the application.

@elmindreda

This comment has been minimized.

Copy link
Member

elmindreda commented Aug 10, 2016

@kchandra22134 Great, thank you!

@elmindreda elmindreda added this to the 3.3 milestone Aug 10, 2016
@elmindreda elmindreda changed the title Add EGLDevice backend to GLFW Add EGLDevice backend Dec 19, 2016
elmindreda added a commit that referenced this pull request Sep 7, 2017
This adds interface to graphics application to create EGLDisplay
directly over GPU device as enabled by EGLDevice extensions

Fixes #786.
elmindreda added a commit that referenced this pull request Sep 7, 2017
Some minor bitrot had occurred since the patch was made.

Related to #786.
elmindreda added a commit that referenced this pull request Sep 7, 2017
Cleanup
Related to #786.
elmindreda added a commit that referenced this pull request Sep 17, 2017
This adds interface to graphics application to create EGLDisplay
directly over GPU device as enabled by EGLDevice extensions

Fixes #786.
elmindreda added a commit that referenced this pull request Sep 17, 2017
Some minor bitrot had occurred since the patch was made.

Related to #786.
elmindreda added a commit that referenced this pull request Sep 17, 2017
Related to #786.
@elmindreda elmindreda mentioned this pull request Oct 17, 2017
6 of 6 tasks complete
@elmindreda elmindreda removed this from the 3.3 milestone Mar 20, 2018
@alecjacobson

This comment has been minimized.

Copy link

alecjacobson commented Jan 25, 2019

Is there any plan to integrate this?

@kivutar

This comment has been minimized.

Copy link

kivutar commented Mar 5, 2019

Supporting this would have a very positive effect for Raspberry Pi users. Linux distributions like Lakka, Retropie, LudOS and Recallbox could use GLFW and not have to package X11 or weston.
I case you decide to merge it for 3.3, I can participate in testing and maybe help maintaining this platform.

@elmindreda

This comment has been minimized.

Copy link
Member

elmindreda commented Mar 5, 2019

@kivutar I would gladly add this platform if it comes with a maintainer. I did some work with the original PR but it didn't seem to work on the machine I had available. Have you been able to get this PR to run on a current system?

@kivutar

This comment has been minimized.

Copy link

kivutar commented Mar 6, 2019

Not yet, I will try it today and tell you the results. We've been using a similar approach in RetroArch for a few years in some of the contexts here https://github.com/libretro/RetroArch/tree/master/gfx/drivers_context
and I've always thought that this abstraction layer shouldn't be kept in our software where it can't benefit other projects. I like to see GLFW going this way.

@kivutar

This comment has been minimized.

Copy link

kivutar commented Mar 6, 2019

I had to add the include path for libdrm.
Now I'm stuck on a missing declaration for PFNEGLSTREAMCONSUMERACQUIREATTRIBEXTPROC.
Except this last issue, the rest of GLFW compiles fine. Any idea of where is this supposed to be defined?

In case you manage to fix the PFNEGLSTREAMCONSUMERACQUIREATTRIBEXTPROC issue on your side, you will have to launch the examples from one of the TTY, not a terminal emulator.

@elmindreda

This comment has been minimized.

Copy link
Member

elmindreda commented Mar 6, 2019

I ran it from the console of a machine with no X server running. If I recall it failed to initialize or possibly there was a black screen. Tried some unrelated EGLDevice examples and they ran without issue.

See the egldevice branch for my initial attempt. It should have the declarations you need. I don't remember exactly what extension document I got them from.

@kivutar

This comment has been minimized.

Copy link

kivutar commented Mar 7, 2019

I'm also getting either Failed to initialize GLFW or Error: EGLDevice: Failed to find required extensions functions on either https://github.com/glfw/glfw/tree/egldevice or this current PR branch.
I have no issues launching other egldevice programs like retroarch.
So I will compare our implementation with this one.

But it looks quite different, as we're using EGL_PLATFORM_GBM_KHR or EGL_PLATFORM_X11_KHR and this PR is targeting EGL_PLATFORM_DEVICE_EXT.

@MadcowD

This comment has been minimized.

Copy link

MadcowD commented Oct 31, 2019

I am desperate to have this branch merge into master (it affects a down-stream project greatly!)

Is there anyway I can help get it in a good position?

What are the current blockers in pushing this forward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.