1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/*
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DRM_TEGRA_UDRM_IOCTL_H
#define DRM_TEGRA_UDRM_IOCTL_H
#include <drm/drm.h>
#if defined(__cplusplus)
extern "C" {
#endif
#define DRM_TEGRA_UDRM_DMABUF_MMAP 0x00
#define DRM_TEGRA_UDRM_DMABUF_DESTROY_MAPPINGS 0x01
#define DRM_TEGRA_UDRM_CLOSE_NOTIFY 0x02
#define DRM_TEGRA_UDRM_SEND_VBLANK_EVENT 0x03
#define DRM_TEGRA_UDRM_DROP_MASTER_NOTIFY 0x04
#define DRM_TEGRA_UDRM_SET_MASTER_NOTIFY 0x05
#define DRM_TEGRA_UDRM_SEND_CONNECTOR_STATUS_EVENT 0x06
struct drm_tegra_udrm_dmabuf_mmap {
int fd;
unsigned long offset;
};
struct drm_tegra_udrm_dmabuf_destroy_mappings {
int fd;
};
struct drm_tegra_udrm_close_notify {
int eventfd;
int clear;
};
struct drm_tegra_udrm_send_vblank_event {
struct drm_event_vblank vblank;
};
struct drm_tegra_udrm_drop_master_notify {
int eventfd;
int clear;
};
struct drm_tegra_udrm_set_master_notify {
int eventfd;
int clear;
};
struct drm_tegra_udrm_connector_status_event {
uint32_t conn_id;
uint32_t prop_id;
};
#define TEGRA_UDRM_IOCTL(dir, name, str) \
DRM_##dir(DRM_COMMAND_BASE + DRM_TEGRA_UDRM_##name, \
struct drm_tegra_udrm_##str)
/* In order to facilitate mmap() on the dumb buffer, UMD issues this
* ioctl from handling of DRM_IOCTL_MODE_MAP_DUMB with dmabuf fd
* corresponding to dumb buffer. Driver will return fake offset
* to UMD which can be used by DRM clients in mmap(.., offset).
*
* In parameters -
* fd: dmabuf fd.
*
* Out parameters -
* offset: offset to be used in mmap().
*/
#define DRM_IOCTL_TEGRA_UDRM_DMABUF_MMAP \
TEGRA_UDRM_IOCTL(IOWR, DMABUF_MMAP, dmabuf_mmap)
/* UMD issues this ioctl from handling of DRM_IOCTL_MODE_DESTROY_DUMB
* to destroy dmabuf fd <=> offset mapping created by driver in
* DRM_IOCTL_TEGRA_UDRM_DMABUF_MMAP.
*
* In parameters -
* fd: dmabuf fd.
*/
#define DRM_IOCTL_TEGRA_UDRM_DMABUF_DESTROY_MAPPINGS \
TEGRA_UDRM_IOCTL(IOW, DMABUF_DESTROY_MAPPINGS, \
dmabuf_destroy_mappings)
/* UMD issues this ioctl with eventfd and then does poll() on
* eventfd. Driver signals this eventfd from .preclose method.
*
* In parameters -
* eventfd: fd created using eventfd().
* clear: When set driver will no longer signal the eventfd.
*/
#define DRM_IOCTL_TEGRA_UDRM_CLOSE_NOTIFY \
TEGRA_UDRM_IOCTL(IOW, CLOSE_NOTIFY, close_notify)
/* UMD issues this ioctl with vblank event. Driver injects
* this event into DRM framework so that it get delivered to DRM
* clients waiting on poll/read on drivers fd.
*
* In parameters -
* vblank: drm_event_vblank structure.
*/
#define DRM_IOCTL_TEGRA_UDRM_SEND_VBLANK_EVENT \
TEGRA_UDRM_IOCTL(IOW, SEND_VBLANK_EVENT, send_vblank_event)
/* UMD issues this ioctl with eventfd and then does poll() on
* eventfd. Driver signals this eventfd from .master_drop method.
*
* In parameters -
* eventfd: fd created using eventfd().
* clear: When set driver will no longer signal the eventfd.
*/
#define DRM_IOCTL_TEGRA_UDRM_DROP_MASTER_NOTIFY \
TEGRA_UDRM_IOCTL(IOW, DROP_MASTER_NOTIFY, drop_master_notify)
#define DRM_IOCTL_TEGRA_UDRM_SET_MASTER_NOTIFY \
TEGRA_UDRM_IOCTL(IOW, SET_MASTER_NOTIFY, set_master_notify)
/* UMD issues this ioctl to generate a uevent for connector status
* property change.
*
* In parameters -
* conn_id: connector id related to the status change.
* prop_id: property id related to the status change.
*/
#define DRM_IOCTL_TEGRA_UDRM_SEND_CONNECTOR_STATUS_EVENT \
TEGRA_UDRM_IOCTL(IOW, SEND_CONNECTOR_STATUS_EVENT, \
connector_status_event)
#if defined(__cplusplus)
}
#endif
#endif
|