summaryrefslogtreecommitdiff
path: root/Documentation/media/uapi/mediactl/media-ioc-g-topology.rst
blob: 997e6b17440dc1383be856749481a29a7b6bc2ca (plain)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
.. -*- coding: utf-8; mode: rst -*-

.. _media_ioc_g_topology:

**************************
ioctl MEDIA_IOC_G_TOPOLOGY
**************************

Name
====

MEDIA_IOC_G_TOPOLOGY - Enumerate the graph topology and graph element properties


Synopsis
========

.. c:function:: int ioctl( int fd, MEDIA_IOC_G_TOPOLOGY, struct media_v2_topology *argp )
    :name: MEDIA_IOC_G_TOPOLOGY


Arguments
=========

``fd``
    File descriptor returned by :ref:`open() <media-func-open>`.

``argp``


Description
===========

The typical usage of this ioctl is to call it twice. On the first call,
the structure defined at struct
:c:type:`media_v2_topology` should be zeroed. At
return, if no errors happen, this ioctl will return the
``topology_version`` and the total number of entities, interfaces, pads
and links.

Before the second call, the userspace should allocate arrays to store
the graph elements that are desired, putting the pointers to them at the
ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping the
other values untouched.

If the ``topology_version`` remains the same, the ioctl should fill the
desired arrays with the media graph elements.

.. tabularcolumns:: |p{1.6cm}|p{3.4cm}|p{12.5cm}|

.. c:type:: media_v2_topology

.. flat-table:: struct media_v2_topology
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 2 8


    -  .. row 1

       -  __u64

       -  ``topology_version``

       -  Version of the media graph topology. When the graph is created,
	  this field starts with zero. Every time a graph element is added
	  or removed, this field is incremented.

    -  .. row 2

       -  __u64

       -  ``num_entities``

       -  Number of entities in the graph

    -  .. row 3

       -  __u64

       -  ``ptr_entities``

       -  A pointer to a memory area where the entities array will be
	  stored, converted to a 64-bits integer. It can be zero. if zero,
	  the ioctl won't store the entities. It will just update
	  ``num_entities``

    -  .. row 4

       -  __u64

       -  ``num_interfaces``

       -  Number of interfaces in the graph

    -  .. row 5

       -  __u64

       -  ``ptr_interfaces``

       -  A pointer to a memory area where the interfaces array will be
	  stored, converted to a 64-bits integer. It can be zero. if zero,
	  the ioctl won't store the interfaces. It will just update
	  ``num_interfaces``

    -  .. row 6

       -  __u64

       -  ``num_pads``

       -  Total number of pads in the graph

    -  .. row 7

       -  __u64

       -  ``ptr_pads``

       -  A pointer to a memory area where the pads array will be stored,
	  converted to a 64-bits integer. It can be zero. if zero, the ioctl
	  won't store the pads. It will just update ``num_pads``

    -  .. row 8

       -  __u64

       -  ``num_links``

       -  Total number of data and interface links in the graph

    -  .. row 9

       -  __u64

       -  ``ptr_links``

       -  A pointer to a memory area where the links array will be stored,
	  converted to a 64-bits integer. It can be zero. if zero, the ioctl
	  won't store the links. It will just update ``num_links``


.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|

.. c:type:: media_v2_entity

.. flat-table:: struct media_v2_entity
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 2 8


    -  .. row 1

       -  __u32

       -  ``id``

       -  Unique ID for the entity.

    -  .. row 2

       -  char

       -  ``name``\ [64]

       -  Entity name as an UTF-8 NULL-terminated string.

    -  .. row 3

       -  __u32

       -  ``function``

       -  Entity main function, see :ref:`media-entity-type` for details.

    -  .. row 4

       -  __u32

       -  ``reserved``\ [12]

       -  Reserved for future extensions. Drivers and applications must set
	  this array to zero.


.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|

.. c:type:: media_v2_interface

.. flat-table:: struct media_v2_interface
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 2 8

    -  .. row 1

       -  __u32

       -  ``id``

       -  Unique ID for the interface.

    -  .. row 2

       -  __u32

       -  ``intf_type``

       -  Interface type, see :ref:`media-intf-type` for details.

    -  .. row 3

       -  __u32

       -  ``flags``

       -  Interface flags. Currently unused.

    -  .. row 4

       -  __u32

       -  ``reserved``\ [9]

       -  Reserved for future extensions. Drivers and applications must set
	  this array to zero.

    -  .. row 5

       -  struct media_v2_intf_devnode

       -  ``devnode``

       -  Used only for device node interfaces. See
	  :c:type:`media_v2_intf_devnode` for details..


.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|

.. c:type:: media_v2_intf_devnode

.. flat-table:: struct media_v2_intf_devnode
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 2 8


    -  .. row 1

       -  __u32

       -  ``major``

       -  Device node major number.

    -  .. row 2

       -  __u32

       -  ``minor``

       -  Device node minor number.


.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|

.. c:type:: media_v2_pad

.. flat-table:: struct media_v2_pad
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 2 8


    -  .. row 1

       -  __u32

       -  ``id``

       -  Unique ID for the pad.

    -  .. row 2

       -  __u32

       -  ``entity_id``

       -  Unique ID for the entity where this pad belongs.

    -  .. row 3

       -  __u32

       -  ``flags``

       -  Pad flags, see :ref:`media-pad-flag` for more details.

    -  .. row 4

       -  __u32

       -  ``reserved``\ [9]

       -  Reserved for future extensions. Drivers and applications must set
	  this array to zero.


.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|

.. c:type:: media_v2_link

.. flat-table:: struct media_v2_link
    :header-rows:  0
    :stub-columns: 0
    :widths: 1 2 8


    -  .. row 1

       -  __u32

       -  ``id``

       -  Unique ID for the link.

    -  .. row 2

       -  __u32

       -  ``source_id``

       -  On pad to pad links: unique ID for the source pad.

	  On interface to entity links: unique ID for the entity.

    -  .. row 3

       -  __u32

       -  ``sink_id``

       -  On pad to pad links: unique ID for the sink pad.

	  On interface to entity links: unique ID for the entity.

    -  .. row 4

       -  __u32

       -  ``flags``

       -  Link flags, see :ref:`media-link-flag` for more details.

    -  .. row 5

       -  __u32

       -  ``reserved``\ [5]

       -  Reserved for future extensions. Drivers and applications must set
	  this array to zero.


Return Value
============

On success 0 is returned, on error -1 and the ``errno`` variable is set
appropriately. The generic error codes are described at the
:ref:`Generic Error Codes <gen-errors>` chapter.

ENOSPC
    This is returned when either one or more of the num_entities,
    num_interfaces, num_links or num_pads are non-zero and are
    smaller than the actual number of elements inside the graph. This
    may happen if the ``topology_version`` changed when compared to the
    last time this ioctl was called. Userspace should usually free the
    area for the pointers, zero the struct elements and call this ioctl
    again.