Skip to content
Snippets Groups Projects
  • Asahi Lina's avatar
    bd1f6606
    rust: drm: gem: shmem: Add DRM shmem helper abstraction · bd1f6606
    Asahi Lina authored and Lyude Paul's avatar Lyude Paul committed
    
    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: default avatarAsahi Lina <lina@asahilina.net>
    bd1f6606
    History
    rust: drm: gem: shmem: Add DRM shmem helper abstraction
    Asahi Lina authored and Lyude Paul's avatar Lyude Paul committed
    
    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: default avatarAsahi Lina <lina@asahilina.net>
gem_shmem_helper.c 1.14 KiB
#include <drm/drm_gem_shmem_helper.h>

void rust_helper_drm_gem_shmem_object_free(struct drm_gem_object *obj)
{
	return drm_gem_shmem_object_free(obj);
}

void rust_helper_drm_gem_shmem_object_print_info(struct drm_printer *p, unsigned int indent,
						   const struct drm_gem_object *obj)
{
	drm_gem_shmem_object_print_info(p, indent, obj);
}

int rust_helper_drm_gem_shmem_object_pin(struct drm_gem_object *obj)
{
	return drm_gem_shmem_object_pin(obj);
}

void rust_helper_drm_gem_shmem_object_unpin(struct drm_gem_object *obj)
{
	drm_gem_shmem_object_unpin(obj);
}

struct sg_table *rust_helper_drm_gem_shmem_object_get_sg_table(struct drm_gem_object *obj)
{
	return drm_gem_shmem_object_get_sg_table(obj);
}

int rust_helper_drm_gem_shmem_object_vmap(struct drm_gem_object *obj,
					    struct iosys_map *map)
{
	return drm_gem_shmem_object_vmap(obj, map);
}

void rust_helper_drm_gem_shmem_object_vunmap(struct drm_gem_object *obj,
					       struct iosys_map *map)
{
	drm_gem_shmem_object_vunmap(obj, map);
}

int rust_helper_drm_gem_shmem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
{
	return drm_gem_shmem_object_mmap(obj, vma);
}