blob: 1c360bf7c9b0ab8f8b46ca76e2633286e82759a4 [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
3.. _media-g-topology:
4
5**************************
6ioctl MEDIA_IOC_G_TOPOLOGY
7**************************
8
9*man MEDIA_IOC_G_TOPOLOGY(2)*
10
11Enumerate the graph topology and graph element properties
12
13
14Synopsis
15========
16
Mauro Carvalho Chehabb7e67f62016-07-02 09:49:16 -030017.. cpp:function:: int ioctl( int fd, int request, struct media_v2_topology *argp )
Markus Heiser5377d912016-06-30 15:18:56 +020018
19Arguments
20=========
21
22``fd``
23 File descriptor returned by :ref:`open() <media-func-open>`.
24
25``request``
26 MEDIA_IOC_G_TOPOLOGY
27
28``argp``
29
30
31Description
32===========
33
34The typical usage of this ioctl is to call it twice. On the first call,
35the structure defined at struct
36:ref:`media_v2_topology <media-v2-topology>` should be zeroed. At
37return, if no errors happen, this ioctl will return the
38``topology_version`` and the total number of entities, interfaces, pads
39and links.
40
41Before the second call, the userspace should allocate arrays to store
42the graph elements that are desired, putting the pointers to them at the
43ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping the
44other values untouched.
45
46If the ``topology_version`` remains the same, the ioctl should fill the
47desired arrays with the media graph elements.
48
49
50.. _media-v2-topology:
51
52.. flat-table:: struct media_v2_topology
53 :header-rows: 0
54 :stub-columns: 0
55
56
57 - .. row 1
58
59 - __u64
60
61 - ``topology_version``
62
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030063 -
64 -
Markus Heiser5377d912016-06-30 15:18:56 +020065 - Version of the media graph topology. When the graph is created,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030066 this field starts with zero. Every time a graph element is added
67 or removed, this field is incremented.
Markus Heiser5377d912016-06-30 15:18:56 +020068
69 - .. row 2
70
71 - __u64
72
73 - ``num_entities``
74
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030075 -
76 -
Markus Heiser5377d912016-06-30 15:18:56 +020077 - Number of entities in the graph
78
79 - .. row 3
80
81 - __u64
82
83 - ``ptr_entities``
84
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030085 -
86 -
Markus Heiser5377d912016-06-30 15:18:56 +020087 - A pointer to a memory area where the entities array will be
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030088 stored, converted to a 64-bits integer. It can be zero. if zero,
89 the ioctl won't store the entities. It will just update
90 ``num_entities``
Markus Heiser5377d912016-06-30 15:18:56 +020091
92 - .. row 4
93
94 - __u64
95
96 - ``num_interfaces``
97
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030098 -
99 -
Markus Heiser5377d912016-06-30 15:18:56 +0200100 - Number of interfaces in the graph
101
102 - .. row 5
103
104 - __u64
105
106 - ``ptr_interfaces``
107
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300108 -
109 -
Markus Heiser5377d912016-06-30 15:18:56 +0200110 - A pointer to a memory area where the interfaces array will be
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300111 stored, converted to a 64-bits integer. It can be zero. if zero,
112 the ioctl won't store the interfaces. It will just update
113 ``num_interfaces``
Markus Heiser5377d912016-06-30 15:18:56 +0200114
115 - .. row 6
116
117 - __u64
118
119 - ``num_pads``
120
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300121 -
122 -
Markus Heiser5377d912016-06-30 15:18:56 +0200123 - Total number of pads in the graph
124
125 - .. row 7
126
127 - __u64
128
129 - ``ptr_pads``
130
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300131 -
132 -
Markus Heiser5377d912016-06-30 15:18:56 +0200133 - A pointer to a memory area where the pads array will be stored,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300134 converted to a 64-bits integer. It can be zero. if zero, the ioctl
135 won't store the pads. It will just update ``num_pads``
Markus Heiser5377d912016-06-30 15:18:56 +0200136
137 - .. row 8
138
139 - __u64
140
141 - ``num_links``
142
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300143 -
144 -
Markus Heiser5377d912016-06-30 15:18:56 +0200145 - Total number of data and interface links in the graph
146
147 - .. row 9
148
149 - __u64
150
151 - ``ptr_links``
152
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300153 -
154 -
Markus Heiser5377d912016-06-30 15:18:56 +0200155 - A pointer to a memory area where the links array will be stored,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300156 converted to a 64-bits integer. It can be zero. if zero, the ioctl
157 won't store the links. It will just update ``num_links``
Markus Heiser5377d912016-06-30 15:18:56 +0200158
159
160
161.. _media-v2-entity:
162
163.. flat-table:: struct media_v2_entity
164 :header-rows: 0
165 :stub-columns: 0
166
167
168 - .. row 1
169
170 - __u32
171
172 - ``id``
173
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300174 -
175 -
Markus Heiser5377d912016-06-30 15:18:56 +0200176 - Unique ID for the entity.
177
178 - .. row 2
179
180 - char
181
182 - ``name``\ [64]
183
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300184 -
185 -
Markus Heiser5377d912016-06-30 15:18:56 +0200186 - Entity name as an UTF-8 NULL-terminated string.
187
188 - .. row 3
189
190 - __u32
191
192 - ``function``
193
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300194 -
195 -
Markus Heiser5377d912016-06-30 15:18:56 +0200196 - Entity main function, see :ref:`media-entity-type` for details.
197
198 - .. row 4
199
200 - __u32
201
202 - ``reserved``\ [12]
203
204 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300205 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200206
207
208
209.. _media-v2-interface:
210
211.. flat-table:: struct media_v2_interface
212 :header-rows: 0
213 :stub-columns: 0
214
215
216 - .. row 1
217
218 - __u32
219
220 - ``id``
221
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300222 -
223 -
Markus Heiser5377d912016-06-30 15:18:56 +0200224 - Unique ID for the interface.
225
226 - .. row 2
227
228 - __u32
229
230 - ``intf_type``
231
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300232 -
233 -
Markus Heiser5377d912016-06-30 15:18:56 +0200234 - Interface type, see :ref:`media-intf-type` for details.
235
236 - .. row 3
237
238 - __u32
239
240 - ``flags``
241
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300242 -
243 -
Markus Heiser5377d912016-06-30 15:18:56 +0200244 - Interface flags. Currently unused.
245
246 - .. row 4
247
248 - __u32
249
250 - ``reserved``\ [9]
251
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300252 -
253 -
Markus Heiser5377d912016-06-30 15:18:56 +0200254 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300255 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200256
257 - .. row 5
258
259 - struct media_v2_intf_devnode
260
261 - ``devnode``
262
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300263 -
264 -
Markus Heiser5377d912016-06-30 15:18:56 +0200265 - Used only for device node interfaces. See
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300266 :ref:`media-v2-intf-devnode` for details..
Markus Heiser5377d912016-06-30 15:18:56 +0200267
268
269
270.. _media-v2-intf-devnode:
271
272.. flat-table:: struct media_v2_interface
273 :header-rows: 0
274 :stub-columns: 0
275
276
277 - .. row 1
278
279 - __u32
280
281 - ``major``
282
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300283 -
284 -
Markus Heiser5377d912016-06-30 15:18:56 +0200285 - Device node major number.
286
287 - .. row 2
288
289 - __u32
290
291 - ``minor``
292
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300293 -
294 -
Markus Heiser5377d912016-06-30 15:18:56 +0200295 - Device node minor number.
296
297
298
299.. _media-v2-pad:
300
301.. flat-table:: struct media_v2_pad
302 :header-rows: 0
303 :stub-columns: 0
304
305
306 - .. row 1
307
308 - __u32
309
310 - ``id``
311
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300312 -
313 -
Markus Heiser5377d912016-06-30 15:18:56 +0200314 - Unique ID for the pad.
315
316 - .. row 2
317
318 - __u32
319
320 - ``entity_id``
321
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300322 -
323 -
Markus Heiser5377d912016-06-30 15:18:56 +0200324 - Unique ID for the entity where this pad belongs.
325
326 - .. row 3
327
328 - __u32
329
330 - ``flags``
331
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300332 -
333 -
Markus Heiser5377d912016-06-30 15:18:56 +0200334 - Pad flags, see :ref:`media-pad-flag` for more details.
335
336 - .. row 4
337
338 - __u32
339
340 - ``reserved``\ [9]
341
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300342 -
343 -
Markus Heiser5377d912016-06-30 15:18:56 +0200344 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300345 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200346
347
348
349.. _media-v2-link:
350
351.. flat-table:: struct media_v2_pad
352 :header-rows: 0
353 :stub-columns: 0
354
355
356 - .. row 1
357
358 - __u32
359
360 - ``id``
361
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300362 -
363 -
Markus Heiser5377d912016-06-30 15:18:56 +0200364 - Unique ID for the pad.
365
366 - .. row 2
367
368 - __u32
369
370 - ``source_id``
371
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300372 -
373 -
Markus Heiser5377d912016-06-30 15:18:56 +0200374 - On pad to pad links: unique ID for the source pad.
375
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300376 On interface to entity links: unique ID for the interface.
Markus Heiser5377d912016-06-30 15:18:56 +0200377
378 - .. row 3
379
380 - __u32
381
382 - ``sink_id``
383
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300384 -
385 -
Markus Heiser5377d912016-06-30 15:18:56 +0200386 - On pad to pad links: unique ID for the sink pad.
387
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300388 On interface to entity links: unique ID for the entity.
Markus Heiser5377d912016-06-30 15:18:56 +0200389
390 - .. row 4
391
392 - __u32
393
394 - ``flags``
395
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300396 -
397 -
Markus Heiser5377d912016-06-30 15:18:56 +0200398 - Link flags, see :ref:`media-link-flag` for more details.
399
400 - .. row 5
401
402 - __u32
403
404 - ``reserved``\ [5]
405
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300406 -
407 -
Markus Heiser5377d912016-06-30 15:18:56 +0200408 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300409 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200410
411
412
413Return Value
414============
415
416On success 0 is returned, on error -1 and the ``errno`` variable is set
417appropriately. The generic error codes are described at the
418:ref:`Generic Error Codes <gen-errors>` chapter.
419
420ENOSPC
421 This is returned when either one or more of the num_entities,
422 num_interfaces, num_links or num_pads are non-zero and are
423 smaller than the actual number of elements inside the graph. This
424 may happen if the ``topology_version`` changed when compared to the
425 last time this ioctl was called. Userspace should usually free the
426 area for the pointers, zero the struct elements and call this ioctl
427 again.