xref: /linux/drivers/gpu/drm/tegra/uapi.h (revision 40d269c000bda9fcd276a0412a9cebd3f6e344c5)
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 	struct xarray syncpoints;
25 };
26 
27 struct tegra_drm_mapping {
28 	struct kref ref;
29 
30 	struct host1x_bo_mapping *map;
31 	struct host1x_bo *bo;
32 
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 int tegra_drm_ioctl_syncpoint_allocate(struct drm_device *drm, void *data,
48 				       struct drm_file *file);
49 int tegra_drm_ioctl_syncpoint_free(struct drm_device *drm, void *data,
50 				   struct drm_file *file);
51 int tegra_drm_ioctl_syncpoint_wait(struct drm_device *drm, void *data,
52 				   struct drm_file *file);
53 
54 void tegra_drm_uapi_close_file(struct tegra_drm_file *file);
55 void tegra_drm_mapping_put(struct tegra_drm_mapping *mapping);
56 
57 #endif
58