#include <linux/dma-buf.h>
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <drm/drm_drv.h>
#include <drm/drm_prime.h>
#include <drm/tegra_drm.h>
#include "drm.h"
#include "gem.h"
MODULE_IMPORT_NS(…);
static unsigned int sg_dma_count_chunks(struct scatterlist *sgl, unsigned int nents)
{ … }
static inline unsigned int sgt_dma_count_chunks(struct sg_table *sgt)
{ … }
static void tegra_bo_put(struct host1x_bo *bo)
{ … }
static struct host1x_bo_mapping *tegra_bo_pin(struct device *dev, struct host1x_bo *bo,
enum dma_data_direction direction)
{ … }
static void tegra_bo_unpin(struct host1x_bo_mapping *map)
{ … }
static void *tegra_bo_mmap(struct host1x_bo *bo)
{ … }
static void tegra_bo_munmap(struct host1x_bo *bo, void *addr)
{ … }
static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo)
{ … }
static const struct host1x_bo_ops tegra_bo_ops = …;
static int tegra_bo_iommu_map(struct tegra_drm *tegra, struct tegra_bo *bo)
{ … }
static int tegra_bo_iommu_unmap(struct tegra_drm *tegra, struct tegra_bo *bo)
{ … }
static const struct drm_gem_object_funcs tegra_gem_object_funcs = …;
static struct tegra_bo *tegra_bo_alloc_object(struct drm_device *drm,
size_t size)
{ … }
static void tegra_bo_free(struct drm_device *drm, struct tegra_bo *bo)
{ … }
static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo)
{ … }
static int tegra_bo_alloc(struct drm_device *drm, struct tegra_bo *bo)
{ … }
struct tegra_bo *tegra_bo_create(struct drm_device *drm, size_t size,
unsigned long flags)
{ … }
struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,
struct drm_device *drm,
size_t size,
unsigned long flags,
u32 *handle)
{ … }
static struct tegra_bo *tegra_bo_import(struct drm_device *drm,
struct dma_buf *buf)
{ … }
void tegra_bo_free_object(struct drm_gem_object *gem)
{ … }
int tegra_bo_dumb_create(struct drm_file *file, struct drm_device *drm,
struct drm_mode_create_dumb *args)
{ … }
static vm_fault_t tegra_bo_fault(struct vm_fault *vmf)
{ … }
const struct vm_operations_struct tegra_bo_vm_ops = …;
int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
{ … }
int tegra_drm_mmap(struct file *file, struct vm_area_struct *vma)
{ … }
static struct sg_table *
tegra_gem_prime_map_dma_buf(struct dma_buf_attachment *attach,
enum dma_data_direction dir)
{ … }
static void tegra_gem_prime_unmap_dma_buf(struct dma_buf_attachment *attach,
struct sg_table *sgt,
enum dma_data_direction dir)
{ … }
static void tegra_gem_prime_release(struct dma_buf *buf)
{ … }
static int tegra_gem_prime_begin_cpu_access(struct dma_buf *buf,
enum dma_data_direction direction)
{ … }
static int tegra_gem_prime_end_cpu_access(struct dma_buf *buf,
enum dma_data_direction direction)
{ … }
static int tegra_gem_prime_mmap(struct dma_buf *buf, struct vm_area_struct *vma)
{ … }
static int tegra_gem_prime_vmap(struct dma_buf *buf, struct iosys_map *map)
{ … }
static void tegra_gem_prime_vunmap(struct dma_buf *buf, struct iosys_map *map)
{ … }
static const struct dma_buf_ops tegra_gem_prime_dmabuf_ops = …;
struct dma_buf *tegra_gem_prime_export(struct drm_gem_object *gem,
int flags)
{ … }
struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm,
struct dma_buf *buf)
{ … }
struct host1x_bo *tegra_gem_lookup(struct drm_file *file, u32 handle)
{ … }