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>`.
29 Pointer to struct :c:type:`media_v2_topology`.
35 The typical usage of this ioctl is to call it twice. On the first call,
36 the structure defined at struct
37 :c:type:`media_v2_topology` should be zeroed. At
38 return, if no errors happen, this ioctl will return the
39 ``topology_version`` and the total number of entities, interfaces, pads
42 Before the second call, the userspace should allocate arrays to store
43 the graph elements that are desired, putting the pointers to them at the
44 ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping the
45 other values untouched.
47 If the ``topology_version`` remains the same, the ioctl should fill the
48 desired arrays with the media graph elements.
50 .. tabularcolumns:: |p{1.6cm}|p{3.4cm}|p{12.5cm}|
52 .. c:type:: media_v2_topology
54 .. flat-table:: struct media_v2_topology
60 - ``topology_version``
61 - Version of the media graph topology. When the graph is created,
62 this field starts with zero. Every time a graph element is added
63 or removed, this field is incremented.
67 - Number of entities in the graph
71 - Applications and drivers shall set this to 0.
75 - A pointer to a memory area where the entities array will be
76 stored, converted to a 64-bits integer. It can be zero. if zero,
77 the ioctl won't store the entities. It will just update
82 - Number of interfaces in the graph
86 - Applications and drivers shall set this to 0.
90 - A pointer to a memory area where the interfaces array will be
91 stored, converted to a 64-bits integer. It can be zero. if zero,
92 the ioctl won't store the interfaces. It will just update
97 - Total number of pads in the graph
101 - Applications and drivers shall set this to 0.
105 - A pointer to a memory area where the pads array will be stored,
106 converted to a 64-bits integer. It can be zero. if zero, the ioctl
107 won't store the pads. It will just update ``num_pads``
111 - Total number of data and interface links in the graph
115 - Applications and drivers shall set this to 0.
119 - A pointer to a memory area where the links array will be stored,
120 converted to a 64-bits integer. It can be zero. if zero, the ioctl
121 won't store the links. It will just update ``num_links``
124 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
126 .. c:type:: media_v2_entity
128 .. flat-table:: struct media_v2_entity
135 - Unique ID for the entity. Do not expect that the ID will
136 always be the same for each instance of the device. In other words,
137 do not hardcode entity IDs in an application.
141 - Entity name as an UTF-8 NULL-terminated string. This name must be unique
142 within the media topology.
146 - Entity main function, see :ref:`media-entity-functions` for details.
150 - Entity flags, see :ref:`media-entity-flag` for details.
151 Only valid if ``MEDIA_V2_ENTITY_HAS_FLAGS(media_version)``
152 returns true. The ``media_version`` is defined in struct
153 :c:type:`media_device_info` and can be retrieved using
154 :ref:`MEDIA_IOC_DEVICE_INFO`.
158 - Reserved for future extensions. Drivers and applications must set
162 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
164 .. c:type:: media_v2_interface
166 .. flat-table:: struct media_v2_interface
173 - Unique ID for the interface. Do not expect that the ID will
174 always be the same for each instance of the device. In other words,
175 do not hardcode interface IDs in an application.
179 - Interface type, see :ref:`media-intf-type` for details.
183 - Interface flags. Currently unused.
187 - Reserved for future extensions. Drivers and applications must set
190 * - struct media_v2_intf_devnode
192 - Used only for device node interfaces. See
193 :c:type:`media_v2_intf_devnode` for details.
196 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
198 .. c:type:: media_v2_intf_devnode
200 .. flat-table:: struct media_v2_intf_devnode
207 - Device node major number.
211 - Device node minor number.
213 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
215 .. c:type:: media_v2_pad
217 .. flat-table:: struct media_v2_pad
224 - Unique ID for the pad. Do not expect that the ID will
225 always be the same for each instance of the device. In other words,
226 do not hardcode pad IDs in an application.
230 - Unique ID for the entity where this pad belongs.
234 - Pad flags, see :ref:`media-pad-flag` for more details.
238 - Pad index, starts at 0. Only valid if ``MEDIA_V2_PAD_HAS_INDEX(media_version)``
239 returns true. The ``media_version`` is defined in struct
240 :c:type:`media_device_info` and can be retrieved using
241 :ref:`MEDIA_IOC_DEVICE_INFO`.
245 - Reserved for future extensions. Drivers and applications must set
249 .. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
251 .. c:type:: media_v2_link
253 .. flat-table:: struct media_v2_link
260 - Unique ID for the link. Do not expect that the ID will
261 always be the same for each instance of the device. In other words,
262 do not hardcode link IDs in an application.
266 - On pad to pad links: unique ID for the source pad.
268 On interface to entity links: unique ID for the interface.
272 - On pad to pad links: unique ID for the sink pad.
274 On interface to entity links: unique ID for the entity.
278 - Link flags, see :ref:`media-link-flag` for more details.
282 - Reserved for future extensions. Drivers and applications must set
289 On success 0 is returned, on error -1 and the ``errno`` variable is set
290 appropriately. The generic error codes are described at the
291 :ref:`Generic Error Codes <gen-errors>` chapter.
294 This is returned when either one or more of the num_entities,
295 num_interfaces, num_links or num_pads are non-zero and are
296 smaller than the actual number of elements inside the graph. This
297 may happen if the ``topology_version`` changed when compared to the
298 last time this ioctl was called. Userspace should usually free the
299 area for the pointers, zero the struct elements and call this ioctl