linux/drivers/gpu/drm/panthor/panthor_gem.h

/* SPDX-License-Identifier: GPL-2.0 or MIT */
/* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */
/* Copyright 2023 Collabora ltd. */

#ifndef __PANTHOR_GEM_H__
#define __PANTHOR_GEM_H__

#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_mm.h>

#include <linux/iosys-map.h>
#include <linux/rwsem.h>

struct panthor_vm;

/**
 * struct panthor_gem_object - Driver specific GEM object.
 */
struct panthor_gem_object {};

/**
 * struct panthor_kernel_bo - Kernel buffer object.
 *
 * These objects are only manipulated by the kernel driver and not
 * directly exposed to the userspace. The GPU address of a kernel
 * BO might be passed to userspace though.
 */
struct panthor_kernel_bo {};

static inline
struct panthor_gem_object *to_panthor_bo(struct drm_gem_object *obj)
{}

struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_t size);

struct drm_gem_object *
panthor_gem_prime_import_sg_table(struct drm_device *ddev,
				  struct dma_buf_attachment *attach,
				  struct sg_table *sgt);

int
panthor_gem_create_with_handle(struct drm_file *file,
			       struct drm_device *ddev,
			       struct panthor_vm *exclusive_vm,
			       u64 *size, u32 flags, uint32_t *handle);

static inline u64
panthor_kernel_bo_gpuva(struct panthor_kernel_bo *bo)
{}

static inline size_t
panthor_kernel_bo_size(struct panthor_kernel_bo *bo)
{}

static inline int
panthor_kernel_bo_vmap(struct panthor_kernel_bo *bo)
{}

static inline void
panthor_kernel_bo_vunmap(struct panthor_kernel_bo *bo)
{}

struct panthor_kernel_bo *
panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
			 size_t size, u32 bo_flags, u32 vm_map_flags,
			 u64 gpu_va);

void panthor_kernel_bo_destroy(struct panthor_kernel_bo *bo);

#endif /* __PANTHOR_GEM_H__ */