summaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook/media/v4l/media-ioc-g-topology.xml
blob: 63152ab9efbad0b10c59105effc55c49cc02d488 (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
382
383
384
385
386
387
388
389
390
391
392
393
394
<refentry id="media-g-topology">
  <refmeta>
    <refentrytitle>ioctl MEDIA_IOC_G_TOPOLOGY</refentrytitle>
    &manvol;
  </refmeta>

  <refnamediv>
    <refname>MEDIA_IOC_G_TOPOLOGY</refname>
    <refpurpose>Enumerate the graph topology and graph element properties</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <funcsynopsis>
      <funcprototype>
	<funcdef>int <function>ioctl</function></funcdef>
	<paramdef>int <parameter>fd</parameter></paramdef>
	<paramdef>int <parameter>request</parameter></paramdef>
	<paramdef>struct media_v2_topology *<parameter>argp</parameter></paramdef>
      </funcprototype>
    </funcsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title>Arguments</title>

    <variablelist>
      <varlistentry>
	<term><parameter>fd</parameter></term>
	<listitem>
	  <para>File descriptor returned by
	  <link linkend='media-func-open'><function>open()</function></link>.</para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter>request</parameter></term>
	<listitem>
	  <para>MEDIA_IOC_G_TOPOLOGY</para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter>argp</parameter></term>
	<listitem>
	  <para></para>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>

  <refsect1>
    <title>Description</title>

    <para><emphasis role="bold">NOTE:</emphasis> This new ioctl is programmed to be added on Kernel 4.6. Its definition/arguments may change until its final version.</para>

    <para>The typical usage of this ioctl is to call it twice.
    On the first call, the structure defined at &media-v2-topology; should
    be zeroed. At return, if no errors happen, this ioctl will return the
    <constant>topology_version</constant> and the total number of entities,
    interfaces, pads and links.</para>
    <para>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.</para>
    <para>If the <constant>topology_version</constant> remains the same, the
    ioctl should fill the desired arrays with the media graph elements.</para>

    <table pgwide="1" frame="none" id="media-v2-topology">
      <title>struct <structname>media_v2_topology</structname></title>
      <tgroup cols="5">
	<colspec colname="c1" />
	<colspec colname="c2" />
	<colspec colname="c3" />
	<colspec colname="c4" />
	<colspec colname="c5" />
	<tbody valign="top">
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>topology_version</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>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.</entry>
	  </row>
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>num_entities</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Number of entities in the graph</entry>
	  </row>
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>ptr_entities</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>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
		   <constant>num_entities</constant></entry>
	  </row>
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>num_interfaces</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Number of interfaces in the graph</entry>
	  </row>
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>ptr_interfaces</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>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
		   <constant>num_interfaces</constant></entry>
	  </row>
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>num_pads</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Total number of pads in the graph</entry>
	  </row>
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>ptr_pads</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>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
		   <constant>num_pads</constant></entry>
	  </row>
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>num_links</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Total number of data and interface links in the graph</entry>
	  </row>
	  <row>
	    <entry>__u64</entry>
	    <entry><structfield>ptr_links</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>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
		   <constant>num_links</constant></entry>
	  </row>
	</tbody>
      </tgroup>
    </table>

    <table pgwide="1" frame="none" id="media-v2-entity">
      <title>struct <structname>media_v2_entity</structname></title>
      <tgroup cols="5">
	<colspec colname="c1" />
	<colspec colname="c2" />
	<colspec colname="c3" />
	<colspec colname="c4" />
	<colspec colname="c5" />
	<tbody valign="top">
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>id</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Unique ID for the entity.</entry>
	  </row>
	  <row>
	    <entry>char</entry>
	    <entry><structfield>name</structfield>[64]</entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Entity name as an UTF-8 NULL-terminated string.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>function</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Entity main function, see <xref linkend="media-entity-type" /> for details.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>reserved</structfield>[12]</entry>
	    <entry>Reserved for future extensions. Drivers and applications must
	    set this array to zero.</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>

    <table pgwide="1" frame="none" id="media-v2-interface">
      <title>struct <structname>media_v2_interface</structname></title>
      <tgroup cols="5">
	<colspec colname="c1" />
	<colspec colname="c2" />
	<colspec colname="c3" />
	<colspec colname="c4" />
	<colspec colname="c5" />
	<tbody valign="top">
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>id</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Unique ID for the interface.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>intf_type</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Interface type, see <xref linkend="media-intf-type" /> for details.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>flags</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Interface flags. Currently unused.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>reserved</structfield>[9]</entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Reserved for future extensions. Drivers and applications must
	    set this array to zero.</entry>
	  </row>
	  <row>
	    <entry>struct media_v2_intf_devnode</entry>
	    <entry><structfield>devnode</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Used only for device node interfaces. See <xref linkend="media-v2-intf-devnode" /> for details..</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>

    <table pgwide="1" frame="none" id="media-v2-intf-devnode">
      <title>struct <structname>media_v2_interface</structname></title>
      <tgroup cols="5">
	<colspec colname="c1" />
	<colspec colname="c2" />
	<colspec colname="c3" />
	<colspec colname="c4" />
	<colspec colname="c5" />
	<tbody valign="top">
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>major</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Device node major number.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>minor</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Device node minor number.</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>

    <table pgwide="1" frame="none" id="media-v2-pad">
      <title>struct <structname>media_v2_pad</structname></title>
      <tgroup cols="5">
	<colspec colname="c1" />
	<colspec colname="c2" />
	<colspec colname="c3" />
	<colspec colname="c4" />
	<colspec colname="c5" />
	<tbody valign="top">
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>id</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Unique ID for the pad.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>entity_id</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Unique ID for the entity where this pad belongs.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>flags</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Pad flags, see <xref linkend="media-pad-flag" /> for more details.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>reserved</structfield>[9]</entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Reserved for future extensions. Drivers and applications must
	    set this array to zero.</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>

    <table pgwide="1" frame="none" id="media-v2-link">
      <title>struct <structname>media_v2_pad</structname></title>
      <tgroup cols="5">
	<colspec colname="c1" />
	<colspec colname="c2" />
	<colspec colname="c3" />
	<colspec colname="c4" />
	<colspec colname="c5" />
	<tbody valign="top">
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>id</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Unique ID for the pad.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>source_id</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>
	       <para>On pad to pad links: unique ID for the source pad.</para>
	       <para>On interface to entity links: unique ID for the interface.</para>
	    </entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>sink_id</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>
	       <para>On pad to pad links: unique ID for the sink pad.</para>
	       <para>On interface to entity links: unique ID for the entity.</para>
	    </entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>flags</structfield></entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Link flags, see <xref linkend="media-link-flag" /> for more details.</entry>
	  </row>
	  <row>
	    <entry>__u32</entry>
	    <entry><structfield>reserved</structfield>[5]</entry>
	    <entry></entry>
	    <entry></entry>
	    <entry>Reserved for future extensions. Drivers and applications must
	    set this array to zero.</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>

  </refsect1>

  <refsect1>
    &return-value;

    <variablelist>
      <varlistentry>
	<term><errorcode>ENOSPC</errorcode></term>
	<listitem>
	  <para>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 <constant>topology_version</constant> 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.</para>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
</refentry>