Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-drm-fsl-dcu.git] / Documentation / video4linux / cx2341x / fw-osd-api.txt
1 OSD firmware API description
2 ============================
3
4 Note: this API is part of the decoder firmware, so it's cx23415 only.
5
6 -------------------------------------------------------------------------------
7
8 Name    CX2341X_OSD_GET_FRAMEBUFFER
9 Enum    65/0x41
10 Description
11         Return base and length of contiguous OSD memory.
12 Result[0]
13         OSD base address
14 Result[1]
15         OSD length
16
17 -------------------------------------------------------------------------------
18
19 Name    CX2341X_OSD_GET_PIXEL_FORMAT
20 Enum    66/0x42
21 Description
22         Query OSD format
23 Result[0]
24         0=8bit index
25         1=16bit RGB 5:6:5
26         2=16bit ARGB 1:5:5:5
27         3=16bit ARGB 1:4:4:4
28         4=32bit ARGB 8:8:8:8
29
30 -------------------------------------------------------------------------------
31
32 Name    CX2341X_OSD_SET_PIXEL_FORMAT
33 Enum    67/0x43
34 Description
35         Assign pixel format
36 Param[0]
37         0=8bit index
38         1=16bit RGB 5:6:5
39         2=16bit ARGB 1:5:5:5
40         3=16bit ARGB 1:4:4:4
41         4=32bit ARGB 8:8:8:8
42
43 -------------------------------------------------------------------------------
44
45 Name    CX2341X_OSD_GET_STATE
46 Enum    68/0x44
47 Description
48         Query OSD state
49 Result[0]
50         Bit  0   0=off, 1=on
51         Bits 1:2 alpha control
52         Bits 3:5 pixel format
53
54 -------------------------------------------------------------------------------
55
56 Name    CX2341X_OSD_SET_STATE
57 Enum    69/0x45
58 Description
59         OSD switch
60 Param[0]
61         0=off, 1=on
62
63 -------------------------------------------------------------------------------
64
65 Name    CX2341X_OSD_GET_OSD_COORDS
66 Enum    70/0x46
67 Description
68         Retrieve coordinates of OSD area blended with video
69 Result[0]
70         OSD buffer address
71 Result[1]
72         Stride in pixels
73 Result[2]
74         Lines in OSD buffer
75 Result[3]
76         Horizontal offset in buffer
77 Result[4]
78         Vertical offset in buffer
79
80 -------------------------------------------------------------------------------
81
82 Name    CX2341X_OSD_SET_OSD_COORDS
83 Enum    71/0x47
84 Description
85         Assign the coordinates of the OSD area to blend with video
86 Param[0]
87         buffer address
88 Param[1]
89         buffer stride in pixels
90 Param[2]
91         lines in buffer
92 Param[3]
93         horizontal offset
94 Param[4]
95         vertical offset
96
97 -------------------------------------------------------------------------------
98
99 Name    CX2341X_OSD_GET_SCREEN_COORDS
100 Enum    72/0x48
101 Description
102         Retrieve OSD screen area coordinates
103 Result[0]
104         top left horizontal offset
105 Result[1]
106         top left vertical offset
107 Result[2]
108         bottom right horizontal offset
109 Result[3]
110         bottom right vertical offset
111
112 -------------------------------------------------------------------------------
113
114 Name    CX2341X_OSD_SET_SCREEN_COORDS
115 Enum    73/0x49
116 Description
117         Assign the coordinates of the screen area to blend with video
118 Param[0]
119         top left horizontal offset
120 Param[1]
121         top left vertical offset
122 Param[2]
123         bottom left horizontal offset
124 Param[3]
125         bottom left vertical offset
126
127 -------------------------------------------------------------------------------
128
129 Name    CX2341X_OSD_GET_GLOBAL_ALPHA
130 Enum    74/0x4A
131 Description
132         Retrieve OSD global alpha
133 Result[0]
134         global alpha: 0=off, 1=on
135 Result[1]
136         bits 0:7 global alpha
137
138 -------------------------------------------------------------------------------
139
140 Name    CX2341X_OSD_SET_GLOBAL_ALPHA
141 Enum    75/0x4B
142 Description
143         Update global alpha
144 Param[0]
145         global alpha: 0=off, 1=on
146 Param[1]
147         global alpha (8 bits)
148 Param[2]
149         local alpha: 0=on, 1=off
150
151 -------------------------------------------------------------------------------
152
153 Name    CX2341X_OSD_SET_BLEND_COORDS
154 Enum    78/0x4C
155 Description
156         Move start of blending area within display buffer
157 Param[0]
158         horizontal offset in buffer
159 Param[1]
160         vertical offset in buffer
161
162 -------------------------------------------------------------------------------
163
164 Name    CX2341X_OSD_GET_FLICKER_STATE
165 Enum    79/0x4F
166 Description
167         Retrieve flicker reduction module state
168 Result[0]
169         flicker state: 0=off, 1=on
170
171 -------------------------------------------------------------------------------
172
173 Name    CX2341X_OSD_SET_FLICKER_STATE
174 Enum    80/0x50
175 Description
176         Set flicker reduction module state
177 Param[0]
178         State: 0=off, 1=on
179
180 -------------------------------------------------------------------------------
181
182 Name    CX2341X_OSD_BLT_COPY
183 Enum    82/0x52
184 Description
185         BLT copy
186 Param[0]
187 '0000'  zero
188 '0001' ~destination AND ~source
189 '0010' ~destination AND  source
190 '0011' ~destination
191 '0100'  destination AND ~source
192 '0101'                  ~source
193 '0110'  destination XOR  source
194 '0111' ~destination OR  ~source
195 '1000' ~destination AND ~source
196 '1001'  destination XNOR source
197 '1010'                   source
198 '1011' ~destination OR   source
199 '1100'  destination
200 '1101'  destination OR  ~source
201 '1110'  destination OR   source
202 '1111'  one
203
204 Param[1]
205         Resulting alpha blending
206             '01' source_alpha
207             '10' destination_alpha
208             '11' source_alpha*destination_alpha+1
209                  (zero if both source and destination alpha are zero)
210 Param[2]
211         '00' output_pixel = source_pixel
212
213         '01' if source_alpha=0:
214                  output_pixel = destination_pixel
215              if 256 > source_alpha > 1:
216                  output_pixel = ((source_alpha + 1)*source_pixel +
217                                  (255 - source_alpha)*destination_pixel)/256
218
219         '10' if destination_alpha=0:
220                  output_pixel = source_pixel
221               if 255 > destination_alpha > 0:
222                  output_pixel = ((255 - destination_alpha)*source_pixel +
223                                  (destination_alpha + 1)*destination_pixel)/256
224
225         '11' if source_alpha=0:
226                  source_temp = 0
227              if source_alpha=255:
228                  source_temp = source_pixel*256
229              if 255 > source_alpha > 0:
230                  source_temp = source_pixel*(source_alpha + 1)
231              if destination_alpha=0:
232                  destination_temp = 0
233              if destination_alpha=255:
234                  destination_temp = destination_pixel*256
235              if 255 > destination_alpha > 0:
236                  destination_temp = destination_pixel*(destination_alpha + 1)
237              output_pixel = (source_temp + destination_temp)/256
238 Param[3]
239         width
240 Param[4]
241         height
242 Param[5]
243         destination pixel mask
244 Param[6]
245         destination rectangle start address
246 Param[7]
247         destination stride in dwords
248 Param[8]
249         source stride in dwords
250 Param[9]
251         source rectangle start address
252
253 -------------------------------------------------------------------------------
254
255 Name    CX2341X_OSD_BLT_FILL
256 Enum    83/0x53
257 Description
258         BLT fill color
259 Param[0]
260         Same as Param[0] on API 0x52
261 Param[1]
262         Same as Param[1] on API 0x52
263 Param[2]
264         Same as Param[2] on API 0x52
265 Param[3]
266         width
267 Param[4]
268         height
269 Param[5]
270         destination pixel mask
271 Param[6]
272         destination rectangle start address
273 Param[7]
274         destination stride in dwords
275 Param[8]
276         color fill value
277
278 -------------------------------------------------------------------------------
279
280 Name    CX2341X_OSD_BLT_TEXT
281 Enum    84/0x54
282 Description
283         BLT for 8 bit alpha text source
284 Param[0]
285         Same as Param[0] on API 0x52
286 Param[1]
287         Same as Param[1] on API 0x52
288 Param[2]
289         Same as Param[2] on API 0x52
290 Param[3]
291         width
292 Param[4]
293         height
294 Param[5]
295         destination pixel mask
296 Param[6]
297         destination rectangle start address
298 Param[7]
299         destination stride in dwords
300 Param[8]
301         source stride in dwords
302 Param[9]
303         source rectangle start address
304 Param[10]
305         color fill value
306
307 -------------------------------------------------------------------------------
308
309 Name    CX2341X_OSD_SET_FRAMEBUFFER_WINDOW
310 Enum    86/0x56
311 Description
312         Positions the main output window on the screen. The coordinates must be
313         such that the entire window fits on the screen.
314 Param[0]
315         window width
316 Param[1]
317         window height
318 Param[2]
319         top left window corner horizontal offset
320 Param[3]
321         top left window corner vertical offset
322
323 -------------------------------------------------------------------------------
324
325 Name    CX2341X_OSD_SET_CHROMA_KEY
326 Enum    96/0x60
327 Description
328         Chroma key switch and color
329 Param[0]
330         state: 0=off, 1=on
331 Param[1]
332         color
333
334 -------------------------------------------------------------------------------
335
336 Name    CX2341X_OSD_GET_ALPHA_CONTENT_INDEX
337 Enum    97/0x61
338 Description
339         Retrieve alpha content index
340 Result[0]
341         alpha content index, Range 0:15
342
343 -------------------------------------------------------------------------------
344
345 Name    CX2341X_OSD_SET_ALPHA_CONTENT_INDEX
346 Enum    98/0x62
347 Description
348         Assign alpha content index
349 Param[0]
350         alpha content index, range 0:15