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 support for GPU rendering #3

Closed
mbernat opened this issue Dec 18, 2023 · 5 comments · Fixed by #12
Closed

Add support for GPU rendering #3

mbernat opened this issue Dec 18, 2023 · 5 comments · Fixed by #12
Assignees

Comments

@mbernat
Copy link
Collaborator

mbernat commented Dec 18, 2023

Based on my investigation so far it should be easiest to support GPU rendering via glium + glutin.

  1. We need to create a simple Window struct holding GBM context and implement HasRawWindowHandle & HasRawDisplayHandle for it.
  2. Next, it should be possible to initialized glutin with our Window. It should support GBM handles out of box.
  3. Finally, glium should work with the glutin context.

Other alternatives require (minor) forking to support GBM RawWindowHandle & RawDisplayHandle.

  • wgpu: after forking it should work with our framebuffers directly, just like glutin does.
  • winit: after forking we could use its windows for full windowing functionality and provide windows to any compatible graphics API.
@mbernat mbernat self-assigned this Dec 18, 2023
@mbernat
Copy link
Collaborator Author

mbernat commented Dec 18, 2023

I'm slowly working through custom glutin initialization. So far I haven't encountered any major obstacles but it's going slowly and I guess we won't know if it's working until I hook up everything correctly all the way to some glium example.

@bschwind
Copy link
Member

@mbernat let me know if you want me to test anything on real hardware.

Probably one of the easiest ways to see if things are working is to use the gl crate and just clear the screen to a known color or something simple like that.

Though once we have glutin contexts working, drawing a triangle with glium is very straightforward too.

@mbernat
Copy link
Collaborator Author

mbernat commented Dec 19, 2023

Thanks @bschwind , I'll let you know when I have anything testable.

I've spent a lot of time just following glium/glutin types and didn't really get anywhere because I just don't know anything about GBM & EGL and I also started getting some IO errors from GBM operations (likely my fault, not HW). But I found a nice example in C [1] that seems to involve all the pieces in the right order. I'll try to get it working and then I'll port it to our codebase.

[1] https://github.com/eyelash/tutorials/blob/master/drm-gbm.c

@mbernat
Copy link
Collaborator Author

mbernat commented Dec 19, 2023

I now have some awful code that can render one broken frame and immediately crash. Also, it only works with nouveau.

I will refactor it into a semi-reasonable PR and we can continue testing and building on that afterwards.

@strohel
Copy link
Member

strohel commented Dec 19, 2023

@mbernat I just want to say thanks for the serious progress here (on #12 and on #11) - that's some very perseverant "bashing it until it works"!

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

Successfully merging a pull request may close this issue.

3 participants