swvkc
swvkc copied to clipboard
Added gpu device option
This is a little hack and I'm not sure whether or not you want it merged. I need it as my operating system uses libudev-zero (a daemon-less libudev replacement) which doesn't implement all the features of udev so I have to manually specify the card to get it to work though it does work which I'm mildly surprised about. The thing that concerns me most in the patch is the duplicate branching in drm_setup
to handle the freeing of devpath
though I can't think of a better way of handling it.
This is a little hack and I'm not sure whether or not you want it merged.
I do want something like this. I too experimented with udev replacements (busybox's mdev
and skarnet's mdevd
), input device discovery didn't work because the ID_INPUT_{KEYBOARD,MOUSE,TOUCHPAD}
properties were missing, so I introduced the possibility to specify device nodes as cmdline args. I haven't done it for the gpu yet because it was working (the boot_vga
attribute was set with both mdevd
and mdev
iirc).
Ideally I would like to make libudev
an optional dependency, because I don't think Vulkan (or better, the Vulkan implementation) requires it (Vulkan is also doing its own gpu discovery). So I think the code needs a bit of cleanup, it was a bit rushed. But in the meantime I could merge this if it works.
This code does work for me at least. And I'm using busybox mdev (though planning to switch to toybox), with libudev-zero. I kinda have a really weird setup as I've been creating a distro with no GNU runtime dependencies and this is the only compositor I've found that doesn't need any of the glib stuff. What's stopping the use of Vulkan's GPU discovery? I'm gessing that libdrm requires more information than Vulkan can provide.
Right now for simplicity DRM and Vulkan open the GPU independently. This is a problem if the system has more than one GPU, because they might open different GPUs. There are two possibilities:
-
Open with DRM and tell Vulkan our choice I think this is doable with mesa's recently added
device-select-layer
-
Open with Vulkan and tell DRM our choice This is not possible in core Vulkan, there is no way to extract the file descriptor or device node. However, the extension
VK_EXT_pci_bus_info
might provide enough info to be able to so.
Either way, I need to do a bit more research. I think 1 is the way to go though. I'll turn this comment into an issue to keep track of this.
@Ella-0 feel free to implement udev_enumerate_add_match_parent
function which required by swvkc
I'll look into doing that.