- Mar 22, 2024
-
-
Lyude Paul authored
-
Lyude Paul authored
DRM actually has a number of helpers that wrap drm_plane_state, one of which is actually needed by VKMS - drm_shadow_plane_state. So, let's start preparing to write bindings for this by first extracting PlaneState<T> into the IntoPlaneState trait - which all DRM structs which wrap drm_plane_state will implement. This is basically the same idea as the GEM ops - but for plane states. Signed-off-by:
Lyude Paul <lyude@redhat.com>
-
Lyude Paul authored
This introduces a work in progress port of the VKMS driver to rust to provide a user of the kernel's new rust bindings for KMS drivers!
-
Lyude Paul authored
-
- Mar 21, 2024
-
-
Lyude Paul authored
I think this is a no-brainer, even considering the fact it's unstable. Without it, there's no actual way of using Box<> without using the kernel's initializers. The current user for this is rvkms, since we intentionally do this to initialize some empty structs in boxes without needing to go through the whole kernel initializer macro dance.
-
Lyude Paul authored
TODO: yes (currently, we only have added a single binding and a mock up of what I expect a fourcc format could look like. This is good enough for rvkms for the time being, but we will want to actually complete this in the future
-
Lyude Paul authored
Since we want to make sure that drm_device.mode_config is initialized for modesetting drivers in rust, the easiest way to do this is to just call drmm_mode_config_init() during creation of any Device structs whose implementors have the FEAT_MODESET feature. Subsequently, since drmm_mode_config_init() registers a managed device cleanup handler - we don't need to add any other function calls. Signed-off-by:
Lyude Paul <lyude@redhat.com>
-
Lyude Paul authored
-
Lyude Paul authored
Using the dma_set_mask_and_coherent() wrapper that we just added. Signed-off-by:
Lyude Paul <lyude@redhat.com>
-
Lyude Paul authored
Which we'll use for the next wrapper Signed-off-by:
Lyude Paul <lyude@redhat.com>
-
Create an abstraction to allow Rust drivers to open a new devres group for the device with a defined id. Moreover, implement the related Drop trait to release the devres group. [Lyude: cherry picked from 8e57c7d478ddeabe61c53b6dd01fd326e3256221 from https://github.com/mairacanal/linux/pull/11 ] Signed-off-by:
Maíra Canal <mcanal@igalia.com>
-
Allows drivers to directly allocate and register a device. Although this style of driver is discouraged, it is useful for virtual devices that cannot be probed. Also, handles the deallocation of a registered device through the Drop trait. Signed-off-by:
Maíra Canal <mcanal@igalia.com>
-
Currently, platform device holds only a pointer, which is safe to be used from any thread. This is useful for devices that are not probed, such as virtual devices. [Lyude: cherry-picked from 9a6a07a9828ea840194c8428d45cd54d5c386265 https://github.com/mairacanal/linux/tree/vgem/wip-dma ] Signed-off-by:
Maíra Canal <mcanal@igalia.com>
-
Signed-off-by:
Hector Martin <marcan@marcan.st>
-
The DRM shmem helper includes common code useful for drivers which allocate GEM objects as anonymous shmem. Add a Rust abstraction for this. Drivers can choose the raw GEM implementation or the shmem layer, depending on their needs. Lyude changelog: * Rebase * Squash "rust: drm: device: Convert Device to AlwaysRefCounted" as this commit doesn't compile without it anyway Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
There doesn't seem to be a way for the Rust bindings to get a compile-time constant reference to drm_gem_shmem_vm_ops, so we need to duplicate that structure in Rust... this isn't nice... Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
This is just for basic usage in the DRM shmem abstractions for implied locking, not intended as a full DMA Reservation abstraction yet. Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
Commit reference: 3dfc5ebff103 Lyude: Any interfaces not currently use or anticipated to be used by rvkms have been dropped. This includes pretty much all of the devicetree (of) references.
-
Lyude Paul authored
-
- Mar 14, 2024
-
-
Now that we've moved the vtable init out of this function, the only thing that forces us to have a mutable reference in this function is the status we use to tell whether or not a DRM Registration object has been registered. Note, we also at least need to have a pointer to the DRM device accessible outside of this structure as well. so, move both of these things into a new RegistrationInfo structure which can be safely cloned. This allows us to get a mutable reference to the information we need in the Registration::register() function and still move the Registration object away, finally allowing us to start using the DRM abstractions here. Signed-off-by:
Danilo Krummrich <dakr@redhat.com>
-
Currently there's a problem preventing us from actually using Asahi's DRM rust abstractions: we need to have a pinned mutable pointer to the device's Registration object to pass to the Registration::register(), but this isn't possible because we move said object into a Revocable<>. So we need to start moving things around so that we don't need a mutable pointer for the time being. Start by moving the vtable initialization out of the Registration::register() function and make it happen when initially creating the Registration object: since this should functionally do the same thing but drop a few of the mutability requirements. Signed-off-by:
Danilo Krummrich <dakr@redhat.com>
-
This requires type_alias_impl_trait. Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
The DRM GEM subsystem is the DRM memory management subsystem used by most modern drivers. Add a Rust abstraction to allow Rust DRM driver implementations to use it. Lyude changelog: * Squashed "rust: drm: device: Convert Device to AlwaysRefCounted" - as without it this doesn't compile anyway * Rebase Signed-off-by:
Asahi Lina <lina@asahilina.net> Signed-off-by:
Danilo Krummrich <dakr@redhat.com>
-
Add Rust counterparts to these C macros. `container_of` is useful for C struct subtyping, to recover the original pointer to the container structure. `offset_of` is useful for struct-relative addressing. Lina: Rewrote commit message and squashed in later changes from rust-for-linux/linux, attributed below. Lyude: Squashed "rust: Fix container_of!()" Co-authored-by:
Miguel Ojeda <ojeda@kernel.org> Signed-off-by:
Miguel Ojeda <ojeda@kernel.org> Co-authored-by:
Léo Lanteri Thauvin <leseulartichaut@gmail.com> Signed-off-by:
Léo Lanteri Thauvin <leseulartichaut@gmail.com> Co-authored-by:
Wedson Almeida Filho <wedsonaf@google.com> Signed-off-by:
Wedson Almeida Filho <wedsonaf@google.com> Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
A DRM File is the DRM counterpart to a kernel file structure, representing an open DRM file descriptor. Add a Rust abstraction to allow drivers to implement their own File types that implement the DriverFile trait. Lyude: Squashed the following commits: * "rust: drm: device: Convert Device to AlwaysRefCounted" * "rust/kernel/device: Fix types for dma_(map_sg, unmap_sg)" Signed-off-by:
Asahi Lina <lina@asahilina.net> Signed-off-by:
Danilo Krummrich <dakr@redhat.com>
-
Add the initial abstractions for DRM drivers and devices. These go together in one commit since they are fairly tightly coupled types. A few things have been stubbed out, to be implemented as further bits of the DRM subsystem are introduced. Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
Some traits exposed by the kernel crate may not be intended to be implemented by downstream modules. Add a Sealed trait to allow avoiding this using the sealed trait pattern. Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
DRM drivers need to be able to declare which driver-specific ioctls they support. This abstraction adds the required types and a helper macro to generate the ioctl definition inside the DRM driver. Note that this macro is not usable until further bits of the abstraction are in place (but it will not fail to compile on its own, if not called). Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
Based on https://github.com/Rust-for-Linux/linux/commit/9d7d4827356cc4c17e1e546175204b12f1becff9 (Fixed a few warnings.) Signed-off-by:
Danilo Krummrich <dakr@redhat.com>
-
Imported from revokable.rs form https://github.com/Rust-for-Linux/linux/commit/968b3f1631b44a3d753be3c3b69b96bbfb2b83a4 (Removed test code and fixed a few warnings.) Signed-off-by:
Danilo Krummrich <dakr@redhat.com>
-
Based on sync/revokable.rs from c9be2e07121f76aaa685a1a8b37e7fb55b6d1bd0 Signed-off-by:
Danilo Krummrich <dakr@redhat.com>
-
This unstable feature is broken/gone in 1.73. To work around this without breaking the API, turn IdArray::new() into a macro so that it can use concrete types (which can still have const associated functions) instead of a trait. This is quite ugly... Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
Based on driver.rs from https://github.com/Rust-for-Linux/linux/commit/3f893e11f62f880f6d4e2bf6cda199a4366203a7
-
Add a Device type which represents an owned reference to a generic struct device. This minimal implementation just handles reference counting and allows the user to get the device name. Lina: Rewrote commit message, dropped the Amba bits, and squashed in simple changes to the core Device code from latter commits in rust-for-linux/rust. Also include the rust_helper_dev_get_drvdata helper which will be needed by consumers later on anyway. Co-developed-by:
Miguel Ojeda <ojeda@kernel.org> Signed-off-by:
Miguel Ojeda <ojeda@kernel.org> Signed-off-by:
Wedson Almeida Filho <wedsonaf@gmail.com> Signed-off-by:
Asahi Lina <lina@asahilina.net>
-
Add a RawDevice trait which can be implemented by any type representing a device class (such as a PlatformDevice). This is the minimum amount of Device support code required to unblock abstractions that need to take device pointers. Lina: Rewrote commit message, and dropped everything except RawDevice. Co-developed-by:
Miguel Ojeda <ojeda@kernel.org> Signed-off-by:
Miguel Ojeda <ojeda@kernel.org> Signed-off-by:
Wedson Almeida Filho <wedsonaf@gmail.com> Signed-off-by:
Asahi Lina <lina@asahilina.net>