blob: 729b7812a8155b5db3f7c4153566f500e2a2fa30 [file] [log] [blame]
Thomas Gleixnercaab2772019-06-03 07:44:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Laurent Pinchartb5561412017-10-13 17:59:05 +03002/*
3 * omap_gem.h -- OMAP DRM GEM Object Management
4 *
5 * Copyright (C) 2011 Texas Instruments
6 * Author: Rob Clark <rob@ti.com>
Laurent Pinchartb5561412017-10-13 17:59:05 +03007 */
8
9#ifndef __OMAPDRM_GEM_H__
10#define __OMAPDRM_GEM_H__
11
12#include <linux/types.h>
Souptick Joarder6ada1322018-05-22 23:43:57 +053013#include <linux/mm_types.h>
Laurent Pinchartb5561412017-10-13 17:59:05 +030014
15enum dma_data_direction;
16
17struct dma_buf;
18struct drm_device;
19struct drm_file;
20struct drm_gem_object;
21struct drm_mode_create_dumb;
22struct file;
23struct list_head;
24struct page;
25struct seq_file;
26struct vm_area_struct;
27struct vm_fault;
28
29union omap_gem_size;
30
31/* Initialization and Cleanup */
32void omap_gem_init(struct drm_device *dev);
33void omap_gem_deinit(struct drm_device *dev);
34
35#ifdef CONFIG_PM
36int omap_gem_resume(struct drm_device *dev);
37#endif
38
39#ifdef CONFIG_DEBUG_FS
40void omap_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
41void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
42#endif
43
44/* GEM Object Creation and Deletion */
45struct drm_gem_object *omap_gem_new(struct drm_device *dev,
Laurent Pinchartdfe9cfc2018-02-11 15:07:33 +020046 union omap_gem_size gsize, u32 flags);
Laurent Pinchartb5561412017-10-13 17:59:05 +030047struct drm_gem_object *omap_gem_new_dmabuf(struct drm_device *dev, size_t size,
48 struct sg_table *sgt);
49int omap_gem_new_handle(struct drm_device *dev, struct drm_file *file,
Laurent Pinchartdfe9cfc2018-02-11 15:07:33 +020050 union omap_gem_size gsize, u32 flags, u32 *handle);
Laurent Pinchartb5561412017-10-13 17:59:05 +030051void omap_gem_free_object(struct drm_gem_object *obj);
52void *omap_gem_vaddr(struct drm_gem_object *obj);
53
54/* Dumb Buffers Interface */
55int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
Laurent Pinchartdfe9cfc2018-02-11 15:07:33 +020056 u32 handle, u64 *offset);
Laurent Pinchartb5561412017-10-13 17:59:05 +030057int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
58 struct drm_mode_create_dumb *args);
59
60/* mmap() Interface */
61int omap_gem_mmap(struct file *filp, struct vm_area_struct *vma);
62int omap_gem_mmap_obj(struct drm_gem_object *obj,
63 struct vm_area_struct *vma);
Laurent Pinchartdfe9cfc2018-02-11 15:07:33 +020064u64 omap_gem_mmap_offset(struct drm_gem_object *obj);
Laurent Pinchartb5561412017-10-13 17:59:05 +030065size_t omap_gem_mmap_size(struct drm_gem_object *obj);
66
67/* PRIME Interface */
Daniel Vettere4fa8452019-06-14 22:35:25 +020068struct dma_buf *omap_gem_prime_export(struct drm_gem_object *obj, int flags);
Laurent Pinchartb5561412017-10-13 17:59:05 +030069struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
70 struct dma_buf *buffer);
71
Souptick Joarder6ada1322018-05-22 23:43:57 +053072vm_fault_t omap_gem_fault(struct vm_fault *vmf);
Laurent Pinchartdfe9cfc2018-02-11 15:07:33 +020073int omap_gem_roll(struct drm_gem_object *obj, u32 roll);
Laurent Pinchartb5561412017-10-13 17:59:05 +030074void omap_gem_cpu_sync_page(struct drm_gem_object *obj, int pgoff);
75void omap_gem_dma_sync_buffer(struct drm_gem_object *obj,
76 enum dma_data_direction dir);
77int omap_gem_pin(struct drm_gem_object *obj, dma_addr_t *dma_addr);
78void omap_gem_unpin(struct drm_gem_object *obj);
79int omap_gem_get_pages(struct drm_gem_object *obj, struct page ***pages,
80 bool remap);
81int omap_gem_put_pages(struct drm_gem_object *obj);
82
Laurent Pinchartdfe9cfc2018-02-11 15:07:33 +020083u32 omap_gem_flags(struct drm_gem_object *obj);
84int omap_gem_rotated_dma_addr(struct drm_gem_object *obj, u32 orient,
Laurent Pinchartb5561412017-10-13 17:59:05 +030085 int x, int y, dma_addr_t *dma_addr);
Laurent Pinchartdfe9cfc2018-02-11 15:07:33 +020086int omap_gem_tiled_stride(struct drm_gem_object *obj, u32 orient);
Laurent Pinchartb5561412017-10-13 17:59:05 +030087
88#endif /* __OMAPDRM_GEM_H__ */