blob: 1f2d530aa28484a082e1a8d878f292f75a756f1f [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
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -03009Name
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030010====
Markus Heiser5377d912016-06-30 15:18:56 +020011
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030012MEDIA_IOC_G_TOPOLOGY - Enumerate the graph topology and graph element properties
Markus Heiser5377d912016-06-30 15:18:56 +020013
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030014
15Synopsis
Markus Heiser5377d912016-06-30 15:18:56 +020016========
17
Mauro Carvalho Chehabb7e67f62016-07-02 09:49:16 -030018.. cpp:function:: int ioctl( int fd, int request, struct media_v2_topology *argp )
Markus Heiser5377d912016-06-30 15:18:56 +020019
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030020
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030021Arguments
Markus Heiser5377d912016-06-30 15:18:56 +020022=========
23
24``fd``
25 File descriptor returned by :ref:`open() <media-func-open>`.
26
27``request``
28 MEDIA_IOC_G_TOPOLOGY
29
30``argp``
31
32
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030033Description
Markus Heiser5377d912016-06-30 15:18:56 +020034===========
35
36The typical usage of this ioctl is to call it twice. On the first call,
37the structure defined at struct
38:ref:`media_v2_topology <media-v2-topology>` should be zeroed. At
39return, if no errors happen, this ioctl will return the
40``topology_version`` and the total number of entities, interfaces, pads
41and links.
42
43Before the second call, the userspace should allocate arrays to store
44the graph elements that are desired, putting the pointers to them at the
45ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping the
46other values untouched.
47
48If the ``topology_version`` remains the same, the ioctl should fill the
49desired arrays with the media graph elements.
50
51
52.. _media-v2-topology:
53
54.. flat-table:: struct media_v2_topology
55 :header-rows: 0
56 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -030057 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +020058
59
60 - .. row 1
61
62 - __u64
63
64 - ``topology_version``
65
Markus Heiser5377d912016-06-30 15:18:56 +020066 - Version of the media graph topology. When the graph is created,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030067 this field starts with zero. Every time a graph element is added
68 or removed, this field is incremented.
Markus Heiser5377d912016-06-30 15:18:56 +020069
70 - .. row 2
71
72 - __u64
73
74 - ``num_entities``
75
Markus Heiser5377d912016-06-30 15:18:56 +020076 - Number of entities in the graph
77
78 - .. row 3
79
80 - __u64
81
82 - ``ptr_entities``
83
Markus Heiser5377d912016-06-30 15:18:56 +020084 - A pointer to a memory area where the entities array will be
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030085 stored, converted to a 64-bits integer. It can be zero. if zero,
86 the ioctl won't store the entities. It will just update
87 ``num_entities``
Markus Heiser5377d912016-06-30 15:18:56 +020088
89 - .. row 4
90
91 - __u64
92
93 - ``num_interfaces``
94
Markus Heiser5377d912016-06-30 15:18:56 +020095 - Number of interfaces in the graph
96
97 - .. row 5
98
99 - __u64
100
101 - ``ptr_interfaces``
102
Markus Heiser5377d912016-06-30 15:18:56 +0200103 - A pointer to a memory area where the interfaces array will be
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300104 stored, converted to a 64-bits integer. It can be zero. if zero,
105 the ioctl won't store the interfaces. It will just update
106 ``num_interfaces``
Markus Heiser5377d912016-06-30 15:18:56 +0200107
108 - .. row 6
109
110 - __u64
111
112 - ``num_pads``
113
Markus Heiser5377d912016-06-30 15:18:56 +0200114 - Total number of pads in the graph
115
116 - .. row 7
117
118 - __u64
119
120 - ``ptr_pads``
121
Markus Heiser5377d912016-06-30 15:18:56 +0200122 - A pointer to a memory area where the pads array will be stored,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300123 converted to a 64-bits integer. It can be zero. if zero, the ioctl
124 won't store the pads. It will just update ``num_pads``
Markus Heiser5377d912016-06-30 15:18:56 +0200125
126 - .. row 8
127
128 - __u64
129
130 - ``num_links``
131
Markus Heiser5377d912016-06-30 15:18:56 +0200132 - Total number of data and interface links in the graph
133
134 - .. row 9
135
136 - __u64
137
138 - ``ptr_links``
139
Markus Heiser5377d912016-06-30 15:18:56 +0200140 - A pointer to a memory area where the links array will be stored,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300141 converted to a 64-bits integer. It can be zero. if zero, the ioctl
142 won't store the links. It will just update ``num_links``
Markus Heiser5377d912016-06-30 15:18:56 +0200143
144
145
146.. _media-v2-entity:
147
148.. flat-table:: struct media_v2_entity
149 :header-rows: 0
150 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300151 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200152
153
154 - .. row 1
155
156 - __u32
157
158 - ``id``
159
Markus Heiser5377d912016-06-30 15:18:56 +0200160 - Unique ID for the entity.
161
162 - .. row 2
163
164 - char
165
166 - ``name``\ [64]
167
Markus Heiser5377d912016-06-30 15:18:56 +0200168 - Entity name as an UTF-8 NULL-terminated string.
169
170 - .. row 3
171
172 - __u32
173
174 - ``function``
175
Markus Heiser5377d912016-06-30 15:18:56 +0200176 - Entity main function, see :ref:`media-entity-type` for details.
177
178 - .. row 4
179
180 - __u32
181
182 - ``reserved``\ [12]
183
184 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300185 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200186
187
188
189.. _media-v2-interface:
190
191.. flat-table:: struct media_v2_interface
192 :header-rows: 0
193 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300194 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200195
196 - .. row 1
197
198 - __u32
199
200 - ``id``
201
Markus Heiser5377d912016-06-30 15:18:56 +0200202 - Unique ID for the interface.
203
204 - .. row 2
205
206 - __u32
207
208 - ``intf_type``
209
Markus Heiser5377d912016-06-30 15:18:56 +0200210 - Interface type, see :ref:`media-intf-type` for details.
211
212 - .. row 3
213
214 - __u32
215
216 - ``flags``
217
Markus Heiser5377d912016-06-30 15:18:56 +0200218 - Interface flags. Currently unused.
219
220 - .. row 4
221
222 - __u32
223
224 - ``reserved``\ [9]
225
Markus Heiser5377d912016-06-30 15:18:56 +0200226 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300227 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200228
229 - .. row 5
230
231 - struct media_v2_intf_devnode
232
233 - ``devnode``
234
Markus Heiser5377d912016-06-30 15:18:56 +0200235 - Used only for device node interfaces. See
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300236 :ref:`media-v2-intf-devnode` for details..
Markus Heiser5377d912016-06-30 15:18:56 +0200237
238
239
240.. _media-v2-intf-devnode:
241
242.. flat-table:: struct media_v2_interface
243 :header-rows: 0
244 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300245 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200246
247
248 - .. row 1
249
250 - __u32
251
252 - ``major``
253
Markus Heiser5377d912016-06-30 15:18:56 +0200254 - Device node major number.
255
256 - .. row 2
257
258 - __u32
259
260 - ``minor``
261
Markus Heiser5377d912016-06-30 15:18:56 +0200262 - Device node minor number.
263
264
265
266.. _media-v2-pad:
267
268.. flat-table:: struct media_v2_pad
269 :header-rows: 0
270 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300271 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200272
273
274 - .. row 1
275
276 - __u32
277
278 - ``id``
279
Markus Heiser5377d912016-06-30 15:18:56 +0200280 - Unique ID for the pad.
281
282 - .. row 2
283
284 - __u32
285
286 - ``entity_id``
287
Markus Heiser5377d912016-06-30 15:18:56 +0200288 - Unique ID for the entity where this pad belongs.
289
290 - .. row 3
291
292 - __u32
293
294 - ``flags``
295
Markus Heiser5377d912016-06-30 15:18:56 +0200296 - Pad flags, see :ref:`media-pad-flag` for more details.
297
298 - .. row 4
299
300 - __u32
301
302 - ``reserved``\ [9]
303
Markus Heiser5377d912016-06-30 15:18:56 +0200304 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300305 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200306
307
308
309.. _media-v2-link:
310
311.. flat-table:: struct media_v2_pad
312 :header-rows: 0
313 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300314 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200315
316
317 - .. row 1
318
319 - __u32
320
321 - ``id``
322
Markus Heiser5377d912016-06-30 15:18:56 +0200323 - Unique ID for the pad.
324
325 - .. row 2
326
327 - __u32
328
329 - ``source_id``
330
Markus Heiser5377d912016-06-30 15:18:56 +0200331 - On pad to pad links: unique ID for the source pad.
332
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300333 On interface to entity links: unique ID for the interface.
Markus Heiser5377d912016-06-30 15:18:56 +0200334
335 - .. row 3
336
337 - __u32
338
339 - ``sink_id``
340
Markus Heiser5377d912016-06-30 15:18:56 +0200341 - On pad to pad links: unique ID for the sink pad.
342
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300343 On interface to entity links: unique ID for the entity.
Markus Heiser5377d912016-06-30 15:18:56 +0200344
345 - .. row 4
346
347 - __u32
348
349 - ``flags``
350
Markus Heiser5377d912016-06-30 15:18:56 +0200351 - Link flags, see :ref:`media-link-flag` for more details.
352
353 - .. row 5
354
355 - __u32
356
357 - ``reserved``\ [5]
358
Markus Heiser5377d912016-06-30 15:18:56 +0200359 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300360 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200361
362
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -0300363Return Value
Markus Heiser5377d912016-06-30 15:18:56 +0200364============
365
366On success 0 is returned, on error -1 and the ``errno`` variable is set
367appropriately. The generic error codes are described at the
368:ref:`Generic Error Codes <gen-errors>` chapter.
369
370ENOSPC
371 This is returned when either one or more of the num_entities,
372 num_interfaces, num_links or num_pads are non-zero and are
373 smaller than the actual number of elements inside the graph. This
374 may happen if the ``topology_version`` changed when compared to the
375 last time this ioctl was called. Userspace should usually free the
376 area for the pointers, zero the struct elements and call this ioctl
377 again.