1/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
2/*
3 * osd.h - DEPRECATED On Screen Display API
4 *
5 * NOTE: should not be used on future drivers
6 *
7 * Copyright (C) 2001 Ralph  Metzler <ralph@convergence.de>
8 *                  & Marcus Metzler <marcus@convergence.de>
9 *                    for convergence integrated media GmbH
10 */
11
12#ifndef _DVBOSD_H_
13#define _DVBOSD_H_
14
15#include <linux/compiler.h>
16
17typedef enum {
18	/* All functions return -2 on "not open" */
19	OSD_Close = 1,	/* () */
20	/*
21	 * Disables OSD and releases the buffers
22	 * returns 0 on success
23	 */
24	OSD_Open,	/* (x0,y0,x1,y1,BitPerPixel[2/4/8](color&0x0F),mix[0..15](color&0xF0)) */
25	/*
26	 * Opens OSD with this size and bit depth
27	 * returns 0 on success, -1 on DRAM allocation error, -2 on "already open"
28	 */
29	OSD_Show,	/* () */
30	/*
31	 * enables OSD mode
32	 * returns 0 on success
33	 */
34	OSD_Hide,	/* () */
35	/*
36	 * disables OSD mode
37	 * returns 0 on success
38	 */
39	OSD_Clear,	/* () */
40	/*
41	 * Sets all pixel to color 0
42	 * returns 0 on success
43	 */
44	OSD_Fill,	/* (color) */
45	/*
46	 * Sets all pixel to color <col>
47	 * returns 0 on success
48	 */
49	OSD_SetColor,	/* (color,R{x0},G{y0},B{x1},opacity{y1}) */
50	/*
51	 * set palette entry <num> to <r,g,b>, <mix> and <trans> apply
52	 * R,G,B: 0..255
53	 * R=Red, G=Green, B=Blue
54	 * opacity=0:      pixel opacity 0% (only video pixel shows)
55	 * opacity=1..254: pixel opacity as specified in header
56	 * opacity=255:    pixel opacity 100% (only OSD pixel shows)
57	 * returns 0 on success, -1 on error
58	 */
59	OSD_SetPalette,	/* (firstcolor{color},lastcolor{x0},data) */
60	/*
61	 * Set a number of entries in the palette
62	 * sets the entries "firstcolor" through "lastcolor" from the array "data"
63	 * data has 4 byte for each color:
64	 * R,G,B, and a opacity value: 0->transparent, 1..254->mix, 255->pixel
65	 */
66	OSD_SetTrans,	/* (transparency{color}) */
67	/*
68	 * Sets transparency of mixed pixel (0..15)
69	 * returns 0 on success
70	 */
71	OSD_SetPixel,	/* (x0,y0,color) */
72	/*
73	 * sets pixel <x>,<y> to color number <col>
74	 * returns 0 on success, -1 on error
75	 */
76	OSD_GetPixel,	/* (x0,y0) */
77	/* returns color number of pixel <x>,<y>,  or -1 */
78	OSD_SetRow,	/* (x0,y0,x1,data) */
79	/*
80	 * fills pixels x0,y through  x1,y with the content of data[]
81	 * returns 0 on success, -1 on clipping all pixel (no pixel drawn)
82	 */
83	OSD_SetBlock,	/* (x0,y0,x1,y1,increment{color},data) */
84	/*
85	 * fills pixels x0,y0 through  x1,y1 with the content of data[]
86	 * inc contains the width of one line in the data block,
87	 * inc<=0 uses blockwidth as linewidth
88	 * returns 0 on success, -1 on clipping all pixel
89	 */
90	OSD_FillRow,	/* (x0,y0,x1,color) */
91	/*
92	 * fills pixels x0,y through  x1,y with the color <col>
93	 * returns 0 on success, -1 on clipping all pixel
94	 */
95	OSD_FillBlock,	/* (x0,y0,x1,y1,color) */
96	/*
97	 * fills pixels x0,y0 through  x1,y1 with the color <col>
98	 * returns 0 on success, -1 on clipping all pixel
99	 */
100	OSD_Line,	/* (x0,y0,x1,y1,color) */
101	/*
102	 * draw a line from x0,y0 to x1,y1 with the color <col>
103	 * returns 0 on success
104	 */
105	OSD_Query,	/* (x0,y0,x1,y1,xasp{color}}), yasp=11 */
106	/*
107	 * fills parameters with the picture dimensions and the pixel aspect ratio
108	 * returns 0 on success
109	 */
110	OSD_Test,       /* () */
111	/*
112	 * draws a test picture. for debugging purposes only
113	 * returns 0 on success
114	 * TODO: remove "test" in final version
115	 */
116	OSD_Text,	/* (x0,y0,size,color,text) */
117	OSD_SetWindow,	/* (x0) set window with number 0<x0<8 as current */
118	OSD_MoveWindow,	/* move current window to (x0, y0) */
119	OSD_OpenRaw,	/* Open other types of OSD windows */
120} OSD_Command;
121
122typedef struct osd_cmd_s {
123	OSD_Command cmd;
124	int x0;
125	int y0;
126	int x1;
127	int y1;
128	int color;
129	void __user *data;
130} osd_cmd_t;
131
132/* OSD_OpenRaw: set 'color' to desired window type */
133typedef enum {
134	OSD_BITMAP1,           /* 1 bit bitmap */
135	OSD_BITMAP2,           /* 2 bit bitmap */
136	OSD_BITMAP4,           /* 4 bit bitmap */
137	OSD_BITMAP8,           /* 8 bit bitmap */
138	OSD_BITMAP1HR,         /* 1 Bit bitmap half resolution */
139	OSD_BITMAP2HR,         /* 2 bit bitmap half resolution */
140	OSD_BITMAP4HR,         /* 4 bit bitmap half resolution */
141	OSD_BITMAP8HR,         /* 8 bit bitmap half resolution */
142	OSD_YCRCB422,          /* 4:2:2 YCRCB Graphic Display */
143	OSD_YCRCB444,          /* 4:4:4 YCRCB Graphic Display */
144	OSD_YCRCB444HR,        /* 4:4:4 YCRCB graphic half resolution */
145	OSD_VIDEOTSIZE,        /* True Size Normal MPEG Video Display */
146	OSD_VIDEOHSIZE,        /* MPEG Video Display Half Resolution */
147	OSD_VIDEOQSIZE,        /* MPEG Video Display Quarter Resolution */
148	OSD_VIDEODSIZE,        /* MPEG Video Display Double Resolution */
149	OSD_VIDEOTHSIZE,       /* True Size MPEG Video Display Half Resolution */
150	OSD_VIDEOTQSIZE,       /* True Size MPEG Video Display Quarter Resolution*/
151	OSD_VIDEOTDSIZE,       /* True Size MPEG Video Display Double Resolution */
152	OSD_VIDEONSIZE,        /* Full Size MPEG Video Display */
153	OSD_CURSOR             /* Cursor */
154} osd_raw_window_t;
155
156typedef struct osd_cap_s {
157	int  cmd;
158#define OSD_CAP_MEMSIZE         1  /* memory size */
159	long val;
160} osd_cap_t;
161
162
163#define OSD_SEND_CMD            _IOW('o', 160, osd_cmd_t)
164#define OSD_GET_CAPABILITY      _IOR('o', 161, osd_cap_t)
165
166#endif
167