control: Add Device::crtc_get/queue_sequence() IOCTLs and event
#200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These two IOCTLs are for querying the most recent sequence number (and its "first pixel out" timestamp) as well as scheduling (queueing) an event when a future sequence number (absolute or relative) is hit, equally containing the "first pixel out" timestamp for that sequence.
As with
wait_vblank(),crtc_queue_sequence()also returns the absolute sequence number that the event ended up latching on. This is useful when specifying a relative index as well as when the drivermax()es an absolute target to the most recently triggered sequence. This request will still result in an event even when that sequence number has already been hit, but doesn't allow you to queue older frames.To figure out
src/lib.rsorsrc/control/mod.rs)?wait_vblank()which is outside ofcontrol, shouldreceive_events()be moved to the (or is the optionalwait_vblank(EVENT, ...)flag a feature of a modesetting device)?Locks DRM mutexshould be true or false?"Unrelated" TODOs
Note that this PR is much bigger than just these two IOCTLs, as I started cleaning through and playing with the code. There are a bunch of
TODOs remaining in the code, mostly questions for the maintainers to decide how to proceed. And a lot of unrelated changes to be split out.user_datafield onpage_flip()just likewait_vblank(), since thecrtc_idfield will always be set from kernel4.12onwards?pub? I.e.ResourceHandlesalready haspubfields and doesn't need trivial getters,WaitVblankReplycould use the same.PageFlipTargetandWaitVblankTarget?doc(alias)to make it easier to relate low-level DRM code to the higher-level wrappers here.Capabilitieswhen they affect a specific function/struct/field/flag.Eventsiterator (basically a buffered reader) consume events from thefdindefinitely? Or at the very least document that it reads1024bytes of data (rounded down to a whole number of events that would fit), leaving them unaware of whether more events are available unless they keep callingread_events()in a loop till it returns an empty iterator?