xref: /linux-6.15/drivers/gpu/drm/tegra/uapi.h (revision d7c591bc)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (c) 2020 NVIDIA Corporation */
3 
4 #ifndef _TEGRA_DRM_UAPI_H
5 #define _TEGRA_DRM_UAPI_H
6 
7 #include <linux/dma-mapping.h>
8 #include <linux/idr.h>
9 #include <linux/kref.h>
10 #include <linux/xarray.h>
11 
12 #include <drm/drm.h>
13 
14 struct drm_file;
15 struct drm_device;
16 
17 struct tegra_drm_file {
18 	/* Legacy UAPI state */
19 	struct idr legacy_contexts;
20 	struct mutex lock;
21 
22 	/* New UAPI state */
23 	struct xarray contexts;
24 };
25 
26 struct tegra_drm_mapping {
27 	struct kref ref;
28 
29 	struct device *dev;
30 	struct host1x_bo *bo;
31 	struct sg_table *sgt;
32 	enum dma_data_direction direction;
33 	dma_addr_t iova;
34 	dma_addr_t iova_end;
35 };
36 
37 int tegra_drm_ioctl_channel_open(struct drm_device *drm, void *data,
38 				 struct drm_file *file);
39 int tegra_drm_ioctl_channel_close(struct drm_device *drm, void *data,
40 				  struct drm_file *file);
41 int tegra_drm_ioctl_channel_map(struct drm_device *drm, void *data,
42 				struct drm_file *file);
43 int tegra_drm_ioctl_channel_unmap(struct drm_device *drm, void *data,
44 				  struct drm_file *file);
45 int tegra_drm_ioctl_channel_submit(struct drm_device *drm, void *data,
46 				   struct drm_file *file);
47 
48 void tegra_drm_uapi_close_file(struct tegra_drm_file *file);
49 void tegra_drm_mapping_put(struct tegra_drm_mapping *mapping);
50 
51 #endif
52