Update OpenBSD support to new drm API introduced in 6.9
This makes OpenBSD work properly on my machine.
WIP because it depends on a libc change in https://github.com/rust-lang/libc/pull/4285#issuecomment-2682420476
My rust experience is rather limited so I'm looking forward to hear how this could be improved.
One potential problem I see is that devname() is not thread-safe as is because the name buffer is static. Does this need to be copied safely, guarded by a lock or marked unsafe?
This was based on upstream libdrm, which still defines those original constants for OpenBSD to be different from the rest: https://gitlab.freedesktop.org/mesa/drm/-/blob/a7eb2cfd53a70fcd9ba9dcfad80a3994642f362f/xf86drm.h#L79-90
Any clue as to how/when this was changing, and is this PR backwards-compatible "enough"?
Any clue as to how/when this was changing, and is this PR backwards-compatible "enough"?
It looks like this changed in 2021 https://github.com/openbsd/xenocara/commit/9d1e1e287e6f15bd4810a2651a500918a3c54d54
OpenBSD only supports the last two releases, with one release every 6 months that means we don't need to worry (besides, breaking API and ABI across releases is not a huge issue in OpenBSD land).
Latest push includes a few fixes based on feedback from @MarijnS95. I also added a check to handle the actual error case "??" properly. I am not convinced that buf.is_null() is actually possible here but it probably doesn't hurt to keep that check.
One potential problem I see is that devname() is not thread-safe as is because the name buffer is static. Does this need to be copied safely, guarded by a lock or marked unsafe?
We can't really mark a function as thread-unsafe in rust, so I am afraid this would need a global lock variable.
Clarified the /dev/dri node change in the commit message, changed the libc dependency to a more realistic target (if I understand their versioning right) and added a global lock for the static buffer returned by devname().
libc with devname support is now available so I force pushed to remove the XXX comment and removed WIP in the PR title