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
Framebuffer interface #85
Conversation
Cool! Wanted to something similar but it is still very much a draft and I'll probably do another approach since forcing anyone to deal with a Framebuffer as Trait Object is probably cumbersome to just making a similar thing in the backend (link). Only glanced over the changes so far but look promising! One thing I would change is to use some other name than Also while at it, we might just change |
Similar to |
How would |
Ah, didn't realize you'd started on this! I agree the trait object seems more cumbersome, and so far it looks like the performance should be ~equivalent.
Agree that it's not a good name. It's awkward that the "native" interface is only "native" for RM1... but anyways probably the best thing to do is write good docs and encourage users to pick the default/autodetect if they don't know they need something else.
Yeah, I think the |
I'm very happy to do this for |
That has the same behaviour as the currently-published release, which is: work perfectly if the program is run with the rm2fb client shim (which translates the syscalls to the rm2fb eqivalent instead) and not at all otherwise. |
Agree that this can cause confusion. Though of it as "native to linux". But people may think of it more like "native to remarkable".
Sounds okay! |
I think I'm satisfied with this now, if anyone wants to take a look... I've renamed the method and added a bunch of docs. I've done some testing as well on my RM2 -- all combinations of the methods and the client shim work as expected. (ie. everything displays to the screen except the |
Will try to review this tomorrow! 👍 |
src/framebuffer/core.rs
Outdated
if state { | ||
MXCFB_ENABLE_EPDC_ACCESS | ||
} else { | ||
MXCFB_DISABLE_EPDC_ACCESS | ||
}, |
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.
We should move this outside the unsafe
block as it's not an unsafe expression per-se also it'd collapse the ioctl call into fewer lines. (shaving that yak)
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.
LGTM!
The examples should be updated to not use the deprecated API but that can also happen in a later PR.
Great! Merged to avoid any further drift. For followup, I have that rm2fb path param and cleaning up the deprecated usages. I'll likely get to that by early next week. |
This rearranges the public API slightly to be more explicit: the user can now call
Framebuffer::new
explicitly, or::classic
or::rm2fb
to pick a specific backend.Internally, this switches to using an enum for the old/new backend. This should be about as efficient to the old option-based interface, but moving the file descriptor used for ioctls into the enum makes certain types of errors less likely. My actual motive was to try and add a noop backend to allow for easier testing, but I'll leave that for a followup.
Haven't tested this properly yet, so marking as draft. Interested in thoughts if anyone has them!