Skip to content

Commit

Permalink
rust: drm: Add GPUVM Manager abstraction
Browse files Browse the repository at this point in the history
Signed-off-by: Asahi Lina <lina@asahilina.net>
  • Loading branch information
asahilina authored and jannau committed Dec 21, 2024
1 parent 5c59860 commit 72d456a
Show file tree
Hide file tree
Showing 5 changed files with 706 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rust/bindings/bindings_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

#include <drm/drm_device.h>
#include <drm/drm_drv.h>
#include <drm/drm_exec.h>
#include <drm/drm_file.h>
#include <drm/drm_gem.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_gpuvm.h>
#include <drm/drm_ioctl.h>
#include <drm/drm_syncobj.h>
#include <drm/gpu_scheduler.h>
Expand Down Expand Up @@ -64,6 +66,8 @@ const gfp_t RUST_CONST_HELPER___GFP_NOWARN = ___GFP_NOWARN;
const blk_features_t RUST_CONST_HELPER_BLK_FEAT_ROTATIONAL = BLK_FEAT_ROTATIONAL;
const fop_flags_t RUST_CONST_HELPER_FOP_UNSIGNED_OFFSET = FOP_UNSIGNED_OFFSET;

const uint32_t BINDINGS_DRM_EXEC_INTERRUPTIBLE_WAIT = DRM_EXEC_INTERRUPTIBLE_WAIT;

const gfp_t BINDINGS_XA_FLAGS_LOCK_IRQ = XA_FLAGS_LOCK_IRQ;
const gfp_t BINDINGS_XA_FLAGS_LOCK_BH = XA_FLAGS_LOCK_BH;
const gfp_t BINDINGS_XA_FLAGS_TRACK_FREE = XA_FLAGS_TRACK_FREE;
Expand Down
34 changes: 34 additions & 0 deletions rust/helpers/drm_gpuvm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: GPL-2.0

#include <drm/drm_gpuvm.h>

#ifdef CONFIG_DRM
#ifdef CONFIG_DRM_GPUVM

struct drm_gpuvm *rust_helper_drm_gpuvm_get(struct drm_gpuvm *obj)
{
return drm_gpuvm_get(obj);
}

void rust_helper_drm_gpuvm_exec_unlock(struct drm_gpuvm_exec *vm_exec)
{
return drm_gpuvm_exec_unlock(vm_exec);
}

void rust_helper_drm_gpuva_init_from_op(struct drm_gpuva *va, struct drm_gpuva_op_map *op)
{
drm_gpuva_init_from_op(va, op);
}

struct drm_gpuvm_bo *rust_helper_drm_gpuvm_bo_get(struct drm_gpuvm_bo *vm_bo)
{
return drm_gpuvm_bo_get(vm_bo);
}

bool rust_helper_drm_gpuvm_is_extobj(struct drm_gpuvm *gpuvm, struct drm_gem_object *obj)
{
return drm_gpuvm_is_extobj(gpuvm, obj);
}

#endif
#endif
1 change: 1 addition & 0 deletions rust/helpers/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "dma-mapping.c"
#include "dma-resv.c"
#include "drm.c"
#include "drm_gpuvm.c"
#include "drm_syncobj.c"
#include "err.c"
#include "io.c"
Expand Down
Loading

0 comments on commit 72d456a

Please sign in to comment.