Mauro Carvalho Chehab | 677cb4b | 2015-12-12 10:56:13 -0200 | [diff] [blame] | 1 | <refentry id="media-g-topology"> |
| 2 | <refmeta> |
| 3 | <refentrytitle>ioctl MEDIA_IOC_G_TOPOLOGY</refentrytitle> |
| 4 | &manvol; |
| 5 | </refmeta> |
| 6 | |
| 7 | <refnamediv> |
| 8 | <refname>MEDIA_IOC_G_TOPOLOGY</refname> |
| 9 | <refpurpose>Enumerate the graph topology and graph element properties</refpurpose> |
| 10 | </refnamediv> |
| 11 | |
| 12 | <refsynopsisdiv> |
| 13 | <funcsynopsis> |
| 14 | <funcprototype> |
| 15 | <funcdef>int <function>ioctl</function></funcdef> |
| 16 | <paramdef>int <parameter>fd</parameter></paramdef> |
| 17 | <paramdef>int <parameter>request</parameter></paramdef> |
| 18 | <paramdef>struct media_v2_topology *<parameter>argp</parameter></paramdef> |
| 19 | </funcprototype> |
| 20 | </funcsynopsis> |
| 21 | </refsynopsisdiv> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Arguments</title> |
| 25 | |
| 26 | <variablelist> |
| 27 | <varlistentry> |
| 28 | <term><parameter>fd</parameter></term> |
| 29 | <listitem> |
| 30 | <para>File descriptor returned by |
| 31 | <link linkend='media-func-open'><function>open()</function></link>.</para> |
| 32 | </listitem> |
| 33 | </varlistentry> |
| 34 | <varlistentry> |
| 35 | <term><parameter>request</parameter></term> |
| 36 | <listitem> |
| 37 | <para>MEDIA_IOC_G_TOPOLOGY</para> |
| 38 | </listitem> |
| 39 | </varlistentry> |
| 40 | <varlistentry> |
| 41 | <term><parameter>argp</parameter></term> |
| 42 | <listitem> |
| 43 | <para></para> |
| 44 | </listitem> |
| 45 | </varlistentry> |
| 46 | </variablelist> |
| 47 | </refsect1> |
| 48 | |
| 49 | <refsect1> |
| 50 | <title>Description</title> |
Mauro Carvalho Chehab | 677cb4b | 2015-12-12 10:56:13 -0200 | [diff] [blame] | 51 | <para>The typical usage of this ioctl is to call it twice. |
| 52 | On the first call, the structure defined at &media-v2-topology; should |
| 53 | be zeroed. At return, if no errors happen, this ioctl will return the |
| 54 | <constant>topology_version</constant> and the total number of entities, |
| 55 | interfaces, pads and links.</para> |
| 56 | <para>Before the second call, the userspace should allocate arrays to |
| 57 | store the graph elements that are desired, putting the pointers to them |
| 58 | at the ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping |
| 59 | the other values untouched.</para> |
| 60 | <para>If the <constant>topology_version</constant> remains the same, the |
| 61 | ioctl should fill the desired arrays with the media graph elements.</para> |
| 62 | |
| 63 | <table pgwide="1" frame="none" id="media-v2-topology"> |
| 64 | <title>struct <structname>media_v2_topology</structname></title> |
| 65 | <tgroup cols="5"> |
| 66 | <colspec colname="c1" /> |
| 67 | <colspec colname="c2" /> |
| 68 | <colspec colname="c3" /> |
| 69 | <colspec colname="c4" /> |
| 70 | <colspec colname="c5" /> |
| 71 | <tbody valign="top"> |
| 72 | <row> |
| 73 | <entry>__u64</entry> |
| 74 | <entry><structfield>topology_version</structfield></entry> |
| 75 | <entry></entry> |
| 76 | <entry></entry> |
| 77 | <entry>Version of the media graph topology. When the graph is |
| 78 | created, this field starts with zero. Every time a graph |
| 79 | element is added or removed, this field is |
| 80 | incremented.</entry> |
| 81 | </row> |
| 82 | <row> |
| 83 | <entry>__u64</entry> |
| 84 | <entry><structfield>num_entities</structfield></entry> |
| 85 | <entry></entry> |
| 86 | <entry></entry> |
| 87 | <entry>Number of entities in the graph</entry> |
| 88 | </row> |
| 89 | <row> |
| 90 | <entry>__u64</entry> |
| 91 | <entry><structfield>ptr_entities</structfield></entry> |
| 92 | <entry></entry> |
| 93 | <entry></entry> |
| 94 | <entry>A pointer to a memory area where the entities array |
| 95 | will be stored, converted to a 64-bits integer. |
| 96 | It can be zero. if zero, the ioctl won't store the |
| 97 | entities. It will just update |
| 98 | <constant>num_entities</constant></entry> |
| 99 | </row> |
| 100 | <row> |
| 101 | <entry>__u64</entry> |
| 102 | <entry><structfield>num_interfaces</structfield></entry> |
| 103 | <entry></entry> |
| 104 | <entry></entry> |
| 105 | <entry>Number of interfaces in the graph</entry> |
| 106 | </row> |
| 107 | <row> |
| 108 | <entry>__u64</entry> |
| 109 | <entry><structfield>ptr_interfaces</structfield></entry> |
| 110 | <entry></entry> |
| 111 | <entry></entry> |
| 112 | <entry>A pointer to a memory area where the interfaces array |
| 113 | will be stored, converted to a 64-bits integer. |
| 114 | It can be zero. if zero, the ioctl won't store the |
| 115 | interfaces. It will just update |
| 116 | <constant>num_interfaces</constant></entry> |
| 117 | </row> |
| 118 | <row> |
| 119 | <entry>__u64</entry> |
| 120 | <entry><structfield>num_pads</structfield></entry> |
| 121 | <entry></entry> |
| 122 | <entry></entry> |
| 123 | <entry>Total number of pads in the graph</entry> |
| 124 | </row> |
| 125 | <row> |
| 126 | <entry>__u64</entry> |
| 127 | <entry><structfield>ptr_pads</structfield></entry> |
| 128 | <entry></entry> |
| 129 | <entry></entry> |
| 130 | <entry>A pointer to a memory area where the pads array |
| 131 | will be stored, converted to a 64-bits integer. |
| 132 | It can be zero. if zero, the ioctl won't store the |
| 133 | pads. It will just update |
| 134 | <constant>num_pads</constant></entry> |
| 135 | </row> |
| 136 | <row> |
| 137 | <entry>__u64</entry> |
| 138 | <entry><structfield>num_links</structfield></entry> |
| 139 | <entry></entry> |
| 140 | <entry></entry> |
| 141 | <entry>Total number of data and interface links in the graph</entry> |
| 142 | </row> |
| 143 | <row> |
| 144 | <entry>__u64</entry> |
| 145 | <entry><structfield>ptr_links</structfield></entry> |
| 146 | <entry></entry> |
| 147 | <entry></entry> |
| 148 | <entry>A pointer to a memory area where the links array |
| 149 | will be stored, converted to a 64-bits integer. |
| 150 | It can be zero. if zero, the ioctl won't store the |
| 151 | links. It will just update |
| 152 | <constant>num_links</constant></entry> |
| 153 | </row> |
| 154 | </tbody> |
| 155 | </tgroup> |
| 156 | </table> |
| 157 | |
| 158 | <table pgwide="1" frame="none" id="media-v2-entity"> |
| 159 | <title>struct <structname>media_v2_entity</structname></title> |
| 160 | <tgroup cols="5"> |
| 161 | <colspec colname="c1" /> |
| 162 | <colspec colname="c2" /> |
| 163 | <colspec colname="c3" /> |
| 164 | <colspec colname="c4" /> |
| 165 | <colspec colname="c5" /> |
| 166 | <tbody valign="top"> |
| 167 | <row> |
| 168 | <entry>__u32</entry> |
| 169 | <entry><structfield>id</structfield></entry> |
| 170 | <entry></entry> |
| 171 | <entry></entry> |
| 172 | <entry>Unique ID for the entity.</entry> |
| 173 | </row> |
| 174 | <row> |
| 175 | <entry>char</entry> |
| 176 | <entry><structfield>name</structfield>[64]</entry> |
| 177 | <entry></entry> |
| 178 | <entry></entry> |
| 179 | <entry>Entity name as an UTF-8 NULL-terminated string.</entry> |
| 180 | </row> |
| 181 | <row> |
| 182 | <entry>__u32</entry> |
| 183 | <entry><structfield>function</structfield></entry> |
| 184 | <entry></entry> |
| 185 | <entry></entry> |
| 186 | <entry>Entity main function, see <xref linkend="media-entity-type" /> for details.</entry> |
| 187 | </row> |
| 188 | <row> |
| 189 | <entry>__u32</entry> |
| 190 | <entry><structfield>reserved</structfield>[12]</entry> |
| 191 | <entry>Reserved for future extensions. Drivers and applications must |
| 192 | set this array to zero.</entry> |
| 193 | </row> |
| 194 | </tbody> |
| 195 | </tgroup> |
| 196 | </table> |
| 197 | |
| 198 | <table pgwide="1" frame="none" id="media-v2-interface"> |
| 199 | <title>struct <structname>media_v2_interface</structname></title> |
| 200 | <tgroup cols="5"> |
| 201 | <colspec colname="c1" /> |
| 202 | <colspec colname="c2" /> |
| 203 | <colspec colname="c3" /> |
| 204 | <colspec colname="c4" /> |
| 205 | <colspec colname="c5" /> |
| 206 | <tbody valign="top"> |
| 207 | <row> |
| 208 | <entry>__u32</entry> |
| 209 | <entry><structfield>id</structfield></entry> |
| 210 | <entry></entry> |
| 211 | <entry></entry> |
| 212 | <entry>Unique ID for the interface.</entry> |
| 213 | </row> |
| 214 | <row> |
| 215 | <entry>__u32</entry> |
| 216 | <entry><structfield>intf_type</structfield></entry> |
| 217 | <entry></entry> |
| 218 | <entry></entry> |
| 219 | <entry>Interface type, see <xref linkend="media-intf-type" /> for details.</entry> |
| 220 | </row> |
| 221 | <row> |
| 222 | <entry>__u32</entry> |
| 223 | <entry><structfield>flags</structfield></entry> |
| 224 | <entry></entry> |
| 225 | <entry></entry> |
| 226 | <entry>Interface flags. Currently unused.</entry> |
| 227 | </row> |
| 228 | <row> |
| 229 | <entry>__u32</entry> |
| 230 | <entry><structfield>reserved</structfield>[9]</entry> |
| 231 | <entry></entry> |
| 232 | <entry></entry> |
| 233 | <entry>Reserved for future extensions. Drivers and applications must |
| 234 | set this array to zero.</entry> |
| 235 | </row> |
| 236 | <row> |
| 237 | <entry>struct media_v2_intf_devnode</entry> |
| 238 | <entry><structfield>devnode</structfield></entry> |
| 239 | <entry></entry> |
| 240 | <entry></entry> |
| 241 | <entry>Used only for device node interfaces. See <xref linkend="media-v2-intf-devnode" /> for details..</entry> |
| 242 | </row> |
| 243 | </tbody> |
| 244 | </tgroup> |
| 245 | </table> |
| 246 | |
| 247 | <table pgwide="1" frame="none" id="media-v2-intf-devnode"> |
| 248 | <title>struct <structname>media_v2_interface</structname></title> |
| 249 | <tgroup cols="5"> |
| 250 | <colspec colname="c1" /> |
| 251 | <colspec colname="c2" /> |
| 252 | <colspec colname="c3" /> |
| 253 | <colspec colname="c4" /> |
| 254 | <colspec colname="c5" /> |
| 255 | <tbody valign="top"> |
| 256 | <row> |
| 257 | <entry>__u32</entry> |
| 258 | <entry><structfield>major</structfield></entry> |
| 259 | <entry></entry> |
| 260 | <entry></entry> |
| 261 | <entry>Device node major number.</entry> |
| 262 | </row> |
| 263 | <row> |
| 264 | <entry>__u32</entry> |
| 265 | <entry><structfield>minor</structfield></entry> |
| 266 | <entry></entry> |
| 267 | <entry></entry> |
| 268 | <entry>Device node minor number.</entry> |
| 269 | </row> |
| 270 | </tbody> |
| 271 | </tgroup> |
| 272 | </table> |
| 273 | |
| 274 | <table pgwide="1" frame="none" id="media-v2-pad"> |
| 275 | <title>struct <structname>media_v2_pad</structname></title> |
| 276 | <tgroup cols="5"> |
| 277 | <colspec colname="c1" /> |
| 278 | <colspec colname="c2" /> |
| 279 | <colspec colname="c3" /> |
| 280 | <colspec colname="c4" /> |
| 281 | <colspec colname="c5" /> |
| 282 | <tbody valign="top"> |
| 283 | <row> |
| 284 | <entry>__u32</entry> |
| 285 | <entry><structfield>id</structfield></entry> |
| 286 | <entry></entry> |
| 287 | <entry></entry> |
| 288 | <entry>Unique ID for the pad.</entry> |
| 289 | </row> |
| 290 | <row> |
| 291 | <entry>__u32</entry> |
| 292 | <entry><structfield>entity_id</structfield></entry> |
| 293 | <entry></entry> |
| 294 | <entry></entry> |
| 295 | <entry>Unique ID for the entity where this pad belongs.</entry> |
| 296 | </row> |
| 297 | <row> |
| 298 | <entry>__u32</entry> |
| 299 | <entry><structfield>flags</structfield></entry> |
| 300 | <entry></entry> |
| 301 | <entry></entry> |
| 302 | <entry>Pad flags, see <xref linkend="media-pad-flag" /> for more details.</entry> |
| 303 | </row> |
| 304 | <row> |
| 305 | <entry>__u32</entry> |
| 306 | <entry><structfield>reserved</structfield>[9]</entry> |
| 307 | <entry></entry> |
| 308 | <entry></entry> |
| 309 | <entry>Reserved for future extensions. Drivers and applications must |
| 310 | set this array to zero.</entry> |
| 311 | </row> |
| 312 | </tbody> |
| 313 | </tgroup> |
| 314 | </table> |
| 315 | |
| 316 | <table pgwide="1" frame="none" id="media-v2-link"> |
| 317 | <title>struct <structname>media_v2_pad</structname></title> |
| 318 | <tgroup cols="5"> |
| 319 | <colspec colname="c1" /> |
| 320 | <colspec colname="c2" /> |
| 321 | <colspec colname="c3" /> |
| 322 | <colspec colname="c4" /> |
| 323 | <colspec colname="c5" /> |
| 324 | <tbody valign="top"> |
| 325 | <row> |
| 326 | <entry>__u32</entry> |
| 327 | <entry><structfield>id</structfield></entry> |
| 328 | <entry></entry> |
| 329 | <entry></entry> |
| 330 | <entry>Unique ID for the pad.</entry> |
| 331 | </row> |
| 332 | <row> |
| 333 | <entry>__u32</entry> |
| 334 | <entry><structfield>source_id</structfield></entry> |
| 335 | <entry></entry> |
| 336 | <entry></entry> |
| 337 | <entry> |
| 338 | <para>On pad to pad links: unique ID for the source pad.</para> |
| 339 | <para>On interface to entity links: unique ID for the interface.</para> |
| 340 | </entry> |
| 341 | </row> |
| 342 | <row> |
| 343 | <entry>__u32</entry> |
| 344 | <entry><structfield>sink_id</structfield></entry> |
| 345 | <entry></entry> |
| 346 | <entry></entry> |
| 347 | <entry> |
| 348 | <para>On pad to pad links: unique ID for the sink pad.</para> |
| 349 | <para>On interface to entity links: unique ID for the entity.</para> |
| 350 | </entry> |
| 351 | </row> |
| 352 | <row> |
| 353 | <entry>__u32</entry> |
| 354 | <entry><structfield>flags</structfield></entry> |
| 355 | <entry></entry> |
| 356 | <entry></entry> |
| 357 | <entry>Link flags, see <xref linkend="media-link-flag" /> for more details.</entry> |
| 358 | </row> |
| 359 | <row> |
| 360 | <entry>__u32</entry> |
| 361 | <entry><structfield>reserved</structfield>[5]</entry> |
| 362 | <entry></entry> |
| 363 | <entry></entry> |
| 364 | <entry>Reserved for future extensions. Drivers and applications must |
| 365 | set this array to zero.</entry> |
| 366 | </row> |
| 367 | </tbody> |
| 368 | </tgroup> |
| 369 | </table> |
| 370 | |
| 371 | </refsect1> |
| 372 | |
| 373 | <refsect1> |
| 374 | &return-value; |
| 375 | |
| 376 | <variablelist> |
| 377 | <varlistentry> |
| 378 | <term><errorcode>ENOSPC</errorcode></term> |
| 379 | <listitem> |
| 380 | <para>This is returned when either one or more of the num_entities, |
| 381 | num_interfaces, num_links or num_pads are non-zero and are smaller |
| 382 | than the actual number of elements inside the graph. This may happen |
| 383 | if the <constant>topology_version</constant> changed when compared |
| 384 | to the last time this ioctl was called. Userspace should usually |
| 385 | free the area for the pointers, zero the struct elements and call |
| 386 | this ioctl again.</para> |
| 387 | </listitem> |
| 388 | </varlistentry> |
| 389 | </variablelist> |
| 390 | </refsect1> |
| 391 | </refentry> |