1 .. -*- coding: utf-8; mode: rst -*-
5 **************************
6 ioctl MEDIA_IOC_G_TOPOLOGY
7 **************************
9 *man MEDIA_IOC_G_TOPOLOGY(2)*
11 Enumerate the graph topology and graph element properties
17 .. cpp:function:: int ioctl( int fd, int request, struct media_v2_topology *argp )
23 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 :ref:`media_v2_topology <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.
50 .. _media-v2-topology:
52 .. flat-table:: struct media_v2_topology
61 - ``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.
77 - Number of entities in the graph
87 - A pointer to a memory area where the entities array will be
88 stored, converted to a 64-bits integer. It can be zero. if zero,
89 the ioctl won't store the entities. It will just update
100 - Number of interfaces in the graph
110 - A pointer to a memory area where the interfaces array will be
111 stored, converted to a 64-bits integer. It can be zero. if zero,
112 the ioctl won't store the interfaces. It will just update
123 - Total number of pads in the graph
133 - A pointer to a memory area where the pads array will be stored,
134 converted to a 64-bits integer. It can be zero. if zero, the ioctl
135 won't store the pads. It will just update ``num_pads``
145 - Total number of data and interface links in the graph
155 - A pointer to a memory area where the links array will be stored,
156 converted to a 64-bits integer. It can be zero. if zero, the ioctl
157 won't store the links. It will just update ``num_links``
163 .. flat-table:: struct media_v2_entity
176 - Unique ID for the entity.
186 - Entity name as an UTF-8 NULL-terminated string.
196 - Entity main function, see :ref:`media-entity-type` for details.
204 - Reserved for future extensions. Drivers and applications must set
209 .. _media-v2-interface:
211 .. flat-table:: struct media_v2_interface
224 - Unique ID for the interface.
234 - Interface type, see :ref:`media-intf-type` for details.
244 - Interface flags. Currently unused.
254 - Reserved for future extensions. Drivers and applications must set
259 - struct media_v2_intf_devnode
265 - Used only for device node interfaces. See
266 :ref:`media-v2-intf-devnode` for details..
270 .. _media-v2-intf-devnode:
272 .. flat-table:: struct media_v2_interface
285 - Device node major number.
295 - Device node minor number.
301 .. flat-table:: struct media_v2_pad
314 - Unique ID for the pad.
324 - Unique ID for the entity where this pad belongs.
334 - Pad flags, see :ref:`media-pad-flag` for more details.
344 - Reserved for future extensions. Drivers and applications must set
351 .. flat-table:: struct media_v2_pad
364 - Unique ID for the pad.
374 - On pad to pad links: unique ID for the source pad.
376 On interface to entity links: unique ID for the interface.
386 - On pad to pad links: unique ID for the sink pad.
388 On interface to entity links: unique ID for the entity.
398 - Link flags, see :ref:`media-link-flag` for more details.
408 - Reserved for future extensions. Drivers and applications must set
416 On success 0 is returned, on error -1 and the ``errno`` variable is set
417 appropriately. The generic error codes are described at the
418 :ref:`Generic Error Codes <gen-errors>` chapter.
421 This is returned when either one or more of the num_entities,
422 num_interfaces, num_links or num_pads are non-zero and are
423 smaller than the actual number of elements inside the graph. This
424 may happen if the ``topology_version`` changed when compared to the
425 last time this ioctl was called. Userspace should usually free the
426 area for the pointers, zero the struct elements and call this ioctl
430 .. ------------------------------------------------------------------------------
431 .. This file was automatically converted from DocBook-XML with the dbxml
432 .. library (https://github.com/return42/sphkerneldoc). The origin XML comes
433 .. from the linux kernel, refer to:
435 .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
436 .. ------------------------------------------------------------------------------