1 #ifndef __MEDIA_INFO_H__
2 #define __MEDIA_INFO_H__
3
4 #ifndef MSM_MEDIA_ALIGN
5 #define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\
6 ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\
7 (((__sz) + (__align) - 1) & (~((__align) - 1))))
8 #endif
9
10 #ifndef MSM_MEDIA_ROUNDUP
11 #define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r))
12 #endif
13
14 #ifndef MSM_MEDIA_MAX
15 #define MSM_MEDIA_MAX(__a, __b) ((__a) > (__b)?(__a):(__b))
16 #endif
17
18 enum color_fmts {
19 /* Venus NV12:
20 * YUV 4:2:0 image with a plane of 8 bit Y samples followed
21 * by an interleaved U/V plane containing 8 bit 2x2 subsampled
22 * colour difference samples.
23 *
24 * <-------- Y/UV_Stride -------->
25 * <------- Width ------->
26 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
27 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
28 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
29 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
30 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
31 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
32 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
33 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
34 * . . . . . . . . . . . . . . . . |
35 * . . . . . . . . . . . . . . . . |
36 * . . . . . . . . . . . . . . . . |
37 * . . . . . . . . . . . . . . . . V
38 * U V U V U V U V U V U V . . . . ^
39 * U V U V U V U V U V U V . . . . |
40 * U V U V U V U V U V U V . . . . |
41 * U V U V U V U V U V U V . . . . UV_Scanlines
42 * . . . . . . . . . . . . . . . . |
43 * . . . . . . . . . . . . . . . . V
44 * . . . . . . . . . . . . . . . . --> Buffer size alignment
45 *
46 * Y_Stride : Width aligned to 128
47 * UV_Stride : Width aligned to 128
48 * Y_Scanlines: Height aligned to 32
49 * UV_Scanlines: Height/2 aligned to 16
50 * Extradata: Arbitrary (software-imposed) padding
51 * Total size = align((Y_Stride * Y_Scanlines
52 * + UV_Stride * UV_Scanlines
53 * + max(Extradata, Y_Stride * 8), 4096)
54 */
55 COLOR_FMT_NV12,
56 /* Venus NV21:
57 * YUV 4:2:0 image with a plane of 8 bit Y samples followed
58 * by an interleaved V/U plane containing 8 bit 2x2 subsampled
59 * colour difference samples.
60 *
61 * <-------- Y/UV_Stride -------->
62 * <------- Width ------->
63 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
64 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
65 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
66 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
67 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
68 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
69 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
70 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
71 * . . . . . . . . . . . . . . . . |
72 * . . . . . . . . . . . . . . . . |
73 * . . . . . . . . . . . . . . . . |
74 * . . . . . . . . . . . . . . . . V
75 * V U V U V U V U V U V U . . . . ^
76 * V U V U V U V U V U V U . . . . |
77 * V U V U V U V U V U V U . . . . |
78 * V U V U V U V U V U V U . . . . UV_Scanlines
79 * . . . . . . . . . . . . . . . . |
80 * . . . . . . . . . . . . . . . . V
81 * . . . . . . . . . . . . . . . . --> Padding & Buffer size alignment
82 *
83 * Y_Stride : Width aligned to 128
84 * UV_Stride : Width aligned to 128
85 * Y_Scanlines: Height aligned to 32
86 * UV_Scanlines: Height/2 aligned to 16
87 * Extradata: Arbitrary (software-imposed) padding
88 * Total size = align((Y_Stride * Y_Scanlines
89 * + UV_Stride * UV_Scanlines
90 * + max(Extradata, Y_Stride * 8), 4096)
91 */
92 COLOR_FMT_NV21,
93 /* Venus NV12_MVTB:
94 * Two YUV 4:2:0 images/views one after the other
95 * in a top-bottom layout, same as NV12
96 * with a plane of 8 bit Y samples followed
97 * by an interleaved U/V plane containing 8 bit 2x2 subsampled
98 * colour difference samples.
99 *
100 *
101 * <-------- Y/UV_Stride -------->
102 * <------- Width ------->
103 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ ^
104 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
105 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | |
106 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines |
107 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
108 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
109 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
110 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | |
111 * . . . . . . . . . . . . . . . . | View_1
112 * . . . . . . . . . . . . . . . . | |
113 * . . . . . . . . . . . . . . . . | |
114 * . . . . . . . . . . . . . . . . V |
115 * U V U V U V U V U V U V . . . . ^ |
116 * U V U V U V U V U V U V . . . . | |
117 * U V U V U V U V U V U V . . . . | |
118 * U V U V U V U V U V U V . . . . UV_Scanlines |
119 * . . . . . . . . . . . . . . . . | |
120 * . . . . . . . . . . . . . . . . V V
121 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^ ^
122 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
123 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height | |
124 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines |
125 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
126 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
127 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | | |
128 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V | |
129 * . . . . . . . . . . . . . . . . | View_2
130 * . . . . . . . . . . . . . . . . | |
131 * . . . . . . . . . . . . . . . . | |
132 * . . . . . . . . . . . . . . . . V |
133 * U V U V U V U V U V U V . . . . ^ |
134 * U V U V U V U V U V U V . . . . | |
135 * U V U V U V U V U V U V . . . . | |
136 * U V U V U V U V U V U V . . . . UV_Scanlines |
137 * . . . . . . . . . . . . . . . . | |
138 * . . . . . . . . . . . . . . . . V V
139 * . . . . . . . . . . . . . . . . --> Buffer size alignment
140 *
141 * Y_Stride : Width aligned to 128
142 * UV_Stride : Width aligned to 128
143 * Y_Scanlines: Height aligned to 32
144 * UV_Scanlines: Height/2 aligned to 16
145 * View_1 begin at: 0 (zero)
146 * View_2 begin at: Y_Stride * Y_Scanlines + UV_Stride * UV_Scanlines
147 * Extradata: Arbitrary (software-imposed) padding
148 * Total size = align((2*(Y_Stride * Y_Scanlines)
149 * + 2*(UV_Stride * UV_Scanlines) + Extradata), 4096)
150 */
151 COLOR_FMT_NV12_MVTB,
152 /*
153 * The buffer can be of 2 types:
154 * (1) Venus NV12 UBWC Progressive
155 * (2) Venus NV12 UBWC Interlaced
156 *
157 * (1) Venus NV12 UBWC Progressive Buffer Format:
158 * Compressed Macro-tile format for NV12.
159 * Contains 4 planes in the following order -
160 * (A) Y_Meta_Plane
161 * (B) Y_UBWC_Plane
162 * (C) UV_Meta_Plane
163 * (D) UV_UBWC_Plane
164 *
165 * Y_Meta_Plane consists of meta information to decode compressed
166 * tile data in Y_UBWC_Plane.
167 * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
168 * UBWC decoder block will use the Y_Meta_Plane data together with
169 * Y_UBWC_Plane data to produce loss-less uncompressed 8 bit Y samples.
170 *
171 * UV_Meta_Plane consists of meta information to decode compressed
172 * tile data in UV_UBWC_Plane.
173 * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
174 * UBWC decoder block will use UV_Meta_Plane data together with
175 * UV_UBWC_Plane data to produce loss-less uncompressed 8 bit 2x2
176 * subsampled color difference samples.
177 *
178 * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
179 * and randomly accessible. There is no dependency between tiles.
180 *
181 * <----- Y_Meta_Stride ---->
182 * <-------- Width ------>
183 * M M M M M M M M M M M M . . ^ ^
184 * M M M M M M M M M M M M . . | |
185 * M M M M M M M M M M M M . . Height |
186 * M M M M M M M M M M M M . . | Meta_Y_Scanlines
187 * M M M M M M M M M M M M . . | |
188 * M M M M M M M M M M M M . . | |
189 * M M M M M M M M M M M M . . | |
190 * M M M M M M M M M M M M . . V |
191 * . . . . . . . . . . . . . . |
192 * . . . . . . . . . . . . . . |
193 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
194 * . . . . . . . . . . . . . . V
195 * <--Compressed tile Y Stride--->
196 * <------- Width ------->
197 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
198 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
199 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height |
200 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines
201 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
202 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
203 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
204 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
205 * . . . . . . . . . . . . . . . . |
206 * . . . . . . . . . . . . . . . . |
207 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
208 * . . . . . . . . . . . . . . . . V
209 * <----- UV_Meta_Stride ---->
210 * M M M M M M M M M M M M . . ^
211 * M M M M M M M M M M M M . . |
212 * M M M M M M M M M M M M . . |
213 * M M M M M M M M M M M M . . M_UV_Scanlines
214 * . . . . . . . . . . . . . . |
215 * . . . . . . . . . . . . . . V
216 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
217 * <--Compressed tile UV Stride--->
218 * U* V* U* V* U* V* U* V* . . . . ^
219 * U* V* U* V* U* V* U* V* . . . . |
220 * U* V* U* V* U* V* U* V* . . . . |
221 * U* V* U* V* U* V* U* V* . . . . UV_Scanlines
222 * . . . . . . . . . . . . . . . . |
223 * . . . . . . . . . . . . . . . . V
224 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
225 *
226 * Y_Stride = align(Width, 128)
227 * UV_Stride = align(Width, 128)
228 * Y_Scanlines = align(Height, 32)
229 * UV_Scanlines = align(Height/2, 16)
230 * Y_UBWC_Plane_size = align(Y_Stride * Y_Scanlines, 4096)
231 * UV_UBWC_Plane_size = align(UV_Stride * UV_Scanlines, 4096)
232 * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
233 * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
234 * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
235 * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
236 * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
237 * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
238 * Extradata = 8k
239 *
240 * Total size = align( Y_UBWC_Plane_size + UV_UBWC_Plane_size +
241 * Y_Meta_Plane_size + UV_Meta_Plane_size
242 * + max(Extradata, Y_Stride * 48), 4096)
243 *
244 *
245 * (2) Venus NV12 UBWC Interlaced Buffer Format:
246 * Compressed Macro-tile format for NV12 interlaced.
247 * Contains 8 planes in the following order -
248 * (A) Y_Meta_Top_Field_Plane
249 * (B) Y_UBWC_Top_Field_Plane
250 * (C) UV_Meta_Top_Field_Plane
251 * (D) UV_UBWC_Top_Field_Plane
252 * (E) Y_Meta_Bottom_Field_Plane
253 * (F) Y_UBWC_Bottom_Field_Plane
254 * (G) UV_Meta_Bottom_Field_Plane
255 * (H) UV_UBWC_Bottom_Field_Plane
256 * Y_Meta_Top_Field_Plane consists of meta information to decode
257 * compressed tile data for Y_UBWC_Top_Field_Plane.
258 * Y_UBWC_Top_Field_Plane consists of Y data in compressed macro-tile
259 * format for top field of an interlaced frame.
260 * UBWC decoder block will use the Y_Meta_Top_Field_Plane data together
261 * with Y_UBWC_Top_Field_Plane data to produce loss-less uncompressed
262 * 8 bit Y samples for top field of an interlaced frame.
263 *
264 * UV_Meta_Top_Field_Plane consists of meta information to decode
265 * compressed tile data in UV_UBWC_Top_Field_Plane.
266 * UV_UBWC_Top_Field_Plane consists of UV data in compressed macro-tile
267 * format for top field of an interlaced frame.
268 * UBWC decoder block will use UV_Meta_Top_Field_Plane data together
269 * with UV_UBWC_Top_Field_Plane data to produce loss-less uncompressed
270 * 8 bit subsampled color difference samples for top field of an
271 * interlaced frame.
272 *
273 * Each tile in Y_UBWC_Top_Field_Plane/UV_UBWC_Top_Field_Plane is
274 * independently decodable and randomly accessible. There is no
275 * dependency between tiles.
276 *
277 * Y_Meta_Bottom_Field_Plane consists of meta information to decode
278 * compressed tile data for Y_UBWC_Bottom_Field_Plane.
279 * Y_UBWC_Bottom_Field_Plane consists of Y data in compressed macro-tile
280 * format for bottom field of an interlaced frame.
281 * UBWC decoder block will use the Y_Meta_Bottom_Field_Plane data
282 * together with Y_UBWC_Bottom_Field_Plane data to produce loss-less
283 * uncompressed 8 bit Y samples for bottom field of an interlaced frame.
284 *
285 * UV_Meta_Bottom_Field_Plane consists of meta information to decode
286 * compressed tile data in UV_UBWC_Bottom_Field_Plane.
287 * UV_UBWC_Bottom_Field_Plane consists of UV data in compressed
288 * macro-tile format for bottom field of an interlaced frame.
289 * UBWC decoder block will use UV_Meta_Bottom_Field_Plane data together
290 * with UV_UBWC_Bottom_Field_Plane data to produce loss-less
291 * uncompressed 8 bit subsampled color difference samples for bottom
292 * field of an interlaced frame.
293 *
294 * Each tile in Y_UBWC_Bottom_Field_Plane/UV_UBWC_Bottom_Field_Plane is
295 * independently decodable and randomly accessible. There is no
296 * dependency between tiles.
297 *
298 * <-----Y_TF_Meta_Stride---->
299 * <-------- Width ------>
300 * M M M M M M M M M M M M . . ^ ^
301 * M M M M M M M M M M M M . . | |
302 * M M M M M M M M M M M M . . Half_height |
303 * M M M M M M M M M M M M . . | Meta_Y_TF_Scanlines
304 * M M M M M M M M M M M M . . | |
305 * M M M M M M M M M M M M . . | |
306 * M M M M M M M M M M M M . . | |
307 * M M M M M M M M M M M M . . V |
308 * . . . . . . . . . . . . . . |
309 * . . . . . . . . . . . . . . |
310 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
311 * . . . . . . . . . . . . . . V
312 * <-Compressed tile Y_TF Stride->
313 * <------- Width ------->
314 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
315 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
316 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height |
317 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_TF_Scanlines
318 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
319 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
320 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
321 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
322 * . . . . . . . . . . . . . . . . |
323 * . . . . . . . . . . . . . . . . |
324 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
325 * . . . . . . . . . . . . . . . . V
326 * <----UV_TF_Meta_Stride---->
327 * M M M M M M M M M M M M . . ^
328 * M M M M M M M M M M M M . . |
329 * M M M M M M M M M M M M . . |
330 * M M M M M M M M M M M M . . M_UV_TF_Scanlines
331 * . . . . . . . . . . . . . . |
332 * . . . . . . . . . . . . . . V
333 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
334 * <-Compressed tile UV_TF Stride->
335 * U* V* U* V* U* V* U* V* . . . . ^
336 * U* V* U* V* U* V* U* V* . . . . |
337 * U* V* U* V* U* V* U* V* . . . . |
338 * U* V* U* V* U* V* U* V* . . . . UV_TF_Scanlines
339 * . . . . . . . . . . . . . . . . |
340 * . . . . . . . . . . . . . . . . V
341 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
342 * <-----Y_BF_Meta_Stride---->
343 * <-------- Width ------>
344 * M M M M M M M M M M M M . . ^ ^
345 * M M M M M M M M M M M M . . | |
346 * M M M M M M M M M M M M . . Half_height |
347 * M M M M M M M M M M M M . . | Meta_Y_BF_Scanlines
348 * M M M M M M M M M M M M . . | |
349 * M M M M M M M M M M M M . . | |
350 * M M M M M M M M M M M M . . | |
351 * M M M M M M M M M M M M . . V |
352 * . . . . . . . . . . . . . . |
353 * . . . . . . . . . . . . . . |
354 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
355 * . . . . . . . . . . . . . . V
356 * <-Compressed tile Y_BF Stride->
357 * <------- Width ------->
358 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
359 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
360 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height |
361 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_BF_Scanlines
362 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
363 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
364 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
365 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
366 * . . . . . . . . . . . . . . . . |
367 * . . . . . . . . . . . . . . . . |
368 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
369 * . . . . . . . . . . . . . . . . V
370 * <----UV_BF_Meta_Stride---->
371 * M M M M M M M M M M M M . . ^
372 * M M M M M M M M M M M M . . |
373 * M M M M M M M M M M M M . . |
374 * M M M M M M M M M M M M . . M_UV_BF_Scanlines
375 * . . . . . . . . . . . . . . |
376 * . . . . . . . . . . . . . . V
377 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
378 * <-Compressed tile UV_BF Stride->
379 * U* V* U* V* U* V* U* V* . . . . ^
380 * U* V* U* V* U* V* U* V* . . . . |
381 * U* V* U* V* U* V* U* V* . . . . |
382 * U* V* U* V* U* V* U* V* . . . . UV_BF_Scanlines
383 * . . . . . . . . . . . . . . . . |
384 * . . . . . . . . . . . . . . . . V
385 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
386 *
387 * Half_height = (Height+1)>>1
388 * Y_TF_Stride = align(Width, 128)
389 * UV_TF_Stride = align(Width, 128)
390 * Y_TF_Scanlines = align(Half_height, 32)
391 * UV_TF_Scanlines = align((Half_height+1)/2, 32)
392 * Y_UBWC_TF_Plane_size = align(Y_TF_Stride * Y_TF_Scanlines, 4096)
393 * UV_UBWC_TF_Plane_size = align(UV_TF_Stride * UV_TF_Scanlines, 4096)
394 * Y_TF_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
395 * Y_TF_Meta_Scanlines = align(roundup(Half_height, Y_TileHeight), 16)
396 * Y_TF_Meta_Plane_size =
397 * align(Y_TF_Meta_Stride * Y_TF_Meta_Scanlines, 4096)
398 * UV_TF_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
399 * UV_TF_Meta_Scanlines = align(roundup(Half_height, UV_TileHeight), 16)
400 * UV_TF_Meta_Plane_size =
401 * align(UV_TF_Meta_Stride * UV_TF_Meta_Scanlines, 4096)
402 * Y_BF_Stride = align(Width, 128)
403 * UV_BF_Stride = align(Width, 128)
404 * Y_BF_Scanlines = align(Half_height, 32)
405 * UV_BF_Scanlines = align((Half_height+1)/2, 32)
406 * Y_UBWC_BF_Plane_size = align(Y_BF_Stride * Y_BF_Scanlines, 4096)
407 * UV_UBWC_BF_Plane_size = align(UV_BF_Stride * UV_BF_Scanlines, 4096)
408 * Y_BF_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
409 * Y_BF_Meta_Scanlines = align(roundup(Half_height, Y_TileHeight), 16)
410 * Y_BF_Meta_Plane_size =
411 * align(Y_BF_Meta_Stride * Y_BF_Meta_Scanlines, 4096)
412 * UV_BF_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
413 * UV_BF_Meta_Scanlines = align(roundup(Half_height, UV_TileHeight), 16)
414 * UV_BF_Meta_Plane_size =
415 * align(UV_BF_Meta_Stride * UV_BF_Meta_Scanlines, 4096)
416 * Extradata = 8k
417 *
418 * Total size = align( Y_UBWC_TF_Plane_size + UV_UBWC_TF_Plane_size +
419 * Y_TF_Meta_Plane_size + UV_TF_Meta_Plane_size +
420 * Y_UBWC_BF_Plane_size + UV_UBWC_BF_Plane_size +
421 * Y_BF_Meta_Plane_size + UV_BF_Meta_Plane_size +
422 * + max(Extradata, Y_TF_Stride * 48), 4096)
423 */
424 COLOR_FMT_NV12_UBWC,
425 /* Venus NV12 10-bit UBWC:
426 * Compressed Macro-tile format for NV12.
427 * Contains 4 planes in the following order -
428 * (A) Y_Meta_Plane
429 * (B) Y_UBWC_Plane
430 * (C) UV_Meta_Plane
431 * (D) UV_UBWC_Plane
432 *
433 * Y_Meta_Plane consists of meta information to decode compressed
434 * tile data in Y_UBWC_Plane.
435 * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
436 * UBWC decoder block will use the Y_Meta_Plane data together with
437 * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples.
438 *
439 * UV_Meta_Plane consists of meta information to decode compressed
440 * tile data in UV_UBWC_Plane.
441 * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
442 * UBWC decoder block will use UV_Meta_Plane data together with
443 * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2
444 * subsampled color difference samples.
445 *
446 * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
447 * and randomly accessible. There is no dependency between tiles.
448 *
449 * <----- Y_Meta_Stride ----->
450 * <-------- Width ------>
451 * M M M M M M M M M M M M . . ^ ^
452 * M M M M M M M M M M M M . . | |
453 * M M M M M M M M M M M M . . Height |
454 * M M M M M M M M M M M M . . | Meta_Y_Scanlines
455 * M M M M M M M M M M M M . . | |
456 * M M M M M M M M M M M M . . | |
457 * M M M M M M M M M M M M . . | |
458 * M M M M M M M M M M M M . . V |
459 * . . . . . . . . . . . . . . |
460 * . . . . . . . . . . . . . . |
461 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
462 * . . . . . . . . . . . . . . V
463 * <--Compressed tile Y Stride--->
464 * <------- Width ------->
465 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
466 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
467 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height |
468 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines
469 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
470 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
471 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
472 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
473 * . . . . . . . . . . . . . . . . |
474 * . . . . . . . . . . . . . . . . |
475 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
476 * . . . . . . . . . . . . . . . . V
477 * <----- UV_Meta_Stride ---->
478 * M M M M M M M M M M M M . . ^
479 * M M M M M M M M M M M M . . |
480 * M M M M M M M M M M M M . . |
481 * M M M M M M M M M M M M . . M_UV_Scanlines
482 * . . . . . . . . . . . . . . |
483 * . . . . . . . . . . . . . . V
484 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
485 * <--Compressed tile UV Stride--->
486 * U* V* U* V* U* V* U* V* . . . . ^
487 * U* V* U* V* U* V* U* V* . . . . |
488 * U* V* U* V* U* V* U* V* . . . . |
489 * U* V* U* V* U* V* U* V* . . . . UV_Scanlines
490 * . . . . . . . . . . . . . . . . |
491 * . . . . . . . . . . . . . . . . V
492 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
493 *
494 *
495 * Y_Stride = align(Width * 4/3, 128)
496 * UV_Stride = align(Width * 4/3, 128)
497 * Y_Scanlines = align(Height, 32)
498 * UV_Scanlines = align(Height/2, 16)
499 * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)
500 * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)
501 * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
502 * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
503 * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
504 * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
505 * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
506 * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
507 * Extradata = 8k
508 *
509 * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +
510 * Y_Meta_Plane_size + UV_Meta_Plane_size
511 * + max(Extradata, Y_Stride * 48), 4096)
512 */
513 COLOR_FMT_NV12_BPP10_UBWC,
514 /* Venus RGBA8888 format:
515 * Contains 1 plane in the following order -
516 * (A) RGBA plane
517 *
518 * <-------- RGB_Stride -------->
519 * <------- Width ------->
520 * R R R R R R R R R R R R . . . . ^ ^
521 * R R R R R R R R R R R R . . . . | |
522 * R R R R R R R R R R R R . . . . Height |
523 * R R R R R R R R R R R R . . . . | RGB_Scanlines
524 * R R R R R R R R R R R R . . . . | |
525 * R R R R R R R R R R R R . . . . | |
526 * R R R R R R R R R R R R . . . . | |
527 * R R R R R R R R R R R R . . . . V |
528 * . . . . . . . . . . . . . . . . |
529 * . . . . . . . . . . . . . . . . |
530 * . . . . . . . . . . . . . . . . |
531 * . . . . . . . . . . . . . . . . V
532 *
533 * RGB_Stride = align(Width * 4, 128)
534 * RGB_Scanlines = align(Height, 32)
535 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
536 * Extradata = 8k
537 *
538 * Total size = align(RGB_Plane_size + Extradata, 4096)
539 */
540 COLOR_FMT_RGBA8888,
541 /* Venus RGBA8888 UBWC format:
542 * Contains 2 planes in the following order -
543 * (A) Meta plane
544 * (B) RGBA plane
545 *
546 * <--- RGB_Meta_Stride ---->
547 * <-------- Width ------>
548 * M M M M M M M M M M M M . . ^ ^
549 * M M M M M M M M M M M M . . | |
550 * M M M M M M M M M M M M . . Height |
551 * M M M M M M M M M M M M . . | Meta_RGB_Scanlines
552 * M M M M M M M M M M M M . . | |
553 * M M M M M M M M M M M M . . | |
554 * M M M M M M M M M M M M . . | |
555 * M M M M M M M M M M M M . . V |
556 * . . . . . . . . . . . . . . |
557 * . . . . . . . . . . . . . . |
558 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
559 * . . . . . . . . . . . . . . V
560 * <-------- RGB_Stride -------->
561 * <------- Width ------->
562 * R R R R R R R R R R R R . . . . ^ ^
563 * R R R R R R R R R R R R . . . . | |
564 * R R R R R R R R R R R R . . . . Height |
565 * R R R R R R R R R R R R . . . . | RGB_Scanlines
566 * R R R R R R R R R R R R . . . . | |
567 * R R R R R R R R R R R R . . . . | |
568 * R R R R R R R R R R R R . . . . | |
569 * R R R R R R R R R R R R . . . . V |
570 * . . . . . . . . . . . . . . . . |
571 * . . . . . . . . . . . . . . . . |
572 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
573 * . . . . . . . . . . . . . . . . V
574 *
575 * RGB_Stride = align(Width * 4, 128)
576 * RGB_Scanlines = align(Height, 32)
577 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
578 * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
579 * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
580 * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
581 * RGB_Meta_Scanlines, 4096)
582 * Extradata = 8k
583 *
584 * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
585 * Extradata, 4096)
586 */
587 COLOR_FMT_RGBA8888_UBWC,
588 /* Venus RGBA1010102 UBWC format:
589 * Contains 2 planes in the following order -
590 * (A) Meta plane
591 * (B) RGBA plane
592 *
593 * <--- RGB_Meta_Stride ---->
594 * <-------- Width ------>
595 * M M M M M M M M M M M M . . ^ ^
596 * M M M M M M M M M M M M . . | |
597 * M M M M M M M M M M M M . . Height |
598 * M M M M M M M M M M M M . . | Meta_RGB_Scanlines
599 * M M M M M M M M M M M M . . | |
600 * M M M M M M M M M M M M . . | |
601 * M M M M M M M M M M M M . . | |
602 * M M M M M M M M M M M M . . V |
603 * . . . . . . . . . . . . . . |
604 * . . . . . . . . . . . . . . |
605 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
606 * . . . . . . . . . . . . . . V
607 * <-------- RGB_Stride -------->
608 * <------- Width ------->
609 * R R R R R R R R R R R R . . . . ^ ^
610 * R R R R R R R R R R R R . . . . | |
611 * R R R R R R R R R R R R . . . . Height |
612 * R R R R R R R R R R R R . . . . | RGB_Scanlines
613 * R R R R R R R R R R R R . . . . | |
614 * R R R R R R R R R R R R . . . . | |
615 * R R R R R R R R R R R R . . . . | |
616 * R R R R R R R R R R R R . . . . V |
617 * . . . . . . . . . . . . . . . . |
618 * . . . . . . . . . . . . . . . . |
619 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
620 * . . . . . . . . . . . . . . . . V
621 *
622 * RGB_Stride = align(Width * 4, 256)
623 * RGB_Scanlines = align(Height, 16)
624 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
625 * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
626 * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
627 * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
628 * RGB_Meta_Scanlines, 4096)
629 * Extradata = 8k
630 *
631 * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
632 * Extradata, 4096)
633 */
634 COLOR_FMT_RGBA1010102_UBWC,
635 /* Venus RGB565 UBWC format:
636 * Contains 2 planes in the following order -
637 * (A) Meta plane
638 * (B) RGB plane
639 *
640 * <--- RGB_Meta_Stride ---->
641 * <-------- Width ------>
642 * M M M M M M M M M M M M . . ^ ^
643 * M M M M M M M M M M M M . . | |
644 * M M M M M M M M M M M M . . Height |
645 * M M M M M M M M M M M M . . | Meta_RGB_Scanlines
646 * M M M M M M M M M M M M . . | |
647 * M M M M M M M M M M M M . . | |
648 * M M M M M M M M M M M M . . | |
649 * M M M M M M M M M M M M . . V |
650 * . . . . . . . . . . . . . . |
651 * . . . . . . . . . . . . . . |
652 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
653 * . . . . . . . . . . . . . . V
654 * <-------- RGB_Stride -------->
655 * <------- Width ------->
656 * R R R R R R R R R R R R . . . . ^ ^
657 * R R R R R R R R R R R R . . . . | |
658 * R R R R R R R R R R R R . . . . Height |
659 * R R R R R R R R R R R R . . . . | RGB_Scanlines
660 * R R R R R R R R R R R R . . . . | |
661 * R R R R R R R R R R R R . . . . | |
662 * R R R R R R R R R R R R . . . . | |
663 * R R R R R R R R R R R R . . . . V |
664 * . . . . . . . . . . . . . . . . |
665 * . . . . . . . . . . . . . . . . |
666 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
667 * . . . . . . . . . . . . . . . . V
668 *
669 * RGB_Stride = align(Width * 2, 128)
670 * RGB_Scanlines = align(Height, 16)
671 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
672 * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
673 * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
674 * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
675 * RGB_Meta_Scanlines, 4096)
676 * Extradata = 8k
677 *
678 * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
679 * Extradata, 4096)
680 */
681 COLOR_FMT_RGB565_UBWC,
682 /* P010 UBWC:
683 * Compressed Macro-tile format for NV12.
684 * Contains 4 planes in the following order -
685 * (A) Y_Meta_Plane
686 * (B) Y_UBWC_Plane
687 * (C) UV_Meta_Plane
688 * (D) UV_UBWC_Plane
689 *
690 * Y_Meta_Plane consists of meta information to decode compressed
691 * tile data in Y_UBWC_Plane.
692 * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
693 * UBWC decoder block will use the Y_Meta_Plane data together with
694 * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples.
695 *
696 * UV_Meta_Plane consists of meta information to decode compressed
697 * tile data in UV_UBWC_Plane.
698 * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
699 * UBWC decoder block will use UV_Meta_Plane data together with
700 * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2
701 * subsampled color difference samples.
702 *
703 * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
704 * and randomly accessible. There is no dependency between tiles.
705 *
706 * <----- Y_Meta_Stride ----->
707 * <-------- Width ------>
708 * M M M M M M M M M M M M . . ^ ^
709 * M M M M M M M M M M M M . . | |
710 * M M M M M M M M M M M M . . Height |
711 * M M M M M M M M M M M M . . | Meta_Y_Scanlines
712 * M M M M M M M M M M M M . . | |
713 * M M M M M M M M M M M M . . | |
714 * M M M M M M M M M M M M . . | |
715 * M M M M M M M M M M M M . . V |
716 * . . . . . . . . . . . . . . |
717 * . . . . . . . . . . . . . . |
718 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
719 * . . . . . . . . . . . . . . V
720 * <--Compressed tile Y Stride--->
721 * <------- Width ------->
722 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . ^ ^
723 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
724 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Height |
725 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | Macro_tile_Y_Scanlines
726 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
727 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
728 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . | |
729 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . V |
730 * . . . . . . . . . . . . . . . . |
731 * . . . . . . . . . . . . . . . . |
732 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
733 * . . . . . . . . . . . . . . . . V
734 * <----- UV_Meta_Stride ---->
735 * M M M M M M M M M M M M . . ^
736 * M M M M M M M M M M M M . . |
737 * M M M M M M M M M M M M . . |
738 * M M M M M M M M M M M M . . M_UV_Scanlines
739 * . . . . . . . . . . . . . . |
740 * . . . . . . . . . . . . . . V
741 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
742 * <--Compressed tile UV Stride--->
743 * U* V* U* V* U* V* U* V* . . . . ^
744 * U* V* U* V* U* V* U* V* . . . . |
745 * U* V* U* V* U* V* U* V* . . . . |
746 * U* V* U* V* U* V* U* V* . . . . UV_Scanlines
747 * . . . . . . . . . . . . . . . . |
748 * . . . . . . . . . . . . . . . . V
749 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
750 *
751 *
752 * Y_Stride = align(Width * 2, 256)
753 * UV_Stride = align(Width * 2, 256)
754 * Y_Scanlines = align(Height, 16)
755 * UV_Scanlines = align(Height/2, 16)
756 * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)
757 * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)
758 * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
759 * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
760 * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
761 * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
762 * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
763 * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
764 * Extradata = 8k
765 *
766 * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +
767 * Y_Meta_Plane_size + UV_Meta_Plane_size
768 * + max(Extradata, Y_Stride * 48), 4096)
769 */
770 COLOR_FMT_P010_UBWC,
771 /* Venus P010:
772 * YUV 4:2:0 image with a plane of 10 bit Y samples followed
773 * by an interleaved U/V plane containing 10 bit 2x2 subsampled
774 * colour difference samples.
775 *
776 * <-------- Y/UV_Stride -------->
777 * <------- Width ------->
778 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
779 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
780 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
781 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
782 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
783 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
784 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
785 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
786 * . . . . . . . . . . . . . . . . |
787 * . . . . . . . . . . . . . . . . |
788 * . . . . . . . . . . . . . . . . |
789 * . . . . . . . . . . . . . . . . V
790 * U V U V U V U V U V U V . . . . ^
791 * U V U V U V U V U V U V . . . . |
792 * U V U V U V U V U V U V . . . . |
793 * U V U V U V U V U V U V . . . . UV_Scanlines
794 * . . . . . . . . . . . . . . . . |
795 * . . . . . . . . . . . . . . . . V
796 * . . . . . . . . . . . . . . . . --> Buffer size alignment
797 *
798 * Y_Stride : Width * 2 aligned to 256
799 * UV_Stride : Width * 2 aligned to 256
800 * Y_Scanlines: Height aligned to 32
801 * UV_Scanlines: Height/2 aligned to 16
802 * Extradata: Arbitrary (software-imposed) padding
803 * Total size = align((Y_Stride * Y_Scanlines
804 * + UV_Stride * UV_Scanlines
805 * + max(Extradata, Y_Stride * 8), 4096)
806 */
807 COLOR_FMT_P010,
808 /* Venus RGBA16161616_F UBWC format:
809 * Contains 2 planes in the following order -
810 * (A) Meta plane
811 * (B) RGBA plane
812 *
813 * <--- RGB_Meta_Stride ---->
814 * <-------- Width ------>
815 * M M M M M M M M M M M M . . ^ ^
816 * M M M M M M M M M M M M . . | |
817 * M M M M M M M M M M M M . . Height |
818 * M M M M M M M M M M M M . . | Meta_RGB_Scanlines
819 * M M M M M M M M M M M M . . | |
820 * M M M M M M M M M M M M . . | |
821 * M M M M M M M M M M M M . . | |
822 * M M M M M M M M M M M M . . V |
823 * . . . . . . . . . . . . . . |
824 * . . . . . . . . . . . . . . |
825 * . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
826 * . . . . . . . . . . . . . . V
827 * <-------- RGB_Stride -------->
828 * <------- Width ------->
829 * R R R R R R R R R R R R . . . . ^ ^
830 * R R R R R R R R R R R R . . . . | |
831 * R R R R R R R R R R R R . . . . Height |
832 * R R R R R R R R R R R R . . . . | RGB_Scanlines
833 * R R R R R R R R R R R R . . . . | |
834 * R R R R R R R R R R R R . . . . | |
835 * R R R R R R R R R R R R . . . . | |
836 * R R R R R R R R R R R R . . . . V |
837 * . . . . . . . . . . . . . . . . |
838 * . . . . . . . . . . . . . . . . |
839 * . . . . . . . . . . . . . . . . -------> Buffer size aligned to 4k
840 * . . . . . . . . . . . . . . . . V
841 *
842 * RGB_Stride = align(Width * 8, 256)
843 * RGB_Scanlines = align(Height, 16)
844 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
845 * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
846 * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
847 * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
848 * RGB_Meta_Scanlines, 4096)
849 * Extradata = 8k
850 *
851 * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
852 * Extradata, 4096)
853 */
854 COLOR_FMT_RGBA16161616_F_UBWC,
855 /* Venus NV12_512:
856 * YUV 4:2:0 image with a plane of 8 bit Y samples followed
857 * by an interleaved U/V plane containing 8 bit 2x2 subsampled
858 * colour difference samples.
859 *
860 * <-------- Y/UV_Stride -------->
861 * <------- Width ------->
862 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
863 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
864 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
865 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
866 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
867 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
868 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
869 * Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
870 * . . . . . . . . . . . . . . . . |
871 * . . . . . . . . . . . . . . . . |
872 * . . . . . . . . . . . . . . . . |
873 * . . . . . . . . . . . . . . . . V
874 * U V U V U V U V U V U V . . . . ^
875 * U V U V U V U V U V U V . . . . |
876 * U V U V U V U V U V U V . . . . |
877 * U V U V U V U V U V U V . . . . UV_Scanlines
878 * . . . . . . . . . . . . . . . . |
879 * . . . . . . . . . . . . . . . . V
880 * . . . . . . . . . . . . . . . . --> Buffer size alignment
881 *
882 * Y_Stride : Width aligned to 512
883 * UV_Stride : Width aligned to 512
884 * Y_Scanlines: Height aligned to 512
885 * UV_Scanlines: Height/2 aligned to 256
886 * Total size = align((Y_Stride * Y_Scanlines
887 * + UV_Stride * UV_Scanlines), 4096)
888 */
889 COLOR_FMT_NV12_512,
890 };
891
892 #define COLOR_FMT_RGBA16161616_F_UBWC COLOR_FMT_RGBA16161616_F_UBWC
893 #define COLOR_FMT_RGBA1010102_UBWC COLOR_FMT_RGBA1010102_UBWC
894 #define COLOR_FMT_RGB565_UBWC COLOR_FMT_RGB565_UBWC
895 #define COLOR_FMT_P010_UBWC COLOR_FMT_P010_UBWC
896 #define COLOR_FMT_P010 COLOR_FMT_P010
897 #define COLOR_FMT_NV12_512 COLOR_FMT_NV12_512
898
VENUS_EXTRADATA_SIZE(int width,int height)899 static __inline__ unsigned int VENUS_EXTRADATA_SIZE(int width, int height)
900 {
901 (void)height;
902 (void)width;
903
904 /*
905 * In the future, calculate the size based on the w/h but just
906 * hardcode it for now since 16K satisfies all current usecases.
907 */
908 return 16 * 1024;
909 }
910
911 /*
912 * Function arguments:
913 * @color_fmt
914 * @width
915 * Progressive: width
916 * Interlaced: width
917 */
VENUS_Y_STRIDE(int color_fmt,int width)918 static __inline__ unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
919 {
920 unsigned int alignment, stride = 0;
921
922 if (!width)
923 goto invalid_input;
924
925 switch (color_fmt) {
926 case COLOR_FMT_NV21:
927 case COLOR_FMT_NV12:
928 case COLOR_FMT_NV12_MVTB:
929 case COLOR_FMT_NV12_UBWC:
930 alignment = 128;
931 stride = MSM_MEDIA_ALIGN(width, alignment);
932 break;
933 case COLOR_FMT_NV12_512:
934 alignment = 512;
935 stride = MSM_MEDIA_ALIGN(width, alignment);
936 break;
937 case COLOR_FMT_NV12_BPP10_UBWC:
938 alignment = 256;
939 stride = MSM_MEDIA_ALIGN(width, 192);
940 stride = MSM_MEDIA_ALIGN(stride * 4/3, alignment);
941 break;
942 case COLOR_FMT_P010_UBWC:
943 alignment = 256;
944 stride = MSM_MEDIA_ALIGN(width * 2, alignment);
945 break;
946 case COLOR_FMT_P010:
947 alignment = 256;
948 stride = MSM_MEDIA_ALIGN(width*2, alignment);
949 break;
950 default:
951 break;
952 }
953 invalid_input:
954 return stride;
955 }
956
957 /*
958 * Function arguments:
959 * @color_fmt
960 * @width
961 * Progressive: width
962 * Interlaced: width
963 */
VENUS_UV_STRIDE(int color_fmt,int width)964 static __inline__ unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
965 {
966 unsigned int alignment, stride = 0;
967
968 if (!width)
969 goto invalid_input;
970
971 switch (color_fmt) {
972 case COLOR_FMT_NV21:
973 case COLOR_FMT_NV12:
974 case COLOR_FMT_NV12_MVTB:
975 case COLOR_FMT_NV12_UBWC:
976 alignment = 128;
977 stride = MSM_MEDIA_ALIGN(width, alignment);
978 break;
979 case COLOR_FMT_NV12_512:
980 alignment = 512;
981 stride = MSM_MEDIA_ALIGN(width, alignment);
982 break;
983 case COLOR_FMT_NV12_BPP10_UBWC:
984 alignment = 256;
985 stride = MSM_MEDIA_ALIGN(width, 192);
986 stride = MSM_MEDIA_ALIGN(stride * 4/3, alignment);
987 break;
988 case COLOR_FMT_P010_UBWC:
989 alignment = 256;
990 stride = MSM_MEDIA_ALIGN(width * 2, alignment);
991 break;
992 case COLOR_FMT_P010:
993 alignment = 256;
994 stride = MSM_MEDIA_ALIGN(width*2, alignment);
995 break;
996 default:
997 break;
998 }
999 invalid_input:
1000 return stride;
1001 }
1002
1003 /*
1004 * Function arguments:
1005 * @color_fmt
1006 * @height
1007 * Progressive: height
1008 * Interlaced: (height+1)>>1
1009 */
VENUS_Y_SCANLINES(int color_fmt,int height)1010 static __inline__ unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)
1011 {
1012 unsigned int alignment, sclines = 0;
1013
1014 if (!height)
1015 goto invalid_input;
1016
1017 switch (color_fmt) {
1018 case COLOR_FMT_NV21:
1019 case COLOR_FMT_NV12:
1020 case COLOR_FMT_NV12_MVTB:
1021 case COLOR_FMT_NV12_UBWC:
1022 case COLOR_FMT_P010:
1023 alignment = 32;
1024 break;
1025 case COLOR_FMT_NV12_512:
1026 alignment = 512;
1027 break;
1028 case COLOR_FMT_NV12_BPP10_UBWC:
1029 case COLOR_FMT_P010_UBWC:
1030 alignment = 16;
1031 break;
1032 default:
1033 return 0;
1034 }
1035 sclines = MSM_MEDIA_ALIGN(height, alignment);
1036 invalid_input:
1037 return sclines;
1038 }
1039
1040 /*
1041 * Function arguments:
1042 * @color_fmt
1043 * @height
1044 * Progressive: height
1045 * Interlaced: (height+1)>>1
1046 */
VENUS_UV_SCANLINES(int color_fmt,int height)1047 static __inline__ unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
1048 {
1049 unsigned int alignment, sclines = 0;
1050
1051 if (!height)
1052 goto invalid_input;
1053
1054 switch (color_fmt) {
1055 case COLOR_FMT_NV21:
1056 case COLOR_FMT_NV12:
1057 case COLOR_FMT_NV12_MVTB:
1058 case COLOR_FMT_NV12_BPP10_UBWC:
1059 case COLOR_FMT_P010_UBWC:
1060 case COLOR_FMT_P010:
1061 alignment = 16;
1062 break;
1063 case COLOR_FMT_NV12_512:
1064 alignment = 256;
1065 break;
1066 case COLOR_FMT_NV12_UBWC:
1067 alignment = 32;
1068 break;
1069 default:
1070 goto invalid_input;
1071 }
1072
1073 sclines = MSM_MEDIA_ALIGN((height+1)>>1, alignment);
1074
1075 invalid_input:
1076 return sclines;
1077 }
1078
1079 /*
1080 * Function arguments:
1081 * @color_fmt
1082 * @width
1083 * Progressive: width
1084 * Interlaced: width
1085 */
VENUS_Y_META_STRIDE(int color_fmt,int width)1086 static __inline__ unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
1087 {
1088 int y_tile_width = 0, y_meta_stride = 0;
1089
1090 if (!width)
1091 goto invalid_input;
1092
1093 switch (color_fmt) {
1094 case COLOR_FMT_NV12_UBWC:
1095 case COLOR_FMT_P010_UBWC:
1096 y_tile_width = 32;
1097 break;
1098 case COLOR_FMT_NV12_BPP10_UBWC:
1099 y_tile_width = 48;
1100 break;
1101 default:
1102 goto invalid_input;
1103 }
1104
1105 y_meta_stride = MSM_MEDIA_ROUNDUP(width, y_tile_width);
1106 y_meta_stride = MSM_MEDIA_ALIGN(y_meta_stride, 64);
1107
1108 invalid_input:
1109 return y_meta_stride;
1110 }
1111
1112 /*
1113 * Function arguments:
1114 * @color_fmt
1115 * @height
1116 * Progressive: height
1117 * Interlaced: (height+1)>>1
1118 */
VENUS_Y_META_SCANLINES(int color_fmt,int height)1119 static __inline__ unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
1120 {
1121 int y_tile_height = 0, y_meta_scanlines = 0;
1122
1123 if (!height)
1124 goto invalid_input;
1125
1126 switch (color_fmt) {
1127 case COLOR_FMT_NV12_UBWC:
1128 y_tile_height = 8;
1129 break;
1130 case COLOR_FMT_NV12_BPP10_UBWC:
1131 case COLOR_FMT_P010_UBWC:
1132 y_tile_height = 4;
1133 break;
1134 default:
1135 goto invalid_input;
1136 }
1137
1138 y_meta_scanlines = MSM_MEDIA_ROUNDUP(height, y_tile_height);
1139 y_meta_scanlines = MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
1140
1141 invalid_input:
1142 return y_meta_scanlines;
1143 }
1144
1145 /*
1146 * Function arguments:
1147 * @color_fmt
1148 * @width
1149 * Progressive: width
1150 * Interlaced: width
1151 */
VENUS_UV_META_STRIDE(int color_fmt,int width)1152 static __inline__ unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)
1153 {
1154 int uv_tile_width = 0, uv_meta_stride = 0;
1155
1156 if (!width)
1157 goto invalid_input;
1158
1159 switch (color_fmt) {
1160 case COLOR_FMT_NV12_UBWC:
1161 case COLOR_FMT_P010_UBWC:
1162 uv_tile_width = 16;
1163 break;
1164 case COLOR_FMT_NV12_BPP10_UBWC:
1165 uv_tile_width = 24;
1166 break;
1167 default:
1168 goto invalid_input;
1169 }
1170
1171 uv_meta_stride = MSM_MEDIA_ROUNDUP((width+1)>>1, uv_tile_width);
1172 uv_meta_stride = MSM_MEDIA_ALIGN(uv_meta_stride, 64);
1173
1174 invalid_input:
1175 return uv_meta_stride;
1176 }
1177
1178 /*
1179 * Function arguments:
1180 * @color_fmt
1181 * @height
1182 * Progressive: height
1183 * Interlaced: (height+1)>>1
1184 */
VENUS_UV_META_SCANLINES(int color_fmt,int height)1185 static __inline__ unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)
1186 {
1187 int uv_tile_height = 0, uv_meta_scanlines = 0;
1188
1189 if (!height)
1190 goto invalid_input;
1191
1192 switch (color_fmt) {
1193 case COLOR_FMT_NV12_UBWC:
1194 uv_tile_height = 8;
1195 break;
1196 case COLOR_FMT_NV12_BPP10_UBWC:
1197 case COLOR_FMT_P010_UBWC:
1198 uv_tile_height = 4;
1199 break;
1200 default:
1201 goto invalid_input;
1202 }
1203
1204 uv_meta_scanlines = MSM_MEDIA_ROUNDUP((height+1)>>1, uv_tile_height);
1205 uv_meta_scanlines = MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
1206
1207 invalid_input:
1208 return uv_meta_scanlines;
1209 }
1210
VENUS_RGB_STRIDE(int color_fmt,int width)1211 static __inline__ unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
1212 {
1213 unsigned int alignment = 0, stride = 0, bpp = 4;
1214
1215 if (!width)
1216 goto invalid_input;
1217
1218 switch (color_fmt) {
1219 case COLOR_FMT_RGBA8888:
1220 alignment = 128;
1221 break;
1222 case COLOR_FMT_RGB565_UBWC:
1223 alignment = 256;
1224 bpp = 2;
1225 break;
1226 case COLOR_FMT_RGBA8888_UBWC:
1227 case COLOR_FMT_RGBA1010102_UBWC:
1228 alignment = 256;
1229 break;
1230 case COLOR_FMT_RGBA16161616_F_UBWC:
1231 alignment = 256;
1232 bpp = 8;
1233 break;
1234 default:
1235 goto invalid_input;
1236 }
1237
1238 stride = MSM_MEDIA_ALIGN(width * bpp, alignment);
1239
1240 invalid_input:
1241 return stride;
1242 }
1243
VENUS_RGB_SCANLINES(int color_fmt,int height)1244 static __inline__ unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)
1245 {
1246 unsigned int alignment = 0, scanlines = 0;
1247
1248 if (!height)
1249 goto invalid_input;
1250
1251 switch (color_fmt) {
1252 case COLOR_FMT_RGBA8888:
1253 alignment = 32;
1254 break;
1255 case COLOR_FMT_RGBA8888_UBWC:
1256 case COLOR_FMT_RGBA1010102_UBWC:
1257 case COLOR_FMT_RGB565_UBWC:
1258 case COLOR_FMT_RGBA16161616_F_UBWC:
1259 alignment = 16;
1260 break;
1261 default:
1262 goto invalid_input;
1263 }
1264
1265 scanlines = MSM_MEDIA_ALIGN(height, alignment);
1266
1267 invalid_input:
1268 return scanlines;
1269 }
1270
VENUS_RGB_META_STRIDE(int color_fmt,int width)1271 static __inline__ unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)
1272 {
1273 int rgb_tile_width = 0, rgb_meta_stride = 0;
1274
1275 if (!width)
1276 goto invalid_input;
1277
1278 switch (color_fmt) {
1279 case COLOR_FMT_RGBA8888_UBWC:
1280 case COLOR_FMT_RGBA1010102_UBWC:
1281 case COLOR_FMT_RGB565_UBWC:
1282 rgb_tile_width = 16;
1283 break;
1284 case COLOR_FMT_RGBA16161616_F_UBWC:
1285 rgb_tile_width = 8;
1286 break;
1287 default:
1288 goto invalid_input;
1289 }
1290
1291 rgb_meta_stride = MSM_MEDIA_ROUNDUP(width, rgb_tile_width);
1292 rgb_meta_stride = MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
1293
1294 invalid_input:
1295 return rgb_meta_stride;
1296 }
1297
VENUS_RGB_META_SCANLINES(int color_fmt,int height)1298 static __inline__ unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)
1299 {
1300 int rgb_tile_height = 0, rgb_meta_scanlines = 0;
1301
1302 if (!height)
1303 goto invalid_input;
1304
1305 switch (color_fmt) {
1306 case COLOR_FMT_RGBA8888_UBWC:
1307 case COLOR_FMT_RGBA1010102_UBWC:
1308 case COLOR_FMT_RGB565_UBWC:
1309 case COLOR_FMT_RGBA16161616_F_UBWC:
1310 rgb_tile_height = 4;
1311 break;
1312 default:
1313 goto invalid_input;
1314 }
1315
1316 rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(height, rgb_tile_height);
1317 rgb_meta_scanlines = MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
1318
1319 invalid_input:
1320 return rgb_meta_scanlines;
1321 }
1322
1323 /*
1324 * Function arguments:
1325 * @color_fmt
1326 * @width
1327 * Progressive: width
1328 * Interlaced: width
1329 * @height
1330 * Progressive: height
1331 * Interlaced: height
1332 */
VENUS_BUFFER_SIZE(int color_fmt,int width,int height)1333 static __inline__ unsigned int VENUS_BUFFER_SIZE(
1334 int color_fmt, int width, int height)
1335 {
1336 unsigned int uv_alignment = 0, size = 0;
1337 unsigned int y_plane, uv_plane, y_stride,
1338 uv_stride, y_sclines, uv_sclines;
1339 unsigned int y_ubwc_plane = 0, uv_ubwc_plane = 0;
1340 unsigned int y_meta_stride = 0, y_meta_scanlines = 0;
1341 unsigned int uv_meta_stride = 0, uv_meta_scanlines = 0;
1342 unsigned int y_meta_plane = 0, uv_meta_plane = 0;
1343 unsigned int rgb_stride = 0, rgb_scanlines = 0;
1344 unsigned int rgb_plane = 0, rgb_ubwc_plane = 0, rgb_meta_plane = 0;
1345 unsigned int rgb_meta_stride = 0, rgb_meta_scanlines = 0;
1346
1347 if (!width || !height)
1348 goto invalid_input;
1349
1350 y_stride = VENUS_Y_STRIDE(color_fmt, width);
1351 uv_stride = VENUS_UV_STRIDE(color_fmt, width);
1352 y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
1353 uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
1354 rgb_stride = VENUS_RGB_STRIDE(color_fmt, width);
1355 rgb_scanlines = VENUS_RGB_SCANLINES(color_fmt, height);
1356
1357 switch (color_fmt) {
1358 case COLOR_FMT_NV21:
1359 case COLOR_FMT_NV12:
1360 case COLOR_FMT_P010:
1361 case COLOR_FMT_NV12_512:
1362 uv_alignment = 4096;
1363 y_plane = y_stride * y_sclines;
1364 uv_plane = uv_stride * uv_sclines + uv_alignment;
1365 size = y_plane + uv_plane;
1366 size = MSM_MEDIA_ALIGN(size, 4096);
1367 break;
1368 case COLOR_FMT_NV12_MVTB:
1369 uv_alignment = 4096;
1370 y_plane = y_stride * y_sclines;
1371 uv_plane = uv_stride * uv_sclines + uv_alignment;
1372 size = y_plane + uv_plane;
1373 size = 2 * size;
1374 size = MSM_MEDIA_ALIGN(size, 4096);
1375 break;
1376 case COLOR_FMT_NV12_UBWC:
1377 y_sclines = VENUS_Y_SCANLINES(color_fmt, (height+1)>>1);
1378 y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
1379 uv_sclines = VENUS_UV_SCANLINES(color_fmt, (height+1)>>1);
1380 uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
1381 y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
1382 y_meta_scanlines =
1383 VENUS_Y_META_SCANLINES(color_fmt, (height+1)>>1);
1384 y_meta_plane = MSM_MEDIA_ALIGN(
1385 y_meta_stride * y_meta_scanlines, 4096);
1386 uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
1387 uv_meta_scanlines =
1388 VENUS_UV_META_SCANLINES(color_fmt, (height+1)>>1);
1389 uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
1390 uv_meta_scanlines, 4096);
1391
1392 size = (y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
1393 uv_meta_plane)*2;
1394 size = MSM_MEDIA_ALIGN(size, 4096);
1395 break;
1396 case COLOR_FMT_NV12_BPP10_UBWC:
1397 y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
1398 uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
1399 y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
1400 y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt, height);
1401 y_meta_plane = MSM_MEDIA_ALIGN(
1402 y_meta_stride * y_meta_scanlines, 4096);
1403 uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
1404 uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt, height);
1405 uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
1406 uv_meta_scanlines, 4096);
1407
1408 size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
1409 uv_meta_plane;
1410 size = MSM_MEDIA_ALIGN(size, 4096);
1411 break;
1412 case COLOR_FMT_P010_UBWC:
1413 y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
1414 uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
1415 y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
1416 y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt, height);
1417 y_meta_plane = MSM_MEDIA_ALIGN(
1418 y_meta_stride * y_meta_scanlines, 4096);
1419 uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
1420 uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt, height);
1421 uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
1422 uv_meta_scanlines, 4096);
1423
1424 size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
1425 uv_meta_plane;
1426 size = MSM_MEDIA_ALIGN(size, 4096);
1427 break;
1428 case COLOR_FMT_RGBA8888:
1429 rgb_plane = MSM_MEDIA_ALIGN(rgb_stride * rgb_scanlines, 4096);
1430 size = rgb_plane;
1431 size = MSM_MEDIA_ALIGN(size, 4096);
1432 break;
1433 case COLOR_FMT_RGBA8888_UBWC:
1434 case COLOR_FMT_RGBA1010102_UBWC:
1435 case COLOR_FMT_RGB565_UBWC:
1436 case COLOR_FMT_RGBA16161616_F_UBWC:
1437 rgb_ubwc_plane = MSM_MEDIA_ALIGN(rgb_stride * rgb_scanlines,
1438 4096);
1439 rgb_meta_stride = VENUS_RGB_META_STRIDE(color_fmt, width);
1440 rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color_fmt,
1441 height);
1442 rgb_meta_plane = MSM_MEDIA_ALIGN(rgb_meta_stride *
1443 rgb_meta_scanlines, 4096);
1444 size = rgb_ubwc_plane + rgb_meta_plane;
1445 size = MSM_MEDIA_ALIGN(size, 4096);
1446 break;
1447 default:
1448 break;
1449 }
1450 invalid_input:
1451 return size;
1452 }
1453
VENUS_BUFFER_SIZE_USED(int color_fmt,int width,int height,int interlace)1454 static __inline__ unsigned int VENUS_BUFFER_SIZE_USED(
1455 int color_fmt, int width, int height, int interlace)
1456 {
1457 unsigned int size = 0;
1458 unsigned int y_stride, uv_stride, y_sclines, uv_sclines;
1459 unsigned int y_ubwc_plane = 0, uv_ubwc_plane = 0;
1460 unsigned int y_meta_stride = 0, y_meta_scanlines = 0;
1461 unsigned int uv_meta_stride = 0, uv_meta_scanlines = 0;
1462 unsigned int y_meta_plane = 0, uv_meta_plane = 0;
1463
1464 if (!width || !height)
1465 goto invalid_input;
1466
1467 if (!interlace && color_fmt == COLOR_FMT_NV12_UBWC) {
1468 y_stride = VENUS_Y_STRIDE(color_fmt, width);
1469 uv_stride = VENUS_UV_STRIDE(color_fmt, width);
1470 y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
1471 y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
1472 uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
1473 uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
1474 y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
1475 y_meta_scanlines =
1476 VENUS_Y_META_SCANLINES(color_fmt, height);
1477 y_meta_plane = MSM_MEDIA_ALIGN(
1478 y_meta_stride * y_meta_scanlines, 4096);
1479 uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
1480 uv_meta_scanlines =
1481 VENUS_UV_META_SCANLINES(color_fmt, height);
1482 uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
1483 uv_meta_scanlines, 4096);
1484 size = (y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
1485 uv_meta_plane);
1486 size = MSM_MEDIA_ALIGN(size, 4096);
1487 } else {
1488 size = VENUS_BUFFER_SIZE(color_fmt, width, height);
1489 }
1490 invalid_input:
1491 return size;
1492 }
1493
VENUS_VIEW2_OFFSET(int color_fmt,int width,int height)1494 static __inline__ unsigned int VENUS_VIEW2_OFFSET(
1495 int color_fmt, int width, int height)
1496 {
1497 unsigned int offset = 0;
1498 unsigned int y_plane, uv_plane, y_stride,
1499 uv_stride, y_sclines, uv_sclines;
1500 if (!width || !height)
1501 goto invalid_input;
1502
1503 y_stride = VENUS_Y_STRIDE(color_fmt, width);
1504 uv_stride = VENUS_UV_STRIDE(color_fmt, width);
1505 y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
1506 uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
1507 switch (color_fmt) {
1508 case COLOR_FMT_NV12_MVTB:
1509 y_plane = y_stride * y_sclines;
1510 uv_plane = uv_stride * uv_sclines;
1511 offset = y_plane + uv_plane;
1512 break;
1513 default:
1514 break;
1515 }
1516 invalid_input:
1517 return offset;
1518 }
1519
1520 #endif
1521