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