-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Dynamic loading of libdrm and libdrm_amdgpu #438
Dynamic loading of libdrm and libdrm_amdgpu #438
Conversation
Dynamic loading would make sense, though it is not a requirement as libdrm is something that is usually present on every system, even when using nvidia proprietary drivers. However, I have one concern with this: what are the backwards compatibility guarantees of the libdrm API? Could the symbols change or be removed in an update? Currently this would lead to a link-time error, which is easier to catch than a runtime one when a function symbol fails to load (or even worse, have the wrong signature). |
lact-daemon/src/server/handler.rs
Outdated
match LibDrmAmdgpu::new() { | ||
Ok(libdrm_amdgpu) => { | ||
info!("libdrm and libdrm_amdgpu initialized"); | ||
Some(Rc::new(libdrm_amdgpu)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this needs to be wrapped in an Rc
, as LibDrmAmdgpu
is a cloneable struct with Arc
s internally: https://github.com/Umio-Yasuno/libdrm-amdgpu-sys-rs/blob/main/lib.rs#L75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
For users who only use NVIDIA GPUs, there is less need to be concerned about
Runtime errors can probably occur with dynamic linking, even if not dynamic loading. |
I'll merge this as is since it turns out the mismatched header problem is already a possibility before this PR, but I would like to continue the discussion in Umio-Yasuno/libdrm-amdgpu-sys-rs#9 |
libdrm_amdgpu_sys 0.8.0
supports dynamic loading.Now
LACT
supports GPUs from multiple vendors, so dynamic loading would be better.