162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * omap_gem.h -- OMAP DRM GEM Object Management
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2011 Texas Instruments
662306a36Sopenharmony_ci * Author: Rob Clark <rob@ti.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __OMAPDRM_GEM_H__
1062306a36Sopenharmony_ci#define __OMAPDRM_GEM_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/types.h>
1362306a36Sopenharmony_ci#include <linux/mm_types.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cienum dma_data_direction;
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistruct dma_buf;
1862306a36Sopenharmony_cistruct drm_device;
1962306a36Sopenharmony_cistruct drm_file;
2062306a36Sopenharmony_cistruct drm_gem_object;
2162306a36Sopenharmony_cistruct drm_mode_create_dumb;
2262306a36Sopenharmony_cistruct file;
2362306a36Sopenharmony_cistruct list_head;
2462306a36Sopenharmony_cistruct page;
2562306a36Sopenharmony_cistruct seq_file;
2662306a36Sopenharmony_cistruct vm_area_struct;
2762306a36Sopenharmony_cistruct vm_fault;
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciunion omap_gem_size;
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* Initialization and Cleanup */
3262306a36Sopenharmony_civoid omap_gem_init(struct drm_device *dev);
3362306a36Sopenharmony_civoid omap_gem_deinit(struct drm_device *dev);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifdef CONFIG_PM
3662306a36Sopenharmony_ciint omap_gem_resume(struct drm_device *dev);
3762306a36Sopenharmony_ci#endif
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#ifdef CONFIG_DEBUG_FS
4062306a36Sopenharmony_civoid omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
4162306a36Sopenharmony_civoid omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
4262306a36Sopenharmony_ci#endif
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* GEM Object Creation and Deletion */
4562306a36Sopenharmony_cistruct drm_gem_object *omap_gem_new(struct drm_device *dev,
4662306a36Sopenharmony_ci		union omap_gem_size gsize, u32 flags);
4762306a36Sopenharmony_cistruct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size,
4862306a36Sopenharmony_ci		struct sg_table *sgt);
4962306a36Sopenharmony_ciint omap_gem_new_handle(struct drm_device *dev, struct drm_file *file,
5062306a36Sopenharmony_ci		union omap_gem_size gsize, u32 flags, u32 *handle);
5162306a36Sopenharmony_civoid *omap_gem_vaddr(struct drm_gem_object *obj);
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci/* Dumb Buffers Interface */
5462306a36Sopenharmony_ciint omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
5562306a36Sopenharmony_ci		u32 handle, u64 *offset);
5662306a36Sopenharmony_ciint omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
5762306a36Sopenharmony_ci		struct drm_mode_create_dumb *args);
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci/* mmap() Interface */
6062306a36Sopenharmony_ciu64 omap_gem_mmap_offset(struct drm_gem_object *obj);
6162306a36Sopenharmony_cisize_t omap_gem_mmap_size(struct drm_gem_object *obj);
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/* PRIME Interface */
6462306a36Sopenharmony_cistruct dma_buf *omap_gem_prime_export(struct drm_gem_object *obj, int flags);
6562306a36Sopenharmony_cistruct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
6662306a36Sopenharmony_ci		struct dma_buf *buffer);
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciint omap_gem_roll(struct drm_gem_object *obj, u32 roll);
6962306a36Sopenharmony_civoid omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff);
7062306a36Sopenharmony_civoid omap_gem_dma_sync_buffer(struct drm_gem_object *obj,
7162306a36Sopenharmony_ci		enum dma_data_direction dir);
7262306a36Sopenharmony_ciint omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr);
7362306a36Sopenharmony_civoid omap_gem_unpin(struct drm_gem_object *obj);
7462306a36Sopenharmony_ciint omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages,
7562306a36Sopenharmony_ci		bool remap);
7662306a36Sopenharmony_ciint omap_gem_put_pages(struct drm_gem_object *obj);
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciu32 omap_gem_flags(struct drm_gem_object *obj);
7962306a36Sopenharmony_ciint omap_gem_rotated_dma_addr(struct drm_gem_object *obj, u32 orient,
8062306a36Sopenharmony_ci		int x, int y, dma_addr_t *dma_addr);
8162306a36Sopenharmony_ciint omap_gem_tiled_stride(struct drm_gem_object *obj, u32 orient);
8262306a36Sopenharmony_cistruct sg_table *omap_gem_get_sg(struct drm_gem_object *obj,
8362306a36Sopenharmony_ci		enum dma_data_direction dir);
8462306a36Sopenharmony_civoid omap_gem_put_sg(struct drm_gem_object *obj, struct sg_table *sgt);
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#endif /* __OMAPDRM_GEM_H__ */
87