1 .. -*- coding: utf-8; mode: rst -*-
3 .. _media_ioc_g_topology:
5 **************************
6 ioctl MEDIA_IOC_G_TOPOLOGY
7 **************************
12 MEDIA_IOC_G_TOPOLOGY - Enumerate the graph topology and graph element properties
18 .. c:function:: int ioctl( int fd, MEDIA_IOC_G_TOPOLOGY, struct media_v2_topology *argp )
19 :name: MEDIA_IOC_G_TOPOLOGY
26 File descriptor returned by :ref:`open() <media-func-open>`.
34 The typical usage of this ioctl is to call it twice. On the first call,
35 the structure defined at struct
36 :c:type:`media_v2_topology` should be zeroed. At
37 return, if no errors happen, this ioctl will return the
38 ``topology_version`` and the total number of entities, interfaces, pads
41 Before the second call, the userspace should allocate arrays to store
42 the graph elements that are desired, putting the pointers to them at the
43 ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping the
44 other values untouched.
46 If the ``topology_version`` remains the same, the ioctl should fill the
47 desired arrays with the media graph elements.
49 .. tabularcolumns:: |p{1.6cm}|p{3.4cm}|p{12.5cm}|
51 .. c:type:: media_v2_topology
53 .. flat-table:: struct media_v2_topology
63 - ``topology_version``
65 - Version of the media graph topology. When the graph is created,
66 this field starts with zero. Every time a graph element is added
67 or removed, this field is incremented.
75 - Number of entities in the graph
83 - Applications and drivers shall set this to 0.
91 - A pointer to a memory area where the entities array will be
92 stored, converted to a 64-bits integer. It can be zero. if zero,
93 the ioctl won't store the entities. It will just update
102 - Number of interfaces in the graph
110 - Applications and drivers shall set this to 0.
118 - A pointer to a memory area where the interfaces array will be
119 stored, converted to a 64-bits integer. It can be zero. if zero,
120 the ioctl won't store the interfaces. It will just update
129 - Total number of pads in the graph
137 - Applications and drivers shall set this to 0.
145 - A pointer to a memory area where the pads array will be stored,
146 converted to a 64-bits integer. It can be zero. if zero, the ioctl
147 won't store the pads. It will just update ``num_pads``
155 - Total number of data and interface links in the graph
163 - Applications and drivers shall set this to 0.
171 - A pointer to a memory area where the links array will be stored,
172 converted to a 64-bits integer. It can be zero. if zero, the ioctl
173 won't store the links. It will just update ``num_links``
176 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
178 .. c:type:: media_v2_entity
180 .. flat-table:: struct media_v2_entity
192 - Unique ID for the entity.
200 - Entity name as an UTF-8 NULL-terminated string.
208 - Entity main function, see :ref:`media-entity-functions` for details.
216 - Reserved for future extensions. Drivers and applications must set
220 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
222 .. c:type:: media_v2_interface
224 .. flat-table:: struct media_v2_interface
235 - Unique ID for the interface.
243 - Interface type, see :ref:`media-intf-type` for details.
251 - Interface flags. Currently unused.
259 - Reserved for future extensions. Drivers and applications must set
264 - struct media_v2_intf_devnode
268 - Used only for device node interfaces. See
269 :c:type:`media_v2_intf_devnode` for details..
272 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
274 .. c:type:: media_v2_intf_devnode
276 .. flat-table:: struct media_v2_intf_devnode
288 - Device node major number.
296 - Device node minor number.
299 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
301 .. c:type:: media_v2_pad
303 .. flat-table:: struct media_v2_pad
315 - Unique ID for the pad.
323 - Unique ID for the entity where this pad belongs.
331 - Pad flags, see :ref:`media-pad-flag` for more details.
339 - Reserved for future extensions. Drivers and applications must set
343 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
345 .. c:type:: media_v2_link
347 .. flat-table:: struct media_v2_link
359 - Unique ID for the link.
367 - On pad to pad links: unique ID for the source pad.
369 On interface to entity links: unique ID for the interface.
377 - On pad to pad links: unique ID for the sink pad.
379 On interface to entity links: unique ID for the entity.
387 - Link flags, see :ref:`media-link-flag` for more details.
395 - Reserved for future extensions. Drivers and applications must set
402 On success 0 is returned, on error -1 and the ``errno`` variable is set
403 appropriately. The generic error codes are described at the
404 :ref:`Generic Error Codes <gen-errors>` chapter.
407 This is returned when either one or more of the num_entities,
408 num_interfaces, num_links or num_pads are non-zero and are
409 smaller than the actual number of elements inside the graph. This
410 may happen if the ``topology_version`` changed when compared to the
411 last time this ioctl was called. Userspace should usually free the
412 area for the pointers, zero the struct elements and call this ioctl