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 .. cpp:function:: int ioctl( int fd, int request, struct media_v2_topology *argp )
25 File descriptor returned by :ref:`open() <media-func-open>`.
36 The typical usage of this ioctl is to call it twice. On the first call,
37 the structure defined at struct
38 :ref:`media_v2_topology <media-v2-topology>` should be zeroed. At
39 return, if no errors happen, this ioctl will return the
40 ``topology_version`` and the total number of entities, interfaces, pads
43 Before the second call, the userspace should allocate arrays to store
44 the graph elements that are desired, putting the pointers to them at the
45 ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping the
46 other values untouched.
48 If the ``topology_version`` remains the same, the ioctl should fill the
49 desired arrays with the media graph elements.
52 .. _media-v2-topology:
54 .. flat-table:: struct media_v2_topology
64 - ``topology_version``
66 - Version of the media graph topology. When the graph is created,
67 this field starts with zero. Every time a graph element is added
68 or removed, this field is incremented.
76 - Number of entities in the graph
84 - A pointer to a memory area where the entities array will be
85 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
95 - Number of interfaces in the graph
103 - A pointer to a memory area where the interfaces array will be
104 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
114 - Total number of pads in the graph
122 - A pointer to a memory area where the pads array will be stored,
123 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``
132 - Total number of data and interface links in the graph
140 - A pointer to a memory area where the links array will be stored,
141 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``
148 .. flat-table:: struct media_v2_entity
160 - Unique ID for the entity.
168 - Entity name as an UTF-8 NULL-terminated string.
176 - Entity main function, see :ref:`media-entity-type` for details.
184 - Reserved for future extensions. Drivers and applications must set
189 .. _media-v2-interface:
191 .. flat-table:: struct media_v2_interface
202 - Unique ID for the interface.
210 - Interface type, see :ref:`media-intf-type` for details.
218 - Interface flags. Currently unused.
226 - Reserved for future extensions. Drivers and applications must set
231 - struct media_v2_intf_devnode
235 - Used only for device node interfaces. See
236 :ref:`media-v2-intf-devnode` for details..
240 .. _media-v2-intf-devnode:
242 .. flat-table:: struct media_v2_interface
254 - Device node major number.
262 - Device node minor number.
268 .. flat-table:: struct media_v2_pad
280 - Unique ID for the pad.
288 - Unique ID for the entity where this pad belongs.
296 - Pad flags, see :ref:`media-pad-flag` for more details.
304 - Reserved for future extensions. Drivers and applications must set
311 .. flat-table:: struct media_v2_pad
323 - Unique ID for the pad.
331 - On pad to pad links: unique ID for the source pad.
333 On interface to entity links: unique ID for the interface.
341 - On pad to pad links: unique ID for the sink pad.
343 On interface to entity links: unique ID for the entity.
351 - Link flags, see :ref:`media-link-flag` for more details.
359 - Reserved for future extensions. Drivers and applications must set
366 On success 0 is returned, on error -1 and the ``errno`` variable is set
367 appropriately. The generic error codes are described at the
368 :ref:`Generic Error Codes <gen-errors>` chapter.
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