cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

dev-output.rst (4293B)


      1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
      2.. c:namespace:: V4L
      3
      4.. _output:
      5
      6**********************
      7Video Output Interface
      8**********************
      9
     10Video output devices encode stills or image sequences as analog video
     11signal. With this interface applications can control the encoding
     12process and move images from user space to the driver.
     13
     14Conventionally V4L2 video output devices are accessed through character
     15device special files named ``/dev/video`` and ``/dev/video0`` to
     16``/dev/video63`` with major number 81 and minor numbers 0 to 63.
     17``/dev/video`` is typically a symbolic link to the preferred video
     18device.
     19
     20.. note:: The same device file names are used also for video capture devices.
     21
     22Querying Capabilities
     23=====================
     24
     25Devices supporting the video output interface set the
     26``V4L2_CAP_VIDEO_OUTPUT`` or ``V4L2_CAP_VIDEO_OUTPUT_MPLANE`` flag in
     27the ``capabilities`` field of struct
     28:c:type:`v4l2_capability` returned by the
     29:ref:`VIDIOC_QUERYCAP` ioctl. As secondary device
     30functions they may also support the :ref:`raw VBI output <raw-vbi>`
     31(``V4L2_CAP_VBI_OUTPUT``) interface. At least one of the read/write or
     32streaming I/O methods must be supported. Modulators and audio outputs
     33are optional.
     34
     35Supplemental Functions
     36======================
     37
     38Video output devices shall support :ref:`audio output <audio>`,
     39:ref:`modulator <tuner>`, :ref:`controls <control>`,
     40:ref:`cropping and scaling <crop>` and
     41:ref:`streaming parameter <streaming-par>` ioctls as needed. The
     42:ref:`video output <video>` ioctls must be supported by all video
     43output devices.
     44
     45Image Format Negotiation
     46========================
     47
     48The output is determined by cropping and image format parameters. The
     49former select an area of the video picture where the image will appear,
     50the latter how images are stored in memory, i. e. in RGB or YUV format,
     51the number of bits per pixel or width and height. Together they also
     52define how images are scaled in the process.
     53
     54As usual these parameters are *not* reset at :c:func:`open()`
     55time to permit Unix tool chains, programming a device and then writing
     56to it as if it was a plain file. Well written V4L2 applications ensure
     57they really get what they want, including cropping and scaling.
     58
     59Cropping initialization at minimum requires to reset the parameters to
     60defaults. An example is given in :ref:`crop`.
     61
     62To query the current image format applications set the ``type`` field of
     63a struct :c:type:`v4l2_format` to
     64``V4L2_BUF_TYPE_VIDEO_OUTPUT`` or ``V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE``
     65and call the :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>` ioctl with a pointer
     66to this structure. Drivers fill the struct
     67:c:type:`v4l2_pix_format` ``pix`` or the struct
     68:c:type:`v4l2_pix_format_mplane` ``pix_mp``
     69member of the ``fmt`` union.
     70
     71To request different parameters applications set the ``type`` field of a
     72struct :c:type:`v4l2_format` as above and initialize all
     73fields of the struct :c:type:`v4l2_pix_format`
     74``vbi`` member of the ``fmt`` union, or better just modify the results
     75of :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>`, and call the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`
     76ioctl with a pointer to this structure. Drivers may adjust the
     77parameters and finally return the actual parameters as :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>`
     78does.
     79
     80Like :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` the :ref:`VIDIOC_TRY_FMT <VIDIOC_G_FMT>` ioctl
     81can be used to learn about hardware limitations without disabling I/O or
     82possibly time consuming hardware preparations.
     83
     84The contents of struct :c:type:`v4l2_pix_format` and
     85struct :c:type:`v4l2_pix_format_mplane` are
     86discussed in :ref:`pixfmt`. See also the specification of the
     87:ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>`, :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` and :ref:`VIDIOC_TRY_FMT <VIDIOC_G_FMT>` ioctls for
     88details. Video output devices must implement both the :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>`
     89and :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, even if :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ignores all
     90requests and always returns default parameters as :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>` does.
     91:ref:`VIDIOC_TRY_FMT <VIDIOC_G_FMT>` is optional.
     92
     93Writing Images
     94==============
     95
     96A video output device may support the :ref:`write() function <rw>`
     97and/or streaming (:ref:`memory mapping <mmap>` or
     98:ref:`user pointer <userp>`) I/O. See :ref:`io` for details.