brintos

brintos / linux-shallow public Read only

0
0
Text · 42.0 KiB · 9fc9dbd Raw
1156 lines · c
1#ifndef __MEDIA_INFO_H__2#define __MEDIA_INFO_H__3 4#ifndef MSM_MEDIA_ALIGN5#define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\6	((((__sz) + (__align) - 1) / (__align)) * (__align)) :\7	(((__sz) + (__align) - 1) & (~((__align) - 1))))8#endif9 10#ifndef MSM_MEDIA_ROUNDUP11#define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r))12#endif13 14#ifndef MSM_MEDIA_MAX15#define MSM_MEDIA_MAX(__a, __b) ((__a) > (__b)?(__a):(__b))16#endif17 18enum color_fmts {19	/* Venus NV12:20	 * YUV 4:2:0 image with a plane of 8 bit Y samples followed21	 * by an interleaved U/V plane containing 8 bit 2x2 subsampled22	 * 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_Scanlines30	 * 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	 * . . . . . . . . . . . . . . . .              V38	 * 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_Scanlines42	 * . . . . . . . . . . . . . . . .  |43	 * . . . . . . . . . . . . . . . .  V44	 * . . . . . . . . . . . . . . . .  --> Buffer size alignment45	 *46	 * Y_Stride : Width aligned to 12847	 * UV_Stride : Width aligned to 12848	 * Y_Scanlines: Height aligned to 3249	 * UV_Scanlines: Height/2 aligned to 1650	 * Extradata: Arbitrary (software-imposed) padding51	 * Total size = align((Y_Stride * Y_Scanlines52	 *          + UV_Stride * UV_Scanlines53	 *          + max(Extradata, Y_Stride * 8), 4096)54	 */55	COLOR_FMT_NV12,56 57	/* Venus NV21:58	 * YUV 4:2:0 image with a plane of 8 bit Y samples followed59	 * by an interleaved V/U plane containing 8 bit 2x2 subsampled60	 * colour difference samples.61	 *62	 * <-------- Y/UV_Stride -------->63	 * <------- Width ------->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 . . . .  |           |66	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |67	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines68	 * 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 . . . .  |           |71	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |72	 * . . . . . . . . . . . . . . . .              |73	 * . . . . . . . . . . . . . . . .              |74	 * . . . . . . . . . . . . . . . .              |75	 * . . . . . . . . . . . . . . . .              V76	 * 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 . . . .  |79	 * V U V U V U V U V U V U . . . .  UV_Scanlines80	 * . . . . . . . . . . . . . . . .  |81	 * . . . . . . . . . . . . . . . .  V82	 * . . . . . . . . . . . . . . . .  --> Padding & Buffer size alignment83	 *84	 * Y_Stride : Width aligned to 12885	 * UV_Stride : Width aligned to 12886	 * Y_Scanlines: Height aligned to 3287	 * UV_Scanlines: Height/2 aligned to 1688	 * Extradata: Arbitrary (software-imposed) padding89	 * Total size = align((Y_Stride * Y_Scanlines90	 *          + UV_Stride * UV_Scanlines91	 *          + max(Extradata, Y_Stride * 8), 4096)92	 */93	COLOR_FMT_NV21,94	/* Venus NV12_MVTB:95	 * Two YUV 4:2:0 images/views one after the other96	 * in a top-bottom layout, same as NV1297	 * with a plane of 8 bit Y samples followed98	 * by an interleaved U/V plane containing 8 bit 2x2 subsampled99	 * colour difference samples.100	 *101	 *102	 * <-------- Y/UV_Stride -------->103	 * <------- Width ------->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 . . . .  |           |               |106	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |               |107	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines      |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 . . . .  |           |               |111	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |               |112	 * . . . . . . . . . . . . . . . .              |             View_1113	 * . . . . . . . . . . . . . . . .              |               |114	 * . . . . . . . . . . . . . . . .              |               |115	 * . . . . . . . . . . . . . . . .              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 . . . .  |                           |119	 * U V U V U V U V U V U V . . . .  UV_Scanlines                |120	 * . . . . . . . . . . . . . . . .  |                           |121	 * . . . . . . . . . . . . . . . .  V                           V122	 * 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 . . . .  |           |               |124	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |               |125	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines      |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 . . . .  |           |               |129	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |               |130	 * . . . . . . . . . . . . . . . .              |             View_2131	 * . . . . . . . . . . . . . . . .              |               |132	 * . . . . . . . . . . . . . . . .              |               |133	 * . . . . . . . . . . . . . . . .              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 . . . .  |                           |137	 * U V U V U V U V U V U V . . . .  UV_Scanlines                |138	 * . . . . . . . . . . . . . . . .  |                           |139	 * . . . . . . . . . . . . . . . .  V                           V140	 * . . . . . . . . . . . . . . . .  --> Buffer size alignment141	 *142	 * Y_Stride : Width aligned to 128143	 * UV_Stride : Width aligned to 128144	 * Y_Scanlines: Height aligned to 32145	 * UV_Scanlines: Height/2 aligned to 16146	 * View_1 begin at: 0 (zero)147	 * View_2 begin at: Y_Stride * Y_Scanlines + UV_Stride * UV_Scanlines148	 * Extradata: Arbitrary (software-imposed) padding149	 * Total size = align((2*(Y_Stride * Y_Scanlines)150	 *          + 2*(UV_Stride * UV_Scanlines) + Extradata), 4096)151	 */152	COLOR_FMT_NV12_MVTB,153	/*154	 * The buffer can be of 2 types:155	 * (1) Venus NV12 UBWC Progressive156	 * (2) Venus NV12 UBWC Interlaced157	 *158	 * (1) Venus NV12 UBWC Progressive Buffer Format:159	 * Compressed Macro-tile format for NV12.160	 * Contains 4 planes in the following order -161	 * (A) Y_Meta_Plane162	 * (B) Y_UBWC_Plane163	 * (C) UV_Meta_Plane164	 * (D) UV_UBWC_Plane165	 *166	 * Y_Meta_Plane consists of meta information to decode compressed167	 * tile data in Y_UBWC_Plane.168	 * Y_UBWC_Plane consists of Y data in compressed macro-tile format.169	 * UBWC decoder block will use the Y_Meta_Plane data together with170	 * Y_UBWC_Plane data to produce loss-less uncompressed 8 bit Y samples.171	 *172	 * UV_Meta_Plane consists of meta information to decode compressed173	 * tile data in UV_UBWC_Plane.174	 * UV_UBWC_Plane consists of UV data in compressed macro-tile format.175	 * UBWC decoder block will use UV_Meta_Plane data together with176	 * UV_UBWC_Plane data to produce loss-less uncompressed 8 bit 2x2177	 * subsampled color difference samples.178	 *179	 * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable180	 * and randomly accessible. There is no dependency between tiles.181	 *182	 * <----- Y_Meta_Stride ---->183	 * <-------- Width ------>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 . .      |           |186	 * M M M M M M M M M M M M . .      Height      |187	 * M M M M M M M M M M M M . .      |         Meta_Y_Scanlines188	 * 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 . .      |           |191	 * M M M M M M M M M M M M . .      V           |192	 * . . . . . . . . . . . . . .                  |193	 * . . . . . . . . . . . . . .                  |194	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k195	 * . . . . . . . . . . . . . .                  V196	 * <--Compressed tile Y Stride--->197	 * <------- Width ------->198	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^199	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |200	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  Height      |201	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_Scanlines202	 * 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* . . . .  |           |205	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |206	 * . . . . . . . . . . . . . . . .              |207	 * . . . . . . . . . . . . . . . .              |208	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k209	 * . . . . . . . . . . . . . . . .              V210	 * <----- UV_Meta_Stride ---->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 . .      |214	 * M M M M M M M M M M M M . .      M_UV_Scanlines215	 * . . . . . . . . . . . . . .      |216	 * . . . . . . . . . . . . . .      V217	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k218	 * <--Compressed tile UV Stride--->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* . . . .  |222	 * U* V* U* V* U* V* U* V* . . . .  UV_Scanlines223	 * . . . . . . . . . . . . . . . .  |224	 * . . . . . . . . . . . . . . . .  V225	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k226	 *227	 * Y_Stride = align(Width, 128)228	 * UV_Stride = align(Width, 128)229	 * Y_Scanlines = align(Height, 32)230	 * UV_Scanlines = align(Height/2, 16)231	 * Y_UBWC_Plane_size = align(Y_Stride * Y_Scanlines, 4096)232	 * UV_UBWC_Plane_size = align(UV_Stride * UV_Scanlines, 4096)233	 * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)234	 * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)235	 * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)236	 * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)237	 * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)238	 * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)239	 * Extradata = 8k240	 *241	 * Total size = align( Y_UBWC_Plane_size + UV_UBWC_Plane_size +242	 *           Y_Meta_Plane_size + UV_Meta_Plane_size243	 *           + max(Extradata, Y_Stride * 48), 4096)244	 *245	 *246	 * (2) Venus NV12 UBWC Interlaced Buffer Format:247	 * Compressed Macro-tile format for NV12 interlaced.248	 * Contains 8 planes in the following order -249	 * (A) Y_Meta_Top_Field_Plane250	 * (B) Y_UBWC_Top_Field_Plane251	 * (C) UV_Meta_Top_Field_Plane252	 * (D) UV_UBWC_Top_Field_Plane253	 * (E) Y_Meta_Bottom_Field_Plane254	 * (F) Y_UBWC_Bottom_Field_Plane255	 * (G) UV_Meta_Bottom_Field_Plane256	 * (H) UV_UBWC_Bottom_Field_Plane257	 * Y_Meta_Top_Field_Plane consists of meta information to decode258	 * compressed tile data for Y_UBWC_Top_Field_Plane.259	 * Y_UBWC_Top_Field_Plane consists of Y data in compressed macro-tile260	 * format for top field of an interlaced frame.261	 * UBWC decoder block will use the Y_Meta_Top_Field_Plane data together262	 * with Y_UBWC_Top_Field_Plane data to produce loss-less uncompressed263	 * 8 bit Y samples for top field of an interlaced frame.264	 *265	 * UV_Meta_Top_Field_Plane consists of meta information to decode266	 * compressed tile data in UV_UBWC_Top_Field_Plane.267	 * UV_UBWC_Top_Field_Plane consists of UV data in compressed macro-tile268	 * format for top field of an interlaced frame.269	 * UBWC decoder block will use UV_Meta_Top_Field_Plane data together270	 * with UV_UBWC_Top_Field_Plane data to produce loss-less uncompressed271	 * 8 bit subsampled color difference samples for top field of an272	 * interlaced frame.273	 *274	 * Each tile in Y_UBWC_Top_Field_Plane/UV_UBWC_Top_Field_Plane is275	 * independently decodable and randomly accessible. There is no276	 * dependency between tiles.277	 *278	 * Y_Meta_Bottom_Field_Plane consists of meta information to decode279	 * compressed tile data for Y_UBWC_Bottom_Field_Plane.280	 * Y_UBWC_Bottom_Field_Plane consists of Y data in compressed macro-tile281	 * format for bottom field of an interlaced frame.282	 * UBWC decoder block will use the Y_Meta_Bottom_Field_Plane data283	 * together with Y_UBWC_Bottom_Field_Plane data to produce loss-less284	 * uncompressed 8 bit Y samples for bottom field of an interlaced frame.285	 *286	 * UV_Meta_Bottom_Field_Plane consists of meta information to decode287	 * compressed tile data in UV_UBWC_Bottom_Field_Plane.288	 * UV_UBWC_Bottom_Field_Plane consists of UV data in compressed289	 * macro-tile format for bottom field of an interlaced frame.290	 * UBWC decoder block will use UV_Meta_Bottom_Field_Plane data together291	 * with UV_UBWC_Bottom_Field_Plane data to produce loss-less292	 * uncompressed 8 bit subsampled color difference samples for bottom293	 * field of an interlaced frame.294	 *295	 * Each tile in Y_UBWC_Bottom_Field_Plane/UV_UBWC_Bottom_Field_Plane is296	 * independently decodable and randomly accessible. There is no297	 * dependency between tiles.298	 *299	 * <-----Y_TF_Meta_Stride---->300	 * <-------- Width ------>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 . .      |           |303	 * M M M M M M M M M M M M . . Half_height      |304	 * M M M M M M M M M M M M . .      |         Meta_Y_TF_Scanlines305	 * 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 . .      |           |308	 * M M M M M M M M M M M M . .      V           |309	 * . . . . . . . . . . . . . .                  |310	 * . . . . . . . . . . . . . .                  |311	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k312	 * . . . . . . . . . . . . . .                  V313	 * <-Compressed tile Y_TF Stride->314	 * <------- Width ------->315	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^316	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |317	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height  |318	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_TF_Scanlines319	 * 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* . . . .  |           |322	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |323	 * . . . . . . . . . . . . . . . .              |324	 * . . . . . . . . . . . . . . . .              |325	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k326	 * . . . . . . . . . . . . . . . .              V327	 * <----UV_TF_Meta_Stride---->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 . .      |331	 * M M M M M M M M M M M M . .      M_UV_TF_Scanlines332	 * . . . . . . . . . . . . . .      |333	 * . . . . . . . . . . . . . .      V334	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k335	 * <-Compressed tile UV_TF Stride->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* . . . .  |339	 * U* V* U* V* U* V* U* V* . . . .  UV_TF_Scanlines340	 * . . . . . . . . . . . . . . . .  |341	 * . . . . . . . . . . . . . . . .  V342	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k343	 * <-----Y_BF_Meta_Stride---->344	 * <-------- Width ------>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 . .      |           |347	 * M M M M M M M M M M M M . . Half_height      |348	 * M M M M M M M M M M M M . .      |         Meta_Y_BF_Scanlines349	 * 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 . .      |           |352	 * M M M M M M M M M M M M . .      V           |353	 * . . . . . . . . . . . . . .                  |354	 * . . . . . . . . . . . . . .                  |355	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k356	 * . . . . . . . . . . . . . .                  V357	 * <-Compressed tile Y_BF Stride->358	 * <------- Width ------->359	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^360	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |361	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height  |362	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_BF_Scanlines363	 * 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* . . . .  |           |366	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |367	 * . . . . . . . . . . . . . . . .              |368	 * . . . . . . . . . . . . . . . .              |369	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k370	 * . . . . . . . . . . . . . . . .              V371	 * <----UV_BF_Meta_Stride---->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 . .      |375	 * M M M M M M M M M M M M . .      M_UV_BF_Scanlines376	 * . . . . . . . . . . . . . .      |377	 * . . . . . . . . . . . . . .      V378	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k379	 * <-Compressed tile UV_BF Stride->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* . . . .  |383	 * U* V* U* V* U* V* U* V* . . . .  UV_BF_Scanlines384	 * . . . . . . . . . . . . . . . .  |385	 * . . . . . . . . . . . . . . . .  V386	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k387	 *388	 * Half_height = (Height+1)>>1389	 * Y_TF_Stride = align(Width, 128)390	 * UV_TF_Stride = align(Width, 128)391	 * Y_TF_Scanlines = align(Half_height, 32)392	 * UV_TF_Scanlines = align((Half_height+1)/2, 32)393	 * Y_UBWC_TF_Plane_size = align(Y_TF_Stride * Y_TF_Scanlines, 4096)394	 * UV_UBWC_TF_Plane_size = align(UV_TF_Stride * UV_TF_Scanlines, 4096)395	 * Y_TF_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)396	 * Y_TF_Meta_Scanlines = align(roundup(Half_height, Y_TileHeight), 16)397	 * Y_TF_Meta_Plane_size =398	 *     align(Y_TF_Meta_Stride * Y_TF_Meta_Scanlines, 4096)399	 * UV_TF_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)400	 * UV_TF_Meta_Scanlines = align(roundup(Half_height, UV_TileHeight), 16)401	 * UV_TF_Meta_Plane_size =402	 *     align(UV_TF_Meta_Stride * UV_TF_Meta_Scanlines, 4096)403	 * Y_BF_Stride = align(Width, 128)404	 * UV_BF_Stride = align(Width, 128)405	 * Y_BF_Scanlines = align(Half_height, 32)406	 * UV_BF_Scanlines = align((Half_height+1)/2, 32)407	 * Y_UBWC_BF_Plane_size = align(Y_BF_Stride * Y_BF_Scanlines, 4096)408	 * UV_UBWC_BF_Plane_size = align(UV_BF_Stride * UV_BF_Scanlines, 4096)409	 * Y_BF_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)410	 * Y_BF_Meta_Scanlines = align(roundup(Half_height, Y_TileHeight), 16)411	 * Y_BF_Meta_Plane_size =412	 *     align(Y_BF_Meta_Stride * Y_BF_Meta_Scanlines, 4096)413	 * UV_BF_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)414	 * UV_BF_Meta_Scanlines = align(roundup(Half_height, UV_TileHeight), 16)415	 * UV_BF_Meta_Plane_size =416	 *     align(UV_BF_Meta_Stride * UV_BF_Meta_Scanlines, 4096)417	 * Extradata = 8k418	 *419	 * Total size = align( Y_UBWC_TF_Plane_size + UV_UBWC_TF_Plane_size +420	 *           Y_TF_Meta_Plane_size + UV_TF_Meta_Plane_size +421	 *			 Y_UBWC_BF_Plane_size + UV_UBWC_BF_Plane_size +422	 *           Y_BF_Meta_Plane_size + UV_BF_Meta_Plane_size +423	 *           + max(Extradata, Y_TF_Stride * 48), 4096)424	 */425	COLOR_FMT_NV12_UBWC,426	/* Venus NV12 10-bit UBWC:427	 * Compressed Macro-tile format for NV12.428	 * Contains 4 planes in the following order -429	 * (A) Y_Meta_Plane430	 * (B) Y_UBWC_Plane431	 * (C) UV_Meta_Plane432	 * (D) UV_UBWC_Plane433	 *434	 * Y_Meta_Plane consists of meta information to decode compressed435	 * tile data in Y_UBWC_Plane.436	 * Y_UBWC_Plane consists of Y data in compressed macro-tile format.437	 * UBWC decoder block will use the Y_Meta_Plane data together with438	 * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples.439	 *440	 * UV_Meta_Plane consists of meta information to decode compressed441	 * tile data in UV_UBWC_Plane.442	 * UV_UBWC_Plane consists of UV data in compressed macro-tile format.443	 * UBWC decoder block will use UV_Meta_Plane data together with444	 * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2445	 * subsampled color difference samples.446	 *447	 * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable448	 * and randomly accessible. There is no dependency between tiles.449	 *450	 * <----- Y_Meta_Stride ----->451	 * <-------- Width ------>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 . .      |           |454	 * M M M M M M M M M M M M . .      Height      |455	 * M M M M M M M M M M M M . .      |         Meta_Y_Scanlines456	 * 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 . .      |           |459	 * M M M M M M M M M M M M . .      V           |460	 * . . . . . . . . . . . . . .                  |461	 * . . . . . . . . . . . . . .                  |462	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k463	 * . . . . . . . . . . . . . .                  V464	 * <--Compressed tile Y Stride--->465	 * <------- Width ------->466	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^467	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |468	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  Height      |469	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_Scanlines470	 * 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* . . . .  |           |473	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |474	 * . . . . . . . . . . . . . . . .              |475	 * . . . . . . . . . . . . . . . .              |476	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k477	 * . . . . . . . . . . . . . . . .              V478	 * <----- UV_Meta_Stride ---->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 . .      |482	 * M M M M M M M M M M M M . .      M_UV_Scanlines483	 * . . . . . . . . . . . . . .      |484	 * . . . . . . . . . . . . . .      V485	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k486	 * <--Compressed tile UV Stride--->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* . . . .  |490	 * U* V* U* V* U* V* U* V* . . . .  UV_Scanlines491	 * . . . . . . . . . . . . . . . .  |492	 * . . . . . . . . . . . . . . . .  V493	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k494	 *495	 *496	 * Y_Stride = align(Width * 4/3, 128)497	 * UV_Stride = align(Width * 4/3, 128)498	 * Y_Scanlines = align(Height, 32)499	 * UV_Scanlines = align(Height/2, 16)500	 * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)501	 * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)502	 * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)503	 * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)504	 * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)505	 * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)506	 * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)507	 * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)508	 * Extradata = 8k509	 *510	 * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +511	 *           Y_Meta_Plane_size + UV_Meta_Plane_size512	 *           + max(Extradata, Y_Stride * 48), 4096)513	 */514	COLOR_FMT_NV12_BPP10_UBWC,515	/* Venus RGBA8888 format:516	 * Contains 1 plane in the following order -517	 * (A) RGBA plane518	 *519	 * <-------- RGB_Stride -------->520	 * <------- Width ------->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 . . . .  |           |523	 * R R R R R R R R R R R R . . . .  Height      |524	 * R R R R R R R R R R R R . . . .  |       RGB_Scanlines525	 * 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 . . . .  |           |528	 * R R R R R R R R R R R R . . . .  V           |529	 * . . . . . . . . . . . . . . . .              |530	 * . . . . . . . . . . . . . . . .              |531	 * . . . . . . . . . . . . . . . .              |532	 * . . . . . . . . . . . . . . . .              V533	 *534	 * RGB_Stride = align(Width * 4, 128)535	 * RGB_Scanlines = align(Height, 32)536	 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)537	 * Extradata = 8k538	 *539	 * Total size = align(RGB_Plane_size + Extradata, 4096)540	 */541	COLOR_FMT_RGBA8888,542	/* Venus RGBA8888 UBWC format:543	 * Contains 2 planes in the following order -544	 * (A) Meta plane545	 * (B) RGBA plane546	 *547	 * <--- RGB_Meta_Stride ---->548	 * <-------- Width ------>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 . .      |           |551	 * M M M M M M M M M M M M . .      Height      |552	 * M M M M M M M M M M M M . .      |       Meta_RGB_Scanlines553	 * 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 . .      |           |556	 * M M M M M M M M M M M M . .      V           |557	 * . . . . . . . . . . . . . .                  |558	 * . . . . . . . . . . . . . .                  |559	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k560	 * . . . . . . . . . . . . . .                  V561	 * <-------- RGB_Stride -------->562	 * <------- Width ------->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 . . . .  |           |565	 * R R R R R R R R R R R R . . . .  Height      |566	 * R R R R R R R R R R R R . . . .  |       RGB_Scanlines567	 * 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 . . . .  |           |570	 * R R R R R R R R R R R R . . . .  V           |571	 * . . . . . . . . . . . . . . . .              |572	 * . . . . . . . . . . . . . . . .              |573	 * . . . . . . . . . . . . . . . .    -------> Buffer size aligned to 4k574	 * . . . . . . . . . . . . . . . .              V575	 *576	 * RGB_Stride = align(Width * 4, 128)577	 * RGB_Scanlines = align(Height, 32)578	 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)579	 * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)580	 * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)581	 * RGB_Meta_Plane_size = align(RGB_Meta_Stride *582	 *		RGB_Meta_Scanlines, 4096)583	 * Extradata = 8k584	 *585	 * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +586	 *		Extradata, 4096)587	 */588	COLOR_FMT_RGBA8888_UBWC,589	/* Venus RGBA1010102 UBWC format:590	 * Contains 2 planes in the following order -591	 * (A) Meta plane592	 * (B) RGBA plane593	 *594	 * <--- RGB_Meta_Stride ---->595	 * <-------- Width ------>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 . .      |           |598	 * M M M M M M M M M M M M . .      Height      |599	 * M M M M M M M M M M M M . .      |       Meta_RGB_Scanlines600	 * 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 . .      |           |603	 * M M M M M M M M M M M M . .      V           |604	 * . . . . . . . . . . . . . .                  |605	 * . . . . . . . . . . . . . .                  |606	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k607	 * . . . . . . . . . . . . . .                  V608	 * <-------- RGB_Stride -------->609	 * <------- Width ------->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 . . . .  |           |612	 * R R R R R R R R R R R R . . . .  Height      |613	 * R R R R R R R R R R R R . . . .  |       RGB_Scanlines614	 * 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 . . . .  |           |617	 * R R R R R R R R R R R R . . . .  V           |618	 * . . . . . . . . . . . . . . . .              |619	 * . . . . . . . . . . . . . . . .              |620	 * . . . . . . . . . . . . . . . .    -------> Buffer size aligned to 4k621	 * . . . . . . . . . . . . . . . .              V622	 *623	 * RGB_Stride = align(Width * 4, 256)624	 * RGB_Scanlines = align(Height, 16)625	 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)626	 * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)627	 * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)628	 * RGB_Meta_Plane_size = align(RGB_Meta_Stride *629	 *		RGB_Meta_Scanlines, 4096)630	 * Extradata = 8k631	 *632	 * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +633	 *		Extradata, 4096)634	 */635	COLOR_FMT_RGBA1010102_UBWC,636	/* Venus RGB565 UBWC format:637	 * Contains 2 planes in the following order -638	 * (A) Meta plane639	 * (B) RGB plane640	 *641	 * <--- RGB_Meta_Stride ---->642	 * <-------- Width ------>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 . .      |           |645	 * M M M M M M M M M M M M . .      Height      |646	 * M M M M M M M M M M M M . .      |       Meta_RGB_Scanlines647	 * 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 . .      |           |650	 * M M M M M M M M M M M M . .      V           |651	 * . . . . . . . . . . . . . .                  |652	 * . . . . . . . . . . . . . .                  |653	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k654	 * . . . . . . . . . . . . . .                  V655	 * <-------- RGB_Stride -------->656	 * <------- Width ------->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 . . . .  |           |659	 * R R R R R R R R R R R R . . . .  Height      |660	 * R R R R R R R R R R R R . . . .  |       RGB_Scanlines661	 * 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 . . . .  |           |664	 * R R R R R R R R R R R R . . . .  V           |665	 * . . . . . . . . . . . . . . . .              |666	 * . . . . . . . . . . . . . . . .              |667	 * . . . . . . . . . . . . . . . .    -------> Buffer size aligned to 4k668	 * . . . . . . . . . . . . . . . .              V669	 *670	 * RGB_Stride = align(Width * 2, 128)671	 * RGB_Scanlines = align(Height, 16)672	 * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)673	 * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)674	 * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)675	 * RGB_Meta_Plane_size = align(RGB_Meta_Stride *676	 *		RGB_Meta_Scanlines, 4096)677	 * Extradata = 8k678	 *679	 * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +680	 *		Extradata, 4096)681	 */682	COLOR_FMT_RGB565_UBWC,683	/* P010 UBWC:684	 * Compressed Macro-tile format for NV12.685	 * Contains 4 planes in the following order -686	 * (A) Y_Meta_Plane687	 * (B) Y_UBWC_Plane688	 * (C) UV_Meta_Plane689	 * (D) UV_UBWC_Plane690	 *691	 * Y_Meta_Plane consists of meta information to decode compressed692	 * tile data in Y_UBWC_Plane.693	 * Y_UBWC_Plane consists of Y data in compressed macro-tile format.694	 * UBWC decoder block will use the Y_Meta_Plane data together with695	 * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples.696	 *697	 * UV_Meta_Plane consists of meta information to decode compressed698	 * tile data in UV_UBWC_Plane.699	 * UV_UBWC_Plane consists of UV data in compressed macro-tile format.700	 * UBWC decoder block will use UV_Meta_Plane data together with701	 * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2702	 * subsampled color difference samples.703	 *704	 * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable705	 * and randomly accessible. There is no dependency between tiles.706	 *707	 * <----- Y_Meta_Stride ----->708	 * <-------- Width ------>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 . .      |           |711	 * M M M M M M M M M M M M . .      Height      |712	 * M M M M M M M M M M M M . .      |         Meta_Y_Scanlines713	 * 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 . .      |           |716	 * M M M M M M M M M M M M . .      V           |717	 * . . . . . . . . . . . . . .                  |718	 * . . . . . . . . . . . . . .                  |719	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k720	 * . . . . . . . . . . . . . .                  V721	 * <--Compressed tile Y Stride--->722	 * <------- Width ------->723	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^724	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |725	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  Height      |726	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_Scanlines727	 * 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* . . . .  |           |730	 * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |731	 * . . . . . . . . . . . . . . . .              |732	 * . . . . . . . . . . . . . . . .              |733	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k734	 * . . . . . . . . . . . . . . . .              V735	 * <----- UV_Meta_Stride ---->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 . .      |739	 * M M M M M M M M M M M M . .      M_UV_Scanlines740	 * . . . . . . . . . . . . . .      |741	 * . . . . . . . . . . . . . .      V742	 * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k743	 * <--Compressed tile UV Stride--->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* . . . .  |747	 * U* V* U* V* U* V* U* V* . . . .  UV_Scanlines748	 * . . . . . . . . . . . . . . . .  |749	 * . . . . . . . . . . . . . . . .  V750	 * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k751	 *752	 *753	 * Y_Stride = align(Width * 2, 256)754	 * UV_Stride = align(Width * 2, 256)755	 * Y_Scanlines = align(Height, 16)756	 * UV_Scanlines = align(Height/2, 16)757	 * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)758	 * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)759	 * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)760	 * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)761	 * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)762	 * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)763	 * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)764	 * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)765	 * Extradata = 8k766	 *767	 * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +768	 *           Y_Meta_Plane_size + UV_Meta_Plane_size769	 *           + max(Extradata, Y_Stride * 48), 4096)770	 */771	COLOR_FMT_P010_UBWC,772	/* Venus P010:773	 * YUV 4:2:0 image with a plane of 10 bit Y samples followed774	 * by an interleaved U/V plane containing 10 bit 2x2 subsampled775	 * colour difference samples.776	 *777	 * <-------- Y/UV_Stride -------->778	 * <------- Width ------->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 . . . .  |           |781	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |782	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines783	 * 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 . . . .  |           |786	 * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |787	 * . . . . . . . . . . . . . . . .              |788	 * . . . . . . . . . . . . . . . .              |789	 * . . . . . . . . . . . . . . . .              |790	 * . . . . . . . . . . . . . . . .              V791	 * 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 . . . .  |794	 * U V U V U V U V U V U V . . . .  UV_Scanlines795	 * . . . . . . . . . . . . . . . .  |796	 * . . . . . . . . . . . . . . . .  V797	 * . . . . . . . . . . . . . . . .  --> Buffer size alignment798	 *799	 * Y_Stride : Width * 2 aligned to 128800	 * UV_Stride : Width * 2 aligned to 128801	 * Y_Scanlines: Height aligned to 32802	 * UV_Scanlines: Height/2 aligned to 16803	 * Extradata: Arbitrary (software-imposed) padding804	 * Total size = align((Y_Stride * Y_Scanlines805	 *          + UV_Stride * UV_Scanlines806	 *          + max(Extradata, Y_Stride * 8), 4096)807	 */808	COLOR_FMT_P010,809};810 811#define COLOR_FMT_RGBA1010102_UBWC	COLOR_FMT_RGBA1010102_UBWC812#define COLOR_FMT_RGB565_UBWC		COLOR_FMT_RGB565_UBWC813#define COLOR_FMT_P010_UBWC		COLOR_FMT_P010_UBWC814#define COLOR_FMT_P010		COLOR_FMT_P010815 816/*817 * Function arguments:818 * @color_fmt819 * @width820 * Progressive: width821 * Interlaced: width822 */823static unsigned int VENUS_Y_STRIDE(int color_fmt, int width)824{825	unsigned int stride = 0;826 827	if (!width)828		return 0;829 830	switch (color_fmt) {831	case COLOR_FMT_NV21:832	case COLOR_FMT_NV12:833	case COLOR_FMT_NV12_MVTB:834	case COLOR_FMT_NV12_UBWC:835		stride = MSM_MEDIA_ALIGN(width, 128);836		break;837	case COLOR_FMT_NV12_BPP10_UBWC:838		stride = MSM_MEDIA_ALIGN(width, 192);839		stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);840		break;841	case COLOR_FMT_P010_UBWC:842		stride = MSM_MEDIA_ALIGN(width * 2, 256);843		break;844	case COLOR_FMT_P010:845		stride = MSM_MEDIA_ALIGN(width * 2, 128);846		break;847	}848 849	return stride;850}851 852/*853 * Function arguments:854 * @color_fmt855 * @width856 * Progressive: width857 * Interlaced: width858 */859static unsigned int VENUS_UV_STRIDE(int color_fmt, int width)860{861	unsigned int stride = 0;862 863	if (!width)864		return 0;865 866	switch (color_fmt) {867	case COLOR_FMT_NV21:868	case COLOR_FMT_NV12:869	case COLOR_FMT_NV12_MVTB:870	case COLOR_FMT_NV12_UBWC:871		stride = MSM_MEDIA_ALIGN(width, 128);872		break;873	case COLOR_FMT_NV12_BPP10_UBWC:874		stride = MSM_MEDIA_ALIGN(width, 192);875		stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);876		break;877	case COLOR_FMT_P010_UBWC:878		stride = MSM_MEDIA_ALIGN(width * 2, 256);879		break;880	case COLOR_FMT_P010:881		stride = MSM_MEDIA_ALIGN(width * 2, 128);882		break;883	}884 885	return stride;886}887 888/*889 * Function arguments:890 * @color_fmt891 * @height892 * Progressive: height893 * Interlaced: (height+1)>>1894 */895static unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)896{897	unsigned int sclines = 0;898 899	if (!height)900		return 0;901 902	switch (color_fmt) {903	case COLOR_FMT_NV21:904	case COLOR_FMT_NV12:905	case COLOR_FMT_NV12_MVTB:906	case COLOR_FMT_NV12_UBWC:907	case COLOR_FMT_P010:908		sclines = MSM_MEDIA_ALIGN(height, 32);909		break;910	case COLOR_FMT_NV12_BPP10_UBWC:911	case COLOR_FMT_P010_UBWC:912		sclines = MSM_MEDIA_ALIGN(height, 16);913		break;914	}915 916	return sclines;917}918 919/*920 * Function arguments:921 * @color_fmt922 * @height923 * Progressive: height924 * Interlaced: (height+1)>>1925 */926static unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)927{928	unsigned int sclines = 0;929 930	if (!height)931		return 0;932 933	switch (color_fmt) {934	case COLOR_FMT_NV21:935	case COLOR_FMT_NV12:936	case COLOR_FMT_NV12_MVTB:937	case COLOR_FMT_NV12_BPP10_UBWC:938	case COLOR_FMT_P010_UBWC:939	case COLOR_FMT_P010:940		sclines = MSM_MEDIA_ALIGN((height + 1) >> 1, 16);941		break;942	case COLOR_FMT_NV12_UBWC:943		sclines = MSM_MEDIA_ALIGN((height + 1) >> 1, 32);944		break;945	}946 947	return sclines;948}949 950/*951 * Function arguments:952 * @color_fmt953 * @width954 * Progressive: width955 * Interlaced: width956 */957static unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)958{959	int y_tile_width = 0, y_meta_stride;960 961	if (!width)962		return 0;963 964	switch (color_fmt) {965	case COLOR_FMT_NV12_UBWC:966	case COLOR_FMT_P010_UBWC:967		y_tile_width = 32;968		break;969	case COLOR_FMT_NV12_BPP10_UBWC:970		y_tile_width = 48;971		break;972	default:973		return 0;974	}975 976	y_meta_stride = MSM_MEDIA_ROUNDUP(width, y_tile_width);977	return MSM_MEDIA_ALIGN(y_meta_stride, 64);978}979 980/*981 * Function arguments:982 * @color_fmt983 * @height984 * Progressive: height985 * Interlaced: (height+1)>>1986 */987static unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)988{989	int y_tile_height = 0, y_meta_scanlines;990 991	if (!height)992		return 0;993 994	switch (color_fmt) {995	case COLOR_FMT_NV12_UBWC:996		y_tile_height = 8;997		break;998	case COLOR_FMT_NV12_BPP10_UBWC:999	case COLOR_FMT_P010_UBWC:1000		y_tile_height = 4;1001		break;1002	default:1003		return 0;1004	}1005 1006	y_meta_scanlines = MSM_MEDIA_ROUNDUP(height, y_tile_height);1007	return MSM_MEDIA_ALIGN(y_meta_scanlines, 16);1008}1009 1010/*1011 * Function arguments:1012 * @color_fmt1013 * @width1014 * Progressive: width1015 * Interlaced: width1016 */1017static unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)1018{1019	int uv_tile_width = 0, uv_meta_stride;1020 1021	if (!width)1022		return 0;1023 1024	switch (color_fmt) {1025	case COLOR_FMT_NV12_UBWC:1026	case COLOR_FMT_P010_UBWC:1027		uv_tile_width = 16;1028		break;1029	case COLOR_FMT_NV12_BPP10_UBWC:1030		uv_tile_width = 24;1031		break;1032	default:1033		return 0;1034	}1035 1036	uv_meta_stride = MSM_MEDIA_ROUNDUP((width+1)>>1, uv_tile_width);1037	return MSM_MEDIA_ALIGN(uv_meta_stride, 64);1038}1039 1040/*1041 * Function arguments:1042 * @color_fmt1043 * @height1044 * Progressive: height1045 * Interlaced: (height+1)>>11046 */1047static unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)1048{1049	int uv_tile_height = 0, uv_meta_scanlines;1050 1051	if (!height)1052		return 0;1053 1054	switch (color_fmt) {1055	case COLOR_FMT_NV12_UBWC:1056		uv_tile_height = 8;1057		break;1058	case COLOR_FMT_NV12_BPP10_UBWC:1059	case COLOR_FMT_P010_UBWC:1060		uv_tile_height = 4;1061		break;1062	default:1063		return 0;1064	}1065 1066	uv_meta_scanlines = MSM_MEDIA_ROUNDUP((height+1)>>1, uv_tile_height);1067	return MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);1068}1069 1070static unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)1071{1072	unsigned int alignment = 0, bpp = 4;1073 1074	if (!width)1075		return 0;1076 1077	switch (color_fmt) {1078	case COLOR_FMT_RGBA8888:1079		alignment = 128;1080		break;1081	case COLOR_FMT_RGB565_UBWC:1082		alignment = 256;1083		bpp = 2;1084		break;1085	case COLOR_FMT_RGBA8888_UBWC:1086	case COLOR_FMT_RGBA1010102_UBWC:1087		alignment = 256;1088		break;1089	default:1090		return 0;1091	}1092 1093	return MSM_MEDIA_ALIGN(width * bpp, alignment);1094}1095 1096static unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)1097{1098	unsigned int alignment = 0;1099 1100	if (!height)1101		return 0;1102 1103	switch (color_fmt) {1104	case COLOR_FMT_RGBA8888:1105		alignment = 32;1106		break;1107	case COLOR_FMT_RGBA8888_UBWC:1108	case COLOR_FMT_RGBA1010102_UBWC:1109	case COLOR_FMT_RGB565_UBWC:1110		alignment = 16;1111		break;1112	default:1113		return 0;1114	}1115 1116	return MSM_MEDIA_ALIGN(height, alignment);1117}1118 1119static unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)1120{1121	int rgb_meta_stride;1122 1123	if (!width)1124		return 0;1125 1126	switch (color_fmt) {1127	case COLOR_FMT_RGBA8888_UBWC:1128	case COLOR_FMT_RGBA1010102_UBWC:1129	case COLOR_FMT_RGB565_UBWC:1130		rgb_meta_stride = MSM_MEDIA_ROUNDUP(width, 16);1131		return MSM_MEDIA_ALIGN(rgb_meta_stride, 64);1132	}1133 1134	return 0;1135}1136 1137static unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)1138{1139	int rgb_meta_scanlines;1140 1141	if (!height)1142		return 0;1143 1144	switch (color_fmt) {1145	case COLOR_FMT_RGBA8888_UBWC:1146	case COLOR_FMT_RGBA1010102_UBWC:1147	case COLOR_FMT_RGB565_UBWC:1148		rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(height, 4);1149		return MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);1150	}1151 1152	return 0;1153}1154 1155#endif1156