Skip to content

nouveau: nil: rewrite the library in Rust

Daniel Almeida requested to merge dwlsalmeida/mesa:nil-rs into main

@gfxstrand Hi Faith,

This is a POC so that we can discuss the strategy for binding between C and Rust, and it's working 😄

We use bindgen as usual to bind over C, and then export a C API through nil_rs.h.

Unfortunately, there is no support for cbindgen in Meson. We discussed this in #mesonbuild yesterday and changes are needed in both cbindgen and Meson to make it work. More info at (cc @dbaker )

For now, I am writing nil_rs.h by hand. It's a bit tricky to get this right, because it is very easy for this file to get out of sync.

We also need to manually move exports.c from /tmp/bindgen/exports.c and then edit it slightly. This is needed to bind over inlined and static symbols.

For now, we just build nil_rs::Image and then dump its fields through fprintf, no crashes.

Let me know what you think. I think this can scale if we're careful. Waiting for a green light here to keep improving on this PR.

Edited by Daniel Almeida

Merge request reports