| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883 |
- .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.0
- .. c:namespace:: dtv.legacy.osd
- .. _dvb_osd:
- ==============
- DVB OSD Device
- ==============
- .. attention:: Do **not** use in new drivers!
- See: :ref:`legacy_dvb_decoder_notes`
- The DVB OSD device controls the OnScreen-Display of the AV7110 based
- DVB-cards with hardware MPEG2 decoder. It can be accessed through
- ``/dev/dvb/adapter?/osd0``.
- Data types and ioctl definitions can be accessed by including
- ``linux/dvb/osd.h`` in your application.
- The OSD is not a frame-buffer like on many other cards.
- It is a kind of canvas one can draw on.
- The color-depth is limited depending on the memory size installed.
- An appropriate palette of colors has to be set up.
- The installed memory size can be identified with the `OSD_GET_CAPABILITY`_
- ioctl.
- OSD Data Types
- ==============
- OSD_Command
- -----------
- Synopsis
- ~~~~~~~~
- .. code-block:: c
- typedef enum {
- /* All functions return -2 on "not open" */
- OSD_Close = 1,
- OSD_Open,
- OSD_Show,
- OSD_Hide,
- OSD_Clear,
- OSD_Fill,
- OSD_SetColor,
- OSD_SetPalette,
- OSD_SetTrans,
- OSD_SetPixel,
- OSD_GetPixel,
- OSD_SetRow,
- OSD_SetBlock,
- OSD_FillRow,
- OSD_FillBlock,
- OSD_Line,
- OSD_Query,
- OSD_Test,
- OSD_Text,
- OSD_SetWindow,
- OSD_MoveWindow,
- OSD_OpenRaw,
- } OSD_Command;
- Commands
- ~~~~~~~~
- .. note:: All functions return -2 on "not open"
- .. flat-table::
- :header-rows: 1
- :stub-columns: 0
- - ..
- - Command
- - | Used variables of ``struct`` `osd_cmd_t`_.
- | Usage{variable} if alternative use.
- - :cspan:`2` Description
- - ..
- - ``OSD_Close``
- - -
- - | Disables OSD and releases the buffers.
- | Returns 0 on success.
- - ..
- - ``OSD_Open``
- - | x0,y0,x1,y1,
- | BitPerPixel[2/4/8]{color&0x0F},
- | mix[0..15]{color&0xF0}
- - | Opens OSD with this size and bit depth
- | Returns 0 on success,
- | -1 on DRAM allocation error,
- | -2 on "already open".
- - ..
- - ``OSD_Show``
- - -
- - | Enables OSD mode.
- | Returns 0 on success.
- - ..
- - ``OSD_Hide``
- - -
- - | Disables OSD mode.
- | Returns 0 on success.
- - ..
- - ``OSD_Clear``
- - -
- - | Sets all pixel to color 0.
- | Returns 0 on success.
- - ..
- - ``OSD_Fill``
- - color
- - | Sets all pixel to color <color>.
- | Returns 0 on success.
- - ..
- - ``OSD_SetColor``
- - | color,
- | R{x0},G{y0},B{x1},
- | opacity{y1}
- - | Set palette entry <num> to <r,g,b>, <mix> and <trans> apply
- | R,G,B: 0..255
- | R=Red, G=Green, B=Blue
- | opacity=0: pixel opacity 0% (only video pixel shows)
- | opacity=1..254: pixel opacity as specified in header
- | opacity=255: pixel opacity 100% (only OSD pixel shows)
- | Returns 0 on success, -1 on error.
- - ..
- - ``OSD_SetPalette``
- - | firstcolor{color},
- | lastcolor{x0},data
- - | Set a number of entries in the palette.
- | Sets the entries "firstcolor" through "lastcolor" from the
- array "data".
- | Data has 4 byte for each color:
- | R,G,B, and a opacity value: 0->transparent, 1..254->mix,
- 255->pixel
- - ..
- - ``OSD_SetTrans``
- - transparency{color}
- - | Sets transparency of mixed pixel (0..15).
- | Returns 0 on success.
- - ..
- - ``OSD_SetPixel``
- - x0,y0,color
- - | Sets pixel <x>,<y> to color number <color>.
- | Returns 0 on success, -1 on error.
- - ..
- - ``OSD_GetPixel``
- - x0,y0
- - | Returns color number of pixel <x>,<y>, or -1.
- | Command currently not supported by the AV7110!
- - ..
- - ``OSD_SetRow``
- - x0,y0,x1,data
- - | Fills pixels x0,y through x1,y with the content of data[].
- | Returns 0 on success, -1 on clipping all pixel (no pixel
- drawn).
- - ..
- - ``OSD_SetBlock``
- - | x0,y0,x1,y1,
- | increment{color},
- | data
- - | Fills pixels x0,y0 through x1,y1 with the content of data[].
- | Inc contains the width of one line in the data block,
- | inc<=0 uses block width as line width.
- | Returns 0 on success, -1 on clipping all pixel.
- - ..
- - ``OSD_FillRow``
- - x0,y0,x1,color
- - | Fills pixels x0,y through x1,y with the color <color>.
- | Returns 0 on success, -1 on clipping all pixel.
- - ..
- - ``OSD_FillBlock``
- - x0,y0,x1,y1,color
- - | Fills pixels x0,y0 through x1,y1 with the color <color>.
- | Returns 0 on success, -1 on clipping all pixel.
- - ..
- - ``OSD_Line``
- - x0,y0,x1,y1,color
- - | Draw a line from x0,y0 to x1,y1 with the color <color>.
- | Returns 0 on success.
- - ..
- - ``OSD_Query``
- - | x0,y0,x1,y1,
- | xasp{color}; yasp=11
- - | Fills parameters with the picture dimensions and the pixel
- aspect ratio.
- | Returns 0 on success.
- | Command currently not supported by the AV7110!
- - ..
- - ``OSD_Test``
- - -
- - | Draws a test picture.
- | For debugging purposes only.
- | Returns 0 on success.
- - ..
- - ``OSD_Text``
- - x0,y0,size,color,text
- - Draws a text at position x0,y0 with the color <color>.
- - ..
- - ``OSD_SetWindow``
- - x0
- - Set window with number 0<x0<8 as current.
- - ..
- - ``OSD_MoveWindow``
- - x0,y0
- - Move current window to (x0, y0).
- - ..
- - ``OSD_OpenRaw``
- - | x0,y0,x1,y1,
- | `osd_raw_window_t`_ {color}
- - Open other types of OSD windows.
- Description
- ~~~~~~~~~~~
- The ``OSD_Command`` data type is used with the `OSD_SEND_CMD`_ ioctl to
- tell the driver which OSD_Command to execute.
- -----
- osd_cmd_t
- ---------
- Synopsis
- ~~~~~~~~
- .. code-block:: c
- typedef struct osd_cmd_s {
- OSD_Command cmd;
- int x0;
- int y0;
- int x1;
- int y1;
- int color;
- void __user *data;
- } osd_cmd_t;
- Variables
- ~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``OSD_Command cmd``
- - `OSD_Command`_ to be executed.
- - ..
- - ``int x0``
- - First horizontal position.
- - ..
- - ``int y0``
- - First vertical position.
- - ..
- - ``int x1``
- - Second horizontal position.
- - ..
- - ``int y1``
- - Second vertical position.
- - ..
- - ``int color``
- - Number of the color in the palette.
- - ..
- - ``void __user *data``
- - Command specific Data.
- Description
- ~~~~~~~~~~~
- The ``osd_cmd_t`` data type is used with the `OSD_SEND_CMD`_ ioctl.
- It contains the data for the OSD_Command and the `OSD_Command`_ itself.
- The structure has to be passed to the driver and the components may be
- modified by it.
- -----
- osd_raw_window_t
- ----------------
- Synopsis
- ~~~~~~~~
- .. code-block:: c
- typedef enum {
- OSD_BITMAP1,
- OSD_BITMAP2,
- OSD_BITMAP4,
- OSD_BITMAP8,
- OSD_BITMAP1HR,
- OSD_BITMAP2HR,
- OSD_BITMAP4HR,
- OSD_BITMAP8HR,
- OSD_YCRCB422,
- OSD_YCRCB444,
- OSD_YCRCB444HR,
- OSD_VIDEOTSIZE,
- OSD_VIDEOHSIZE,
- OSD_VIDEOQSIZE,
- OSD_VIDEODSIZE,
- OSD_VIDEOTHSIZE,
- OSD_VIDEOTQSIZE,
- OSD_VIDEOTDSIZE,
- OSD_VIDEONSIZE,
- OSD_CURSOR
- } osd_raw_window_t;
- Constants
- ~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``OSD_BITMAP1``
- - :cspan:`1` 1 bit bitmap
- - ..
- - ``OSD_BITMAP2``
- - 2 bit bitmap
- - ..
- - ``OSD_BITMAP4``
- - 4 bit bitmap
- - ..
- - ``OSD_BITMAP8``
- - 8 bit bitmap
- - ..
- - ``OSD_BITMAP1HR``
- - 1 Bit bitmap half resolution
- - ..
- - ``OSD_BITMAP2HR``
- - 2 Bit bitmap half resolution
- - ..
- - ``OSD_BITMAP4HR``
- - 4 Bit bitmap half resolution
- - ..
- - ``OSD_BITMAP8HR``
- - 8 Bit bitmap half resolution
- - ..
- - ``OSD_YCRCB422``
- - 4:2:2 YCRCB Graphic Display
- - ..
- - ``OSD_YCRCB444``
- - 4:4:4 YCRCB Graphic Display
- - ..
- - ``OSD_YCRCB444HR``
- - 4:4:4 YCRCB graphic half resolution
- - ..
- - ``OSD_VIDEOTSIZE``
- - True Size Normal MPEG Video Display
- - ..
- - ``OSD_VIDEOHSIZE``
- - MPEG Video Display Half Resolution
- - ..
- - ``OSD_VIDEOQSIZE``
- - MPEG Video Display Quarter Resolution
- - ..
- - ``OSD_VIDEODSIZE``
- - MPEG Video Display Double Resolution
- - ..
- - ``OSD_VIDEOTHSIZE``
- - True Size MPEG Video Display Half Resolution
- - ..
- - ``OSD_VIDEOTQSIZE``
- - True Size MPEG Video Display Quarter Resolution
- - ..
- - ``OSD_VIDEOTDSIZE``
- - True Size MPEG Video Display Double Resolution
- - ..
- - ``OSD_VIDEONSIZE``
- - Full Size MPEG Video Display
- - ..
- - ``OSD_CURSOR``
- - Cursor
- Description
- ~~~~~~~~~~~
- The ``osd_raw_window_t`` data type is used with the `OSD_Command`_
- OSD_OpenRaw to tell the driver which type of OSD to open.
- -----
- osd_cap_t
- ---------
- Synopsis
- ~~~~~~~~
- .. code-block:: c
- typedef struct osd_cap_s {
- int cmd;
- #define OSD_CAP_MEMSIZE 1
- long val;
- } osd_cap_t;
- Variables
- ~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``int cmd``
- - Capability to query.
- - ..
- - ``long val``
- - Used to store the Data.
- Supported capabilities
- ~~~~~~~~~~~~~~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``OSD_CAP_MEMSIZE``
- - Memory size installed on the card.
- Description
- ~~~~~~~~~~~
- This structure of data used with the `OSD_GET_CAPABILITY`_ call.
- -----
- OSD Function Calls
- ==================
- OSD_SEND_CMD
- ------------
- Synopsis
- ~~~~~~~~
- .. c:macro:: OSD_SEND_CMD
- .. code-block:: c
- int ioctl(int fd, int request = OSD_SEND_CMD, enum osd_cmd_t *cmd)
- Arguments
- ~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``int fd``
- - :cspan:`1` File descriptor returned by a previous call
- to `open()`_.
- - ..
- - ``int request``
- - Pointer to the location of the structure `osd_cmd_t`_ for this
- command.
- Description
- ~~~~~~~~~~~
- .. attention:: Do **not** use in new drivers!
- See: :ref:`legacy_dvb_decoder_notes`
- This ioctl sends the `OSD_Command`_ to the card.
- Return Value
- ~~~~~~~~~~~~
- On success 0 is returned, on error -1 and the ``errno`` variable is set
- appropriately. The generic error codes are described at the
- :ref:`Generic Error Codes <gen-errors>` chapter.
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``EINVAL``
- - Command is out of range.
- -----
- OSD_GET_CAPABILITY
- ------------------
- Synopsis
- ~~~~~~~~
- .. c:macro:: OSD_GET_CAPABILITY
- .. code-block:: c
- int ioctl(int fd, int request = OSD_GET_CAPABILITY,
- struct osd_cap_t *cap)
- Arguments
- ~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``int fd``
- - :cspan:`1` File descriptor returned by a previous call
- to `open()`_.
- - ..
- - ``int request``
- - Equals ``OSD_GET_CAPABILITY`` for this command.
- - ..
- - ``unsigned int *cap``
- - Pointer to the location of the structure `osd_cap_t`_ for this
- command.
- Description
- ~~~~~~~~~~~
- .. attention:: Do **not** use in new drivers!
- See: :ref:`legacy_dvb_decoder_notes`
- This ioctl is used to get the capabilities of the OSD of the AV7110 based
- DVB-decoder-card in use.
- .. note::
- The structure osd_cap_t has to be setup by the user and passed to the
- driver.
- Return Value
- ~~~~~~~~~~~~
- On success 0 is returned, on error -1 and the ``errno`` variable is set
- appropriately. The generic error codes are described at the
- :ref:`Generic Error Codes <gen-errors>` chapter.
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``EINVAL``
- - Unsupported capability.
- -----
- open()
- ------
- Synopsis
- ~~~~~~~~
- .. code-block:: c
- #include <fcntl.h>
- .. c:function:: int open(const char *deviceName, int flags)
- Arguments
- ~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``const char *deviceName``
- - Name of specific OSD device.
- - ..
- - :rspan:`3` ``int flags``
- - :cspan:`1` A bit-wise OR of the following flags:
- - ..
- - ``O_RDONLY``
- - read-only access
- - ..
- - ``O_RDWR``
- - read/write access
- - ..
- - ``O_NONBLOCK``
- - | Open in non-blocking mode
- | (blocking mode is the default)
- Description
- ~~~~~~~~~~~
- This system call opens a named OSD device (e.g.
- ``/dev/dvb/adapter?/osd0``) for subsequent use.
- Return Value
- ~~~~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``ENODEV``
- - Device driver not loaded/available.
- - ..
- - ``EINTERNAL``
- - Internal error.
- - ..
- - ``EBUSY``
- - Device or resource busy.
- - ..
- - ``EINVAL``
- - Invalid argument.
- -----
- close()
- -------
- Synopsis
- ~~~~~~~~
- .. c:function:: int close(int fd)
- Arguments
- ~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``int fd``
- - :cspan:`1` File descriptor returned by a previous call
- to `open()`_ .
- Description
- ~~~~~~~~~~~
- This system call closes a previously opened OSD device.
- Return Value
- ~~~~~~~~~~~~
- .. flat-table::
- :header-rows: 0
- :stub-columns: 0
- - ..
- - ``EBADF``
- - fd is not a valid open file descriptor.
|