legacy_dvb_osd.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later OR GPL-2.0
  2. .. c:namespace:: dtv.legacy.osd
  3. .. _dvb_osd:
  4. ==============
  5. DVB OSD Device
  6. ==============
  7. .. attention:: Do **not** use in new drivers!
  8. See: :ref:`legacy_dvb_decoder_notes`
  9. The DVB OSD device controls the OnScreen-Display of the AV7110 based
  10. DVB-cards with hardware MPEG2 decoder. It can be accessed through
  11. ``/dev/dvb/adapter?/osd0``.
  12. Data types and ioctl definitions can be accessed by including
  13. ``linux/dvb/osd.h`` in your application.
  14. The OSD is not a frame-buffer like on many other cards.
  15. It is a kind of canvas one can draw on.
  16. The color-depth is limited depending on the memory size installed.
  17. An appropriate palette of colors has to be set up.
  18. The installed memory size can be identified with the `OSD_GET_CAPABILITY`_
  19. ioctl.
  20. OSD Data Types
  21. ==============
  22. OSD_Command
  23. -----------
  24. Synopsis
  25. ~~~~~~~~
  26. .. code-block:: c
  27. typedef enum {
  28. /* All functions return -2 on "not open" */
  29. OSD_Close = 1,
  30. OSD_Open,
  31. OSD_Show,
  32. OSD_Hide,
  33. OSD_Clear,
  34. OSD_Fill,
  35. OSD_SetColor,
  36. OSD_SetPalette,
  37. OSD_SetTrans,
  38. OSD_SetPixel,
  39. OSD_GetPixel,
  40. OSD_SetRow,
  41. OSD_SetBlock,
  42. OSD_FillRow,
  43. OSD_FillBlock,
  44. OSD_Line,
  45. OSD_Query,
  46. OSD_Test,
  47. OSD_Text,
  48. OSD_SetWindow,
  49. OSD_MoveWindow,
  50. OSD_OpenRaw,
  51. } OSD_Command;
  52. Commands
  53. ~~~~~~~~
  54. .. note:: All functions return -2 on "not open"
  55. .. flat-table::
  56. :header-rows: 1
  57. :stub-columns: 0
  58. - ..
  59. - Command
  60. - | Used variables of ``struct`` `osd_cmd_t`_.
  61. | Usage{variable} if alternative use.
  62. - :cspan:`2` Description
  63. - ..
  64. - ``OSD_Close``
  65. - -
  66. - | Disables OSD and releases the buffers.
  67. | Returns 0 on success.
  68. - ..
  69. - ``OSD_Open``
  70. - | x0,y0,x1,y1,
  71. | BitPerPixel[2/4/8]{color&0x0F},
  72. | mix[0..15]{color&0xF0}
  73. - | Opens OSD with this size and bit depth
  74. | Returns 0 on success,
  75. | -1 on DRAM allocation error,
  76. | -2 on "already open".
  77. - ..
  78. - ``OSD_Show``
  79. - -
  80. - | Enables OSD mode.
  81. | Returns 0 on success.
  82. - ..
  83. - ``OSD_Hide``
  84. - -
  85. - | Disables OSD mode.
  86. | Returns 0 on success.
  87. - ..
  88. - ``OSD_Clear``
  89. - -
  90. - | Sets all pixel to color 0.
  91. | Returns 0 on success.
  92. - ..
  93. - ``OSD_Fill``
  94. - color
  95. - | Sets all pixel to color <color>.
  96. | Returns 0 on success.
  97. - ..
  98. - ``OSD_SetColor``
  99. - | color,
  100. | R{x0},G{y0},B{x1},
  101. | opacity{y1}
  102. - | Set palette entry <num> to <r,g,b>, <mix> and <trans> apply
  103. | R,G,B: 0..255
  104. | R=Red, G=Green, B=Blue
  105. | opacity=0: pixel opacity 0% (only video pixel shows)
  106. | opacity=1..254: pixel opacity as specified in header
  107. | opacity=255: pixel opacity 100% (only OSD pixel shows)
  108. | Returns 0 on success, -1 on error.
  109. - ..
  110. - ``OSD_SetPalette``
  111. - | firstcolor{color},
  112. | lastcolor{x0},data
  113. - | Set a number of entries in the palette.
  114. | Sets the entries "firstcolor" through "lastcolor" from the
  115. array "data".
  116. | Data has 4 byte for each color:
  117. | R,G,B, and a opacity value: 0->transparent, 1..254->mix,
  118. 255->pixel
  119. - ..
  120. - ``OSD_SetTrans``
  121. - transparency{color}
  122. - | Sets transparency of mixed pixel (0..15).
  123. | Returns 0 on success.
  124. - ..
  125. - ``OSD_SetPixel``
  126. - x0,y0,color
  127. - | Sets pixel <x>,<y> to color number <color>.
  128. | Returns 0 on success, -1 on error.
  129. - ..
  130. - ``OSD_GetPixel``
  131. - x0,y0
  132. - | Returns color number of pixel <x>,<y>, or -1.
  133. | Command currently not supported by the AV7110!
  134. - ..
  135. - ``OSD_SetRow``
  136. - x0,y0,x1,data
  137. - | Fills pixels x0,y through x1,y with the content of data[].
  138. | Returns 0 on success, -1 on clipping all pixel (no pixel
  139. drawn).
  140. - ..
  141. - ``OSD_SetBlock``
  142. - | x0,y0,x1,y1,
  143. | increment{color},
  144. | data
  145. - | Fills pixels x0,y0 through x1,y1 with the content of data[].
  146. | Inc contains the width of one line in the data block,
  147. | inc<=0 uses block width as line width.
  148. | Returns 0 on success, -1 on clipping all pixel.
  149. - ..
  150. - ``OSD_FillRow``
  151. - x0,y0,x1,color
  152. - | Fills pixels x0,y through x1,y with the color <color>.
  153. | Returns 0 on success, -1 on clipping all pixel.
  154. - ..
  155. - ``OSD_FillBlock``
  156. - x0,y0,x1,y1,color
  157. - | Fills pixels x0,y0 through x1,y1 with the color <color>.
  158. | Returns 0 on success, -1 on clipping all pixel.
  159. - ..
  160. - ``OSD_Line``
  161. - x0,y0,x1,y1,color
  162. - | Draw a line from x0,y0 to x1,y1 with the color <color>.
  163. | Returns 0 on success.
  164. - ..
  165. - ``OSD_Query``
  166. - | x0,y0,x1,y1,
  167. | xasp{color}; yasp=11
  168. - | Fills parameters with the picture dimensions and the pixel
  169. aspect ratio.
  170. | Returns 0 on success.
  171. | Command currently not supported by the AV7110!
  172. - ..
  173. - ``OSD_Test``
  174. - -
  175. - | Draws a test picture.
  176. | For debugging purposes only.
  177. | Returns 0 on success.
  178. - ..
  179. - ``OSD_Text``
  180. - x0,y0,size,color,text
  181. - Draws a text at position x0,y0 with the color <color>.
  182. - ..
  183. - ``OSD_SetWindow``
  184. - x0
  185. - Set window with number 0<x0<8 as current.
  186. - ..
  187. - ``OSD_MoveWindow``
  188. - x0,y0
  189. - Move current window to (x0, y0).
  190. - ..
  191. - ``OSD_OpenRaw``
  192. - | x0,y0,x1,y1,
  193. | `osd_raw_window_t`_ {color}
  194. - Open other types of OSD windows.
  195. Description
  196. ~~~~~~~~~~~
  197. The ``OSD_Command`` data type is used with the `OSD_SEND_CMD`_ ioctl to
  198. tell the driver which OSD_Command to execute.
  199. -----
  200. osd_cmd_t
  201. ---------
  202. Synopsis
  203. ~~~~~~~~
  204. .. code-block:: c
  205. typedef struct osd_cmd_s {
  206. OSD_Command cmd;
  207. int x0;
  208. int y0;
  209. int x1;
  210. int y1;
  211. int color;
  212. void __user *data;
  213. } osd_cmd_t;
  214. Variables
  215. ~~~~~~~~~
  216. .. flat-table::
  217. :header-rows: 0
  218. :stub-columns: 0
  219. - ..
  220. - ``OSD_Command cmd``
  221. - `OSD_Command`_ to be executed.
  222. - ..
  223. - ``int x0``
  224. - First horizontal position.
  225. - ..
  226. - ``int y0``
  227. - First vertical position.
  228. - ..
  229. - ``int x1``
  230. - Second horizontal position.
  231. - ..
  232. - ``int y1``
  233. - Second vertical position.
  234. - ..
  235. - ``int color``
  236. - Number of the color in the palette.
  237. - ..
  238. - ``void __user *data``
  239. - Command specific Data.
  240. Description
  241. ~~~~~~~~~~~
  242. The ``osd_cmd_t`` data type is used with the `OSD_SEND_CMD`_ ioctl.
  243. It contains the data for the OSD_Command and the `OSD_Command`_ itself.
  244. The structure has to be passed to the driver and the components may be
  245. modified by it.
  246. -----
  247. osd_raw_window_t
  248. ----------------
  249. Synopsis
  250. ~~~~~~~~
  251. .. code-block:: c
  252. typedef enum {
  253. OSD_BITMAP1,
  254. OSD_BITMAP2,
  255. OSD_BITMAP4,
  256. OSD_BITMAP8,
  257. OSD_BITMAP1HR,
  258. OSD_BITMAP2HR,
  259. OSD_BITMAP4HR,
  260. OSD_BITMAP8HR,
  261. OSD_YCRCB422,
  262. OSD_YCRCB444,
  263. OSD_YCRCB444HR,
  264. OSD_VIDEOTSIZE,
  265. OSD_VIDEOHSIZE,
  266. OSD_VIDEOQSIZE,
  267. OSD_VIDEODSIZE,
  268. OSD_VIDEOTHSIZE,
  269. OSD_VIDEOTQSIZE,
  270. OSD_VIDEOTDSIZE,
  271. OSD_VIDEONSIZE,
  272. OSD_CURSOR
  273. } osd_raw_window_t;
  274. Constants
  275. ~~~~~~~~~
  276. .. flat-table::
  277. :header-rows: 0
  278. :stub-columns: 0
  279. - ..
  280. - ``OSD_BITMAP1``
  281. - :cspan:`1` 1 bit bitmap
  282. - ..
  283. - ``OSD_BITMAP2``
  284. - 2 bit bitmap
  285. - ..
  286. - ``OSD_BITMAP4``
  287. - 4 bit bitmap
  288. - ..
  289. - ``OSD_BITMAP8``
  290. - 8 bit bitmap
  291. - ..
  292. - ``OSD_BITMAP1HR``
  293. - 1 Bit bitmap half resolution
  294. - ..
  295. - ``OSD_BITMAP2HR``
  296. - 2 Bit bitmap half resolution
  297. - ..
  298. - ``OSD_BITMAP4HR``
  299. - 4 Bit bitmap half resolution
  300. - ..
  301. - ``OSD_BITMAP8HR``
  302. - 8 Bit bitmap half resolution
  303. - ..
  304. - ``OSD_YCRCB422``
  305. - 4:2:2 YCRCB Graphic Display
  306. - ..
  307. - ``OSD_YCRCB444``
  308. - 4:4:4 YCRCB Graphic Display
  309. - ..
  310. - ``OSD_YCRCB444HR``
  311. - 4:4:4 YCRCB graphic half resolution
  312. - ..
  313. - ``OSD_VIDEOTSIZE``
  314. - True Size Normal MPEG Video Display
  315. - ..
  316. - ``OSD_VIDEOHSIZE``
  317. - MPEG Video Display Half Resolution
  318. - ..
  319. - ``OSD_VIDEOQSIZE``
  320. - MPEG Video Display Quarter Resolution
  321. - ..
  322. - ``OSD_VIDEODSIZE``
  323. - MPEG Video Display Double Resolution
  324. - ..
  325. - ``OSD_VIDEOTHSIZE``
  326. - True Size MPEG Video Display Half Resolution
  327. - ..
  328. - ``OSD_VIDEOTQSIZE``
  329. - True Size MPEG Video Display Quarter Resolution
  330. - ..
  331. - ``OSD_VIDEOTDSIZE``
  332. - True Size MPEG Video Display Double Resolution
  333. - ..
  334. - ``OSD_VIDEONSIZE``
  335. - Full Size MPEG Video Display
  336. - ..
  337. - ``OSD_CURSOR``
  338. - Cursor
  339. Description
  340. ~~~~~~~~~~~
  341. The ``osd_raw_window_t`` data type is used with the `OSD_Command`_
  342. OSD_OpenRaw to tell the driver which type of OSD to open.
  343. -----
  344. osd_cap_t
  345. ---------
  346. Synopsis
  347. ~~~~~~~~
  348. .. code-block:: c
  349. typedef struct osd_cap_s {
  350. int cmd;
  351. #define OSD_CAP_MEMSIZE 1
  352. long val;
  353. } osd_cap_t;
  354. Variables
  355. ~~~~~~~~~
  356. .. flat-table::
  357. :header-rows: 0
  358. :stub-columns: 0
  359. - ..
  360. - ``int cmd``
  361. - Capability to query.
  362. - ..
  363. - ``long val``
  364. - Used to store the Data.
  365. Supported capabilities
  366. ~~~~~~~~~~~~~~~~~~~~~~
  367. .. flat-table::
  368. :header-rows: 0
  369. :stub-columns: 0
  370. - ..
  371. - ``OSD_CAP_MEMSIZE``
  372. - Memory size installed on the card.
  373. Description
  374. ~~~~~~~~~~~
  375. This structure of data used with the `OSD_GET_CAPABILITY`_ call.
  376. -----
  377. OSD Function Calls
  378. ==================
  379. OSD_SEND_CMD
  380. ------------
  381. Synopsis
  382. ~~~~~~~~
  383. .. c:macro:: OSD_SEND_CMD
  384. .. code-block:: c
  385. int ioctl(int fd, int request = OSD_SEND_CMD, enum osd_cmd_t *cmd)
  386. Arguments
  387. ~~~~~~~~~
  388. .. flat-table::
  389. :header-rows: 0
  390. :stub-columns: 0
  391. - ..
  392. - ``int fd``
  393. - :cspan:`1` File descriptor returned by a previous call
  394. to `open()`_.
  395. - ..
  396. - ``int request``
  397. - Pointer to the location of the structure `osd_cmd_t`_ for this
  398. command.
  399. Description
  400. ~~~~~~~~~~~
  401. .. attention:: Do **not** use in new drivers!
  402. See: :ref:`legacy_dvb_decoder_notes`
  403. This ioctl sends the `OSD_Command`_ to the card.
  404. Return Value
  405. ~~~~~~~~~~~~
  406. On success 0 is returned, on error -1 and the ``errno`` variable is set
  407. appropriately. The generic error codes are described at the
  408. :ref:`Generic Error Codes <gen-errors>` chapter.
  409. .. flat-table::
  410. :header-rows: 0
  411. :stub-columns: 0
  412. - ..
  413. - ``EINVAL``
  414. - Command is out of range.
  415. -----
  416. OSD_GET_CAPABILITY
  417. ------------------
  418. Synopsis
  419. ~~~~~~~~
  420. .. c:macro:: OSD_GET_CAPABILITY
  421. .. code-block:: c
  422. int ioctl(int fd, int request = OSD_GET_CAPABILITY,
  423. struct osd_cap_t *cap)
  424. Arguments
  425. ~~~~~~~~~
  426. .. flat-table::
  427. :header-rows: 0
  428. :stub-columns: 0
  429. - ..
  430. - ``int fd``
  431. - :cspan:`1` File descriptor returned by a previous call
  432. to `open()`_.
  433. - ..
  434. - ``int request``
  435. - Equals ``OSD_GET_CAPABILITY`` for this command.
  436. - ..
  437. - ``unsigned int *cap``
  438. - Pointer to the location of the structure `osd_cap_t`_ for this
  439. command.
  440. Description
  441. ~~~~~~~~~~~
  442. .. attention:: Do **not** use in new drivers!
  443. See: :ref:`legacy_dvb_decoder_notes`
  444. This ioctl is used to get the capabilities of the OSD of the AV7110 based
  445. DVB-decoder-card in use.
  446. .. note::
  447. The structure osd_cap_t has to be setup by the user and passed to the
  448. driver.
  449. Return Value
  450. ~~~~~~~~~~~~
  451. On success 0 is returned, on error -1 and the ``errno`` variable is set
  452. appropriately. The generic error codes are described at the
  453. :ref:`Generic Error Codes <gen-errors>` chapter.
  454. .. flat-table::
  455. :header-rows: 0
  456. :stub-columns: 0
  457. - ..
  458. - ``EINVAL``
  459. - Unsupported capability.
  460. -----
  461. open()
  462. ------
  463. Synopsis
  464. ~~~~~~~~
  465. .. code-block:: c
  466. #include <fcntl.h>
  467. .. c:function:: int open(const char *deviceName, int flags)
  468. Arguments
  469. ~~~~~~~~~
  470. .. flat-table::
  471. :header-rows: 0
  472. :stub-columns: 0
  473. - ..
  474. - ``const char *deviceName``
  475. - Name of specific OSD device.
  476. - ..
  477. - :rspan:`3` ``int flags``
  478. - :cspan:`1` A bit-wise OR of the following flags:
  479. - ..
  480. - ``O_RDONLY``
  481. - read-only access
  482. - ..
  483. - ``O_RDWR``
  484. - read/write access
  485. - ..
  486. - ``O_NONBLOCK``
  487. - | Open in non-blocking mode
  488. | (blocking mode is the default)
  489. Description
  490. ~~~~~~~~~~~
  491. This system call opens a named OSD device (e.g.
  492. ``/dev/dvb/adapter?/osd0``) for subsequent use.
  493. Return Value
  494. ~~~~~~~~~~~~
  495. .. flat-table::
  496. :header-rows: 0
  497. :stub-columns: 0
  498. - ..
  499. - ``ENODEV``
  500. - Device driver not loaded/available.
  501. - ..
  502. - ``EINTERNAL``
  503. - Internal error.
  504. - ..
  505. - ``EBUSY``
  506. - Device or resource busy.
  507. - ..
  508. - ``EINVAL``
  509. - Invalid argument.
  510. -----
  511. close()
  512. -------
  513. Synopsis
  514. ~~~~~~~~
  515. .. c:function:: int close(int fd)
  516. Arguments
  517. ~~~~~~~~~
  518. .. flat-table::
  519. :header-rows: 0
  520. :stub-columns: 0
  521. - ..
  522. - ``int fd``
  523. - :cspan:`1` File descriptor returned by a previous call
  524. to `open()`_ .
  525. Description
  526. ~~~~~~~~~~~
  527. This system call closes a previously opened OSD device.
  528. Return Value
  529. ~~~~~~~~~~~~
  530. .. flat-table::
  531. :header-rows: 0
  532. :stub-columns: 0
  533. - ..
  534. - ``EBADF``
  535. - fd is not a valid open file descriptor.