162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd 462306a36Sopenharmony_ci * Author:Mark Yao <mark.yao@rock-chips.com> 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef _ROCKCHIP_DRM_GEM_H 862306a36Sopenharmony_ci#define _ROCKCHIP_DRM_GEM_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#define to_rockchip_obj(x) container_of(x, struct rockchip_gem_object, base) 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_cistruct rockchip_gem_object { 1362306a36Sopenharmony_ci struct drm_gem_object base; 1462306a36Sopenharmony_ci unsigned int flags; 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci void *kvaddr; 1762306a36Sopenharmony_ci dma_addr_t dma_addr; 1862306a36Sopenharmony_ci /* Used when IOMMU is disabled */ 1962306a36Sopenharmony_ci unsigned long dma_attrs; 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci /* Used when IOMMU is enabled */ 2262306a36Sopenharmony_ci struct drm_mm_node mm; 2362306a36Sopenharmony_ci unsigned long num_pages; 2462306a36Sopenharmony_ci struct page **pages; 2562306a36Sopenharmony_ci struct sg_table *sgt; 2662306a36Sopenharmony_ci size_t size; 2762306a36Sopenharmony_ci}; 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_cistruct sg_table *rockchip_gem_prime_get_sg_table(struct drm_gem_object *obj); 3062306a36Sopenharmony_cistruct drm_gem_object * 3162306a36Sopenharmony_cirockchip_gem_prime_import_sg_table(struct drm_device *dev, 3262306a36Sopenharmony_ci struct dma_buf_attachment *attach, 3362306a36Sopenharmony_ci struct sg_table *sg); 3462306a36Sopenharmony_ciint rockchip_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map); 3562306a36Sopenharmony_civoid rockchip_gem_prime_vunmap(struct drm_gem_object *obj, 3662306a36Sopenharmony_ci struct iosys_map *map); 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_cistruct rockchip_gem_object * 3962306a36Sopenharmony_ci rockchip_gem_create_object(struct drm_device *drm, unsigned int size, 4062306a36Sopenharmony_ci bool alloc_kmap); 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_civoid rockchip_gem_free_object(struct drm_gem_object *obj); 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ciint rockchip_gem_dumb_create(struct drm_file *file_priv, 4562306a36Sopenharmony_ci struct drm_device *dev, 4662306a36Sopenharmony_ci struct drm_mode_create_dumb *args); 4762306a36Sopenharmony_ci#endif /* _ROCKCHIP_DRM_GEM_H */ 48