mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

DRM GEM is the DRM memory management subsystem used by most modern drivers; add a Rust abstraction for DRM GEM. This includes the BaseObject trait, which contains operations shared by all GEM object classes. Signed-off-by: Asahi Lina <lina@asahilina.net> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Lyude Paul <lyude@redhat.com> Link: https://lore.kernel.org/r/20250410235546.43736-8-dakr@kernel.org [ Rework of GEM object abstractions * switch to the Opaque<T> type * fix (mutable) references to struct drm_gem_object (which in this context is UB) * drop all custom reference types in favor of AlwaysRefCounted * bunch of minor changes and simplifications (e.g. IntoGEMObject trait) * write and fix safety and invariant comments * remove necessity for and convert 'as' casts * original source archive: https://archive.is/dD5SL - Danilo ] [ Fix missing CONFIG_DRM guards in rust/helpers/drm.c. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
23 lines
434 B
C
23 lines
434 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <drm/drm_gem.h>
|
|
#include <drm/drm_vma_manager.h>
|
|
|
|
#ifdef CONFIG_DRM
|
|
|
|
void rust_helper_drm_gem_object_get(struct drm_gem_object *obj)
|
|
{
|
|
drm_gem_object_get(obj);
|
|
}
|
|
|
|
void rust_helper_drm_gem_object_put(struct drm_gem_object *obj)
|
|
{
|
|
drm_gem_object_put(obj);
|
|
}
|
|
|
|
__u64 rust_helper_drm_vma_node_offset_addr(struct drm_vma_offset_node *node)
|
|
{
|
|
return drm_vma_node_offset_addr(node);
|
|
}
|
|
|
|
#endif
|