-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Initial kmsdrm support #2272
Initial kmsdrm support #2272
Conversation
Wow! This is neat. I'll be sure to look closer at this when I can, but for now, I just have to note that I think your editor's autoformatting bungled up our |
Whoops! Sorry about that. I'm using remark and taplo for my formatting, I'll go back and fix the formatting on the documents you mentioned |
|
Sorry about that, I fixed the formatting again |
Forget about the
(I don't know what being "signal safe" is, but I don't think it matters) |
One of the maintainers of drm-rs/gbm.rs/input.rs/smithay here, this looks very well put together and I cannot spot any obvious mistakes. (But obviously I don't know a lot about winit internals.) One nitpick: The mode selection is likely copied from some outdated example code. drm-rs gained the option to read out mode-types recently. Most monitors have a "Preferred" mode, which is likely what winit should select. (https://docs.rs/drm/latest/drm/control/struct.Mode.html#method.mode_type). Additionally, I think there was an earlier attempt to do something like this for glutin, I think(?): Smithay/gbm.rs#2 Thanks for working on this! 👍 |
I'm literally stumped. Unfortunately, I'm not knowledgable enough with Github workflows to solve this problem. If someone could fix the |
Hey @StratusFearMe21, are you still interested in working on this? In the spirit of moving this forward, maybe CI could be dropped for now, and we could create an issue to tackle that later? Also, when (if, but hopefully when) we merge this, would you be up for taking the role as maintainer of the platform? That is, review PRs for kmsdrm, have the final say in what gets merged and what doesn't, and generally help out maintaining |
Wow! I'm absolutely honored, it would be my pleasure to help maintain winit, and this platform @madsmtm |
6e044e7
to
9ee4d95
Compare
An extra maintainer would be very welcome! I've sent you an invite to the @rust-windowing organization, for now you'll have write access to If, when you fix the merge conflicts, could add yourself to A few notes on how we work: While we technically have a policy for when things can be merged (2 maintainers must have reviewed), it is rarely followed because of lack of manpower - try to have a few people review your own PRs before merging them, but remember that it is better to merge a PR than have it sitting around forever. Re platforms that no-one support (currently Web), any maintainer may merge PRs here. Are you on Matrix / IRC? Would be nice if you were, I find that's a good way to stay in touch; feel free to ask any questions if you're uncertain about something! |
Okay, so it seems I've left this PR alone for too long. At this point I think I'll have to re-write this PR from Scratch. In the meantime though I'm gonna wait until this PR (rust-windowing/glutin#1435) is merged before doing that.This PR has been in the works for ~5 months now and I think I can do a better job now than I could then anyway. Thanks for understanding |
No worries, I hope you can at least reuse some of the work you've done in this PR! |
@@ -17,36 +17,38 @@ default-target = "x86_64-unknown-linux-gnu" | |||
targets = ["i686-pc-windows-msvc", "x86_64-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "wasm32-unknown-unknown"] | |||
|
|||
[features] | |||
default = ["x11", "wayland", "wayland-dlopen"] | |||
default = ["x11", "wayland", "wayland-dlopen", "kms"] |
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.
IMO drmkms
should be opt-in rather than opt-out
@StratusFearMe21 there's some people on Matrix wondering what your plans with this are? |
@madsmtm , yeah, I havent been on Matrix lately since my server conked out. School has been way harder than I originally anticipated when I accepted your invite to be a maintainer, and thats why I havent made any progress on this PR. If you'd like to take me off the team as a maintainer, I would completely understand |
Thanks for the update! And don't worry, it's fine, we all have a life to tend to outside open source ;). Take the time you need! |
I took the liberty of picking up this PR and doing the grunt-work of merging current master into it and making it compile: #2795 |
Closing due to inactivity. |
CHANGELOG.md
if knowledge of this change could be valuable to usersWhat's this?
This is the start of a kmsdrm backend for winit! Essentially, if wayland and X.org are not available, this PR makes winit create a gbm device and a libinput listener to send the device window events.
KMS/DRM
KMS/DRM is the system that wayland compositors and X use to draw things to the screen. It's an abstraction over the graphics card essentially. In order to render a framebuffer to the screen, you must
My PR does steps 1-4 and 6. Steps 5 is where the user will come in and initialize a framebuffer for their graphics library of choice.
Event Handling
KMS/DRM mode does not have a traditional input system, in fact it has none at all. It requires that you grab the raw input file descriptors from
/dev/input
and read those. This is wherelibinput
comes in. This is the same library thatsmithay
and many wayland compositors use to complete this task. It even provides an event based interface which integrates very well withwinit
. I chose this library because it melds very well withwinit
, and it handles every type of input thatwinit
supports out of the box, howeverlibinput
is not written in Rustlibinput
supports multi-touch given that you are not performing a gesture. In this caselibinput
will produce gesture events and only tell you when the gesture begins, moves, and ends. These gestures do not provide finger ids either.WindowEvent
s andDeviceEvent
s even if a window has not been initialized.Also, I should probably mention, there is an invisible virtual cursor that my KMS/DRM backend simulates which takes deltas from
libinput
and producesDeviceEvent
s for the raw mouse deltas andWindowEvent
s for the virtual location of the cursor on screen.It it possible to access the gbm device mutex via the
gbm_device()
, the current connector viagbm_connector()
and the current crtc via thegbm_crtc()
method in theEventLoopWindowTargetExtUnix
traitNote
In the future
I could add an actual cursor and render it to the screen using the cursor framebuffer.
Thanks for considering my PR!