root/drivers/gpu/drm/rockchip/rockchip_drm_gem.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
   4  * Author:Mark Yao <mark.yao@rock-chips.com>
   5  */
   6 
   7 #ifndef _ROCKCHIP_DRM_GEM_H
   8 #define _ROCKCHIP_DRM_GEM_H
   9 
  10 #define to_rockchip_obj(x) container_of(x, struct rockchip_gem_object, base)
  11 
  12 struct rockchip_gem_object {
  13         struct drm_gem_object base;
  14         unsigned int flags;
  15 
  16         void *kvaddr;
  17         dma_addr_t dma_addr;
  18         /* Used when IOMMU is disabled */
  19         unsigned long dma_attrs;
  20 
  21         /* Used when IOMMU is enabled */
  22         struct drm_mm_node mm;
  23         unsigned long num_pages;
  24         struct page **pages;
  25         struct sg_table *sgt;
  26         size_t size;
  27 };
  28 
  29 struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj);
  30 struct drm_gem_object *
  31 rockchip_gem_prime_import_sg_table(struct drm_device *dev,
  32                                    struct dma_buf_attachment *attach,
  33                                    struct sg_table *sg);
  34 void *rockchip_gem_prime_vmap(struct drm_gem_object *obj);
  35 void rockchip_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
  36 
  37 /* drm driver mmap file operations */
  38 int rockchip_gem_mmap(struct file *filp, struct vm_area_struct *vma);
  39 
  40 /* mmap a gem object to userspace. */
  41 int rockchip_gem_mmap_buf(struct drm_gem_object *obj,
  42                           struct vm_area_struct *vma);
  43 
  44 struct rockchip_gem_object *
  45         rockchip_gem_create_object(struct drm_device *drm, unsigned int size,
  46                                    bool alloc_kmap);
  47 
  48 void rockchip_gem_free_object(struct drm_gem_object *obj);
  49 
  50 int rockchip_gem_dumb_create(struct drm_file *file_priv,
  51                              struct drm_device *dev,
  52                              struct drm_mode_create_dumb *args);
  53 #endif /* _ROCKCHIP_DRM_GEM_H */

/* [<][>][^][v][top][bottom][index][help] */