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

Missing xf86drm.h bindings #207

Open
jlHertel opened this issue Oct 26, 2024 · 3 comments
Open

Missing xf86drm.h bindings #207

jlHertel opened this issue Oct 26, 2024 · 3 comments

Comments

@jlHertel
Copy link

First of all thanks for the wonderful library.

When generating the bindings, bindgen is only looking at drm.h and drm_mode.h leaving xf86drm.h out. Most of the functions defined in xf86drm.h are just IOCTL calls, so I guess it made sense to not directly import them and instead implement the IOCTLs in Rust.
There is one function called drmGetDevices2() which isn't just plain IOCTL calls, but rather does quite some processing to list the DRM devices. I have a use-case in which I would like to use this function from Rust, but since the binding is missing, I'm unable to do.
I tried to understand the bindings configuration and propose a PR, but they are just mind-blowing to me.

Is it possible to generate bindings only for that specific function?

Thanks in advance.

@ids1024
Copy link
Member

ids1024 commented Oct 27, 2024

I don't think we actually link libdrm. So that's why the bindings only includes ioctl numbers, structs, and such, and not extern functions.

It may be good to include an implementation of similar functionality, if we don't already. #202 moved some code related to dealing with device nodes to drm-rs from Smithay, but I guess it doesn't include a simple way to get a list of devices.

@jlHertel
Copy link
Author

If that is the case, then we can probably port the code directly from libdrm, since its also MIT licensed.
One question though: we generally don't provide a Card implementation, but this function returns a list of cards, so we will need to provide at least a file-backed Card. Is that OK?
Sorry if the question is dumb, I'm quite new to Rust and might be overlooking something

@jlHertel
Copy link
Author

@ids1024 I made a pull request with the code I believe will be enough to list devices. I would appreciate if you could review it.

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

No branches or pull requests

2 participants