sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget6/translations/zh_CN/userspace-api/media/v4l/dev-subdevmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/zh_TW/userspace-api/media/v4l/dev-subdevmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/it_IT/userspace-api/media/v4l/dev-subdevmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/ja_JP/userspace-api/media/v4l/dev-subdevmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/ko_KR/userspace-api/media/v4l/dev-subdevmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget6/translations/sp_SP/userspace-api/media/v4l/dev-subdevmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-laterh]h8SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhP/var/lib/git/docbuild/linux/Documentation/userspace-api/media/v4l/dev-subdev.rsthKubhtarget)}(h .. _subdev:h]h}(h]h ]h"]h$]h&]refidsubdevuh1hhKhhhhhhubhsection)}(hhh](htitle)}(hSub-device Interfaceh]hSub-device Interface}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXHThe complex nature of V4L2 devices, where hardware is often made of several integrated circuits that need to interact with each other in a controlled way, leads to complex V4L2 drivers. The drivers usually reflect the hardware model in software, and model the different hardware components as software blocks called sub-devices.h]hXHThe complex nature of V4L2 devices, where hardware is often made of several integrated circuits that need to interact with each other in a controlled way, leads to complex V4L2 drivers. The drivers usually reflect the hardware model in software, and model the different hardware components as software blocks called sub-devices.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hX.V4L2 sub-devices are usually kernel-only objects. If the V4L2 driver implements the media device API, they will automatically inherit from media entities. Applications will be able to enumerate the sub-devices and discover the hardware topology using the media entities, pads and links enumeration API.h]hX.V4L2 sub-devices are usually kernel-only objects. If the V4L2 driver implements the media device API, they will automatically inherit from media entities. Applications will be able to enumerate the sub-devices and discover the hardware topology using the media entities, pads and links enumeration API.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXIn addition to make sub-devices discoverable, drivers can also choose to make them directly configurable by applications. When both the sub-device driver and the V4L2 device driver support this, sub-devices will feature a character device node on which ioctls can be called toh]hXIn addition to make sub-devices discoverable, drivers can also choose to make them directly configurable by applications. When both the sub-device driver and the V4L2 device driver support this, sub-devices will feature a character device node on which ioctls can be called to}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh bullet_list)}(hhh](h list_item)}(h+query, read and write sub-devices controls h]h)}(h*query, read and write sub-devices controlsh]h*query, read and write sub-devices controls}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj )}(h6subscribe and unsubscribe to events and retrieve them h]h)}(h5subscribe and unsubscribe to events and retrieve themh]h5subscribe and unsubscribe to events and retrieve them}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj"ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj )}(h+negotiate image formats on individual pads h]h)}(h*negotiate image formats on individual padsh]h*negotiate image formats on individual pads}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj:ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj )}(hIinspect and modify internal data routing between pads of the same entity h]h)}(hHinspect and modify internal data routing between pads of the same entityh]hHinspect and modify internal data routing between pads of the same entity}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjRubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1jhhhKhhhhubh)}(hbSub-device character device nodes, conventionally named ``/dev/v4l-subdev*``, use major number 81.h](h8Sub-device character device nodes, conventionally named }(hjrhhhNhNubhliteral)}(h``/dev/v4l-subdev*``h]h/dev/v4l-subdev*}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1jzhjrubh, use major number 81.}(hjrhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK"hhhhubh)}(hXDrivers may opt to limit the sub-device character devices to only expose operations that do not modify the device state. In such a case the sub-devices are referred to as ``read-only`` in the rest of this documentation, and the related restrictions are documented in individual ioctls.h](hDrivers may opt to limit the sub-device character devices to only expose operations that do not modify the device state. In such a case the sub-devices are referred to as }(hjhhhNhNubj{)}(h ``read-only``h]h read-only}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhjubhe in the rest of this documentation, and the related restrictions are documented in individual ioctls.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK%hhhhubh)}(hhh](h)}(hControlsh]hControls}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK,ubh)}(hMost V4L2 controls are implemented by sub-device hardware. Drivers usually merge all controls and expose them through video device nodes. Applications can control all sub-devices through a single interface.h]hMost V4L2 controls are implemented by sub-device hardware. Drivers usually merge all controls and expose them through video device nodes. Applications can control all sub-devices through a single interface.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjhhubh)}(hXComplex devices sometimes implement the same control in different pieces of hardware. This situation is common in embedded platforms, where both sensors and image processing hardware implement identical functions, such as contrast adjustment, white balance or faulty pixels correction. As the V4L2 controls API doesn't support several identical controls in a single device, all but one of the identical controls are hidden.h]hXComplex devices sometimes implement the same control in different pieces of hardware. This situation is common in embedded platforms, where both sensors and image processing hardware implement identical functions, such as contrast adjustment, white balance or faulty pixels correction. As the V4L2 controls API doesn’t support several identical controls in a single device, all but one of the identical controls are hidden.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hjhhubh)}(hXApplications can access those hidden controls through the sub-device node with the V4L2 control API described in :ref:`control`. The ioctls behave identically as when issued on V4L2 device nodes, with the exception that they deal only with controls implemented in the sub-device.h](hqApplications can access those hidden controls through the sub-device node with the V4L2 control API described in }(hjhhhNhNubh)}(h:ref:`control`h]hinline)}(hjh]hcontrol}(hjhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdoc"userspace-api/media/v4l/dev-subdev refdomainjreftyperef refexplicitrefwarn reftargetcontroluh1hhhhK9hjubh. The ioctls behave identically as when issued on V4L2 device nodes, with the exception that they deal only with controls implemented in the sub-device.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK9hjhhubh)}(hiDepending on the driver, those controls might also be exposed through one (or several) V4L2 device nodes.h]hiDepending on the driver, those controls might also be exposed through one (or several) V4L2 device nodes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK?hjhhubeh}(h]controlsah ]h"]controlsah$]h&]uh1hhhhhhhhK,ubh)}(hhh](h)}(hEventsh]hEvents}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj.hhhhhKDubh)}(hXBV4L2 sub-devices can notify applications of events as described in :ref:`event`. The API behaves identically as when used on V4L2 device nodes, with the exception that it only deals with events generated by the sub-device. Depending on the driver, those events might also be reported on one (or several) V4L2 device nodes.h](hCV4L2 sub-devices can notify applications of events as described in }(hj?hhhNhNubh)}(h :ref:`event`h]j)}(hjIh]hevent}(hjKhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjGubah}(h]h ]h"]h$]h&]refdocj refdomainjUreftyperef refexplicitrefwarnj eventuh1hhhhKFhj?ubh. The API behaves identically as when used on V4L2 device nodes, with the exception that it only deals with events generated by the sub-device. Depending on the driver, those events might also be reported on one (or several) V4L2 device nodes.}(hj?hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKFhj.hhubh)}(h.. _pad-level-formats:h]h}(h]h ]h"]h$]h&]hpad-level-formatsuh1hhKMhj.hhhhubeh}(h]eventsah ]h"]eventsah$]h&]uh1hhhhhhhhKDubh)}(hhh](h)}(hPad-level Formatsh]hPad-level Formats}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKPubhwarning)}(hPad-level formats are only applicable to very complex devices that need to expose low-level format configuration to user space. Generic V4L2 applications do *not* need to use the API described in this section.h]h)}(hPad-level formats are only applicable to very complex devices that need to expose low-level format configuration to user space. Generic V4L2 applications do *not* need to use the API described in this section.h](hPad-level formats are only applicable to very complex devices that need to expose low-level format configuration to user space. Generic V4L2 applications do }(hjhhhNhNubhemphasis)}(h*not*h]hnot}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh/ need to use the API described in this section.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKThjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubhnote)}(hFor the purpose of this section, the term *format* means the combination of media bus data format, frame width and frame height.h]h)}(hFor the purpose of this section, the term *format* means the combination of media bus data format, frame width and frame height.h](h*For the purpose of this section, the term }(hjhhhNhNubj)}(h*format*h]hformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhN means the combination of media bus data format, frame width and frame height.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubh)}(hX'Image formats are typically negotiated on video capture and output devices using the format and :ref:`selection ` ioctls. The driver is responsible for configuring every block in the video pipeline according to the requested format at the pipeline input and/or output.h](h`Image formats are typically negotiated on video capture and output devices using the format and }(hjhhhNhNubh)}(h,:ref:`selection `h]j)}(hjh]h selection}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_selectionuh1hhhhK^hjubh ioctls. The driver is responsible for configuring every block in the video pipeline according to the requested format at the pipeline input and/or output.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK^hjhhubh)}(hXDFor complex devices, such as often found in embedded systems, identical image sizes at the output of a pipeline can be achieved using different hardware configurations. One such example is shown on :ref:`pipeline-scaling`, where image scaling can be performed on both the video sensor and the host image processing hardware.h](hFor complex devices, such as often found in embedded systems, identical image sizes at the output of a pipeline can be achieved using different hardware configurations. One such example is shown on }(hj!hhhNhNubh)}(h:ref:`pipeline-scaling`h]j)}(hj+h]hpipeline-scaling}(hj-hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj)ubah}(h]h ]h"]h$]h&]refdocj refdomainj7reftyperef refexplicitrefwarnj pipeline-scalinguh1hhhhKdhj!ubhg, where image scaling can be performed on both the video sensor and the host image processing hardware.}(hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKdhjhhubh)}(h.. _pipeline-scaling:h]h}(h]h ]h"]h$]h&]hpipeline-scalinguh1hhKkhjhhhhubkfigure kernel_figure)}(hhh]hfigure)}(hhh](himage)}(h.. kernel-figure:: pipeline.dot :alt: pipeline.dot :align: center Image Format Negotiation on Pipelines High quality and high speed pipeline configuration h]h}(h]h ]h"]h$]h&]alt pipeline.doturi$userspace-api/media/v4l/pipeline.dot candidates}*jxsuh1jihjfhhhKubhcaption)}(h%Image Format Negotiation on Pipelinesh]h%Image Format Negotiation on Pipelines}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1j|hhhKqhjfubhlegend)}(hhh]h)}(h2High quality and high speed pipeline configurationh]h2High quality and high speed pipeline configuration}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKshjubah}(h]h ]h"]h$]h&]uh1jhjfubeh}(h]id2ah ]h"]h$]h&]aligncenteruh1jdhjaubah}(h]j]ah ]h"]pipeline-scalingah$]h&]uh1j_hjhhhhhNexpect_referenced_by_name}jjSsexpect_referenced_by_id}j]jSsubh)}(hX9The sensor scaler is usually of less quality than the host scaler, but scaling on the sensor is required to achieve higher frame rates. Depending on the use case (quality vs. speed), the pipeline must be configured differently. Applications need to configure the formats at every point in the pipeline explicitly.h]hX9The sensor scaler is usually of less quality than the host scaler, but scaling on the sensor is required to achieve higher frame rates. Depending on the use case (quality vs. speed), the pipeline must be configured differently. Applications need to configure the formats at every point in the pipeline explicitly.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKwhjhhubh)}(hXCDrivers that implement the :ref:`media API ` can expose pad-level image format configuration to applications. When they do, applications can use the :ref:`VIDIOC_SUBDEV_G_FMT ` and :ref:`VIDIOC_SUBDEV_S_FMT ` ioctls. to negotiate formats on a per-pad basis.h](hDrivers that implement the }(hjhhhNhNubh)}(h):ref:`media API `h]j)}(hjh]h media API}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj media-controller-introuh1hhhhK}hjubhi can expose pad-level image format configuration to applications. When they do, applications can use the }(hjhhhNhNubh)}(h0:ref:`VIDIOC_SUBDEV_G_FMT `h]j)}(hjh]hVIDIOC_SUBDEV_G_FMT}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhK}hjubh and }(hjhhhNhNubh)}(h0:ref:`VIDIOC_SUBDEV_S_FMT `h]j)}(hjh]hVIDIOC_SUBDEV_S_FMT}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainj%reftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhK}hjubh1 ioctls. to negotiate formats on a per-pad basis.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK}hjhhubh)}(hX@Applications are responsible for configuring coherent parameters on the whole pipeline and making sure that connected pads have compatible formats. The pipeline is checked for formats mismatch at :ref:`VIDIOC_STREAMON ` time, and an ``EPIPE`` error code is then returned if the configuration is invalid.h](hApplications are responsible for configuring coherent parameters on the whole pipeline and making sure that connected pads have compatible formats. The pipeline is checked for formats mismatch at }(hjAhhhNhNubh)}(h(:ref:`VIDIOC_STREAMON `h]j)}(hjKh]hVIDIOC_STREAMON}(hjMhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjIubah}(h]h ]h"]h$]h&]refdocj refdomainjWreftyperef refexplicitrefwarnj vidioc_streamonuh1hhhhKhjAubh time, and an }(hjAhhhNhNubj{)}(h ``EPIPE``h]hEPIPE}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhjAubh= error code is then returned if the configuration is invalid.}(hjAhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hPad-level image format configuration support can be tested by calling the :ref:`VIDIOC_SUBDEV_G_FMT` ioctl on pad 0. If the driver returns an ``EINVAL`` error code pad-level format configuration is not supported by the sub-device.h](hJPad-level image format configuration support can be tested by calling the }(hjhhhNhNubh)}(h:ref:`VIDIOC_SUBDEV_G_FMT`h]j)}(hjh]hVIDIOC_SUBDEV_G_FMT}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhKhjubh* ioctl on pad 0. If the driver returns an }(hjhhhNhNubj{)}(h ``EINVAL``h]hEINVAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhjubhN error code pad-level format configuration is not supported by the sub-device.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh](h)}(hFormat Negotiationh]hFormat Negotiation}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXZAcceptable formats on pads can (and usually do) depend on a number of external parameters, such as formats on other pads, active links, or even controls. Finding a combination of formats on all pads in a video pipeline, acceptable to both application and driver, can't rely on formats enumeration only. A format negotiation mechanism is required.h]hX\Acceptable formats on pads can (and usually do) depend on a number of external parameters, such as formats on other pads, active links, or even controls. Finding a combination of formats on all pads in a video pipeline, acceptable to both application and driver, can’t rely on formats enumeration only. A format negotiation mechanism is required.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX3Central to the format negotiation mechanism are the get/set format operations. When called with the ``which`` argument set to :ref:`V4L2_SUBDEV_FORMAT_TRY `, the :ref:`VIDIOC_SUBDEV_G_FMT ` and :ref:`VIDIOC_SUBDEV_S_FMT ` ioctls operate on a set of formats parameters that are not connected to the hardware configuration. Modifying those 'try' formats leaves the device state untouched (this applies to both the software state stored in the driver and the hardware state stored in the device itself).h](hdCentral to the format negotiation mechanism are the get/set format operations. When called with the }(hjhhhNhNubj{)}(h ``which``h]hwhich}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhjubh argument set to }(hjhhhNhNubh)}(h3:ref:`V4L2_SUBDEV_FORMAT_TRY `h]j)}(hjh]hV4L2_SUBDEV_FORMAT_TRY}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhKhjubh, the }(hjhhhNhNubh)}(h0:ref:`VIDIOC_SUBDEV_G_FMT `h]j)}(hj(h]hVIDIOC_SUBDEV_G_FMT}(hj*hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj&ubah}(h]h ]h"]h$]h&]refdocj refdomainj4reftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhKhjubh and }(hjhhhNhNubh)}(h0:ref:`VIDIOC_SUBDEV_S_FMT `h]j)}(hjLh]hVIDIOC_SUBDEV_S_FMT}(hjNhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjJubah}(h]h ]h"]h$]h&]refdocj refdomainjXreftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhKhjubhX ioctls operate on a set of formats parameters that are not connected to the hardware configuration. Modifying those ‘try’ formats leaves the device state untouched (this applies to both the software state stored in the driver and the hardware state stored in the device itself).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXOWhile not kept as part of the device state, try formats are stored in the sub-device file handles. A :ref:`VIDIOC_SUBDEV_G_FMT ` call will return the last try format set *on the same sub-device file handle*. Several applications querying the same sub-device at the same time will thus not interact with each other.h](heWhile not kept as part of the device state, try formats are stored in the sub-device file handles. A }(hjthhhNhNubh)}(h0:ref:`VIDIOC_SUBDEV_G_FMT `h]j)}(hj~h]hVIDIOC_SUBDEV_G_FMT}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj|ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhKhjtubh* call will return the last try format set }(hjthhhNhNubj)}(h$*on the same sub-device file handle*h]h"on the same sub-device file handle}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjtubhl. Several applications querying the same sub-device at the same time will thus not interact with each other.}(hjthhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXvTo find out whether a particular format is supported by the device, applications use the :ref:`VIDIOC_SUBDEV_S_FMT ` ioctl. Drivers verify and, if needed, change the requested ``format`` based on device requirements and return the possibly modified value. Applications can then choose to try a different format or accept the returned value and continue.h](hYTo find out whether a particular format is supported by the device, applications use the }(hjhhhNhNubh)}(h0:ref:`VIDIOC_SUBDEV_S_FMT `h]j)}(hjh]hVIDIOC_SUBDEV_S_FMT}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhKhjubh< ioctl. Drivers verify and, if needed, change the requested }(hjhhhNhNubj{)}(h ``format``h]hformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhjubh based on device requirements and return the possibly modified value. Applications can then choose to try a different format or accept the returned value and continue.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXtFormats returned by the driver during a negotiation iteration are guaranteed to be supported by the device. In particular, drivers guarantee that a returned format will not be further changed if passed to an :ref:`VIDIOC_SUBDEV_S_FMT ` call as-is (as long as external parameters, such as formats on other pads or links' configuration are not changed).h](hFormats returned by the driver during a negotiation iteration are guaranteed to be supported by the device. In particular, drivers guarantee that a returned format will not be further changed if passed to an }(hjhhhNhNubh)}(h0:ref:`VIDIOC_SUBDEV_S_FMT `h]j)}(hjh]hVIDIOC_SUBDEV_S_FMT}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhKhjubhv call as-is (as long as external parameters, such as formats on other pads or links’ configuration are not changed).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXDDrivers automatically propagate formats inside sub-devices. When a try or active format is set on a pad, corresponding formats on other pads of the same sub-device can be modified by the driver. Drivers are free to modify formats as required by the device. However, they should comply with the following rules when possible:h]hXDDrivers automatically propagate formats inside sub-devices. When a try or active format is set on a pad, corresponding formats on other pads of the same sub-device can be modified by the driver. Drivers are free to modify formats as required by the device. However, they should comply with the following rules when possible:}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hhh](j )}(hFormats should be propagated from sink pads to source pads. Modifying a format on a source pad should not modify the format on any sink pad. h]h)}(hFormats should be propagated from sink pads to source pads. Modifying a format on a source pad should not modify the format on any sink pad.h]hFormats should be propagated from sink pads to source pads. Modifying a format on a source pad should not modify the format on any sink pad.}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj?ubah}(h]h ]h"]h$]h&]uh1jhj<hhhhhNubj )}(hXSub-devices that scale frames using variable scaling factors should reset the scale factors to default values when sink pads formats are modified. If the 1:1 scaling ratio is supported, this means that source pads formats should be reset to the sink pads formats. h]h)}(hXSub-devices that scale frames using variable scaling factors should reset the scale factors to default values when sink pads formats are modified. If the 1:1 scaling ratio is supported, this means that source pads formats should be reset to the sink pads formats.h]hXSub-devices that scale frames using variable scaling factors should reset the scale factors to default values when sink pads formats are modified. If the 1:1 scaling ratio is supported, this means that source pads formats should be reset to the sink pads formats.}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjWubah}(h]h ]h"]h$]h&]uh1jhj<hhhhhNubeh}(h]h ]h"]h$]h&]jpjquh1jhhhKhjhhubh)}(hXFormats are not propagated across links, as that would involve propagating them from one sub-device file handle to another. Applications must then take care to configure both ends of every link explicitly with compatible formats. Identical formats on the two ends of a link are guaranteed to be compatible. Drivers are free to accept different formats matching device requirements as being compatible.h]hXFormats are not propagated across links, as that would involve propagating them from one sub-device file handle to another. Applications must then take care to configure both ends of every link explicitly with compatible formats. Identical formats on the two ends of a link are guaranteed to be compatible. Drivers are free to accept different formats matching device requirements as being compatible.}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h:ref:`sample-pipeline-config` shows a sample configuration sequence for the pipeline described in :ref:`pipeline-scaling` (table columns list entity names and pad numbers).h](h)}(h:ref:`sample-pipeline-config`h]j)}(hjh]hsample-pipeline-config}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sample-pipeline-configuh1hhhhKhjubhE shows a sample configuration sequence for the pipeline described in }(hjhhhNhNubh)}(h:ref:`pipeline-scaling`h]j)}(hjh]hpipeline-scaling}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj pipeline-scalinguh1hhhhKhjubh3 (table columns list entity names and pad numbers).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubhraw)}(h3\begingroup \scriptsize \setlength{\tabcolsep}{2pt}h]h3\begingroup \scriptsize \setlength{\tabcolsep}{2pt}}hjsbah}(h]h ]h"]h$]h&]formatlatexhhuh1jhhhKhjhhubhtabular_col_spec)}(hhh]h}(h]h ]h"]h$]h&]spec@|p{2.0cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|p{2.1cm}|uh1jhhhKhjhhubh)}(h.. _sample-pipeline-config:h]h}(h]h ]h"]h$]h&]hsample-pipeline-configuh1hhKhjhhhhubhtable)}(hhh](h)}(hSample Pipeline Configurationh]hSample Pipeline Configuration}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubhtgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubhthead)}(hhh]hrow)}(hhh](hentry)}(hhh]h}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh](h)}(hSensor/0h]hSensor/0}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjtubh)}(hformath]hformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjtubeh}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh](h)}(h Frontend/0h]h Frontend/0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hformath]hformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh](h)}(h Frontend/1h]h Frontend/1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hformath]hformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh](h)}(hScaler/0h]hScaler/0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hformath]hformat}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh](h)}(hScaler/0h]hScaler/0}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hcompose selection rectangleh]hcompose selection rectangle}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh](h)}(hScaler/1h]hScaler/1}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj-ubh)}(hformath]hformat}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj-ubeh}(h]h ]h"]h$]h&]uh1jihjfubeh}(h]h ]h"]h$]h&]uh1jdhjaubah}(h]h ]h"]h$]h&]uh1j_hjubhtbody)}(hhh](je)}(hhh](jj)}(hhh]h)}(h Initial stateh]h Initial state}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjfubah}(h]h ]h"]h$]h&]uh1jihjcubjj)}(hhh](h)}(h 2048x1536h]h 2048x1536}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj}ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj}ubeh}(h]h ]h"]h$]h&]uh1jihjcubjj)}(hhh]h)}(h (default)h]h (default)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jihjcubjj)}(hhh]h)}(h (default)h]h (default)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jihjcubjj)}(hhh]h)}(h (default)h]h (default)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jihjcubjj)}(hhh]h)}(h (default)h]h (default)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jihjcubjj)}(hhh]h)}(h (default)h]h (default)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jihjcubeh}(h]h ]h"]h$]h&]uh1jdhj`ubje)}(hhh](jj)}(hhh]h)}(hConfigure frontend sink formath]hConfigure frontend sink format}(hj! hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh](h)}(h 2048x1536h]h 2048x1536}(hj8 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj5 ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hjF hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj5 ubeh}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh](h)}(h *2048x1536*h]j)}(hj_ h]h 2048x1536}(hja hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj] ubah}(h]h ]h"]h$]h&]uh1hhhhMhjZ ubh)}(h *SGRBG8_1X8*h]j)}(hjv h]h SGRBG8_1X8}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjt ubah}(h]h ]h"]h$]h&]uh1hhhhMhjZ ubeh}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh](h)}(h *2046x1534*h]j)}(hj h]h 2046x1534}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(h *SGRBG8_1X8*h]j)}(hj h]h SGRBG8_1X8}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh]h)}(h (default)h]h (default)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj ubah}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh]h)}(h (default)h]h (default)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj ubah}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh]h)}(h (default)h]h (default)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj ubah}(h]h ]h"]h$]h&]uh1jihj ubeh}(h]h ]h"]h$]h&]uh1jdhj`ubje)}(hhh](jj)}(hhh]h)}(hConfigure scaler sink formath]hConfigure scaler sink format}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj ubah}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh](h)}(h 2048x1536h]h 2048x1536}(hj0 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj- ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hj> hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj- ubeh}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh](h)}(h 2048x1536h]h 2048x1536}(hjU hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjR ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjR ubeh}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh](h)}(h 2046x1534h]h 2046x1534}(hjz hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjw ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjw ubeh}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh](h)}(h *2046x1534*h]j)}(hj h]h 2046x1534}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(h *SGRBG8_1X8*h]j)}(hj h]h SGRBG8_1X8}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh]h)}(h*0,0/2046x1534*h]j)}(hj h]h 0,0/2046x1534}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jihj ubjj)}(hhh](h)}(h *2046x1534*h]j)}(hj h]h 2046x1534}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(h *SGRBG8_1X8*h]j)}(hj h]h SGRBG8_1X8}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubeh}(h]h ]h"]h$]h&]uh1jihj ubeh}(h]h ]h"]h$]h&]uh1jdhj`ubje)}(hhh](jj)}(hhh]h)}(h'Configure scaler sink compose selectionh]h'Configure scaler sink compose selection}(hj6 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj3 ubah}(h]h ]h"]h$]h&]uh1jihj0 ubjj)}(hhh](h)}(h 2048x1536h]h 2048x1536}(hjM hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjJ ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hj[ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjJ ubeh}(h]h ]h"]h$]h&]uh1jihj0 ubjj)}(hhh](h)}(h 2048x1536h]h 2048x1536}(hjr hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM!hjo ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM#hjo ubeh}(h]h ]h"]h$]h&]uh1jihj0 ubjj)}(hhh](h)}(h 2046x1534h]h 2046x1534}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hj ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM&hj ubeh}(h]h ]h"]h$]h&]uh1jihj0 ubjj)}(hhh](h)}(h 2046x1534h]h 2046x1534}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hj ubh)}(h SGRBG8_1X8h]h SGRBG8_1X8}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM)hj ubeh}(h]h ]h"]h$]h&]uh1jihj0 ubjj)}(hhh]h)}(h*0,0/1280x960*h]j)}(hj h]h 0,0/1280x960}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhM*hj ubah}(h]h ]h"]h$]h&]uh1jihj0 ubjj)}(hhh](h)}(h *1280x960*h]j)}(hj h]h1280x960}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhM+hj ubh)}(h *SGRBG8_1X8*h]j)}(hj h]h SGRBG8_1X8}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1hhhhM-hj ubeh}(h]h ]h"]h$]h&]uh1jihj0 ubeh}(h]h ]h"]h$]h&]uh1jdhj`ubeh}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]colsKuh1jhjubeh}(h](id3jeh ]h"]sample-pipeline-configah$]h&]uh1jhjhhhNhNj}jM jsj}jjsubj)}(h \endgrouph]h \endgroup}hjR sbah}(h]h ]h"]h$]h&]formatlatexhhuh1jhhhM/hjhhubhenumerated_list)}(hhh](j )}(hXInitial state. The sensor source pad format is set to its native 3MP size and V4L2_MBUS_FMT_SGRBG8_1X8 media bus code. Formats on the host frontend and scaler sink and source pads have the default values, as well as the compose rectangle on the scaler's sink pad. h]h)}(hXInitial state. The sensor source pad format is set to its native 3MP size and V4L2_MBUS_FMT_SGRBG8_1X8 media bus code. Formats on the host frontend and scaler sink and source pads have the default values, as well as the compose rectangle on the scaler's sink pad.h]hX Initial state. The sensor source pad format is set to its native 3MP size and V4L2_MBUS_FMT_SGRBG8_1X8 media bus code. Formats on the host frontend and scaler sink and source pads have the default values, as well as the compose rectangle on the scaler’s sink pad.}(hjk hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hjg ubah}(h]h ]h"]h$]h&]uh1jhjd hhhhhNubj )}(hThe application configures the frontend sink pad format's size to 2048x1536 and its media bus code to V4L2_MBUS_FMT_SGRBG_1X8. The driver propagates the format to the frontend source pad. h]h)}(hThe application configures the frontend sink pad format's size to 2048x1536 and its media bus code to V4L2_MBUS_FMT_SGRBG_1X8. The driver propagates the format to the frontend source pad.h]hThe application configures the frontend sink pad format’s size to 2048x1536 and its media bus code to V4L2_MBUS_FMT_SGRBG_1X8. The driver propagates the format to the frontend source pad.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM8hj ubah}(h]h ]h"]h$]h&]uh1jhjd hhhhhNubj )}(hX}The application configures the scaler sink pad format's size to 2046x1534 and the media bus code to V4L2_MBUS_FMT_SGRBG_1X8 to match the frontend source size and media bus code. The media bus code on the sink pad is set to V4L2_MBUS_FMT_SGRBG_1X8. The driver propagates the size to the compose selection rectangle on the scaler's sink pad, and the format to the scaler source pad. h]h)}(hX|The application configures the scaler sink pad format's size to 2046x1534 and the media bus code to V4L2_MBUS_FMT_SGRBG_1X8 to match the frontend source size and media bus code. The media bus code on the sink pad is set to V4L2_MBUS_FMT_SGRBG_1X8. The driver propagates the size to the compose selection rectangle on the scaler's sink pad, and the format to the scaler source pad.h]hXThe application configures the scaler sink pad format’s size to 2046x1534 and the media bus code to V4L2_MBUS_FMT_SGRBG_1X8 to match the frontend source size and media bus code. The media bus code on the sink pad is set to V4L2_MBUS_FMT_SGRBG_1X8. The driver propagates the size to the compose selection rectangle on the scaler’s sink pad, and the format to the scaler source pad.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hj ubah}(h]h ]h"]h$]h&]uh1jhjd hhhhhNubj )}(hThe application configures the size of the compose selection rectangle of the scaler's sink pad 1280x960. The driver propagates the size to the scaler's source pad format. h]h)}(hThe application configures the size of the compose selection rectangle of the scaler's sink pad 1280x960. The driver propagates the size to the scaler's source pad format.h]hThe application configures the size of the compose selection rectangle of the scaler’s sink pad 1280x960. The driver propagates the size to the scaler’s source pad format.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMChj ubah}(h]h ]h"]h$]h&]uh1jhjd hhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1jb hjhhhhhM3ubh)}(hX When satisfied with the try results, applications can set the active formats by setting the ``which`` argument to ``V4L2_SUBDEV_FORMAT_ACTIVE``. Active formats are changed exactly as try formats by drivers. To avoid modifying the hardware state during format negotiation, applications should negotiate try formats first and then modify the active settings using the try formats returned during the last negotiation iteration. This guarantees that the active format will be applied as-is by the driver without being modified.h](h\When satisfied with the try results, applications can set the active formats by setting the }(hj hhhNhNubj{)}(h ``which``h]hwhich}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jzhj ubh argument to }(hj hhhNhNubj{)}(h``V4L2_SUBDEV_FORMAT_ACTIVE``h]hV4L2_SUBDEV_FORMAT_ACTIVE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jzhj ubhX}. Active formats are changed exactly as try formats by drivers. To avoid modifying the hardware state during format negotiation, applications should negotiate try formats first and then modify the active settings using the try formats returned during the last negotiation iteration. This guarantees that the active format will be applied as-is by the driver without being modified.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMGhjhhubh)}(h.. _v4l2-subdev-selections:h]h}(h]h ]h"]h$]h&]hv4l2-subdev-selectionsuh1hhMQhjhhhhubeh}(h]format-negotiationah ]h"]format negotiationah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h-Selections: cropping, scaling and compositionh]h-Selections: cropping, scaling and composition}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMTubh)}(hXDMany sub-devices support cropping frames on their input or output pads (or possible even on both). Cropping is used to select the area of interest in an image, typically on an image sensor or a video decoder. It can also be used as part of digital zoom implementations to select the area of the image that will be scaled up.h]hXDMany sub-devices support cropping frames on their input or output pads (or possible even on both). Cropping is used to select the area of interest in an image, typically on an image sensor or a video decoder. It can also be used as part of digital zoom implementations to select the area of the image that will be scaled up.}(hj( hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMVhj hhubh)}(hCrop settings are defined by a crop rectangle and represented in a struct :c:type:`v4l2_rect` by the coordinates of the top left corner and the rectangle size. Both the coordinates and sizes are expressed in pixels.h](hJCrop settings are defined by a crop rectangle and represented in a struct }(hj6 hhhNhNubh)}(h:c:type:`v4l2_rect`h]j{)}(hj@ h]h v4l2_rect}(hjB hhhNhNubah}(h]h ](jcc-typeeh"]h$]h&]uh1jzhj> ubah}(h]h ]h"]h$]h&]refdocj refdomainjL reftypetype refexplicitrefwarnj  v4l2_rectuh1hhhhM\hj6 ubhz by the coordinates of the top left corner and the rectangle size. Both the coordinates and sizes are expressed in pixels.}(hj6 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM\hj hhubh)}(htAs for pad formats, drivers store try and active rectangles for the selection targets :ref:`v4l2-selections-common`.h](hVAs for pad formats, drivers store try and active rectangles for the selection targets }(hjh hhhNhNubh)}(h:ref:`v4l2-selections-common`h]j)}(hjr h]hv4l2-selections-common}(hjt hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjp ubah}(h]h ]h"]h$]h&]refdocj refdomainj~ reftyperef refexplicitrefwarnj v4l2-selections-commonuh1hhhhMahjh ubh.}(hjh hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMahj hhubh)}(hX,On sink pads, cropping is applied relative to the current pad format. The pad format represents the image size as received by the sub-device from the previous block in the pipeline, and the crop rectangle represents the sub-image that will be transmitted further inside the sub-device for processing.h]hX,On sink pads, cropping is applied relative to the current pad format. The pad format represents the image size as received by the sub-device from the previous block in the pipeline, and the crop rectangle represents the sub-image that will be transmitted further inside the sub-device for processing.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMdhj hhubh)}(hThe scaling operation changes the size of the image by scaling it to new dimensions. The scaling ratio isn't specified explicitly, but is implied from the original and scaled image sizes. Both sizes are represented by struct :c:type:`v4l2_rect`.h](hThe scaling operation changes the size of the image by scaling it to new dimensions. The scaling ratio isn’t specified explicitly, but is implied from the original and scaled image sizes. Both sizes are represented by struct }(hj hhhNhNubh)}(h:c:type:`v4l2_rect`h]j{)}(hj h]h v4l2_rect}(hj hhhNhNubah}(h]h ](jjL c-typeeh"]h$]h&]uh1jzhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjL reftypetype refexplicitrefwarnj  v4l2_rectuh1hhhhMjhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMjhj hhubh)}(hXScaling support is optional. When supported by a subdev, the crop rectangle on the subdev's sink pad is scaled to the size configured using the :ref:`VIDIOC_SUBDEV_S_SELECTION ` IOCTL using ``V4L2_SEL_TGT_COMPOSE`` selection target on the same pad. If the subdev supports scaling but not composing, the top and left values are not used and must always be set to zero.h](hScaling support is optional. When supported by a subdev, the crop rectangle on the subdev’s sink pad is scaled to the size configured using the }(hj hhhNhNubh)}(h<:ref:`VIDIOC_SUBDEV_S_SELECTION `h]j)}(hj h]hVIDIOC_SUBDEV_S_SELECTION}(hj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj vidioc_subdev_g_selectionuh1hhhhMohj ubh IOCTL using }(hj hhhNhNubj{)}(h``V4L2_SEL_TGT_COMPOSE``h]hV4L2_SEL_TGT_COMPOSE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhj ubh selection target on the same pad. If the subdev supports scaling but not composing, the top and left values are not used and must always be set to zero.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMohj hhubh)}(hX*On source pads, cropping is similar to sink pads, with the exception that the source size from which the cropping is performed, is the COMPOSE rectangle on the sink pad. In both sink and source pads, the crop rectangle must be entirely contained inside the source image size for the crop operation.h]hX*On source pads, cropping is similar to sink pads, with the exception that the source size from which the cropping is performed, is the COMPOSE rectangle on the sink pad. In both sink and source pads, the crop rectangle must be entirely contained inside the source image size for the crop operation.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMwhj hhubh)}(hXThe drivers should always use the closest possible rectangle the user requests on all selection targets, unless specifically told otherwise. ``V4L2_SEL_FLAG_GE`` and ``V4L2_SEL_FLAG_LE`` flags may be used to round the image size either up or down. :ref:`v4l2-selection-flags`h](hThe drivers should always use the closest possible rectangle the user requests on all selection targets, unless specifically told otherwise. }(hj+hhhNhNubj{)}(h``V4L2_SEL_FLAG_GE``h]hV4L2_SEL_FLAG_GE}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1jzhj+ubh and }(hj+hhhNhNubj{)}(h``V4L2_SEL_FLAG_LE``h]hV4L2_SEL_FLAG_LE}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhj+ubh> flags may be used to round the image size either up or down. }(hj+hhhNhNubh)}(h:ref:`v4l2-selection-flags`h]j)}(hjYh]hv4l2-selection-flags}(hj[hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjWubah}(h]h ]h"]h$]h&]refdocj refdomainjereftyperef refexplicitrefwarnj v4l2-selection-flagsuh1hhhhM}hj+ubeh}(h]h ]h"]h$]h&]uh1hhhhM}hj hhubeh}(h](+selections-cropping-scaling-and-compositionj eh ]h"](-selections: cropping, scaling and compositionv4l2-subdev-selectionseh$]h&]uh1hhjhhhhhMTj}jj sj}j j subh)}(hhh](h)}(hTypes of selection targetsh]hTypes of selection targets}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(hActual targetsh]hActual targets}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hActual targets (without a postfix) reflect the actual hardware configuration at any point of time. There is a BOUNDS target corresponding to every actual target.h]hActual targets (without a postfix) reflect the actual hardware configuration at any point of time. There is a BOUNDS target corresponding to every actual target.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]actual-targetsah ]h"]actual targetsah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(hBOUNDS targetsh]hBOUNDS targets}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hXOBOUNDS targets is the smallest rectangle that contains all valid actual rectangles. It may not be possible to set the actual rectangle as large as the BOUNDS rectangle, however. This may be because e.g. a sensor's pixel array is not rectangular but cross-shaped or round. The maximum size may also be smaller than the BOUNDS rectangle.h]hXQBOUNDS targets is the smallest rectangle that contains all valid actual rectangles. It may not be possible to set the actual rectangle as large as the BOUNDS rectangle, however. This may be because e.g. a sensor’s pixel array is not rectangular but cross-shaped or round. The maximum size may also be smaller than the BOUNDS rectangle.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h.. _format-propagation:h]h}(h]h ]h"]h$]h&]hformat-propagationuh1hhMhjhhhhubeh}(h]bounds-targetsah ]h"]bounds targetsah$]h&]uh1hhjhhhhhMubeh}(h]types-of-selection-targetsah ]h"]types of selection targetsah$]h&]uh1hhjhhhhhMubh)}(hhh](h)}(h-Order of configuration and format propagationh]h-Order of configuration and format propagation}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hX2Inside subdevs, the order of image processing steps will always be from the sink pad towards the source pad. This is also reflected in the order in which the configuration must be performed by the user: the changes made will be propagated to any subsequent stages. If this behaviour is not desired, the user must set ``V4L2_SEL_FLAG_KEEP_CONFIG`` flag. This flag causes no propagation of the changes are allowed in any circumstances. This may also cause the accessed rectangle to be adjusted by the driver, depending on the properties of the underlying hardware.h](hX=Inside subdevs, the order of image processing steps will always be from the sink pad towards the source pad. This is also reflected in the order in which the configuration must be performed by the user: the changes made will be propagated to any subsequent stages. If this behaviour is not desired, the user must set }(hj hhhNhNubj{)}(h``V4L2_SEL_FLAG_KEEP_CONFIG``h]hV4L2_SEL_FLAG_KEEP_CONFIG}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhj ubh flag. This flag causes no propagation of the changes are allowed in any circumstances. This may also cause the accessed rectangle to be adjusted by the driver, depending on the properties of the underlying hardware.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hThe coordinates to a step always refer to the actual size of the previous step. The exception to this rule is the sink compose rectangle, which refers to the sink compose bounds rectangle --- if it is supported by the hardware.h]hThe coordinates to a step always refer to the actual size of the previous step. The exception to this rule is the sink compose rectangle, which refers to the sink compose bounds rectangle --- if it is supported by the hardware.}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubjc )}(hhh](j )}(hSink pad format. The user configures the sink pad format. This format defines the parameters of the image the entity receives through the pad for further processing. h]h)}(hSink pad format. The user configures the sink pad format. This format defines the parameters of the image the entity receives through the pad for further processing.h]hSink pad format. The user configures the sink pad format. This format defines the parameters of the image the entity receives through the pad for further processing.}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj<ubah}(h]h ]h"]h$]h&]uh1jhj9hhhhhNubj )}(heSink pad actual crop selection. The sink pad crop defines the crop performed to the sink pad format. h]h)}(hdSink pad actual crop selection. The sink pad crop defines the crop performed to the sink pad format.h]hdSink pad actual crop selection. The sink pad crop defines the crop performed to the sink pad format.}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjTubah}(h]h ]h"]h$]h&]uh1jhj9hhhhhNubj )}(hX%Sink pad actual compose selection. The size of the sink pad compose rectangle defines the scaling ratio compared to the size of the sink pad crop rectangle. The location of the compose rectangle specifies the location of the actual sink compose rectangle in the sink compose bounds rectangle. h]h)}(hX$Sink pad actual compose selection. The size of the sink pad compose rectangle defines the scaling ratio compared to the size of the sink pad crop rectangle. The location of the compose rectangle specifies the location of the actual sink compose rectangle in the sink compose bounds rectangle.h]hX$Sink pad actual compose selection. The size of the sink pad compose rectangle defines the scaling ratio compared to the size of the sink pad crop rectangle. The location of the compose rectangle specifies the location of the actual sink compose rectangle in the sink compose bounds rectangle.}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjlubah}(h]h ]h"]h$]h&]uh1jhj9hhhhhNubj )}(hSource pad actual crop selection. Crop on the source pad defines crop performed to the image in the sink compose bounds rectangle. h]h)}(hSource pad actual crop selection. Crop on the source pad defines crop performed to the image in the sink compose bounds rectangle.h]hSource pad actual crop selection. Crop on the source pad defines crop performed to the image in the sink compose bounds rectangle.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhj9hhhhhNubj )}(hSource pad format. The source pad format defines the output pixel format of the subdev, as well as the other parameters with the exception of the image width and height. Width and height are defined by the size of the source pad actual crop selection. h]h)}(hSource pad format. The source pad format defines the output pixel format of the subdev, as well as the other parameters with the exception of the image width and height. Width and height are defined by the size of the source pad actual crop selection.h]hSource pad format. The source pad format defines the output pixel format of the subdev, as well as the other parameters with the exception of the image width and height. Width and height are defined by the size of the source pad actual crop selection.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhj9hhhhhNubeh}(h]h ]h"]h$]h&]j j j hj j uh1jb hjhhhhhMubh)}(hXQAccessing any of the above rectangles not supported by the subdev will return ``EINVAL``. Any rectangle referring to a previous unsupported rectangle coordinates will instead refer to the previous supported rectangle. For example, if sink crop is not supported, the compose selection will refer to the sink pad format dimensions instead.1h](hNAccessing any of the above rectangles not supported by the subdev will return }(hjhhhNhNubj{)}(h ``EINVAL``h]hEINVAL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhjubh. Any rectangle referring to a previous unsupported rectangle coordinates will instead refer to the previous supported rectangle. For example, if sink crop is not supported, the compose selection will refer to the sink pad format dimensions instead.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h!.. _subdev-image-processing-crop:h]h}(h]h ]h"]h$]h&]hsubdev-image-processing-cropuh1hhMhjhhhhubj`)}(hhh]je)}(hhh](jj)}(h.. kernel-figure:: subdev-image-processing-crop.svg :alt: subdev-image-processing-crop.svg :align: center **Figure 4.5. Image processing in subdevs: simple crop example** h]h}(h]h ]h"]h$]h&]alt subdev-image-processing-crop.svguri8userspace-api/media/v4l/subdev-image-processing-crop.svgjy}j{jsuh1jihjhhhKubj})}(h@**Figure 4.5. Image processing in subdevs: simple crop example**h]hstrong)}(hjh]h
` h]h)}(hkSet up links. Connect the pads between sub-devices using the :ref:`Media Controller API `h](h=Set up links. Connect the pads between sub-devices using the }(hjhhhNhNubh)}(h.:ref:`Media Controller API `h]j)}(hjh]hMedia Controller API}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj media_controlleruh1hhhhM_hjubeh}(h]h ]h"]h$]h&]uh1hhhhM_hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj )}(hXStreams. Streams are declared and their routing is configured by setting the routing table for the sub-device using :ref:`VIDIOC_SUBDEV_S_ROUTING ` ioctl. Note that setting the routing table will reset formats and selections in the sub-device to default values. h]h)}(hXStreams. Streams are declared and their routing is configured by setting the routing table for the sub-device using :ref:`VIDIOC_SUBDEV_S_ROUTING ` ioctl. Note that setting the routing table will reset formats and selections in the sub-device to default values.h](htStreams. Streams are declared and their routing is configured by setting the routing table for the sub-device using }(hjhhhNhNubh)}(h8:ref:`VIDIOC_SUBDEV_S_ROUTING `h]j)}(hj#h]hVIDIOC_SUBDEV_S_ROUTING}(hj%hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj!ubah}(h]h ]h"]h$]h&]refdocj refdomainj/reftyperef refexplicitrefwarnj vidioc_subdev_g_routinguh1hhhhMbhjubhr ioctl. Note that setting the routing table will reset formats and selections in the sub-device to default values.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMbhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj )}(hXYConfigure formats and selections. Formats and selections of each stream are configured separately as documented for plain sub-devices in :ref:`format-propagation`. The stream ID is set to the same stream ID associated with either sink or source pads of routes configured using the :ref:`VIDIOC_SUBDEV_S_ROUTING ` ioctl. h]h)}(hXXConfigure formats and selections. Formats and selections of each stream are configured separately as documented for plain sub-devices in :ref:`format-propagation`. The stream ID is set to the same stream ID associated with either sink or source pads of routes configured using the :ref:`VIDIOC_SUBDEV_S_ROUTING ` ioctl.h](hConfigure formats and selections. Formats and selections of each stream are configured separately as documented for plain sub-devices in }(hjUhhhNhNubh)}(h:ref:`format-propagation`h]j)}(hj_h]hformat-propagation}(hjahhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj]ubah}(h]h ]h"]h$]h&]refdocj refdomainjkreftyperef refexplicitrefwarnj format-propagationuh1hhhhMghjUubhw. The stream ID is set to the same stream ID associated with either sink or source pads of routes configured using the }(hjUhhhNhNubh)}(h8:ref:`VIDIOC_SUBDEV_S_ROUTING `h]j)}(hjh]hVIDIOC_SUBDEV_S_ROUTING}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_routinguh1hhhhMghjUubh ioctl.}(hjUhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMghjQubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]j j j hj j uh1jb hjhhhhhM_ubeh}(h]configuring-streamsah ]h"]configuring streamsah$]h&]uh1hhjhhhhhMWubh)}(hhh](h)}(h!Multiplexed streams setup exampleh]h!Multiplexed streams setup example}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMnubh)}(hCA simple example of a multiplexed stream setup might be as follows:h]hCA simple example of a multiplexed stream setup might be as follows:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMphjhhubj)}(hhh](j )}(h~Two identical sensors (Sensor A and Sensor B). Each sensor has a single source pad (pad 0) which carries a pixel data stream. h]h)}(h}Two identical sensors (Sensor A and Sensor B). Each sensor has a single source pad (pad 0) which carries a pixel data stream.h]h}Two identical sensors (Sensor A and Sensor B). Each sensor has a single source pad (pad 0) which carries a pixel data stream.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMrhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj )}(hMultiplexer bridge (Bridge). The bridge has two sink pads, connected to the sensors (pads 0, 1), and one source pad (pad 2), which outputs two streams. h]h)}(hMultiplexer bridge (Bridge). The bridge has two sink pads, connected to the sensors (pads 0, 1), and one source pad (pad 2), which outputs two streams.h]hMultiplexer bridge (Bridge). The bridge has two sink pads, connected to the sensors (pads 0, 1), and one source pad (pad 2), which outputs two streams.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMuhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj )}(hReceiver in the SoC (Receiver). The receiver has a single sink pad (pad 0), connected to the bridge, and two source pads (pads 1-2), going to the DMA engine. The receiver demultiplexes the incoming streams to the source pads. h]h)}(hReceiver in the SoC (Receiver). The receiver has a single sink pad (pad 0), connected to the bridge, and two source pads (pads 1-2), going to the DMA engine. The receiver demultiplexes the incoming streams to the source pads.h]hReceiver in the SoC (Receiver). The receiver has a single sink pad (pad 0), connected to the bridge, and two source pads (pads 1-2), going to the DMA engine. The receiver demultiplexes the incoming streams to the source pads.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMxhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj )}(hDMA Engines in the SoC (DMA Engine), one for each stream. Each DMA engine is connected to a single source pad in the receiver. h]h)}(h~DMA Engines in the SoC (DMA Engine), one for each stream. Each DMA engine is connected to a single source pad in the receiver.h]h~DMA Engines in the SoC (DMA Engine), one for each stream. Each DMA engine is connected to a single source pad in the receiver.}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM|hj)ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]jpjquh1jhhhMrhjhhubh)}(hThe sensors, the bridge and the receiver are modeled as V4L2 sub-devices, exposed to userspace via /dev/v4l-subdevX device nodes. The DMA engines are modeled as V4L2 devices, exposed to userspace via /dev/videoX nodes.h]hThe sensors, the bridge and the receiver are modeled as V4L2 sub-devices, exposed to userspace via /dev/v4l-subdevX device nodes. The DMA engines are modeled as V4L2 devices, exposed to userspace via /dev/videoX nodes.}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hHTo configure this pipeline, the userspace must take the following steps:h]hHTo configure this pipeline, the userspace must take the following steps:}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubjc )}(hhh](j )}(hSet up media links between entities: connect the sensors to the bridge, bridge to the receiver, and the receiver to the DMA engines. This step does not differ from normal non-multiplexed media controller setup. h]h)}(hSet up media links between entities: connect the sensors to the bridge, bridge to the receiver, and the receiver to the DMA engines. This step does not differ from normal non-multiplexed media controller setup.h]hSet up media links between entities: connect the sensors to the bridge, bridge to the receiver, and the receiver to the DMA engines. This step does not differ from normal non-multiplexed media controller setup.}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjfubah}(h]h ]h"]h$]h&]uh1jhjchhhhhNubj )}(hConfigure routing h]h)}(hConfigure routingh]hConfigure routing}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj~ubah}(h]h ]h"]h$]h&]uh1jhjchhhhhNubeh}(h]h ]h"]h$]h&]j j j hj j uh1jb hjhhhhhMubj)}(hhh](h)}(hBridge routing tableh]hBridge routing table}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj)}(hhh](j)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj`)}(hhh]je)}(hhh](jj)}(hhh]h)}(hSink Pad/Streamh]hSink Pad/Stream}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(hSource Pad/Streamh]hSource Pad/Stream}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(h Routing Flagsh]h Routing Flags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(hCommentsh]hComments}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj#ubah}(h]h ]h"]h$]h&]uh1jihjubeh}(h]h ]h"]h$]h&]uh1jdhjubah}(h]h ]h"]h$]h&]uh1j_hjubj_)}(hhh](je)}(hhh](jj)}(hhh]h)}(h0/0h]h0/0}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjLubah}(h]h ]h"]h$]h&]uh1jihjIubjj)}(hhh]h)}(h2/0h]h2/0}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjcubah}(h]h ]h"]h$]h&]uh1jihjIubjj)}(hhh]h)}(hV4L2_SUBDEV_ROUTE_FL_ACTIVEh]hV4L2_SUBDEV_ROUTE_FL_ACTIVE}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjzubah}(h]h ]h"]h$]h&]uh1jihjIubjj)}(hhh]h)}(hPixel data stream from Sensor Ah]hPixel data stream from Sensor A}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjIubeh}(h]h ]h"]h$]h&]uh1jdhjFubje)}(hhh](jj)}(hhh]h)}(h1/0h]h1/0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(h2/1h]h2/1}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(hV4L2_SUBDEV_ROUTE_FL_ACTIVEh]hV4L2_SUBDEV_ROUTE_FL_ACTIVE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(hPixel data stream from Sensor Bh]hPixel data stream from Sensor B}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubeh}(h]h ]h"]h$]h&]uh1jdhjFubeh}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]colsKuh1jhjubeh}(h]id7ah ]h"]h$]h&]uh1jhjhhhNhNubj)}(hhh](h)}(hReceiver routing tableh]hReceiver routing table}(hj*hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj'ubj)}(hhh](j)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj8ubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj8ubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj8ubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhj8ubj`)}(hhh]je)}(hhh](jj)}(hhh]h)}(hSink Pad/Streamh]hSink Pad/Stream}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjiubah}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh]h)}(hSource Pad/Streamh]hSource Pad/Stream}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh]h)}(h Routing Flagsh]h Routing Flags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjfubjj)}(hhh]h)}(hCommentsh]hComments}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjfubeh}(h]h ]h"]h$]h&]uh1jdhjcubah}(h]h ]h"]h$]h&]uh1j_hj8ubj_)}(hhh](je)}(hhh](jj)}(hhh]h)}(h0/0h]h0/0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(h1/0h]h1/0}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(hV4L2_SUBDEV_ROUTE_FL_ACTIVEh]hV4L2_SUBDEV_ROUTE_FL_ACTIVE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubjj)}(hhh]h)}(hPixel data stream from Sensor Ah]hPixel data stream from Sensor A}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihjubeh}(h]h ]h"]h$]h&]uh1jdhjubje)}(hhh](jj)}(hhh]h)}(h0/1h]h0/1}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj<ubah}(h]h ]h"]h$]h&]uh1jihj9ubjj)}(hhh]h)}(h2/0h]h2/0}(hjVhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjSubah}(h]h ]h"]h$]h&]uh1jihj9ubjj)}(hhh]h)}(hV4L2_SUBDEV_ROUTE_FL_ACTIVEh]hV4L2_SUBDEV_ROUTE_FL_ACTIVE}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjjubah}(h]h ]h"]h$]h&]uh1jihj9ubjj)}(hhh]h)}(hPixel data stream from Sensor Bh]hPixel data stream from Sensor B}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jihj9ubeh}(h]h ]h"]h$]h&]uh1jdhjubeh}(h]h ]h"]h$]h&]uh1j^hj8ubeh}(h]h ]h"]h$]h&]colsKuh1jhj'ubeh}(h]id8ah ]h"]h$]h&]uh1jhjhhhNhNubjc )}(hhh]j )}(hXConfigure formats and selections After configuring routing, the next step is configuring the formats and selections for the streams. This is similar to performing this step without streams, with just one exception: the ``stream`` field needs to be assigned to the value of the stream ID. A common way to accomplish this is to start from the sensors and propagate the configurations along the stream towards the receiver, using :ref:`VIDIOC_SUBDEV_S_FMT ` ioctls to configure each stream endpoint in each sub-device.h](h)}(h Configure formats and selectionsh]h Configure formats and selections}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hAfter configuring routing, the next step is configuring the formats and selections for the streams. This is similar to performing this step without streams, with just one exception: the ``stream`` field needs to be assigned to the value of the stream ID.h](hAfter configuring routing, the next step is configuring the formats and selections for the streams. This is similar to performing this step without streams, with just one exception: the }(hjhhhNhNubj{)}(h ``stream``h]hstream}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jzhjubh: field needs to be assigned to the value of the stream ID.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(hA common way to accomplish this is to start from the sensors and propagate the configurations along the stream towards the receiver, using :ref:`VIDIOC_SUBDEV_S_FMT ` ioctls to configure each stream endpoint in each sub-device.h](hA common way to accomplish this is to start from the sensors and propagate the configurations along the stream towards the receiver, using }(hjhhhNhNubh)}(h0:ref:`VIDIOC_SUBDEV_S_FMT `h]j)}(hjh]hVIDIOC_SUBDEV_S_FMT}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj vidioc_subdev_g_fmtuh1hhhhMhjubh= ioctls to configure each stream endpoint in each sub-device.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjhhhhhNubah}(h]h ]h"]h$]h&]j j j hj j startKuh1jb hjhhhhhMubeh}(h]!multiplexed-streams-setup-exampleah ]h"]!multiplexed streams setup exampleah$]h&]uh1hhjhhhhhMnubeh}(h](3streams-multiplexed-media-pads-and-internal-routingj eh ]h"](4streams, multiplexed media pads and internal routingsubdev-routingeh$]h&]uh1hhjhhhhhMj}j4jsj}j jsubeh}(h](j{id1eh ]h"](pad-level formatspad-level-formatseh$]h&]uh1hhhhhhhhKPj}j?jqsj}j{jqsubeh}(h](sub-device-interfaceheh ]h"](sub-device interfacesubdeveh$]h&]uh1hhhhhhhhKj}jJhsj}hhsubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjifootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjqerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}(h]haj{]jqaj]]jSaj]jaj ]j aj]jaj]jaj<]j2aj]jaj ]jaunameids}(jJhjIjFj+j(jj~j?j{j>j;jj]j j jM jjj jjjjjjjjjjjjjjjuj<jjj4j j3j0jjjjjjjjj+j(u nametypes}(jJjIj+jj?j>jj jM jjjjjjjjjujj4j3jjjjj+uh}(hhjFhj(jj~j.j{jj;jj]jaj jjjj j jj jjjjjjjjjjjjj<j=jjj jj0jjjTjjjjjjj(jjjfjJ jjjjkj@jjj"jjj'u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jKsRparse_messages]hsystem_message)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "3" (ordinal 3)h]h>Enumerated list start value not ordinal-1: “3” (ordinal 3)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1jhjhhhhhMubatransform_messages](j)}(hhh]h)}(hhh]h,Hyperlink target "subdev" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineKuh1jubj)}(hhh]h)}(hhh]h7Hyperlink target "pad-level-formats" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineKMuh1jubj)}(hhh]h)}(hhh]h6Hyperlink target "pipeline-scaling" is not referenced.}hj4sbah}(h]h ]h"]h$]h&]uh1hhj1ubah}(h]h ]h"]h$]h&]levelKtypejsourcehlineKkuh1jubj)}(hhh]h)}(hhh]h