19c92ab61SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 22048e328SMark Yao /* 32048e328SMark Yao * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd 42048e328SMark Yao * Author:Mark Yao <mark.yao@rock-chips.com> 52048e328SMark Yao */ 62048e328SMark Yao 72048e328SMark Yao #ifndef _ROCKCHIP_DRM_GEM_H 82048e328SMark Yao #define _ROCKCHIP_DRM_GEM_H 92048e328SMark Yao 102048e328SMark Yao #define to_rockchip_obj(x) container_of(x, struct rockchip_gem_object, base) 112048e328SMark Yao 122048e328SMark Yao struct rockchip_gem_object { 132048e328SMark Yao struct drm_gem_object base; 142048e328SMark Yao unsigned int flags; 152048e328SMark Yao 162048e328SMark Yao void *kvaddr; 172048e328SMark Yao dma_addr_t dma_addr; 1838f993b7STomasz Figa /* Used when IOMMU is disabled */ 1900085f1eSKrzysztof Kozlowski unsigned long dma_attrs; 2038f993b7STomasz Figa 2138f993b7STomasz Figa /* Used when IOMMU is enabled */ 2238f993b7STomasz Figa struct drm_mm_node mm; 2338f993b7STomasz Figa unsigned long num_pages; 2438f993b7STomasz Figa struct page **pages; 2538f993b7STomasz Figa struct sg_table *sgt; 2638f993b7STomasz Figa size_t size; 272048e328SMark Yao }; 282048e328SMark Yao 292048e328SMark Yao struct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj); 302048e328SMark Yao struct drm_gem_object * 316fd0bfe2SHaixia Shi rockchip_gem_prime_import_sg_table(struct drm_device *dev, 326fd0bfe2SHaixia Shi struct dma_buf_attachment *attach, 336fd0bfe2SHaixia Shi struct sg_table *sg); 34*7938f421SLucas De Marchi int rockchip_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map); 35*7938f421SLucas De Marchi void rockchip_gem_prime_vunmap(struct drm_gem_object *obj, 36*7938f421SLucas De Marchi struct iosys_map *map); 372048e328SMark Yao 382048e328SMark Yao struct rockchip_gem_object * 39f76c83b5SDaniel Kurtz rockchip_gem_create_object(struct drm_device *drm, unsigned int size, 40f76c83b5SDaniel Kurtz bool alloc_kmap); 412048e328SMark Yao 422048e328SMark Yao void rockchip_gem_free_object(struct drm_gem_object *obj); 432048e328SMark Yao 442048e328SMark Yao int rockchip_gem_dumb_create(struct drm_file *file_priv, 452048e328SMark Yao struct drm_device *dev, 462048e328SMark Yao struct drm_mode_create_dumb *args); 472048e328SMark Yao #endif /* _ROCKCHIP_DRM_GEM_H */ 48