1
2
3 #ifndef _DRM_CLIENT_H_
4 #define _DRM_CLIENT_H_
5
6 #include <linux/lockdep.h>
7 #include <linux/mutex.h>
8 #include <linux/types.h>
9
10 #include <drm/drm_connector.h>
11 #include <drm/drm_crtc.h>
12
13 struct drm_client_dev;
14 struct drm_device;
15 struct drm_file;
16 struct drm_framebuffer;
17 struct drm_gem_object;
18 struct drm_minor;
19 struct module;
20
21
22
23
24 struct drm_client_funcs {
25
26
27
28 struct module *owner;
29
30
31
32
33
34
35
36
37
38 void (*unregister)(struct drm_client_dev *client);
39
40
41
42
43
44
45
46
47
48
49 int (*restore)(struct drm_client_dev *client);
50
51
52
53
54
55
56
57
58
59 int (*hotplug)(struct drm_client_dev *client);
60 };
61
62
63
64
65 struct drm_client_dev {
66
67
68
69 struct drm_device *dev;
70
71
72
73
74 const char *name;
75
76
77
78
79
80
81
82 struct list_head list;
83
84
85
86
87 const struct drm_client_funcs *funcs;
88
89
90
91
92 struct drm_file *file;
93
94
95
96
97 struct mutex modeset_mutex;
98
99
100
101
102 struct drm_mode_set *modesets;
103 };
104
105 int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
106 const char *name, const struct drm_client_funcs *funcs);
107 void drm_client_release(struct drm_client_dev *client);
108 void drm_client_register(struct drm_client_dev *client);
109
110 void drm_client_dev_unregister(struct drm_device *dev);
111 void drm_client_dev_hotplug(struct drm_device *dev);
112 void drm_client_dev_restore(struct drm_device *dev);
113
114
115
116
117 struct drm_client_buffer {
118
119
120
121 struct drm_client_dev *client;
122
123
124
125
126 u32 handle;
127
128
129
130
131 u32 pitch;
132
133
134
135
136 struct drm_gem_object *gem;
137
138
139
140
141 void *vaddr;
142
143
144
145
146 struct drm_framebuffer *fb;
147 };
148
149 struct drm_client_buffer *
150 drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format);
151 void drm_client_framebuffer_delete(struct drm_client_buffer *buffer);
152 void *drm_client_buffer_vmap(struct drm_client_buffer *buffer);
153 void drm_client_buffer_vunmap(struct drm_client_buffer *buffer);
154
155 int drm_client_modeset_create(struct drm_client_dev *client);
156 void drm_client_modeset_free(struct drm_client_dev *client);
157 int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int height);
158 bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation);
159 int drm_client_modeset_commit_force(struct drm_client_dev *client);
160 int drm_client_modeset_commit(struct drm_client_dev *client);
161 int drm_client_modeset_dpms(struct drm_client_dev *client, int mode);
162
163
164
165
166
167
168 #define drm_client_for_each_modeset(modeset, client) \
169 for (({ lockdep_assert_held(&(client)->modeset_mutex); }), \
170 modeset = (client)->modesets; modeset->crtc; modeset++)
171
172
173
174
175
176
177
178
179
180
181
182 #define drm_client_for_each_connector_iter(connector, iter) \
183 drm_for_each_connector_iter(connector, iter) \
184 if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
185
186 int drm_client_debugfs_init(struct drm_minor *minor);
187
188 #endif