Back to home page

OSCL-LXR

 
 

    


0001 #ifndef __MEDIA_INFO_H__
0002 #define __MEDIA_INFO_H__
0003 
0004 #ifndef MSM_MEDIA_ALIGN
0005 #define MSM_MEDIA_ALIGN(__sz, __align) (((__align) & ((__align) - 1)) ?\
0006     ((((__sz) + (__align) - 1) / (__align)) * (__align)) :\
0007     (((__sz) + (__align) - 1) & (~((__align) - 1))))
0008 #endif
0009 
0010 #ifndef MSM_MEDIA_ROUNDUP
0011 #define MSM_MEDIA_ROUNDUP(__sz, __r) (((__sz) + ((__r) - 1)) / (__r))
0012 #endif
0013 
0014 #ifndef MSM_MEDIA_MAX
0015 #define MSM_MEDIA_MAX(__a, __b) ((__a) > (__b)?(__a):(__b))
0016 #endif
0017 
0018 enum color_fmts {
0019     /* Venus NV12:
0020      * YUV 4:2:0 image with a plane of 8 bit Y samples followed
0021      * by an interleaved U/V plane containing 8 bit 2x2 subsampled
0022      * colour difference samples.
0023      *
0024      * <-------- Y/UV_Stride -------->
0025      * <------- Width ------->
0026      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  ^           ^
0027      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0028      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |
0029      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines
0030      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0031      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0032      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0033      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |
0034      * . . . . . . . . . . . . . . . .              |
0035      * . . . . . . . . . . . . . . . .              |
0036      * . . . . . . . . . . . . . . . .              |
0037      * . . . . . . . . . . . . . . . .              V
0038      * U V U V U V U V U V U V . . . .  ^
0039      * U V U V U V U V U V U V . . . .  |
0040      * U V U V U V U V U V U V . . . .  |
0041      * U V U V U V U V U V U V . . . .  UV_Scanlines
0042      * . . . . . . . . . . . . . . . .  |
0043      * . . . . . . . . . . . . . . . .  V
0044      * . . . . . . . . . . . . . . . .  --> Buffer size alignment
0045      *
0046      * Y_Stride : Width aligned to 128
0047      * UV_Stride : Width aligned to 128
0048      * Y_Scanlines: Height aligned to 32
0049      * UV_Scanlines: Height/2 aligned to 16
0050      * Extradata: Arbitrary (software-imposed) padding
0051      * Total size = align((Y_Stride * Y_Scanlines
0052      *          + UV_Stride * UV_Scanlines
0053      *          + max(Extradata, Y_Stride * 8), 4096)
0054      */
0055     COLOR_FMT_NV12,
0056 
0057     /* Venus NV21:
0058      * YUV 4:2:0 image with a plane of 8 bit Y samples followed
0059      * by an interleaved V/U plane containing 8 bit 2x2 subsampled
0060      * colour difference samples.
0061      *
0062      * <-------- Y/UV_Stride -------->
0063      * <------- Width ------->
0064      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  ^           ^
0065      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0066      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |
0067      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines
0068      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0069      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0070      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0071      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |
0072      * . . . . . . . . . . . . . . . .              |
0073      * . . . . . . . . . . . . . . . .              |
0074      * . . . . . . . . . . . . . . . .              |
0075      * . . . . . . . . . . . . . . . .              V
0076      * V U V U V U V U V U V U . . . .  ^
0077      * V U V U V U V U V U V U . . . .  |
0078      * V U V U V U V U V U V U . . . .  |
0079      * V U V U V U V U V U V U . . . .  UV_Scanlines
0080      * . . . . . . . . . . . . . . . .  |
0081      * . . . . . . . . . . . . . . . .  V
0082      * . . . . . . . . . . . . . . . .  --> Padding & Buffer size alignment
0083      *
0084      * Y_Stride : Width aligned to 128
0085      * UV_Stride : Width aligned to 128
0086      * Y_Scanlines: Height aligned to 32
0087      * UV_Scanlines: Height/2 aligned to 16
0088      * Extradata: Arbitrary (software-imposed) padding
0089      * Total size = align((Y_Stride * Y_Scanlines
0090      *          + UV_Stride * UV_Scanlines
0091      *          + max(Extradata, Y_Stride * 8), 4096)
0092      */
0093     COLOR_FMT_NV21,
0094     /* Venus NV12_MVTB:
0095      * Two YUV 4:2:0 images/views one after the other
0096      * in a top-bottom layout, same as NV12
0097      * with a plane of 8 bit Y samples followed
0098      * by an interleaved U/V plane containing 8 bit 2x2 subsampled
0099      * colour difference samples.
0100      *
0101      *
0102      * <-------- Y/UV_Stride -------->
0103      * <------- Width ------->
0104      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  ^           ^               ^
0105      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |               |
0106      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |               |
0107      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines      |
0108      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |               |
0109      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |               |
0110      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |               |
0111      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |               |
0112      * . . . . . . . . . . . . . . . .              |             View_1
0113      * . . . . . . . . . . . . . . . .              |               |
0114      * . . . . . . . . . . . . . . . .              |               |
0115      * . . . . . . . . . . . . . . . .              V               |
0116      * U V U V U V U V U V U V . . . .  ^                           |
0117      * U V U V U V U V U V U V . . . .  |                           |
0118      * U V U V U V U V U V U V . . . .  |                           |
0119      * U V U V U V U V U V U V . . . .  UV_Scanlines                |
0120      * . . . . . . . . . . . . . . . .  |                           |
0121      * . . . . . . . . . . . . . . . .  V                           V
0122      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  ^           ^               ^
0123      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |               |
0124      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |               |
0125      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines      |
0126      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |               |
0127      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |               |
0128      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |               |
0129      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |               |
0130      * . . . . . . . . . . . . . . . .              |             View_2
0131      * . . . . . . . . . . . . . . . .              |               |
0132      * . . . . . . . . . . . . . . . .              |               |
0133      * . . . . . . . . . . . . . . . .              V               |
0134      * U V U V U V U V U V U V . . . .  ^                           |
0135      * U V U V U V U V U V U V . . . .  |                           |
0136      * U V U V U V U V U V U V . . . .  |                           |
0137      * U V U V U V U V U V U V . . . .  UV_Scanlines                |
0138      * . . . . . . . . . . . . . . . .  |                           |
0139      * . . . . . . . . . . . . . . . .  V                           V
0140      * . . . . . . . . . . . . . . . .  --> Buffer size alignment
0141      *
0142      * Y_Stride : Width aligned to 128
0143      * UV_Stride : Width aligned to 128
0144      * Y_Scanlines: Height aligned to 32
0145      * UV_Scanlines: Height/2 aligned to 16
0146      * View_1 begin at: 0 (zero)
0147      * View_2 begin at: Y_Stride * Y_Scanlines + UV_Stride * UV_Scanlines
0148      * Extradata: Arbitrary (software-imposed) padding
0149      * Total size = align((2*(Y_Stride * Y_Scanlines)
0150      *          + 2*(UV_Stride * UV_Scanlines) + Extradata), 4096)
0151      */
0152     COLOR_FMT_NV12_MVTB,
0153     /*
0154      * The buffer can be of 2 types:
0155      * (1) Venus NV12 UBWC Progressive
0156      * (2) Venus NV12 UBWC Interlaced
0157      *
0158      * (1) Venus NV12 UBWC Progressive Buffer Format:
0159      * Compressed Macro-tile format for NV12.
0160      * Contains 4 planes in the following order -
0161      * (A) Y_Meta_Plane
0162      * (B) Y_UBWC_Plane
0163      * (C) UV_Meta_Plane
0164      * (D) UV_UBWC_Plane
0165      *
0166      * Y_Meta_Plane consists of meta information to decode compressed
0167      * tile data in Y_UBWC_Plane.
0168      * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
0169      * UBWC decoder block will use the Y_Meta_Plane data together with
0170      * Y_UBWC_Plane data to produce loss-less uncompressed 8 bit Y samples.
0171      *
0172      * UV_Meta_Plane consists of meta information to decode compressed
0173      * tile data in UV_UBWC_Plane.
0174      * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
0175      * UBWC decoder block will use UV_Meta_Plane data together with
0176      * UV_UBWC_Plane data to produce loss-less uncompressed 8 bit 2x2
0177      * subsampled color difference samples.
0178      *
0179      * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
0180      * and randomly accessible. There is no dependency between tiles.
0181      *
0182      * <----- Y_Meta_Stride ---->
0183      * <-------- Width ------>
0184      * M M M M M M M M M M M M . .      ^           ^
0185      * M M M M M M M M M M M M . .      |           |
0186      * M M M M M M M M M M M M . .      Height      |
0187      * M M M M M M M M M M M M . .      |         Meta_Y_Scanlines
0188      * M M M M M M M M M M M M . .      |           |
0189      * M M M M M M M M M M M M . .      |           |
0190      * M M M M M M M M M M M M . .      |           |
0191      * M M M M M M M M M M M M . .      V           |
0192      * . . . . . . . . . . . . . .                  |
0193      * . . . . . . . . . . . . . .                  |
0194      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0195      * . . . . . . . . . . . . . .                  V
0196      * <--Compressed tile Y Stride--->
0197      * <------- Width ------->
0198      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^
0199      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0200      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  Height      |
0201      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_Scanlines
0202      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0203      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0204      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0205      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |
0206      * . . . . . . . . . . . . . . . .              |
0207      * . . . . . . . . . . . . . . . .              |
0208      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0209      * . . . . . . . . . . . . . . . .              V
0210      * <----- UV_Meta_Stride ---->
0211      * M M M M M M M M M M M M . .      ^
0212      * M M M M M M M M M M M M . .      |
0213      * M M M M M M M M M M M M . .      |
0214      * M M M M M M M M M M M M . .      M_UV_Scanlines
0215      * . . . . . . . . . . . . . .      |
0216      * . . . . . . . . . . . . . .      V
0217      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0218      * <--Compressed tile UV Stride--->
0219      * U* V* U* V* U* V* U* V* . . . .  ^
0220      * U* V* U* V* U* V* U* V* . . . .  |
0221      * U* V* U* V* U* V* U* V* . . . .  |
0222      * U* V* U* V* U* V* U* V* . . . .  UV_Scanlines
0223      * . . . . . . . . . . . . . . . .  |
0224      * . . . . . . . . . . . . . . . .  V
0225      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0226      *
0227      * Y_Stride = align(Width, 128)
0228      * UV_Stride = align(Width, 128)
0229      * Y_Scanlines = align(Height, 32)
0230      * UV_Scanlines = align(Height/2, 16)
0231      * Y_UBWC_Plane_size = align(Y_Stride * Y_Scanlines, 4096)
0232      * UV_UBWC_Plane_size = align(UV_Stride * UV_Scanlines, 4096)
0233      * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
0234      * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
0235      * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
0236      * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
0237      * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
0238      * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
0239      * Extradata = 8k
0240      *
0241      * Total size = align( Y_UBWC_Plane_size + UV_UBWC_Plane_size +
0242      *           Y_Meta_Plane_size + UV_Meta_Plane_size
0243      *           + max(Extradata, Y_Stride * 48), 4096)
0244      *
0245      *
0246      * (2) Venus NV12 UBWC Interlaced Buffer Format:
0247      * Compressed Macro-tile format for NV12 interlaced.
0248      * Contains 8 planes in the following order -
0249      * (A) Y_Meta_Top_Field_Plane
0250      * (B) Y_UBWC_Top_Field_Plane
0251      * (C) UV_Meta_Top_Field_Plane
0252      * (D) UV_UBWC_Top_Field_Plane
0253      * (E) Y_Meta_Bottom_Field_Plane
0254      * (F) Y_UBWC_Bottom_Field_Plane
0255      * (G) UV_Meta_Bottom_Field_Plane
0256      * (H) UV_UBWC_Bottom_Field_Plane
0257      * Y_Meta_Top_Field_Plane consists of meta information to decode
0258      * compressed tile data for Y_UBWC_Top_Field_Plane.
0259      * Y_UBWC_Top_Field_Plane consists of Y data in compressed macro-tile
0260      * format for top field of an interlaced frame.
0261      * UBWC decoder block will use the Y_Meta_Top_Field_Plane data together
0262      * with Y_UBWC_Top_Field_Plane data to produce loss-less uncompressed
0263      * 8 bit Y samples for top field of an interlaced frame.
0264      *
0265      * UV_Meta_Top_Field_Plane consists of meta information to decode
0266      * compressed tile data in UV_UBWC_Top_Field_Plane.
0267      * UV_UBWC_Top_Field_Plane consists of UV data in compressed macro-tile
0268      * format for top field of an interlaced frame.
0269      * UBWC decoder block will use UV_Meta_Top_Field_Plane data together
0270      * with UV_UBWC_Top_Field_Plane data to produce loss-less uncompressed
0271      * 8 bit subsampled color difference samples for top field of an
0272      * interlaced frame.
0273      *
0274      * Each tile in Y_UBWC_Top_Field_Plane/UV_UBWC_Top_Field_Plane is
0275      * independently decodable and randomly accessible. There is no
0276      * dependency between tiles.
0277      *
0278      * Y_Meta_Bottom_Field_Plane consists of meta information to decode
0279      * compressed tile data for Y_UBWC_Bottom_Field_Plane.
0280      * Y_UBWC_Bottom_Field_Plane consists of Y data in compressed macro-tile
0281      * format for bottom field of an interlaced frame.
0282      * UBWC decoder block will use the Y_Meta_Bottom_Field_Plane data
0283      * together with Y_UBWC_Bottom_Field_Plane data to produce loss-less
0284      * uncompressed 8 bit Y samples for bottom field of an interlaced frame.
0285      *
0286      * UV_Meta_Bottom_Field_Plane consists of meta information to decode
0287      * compressed tile data in UV_UBWC_Bottom_Field_Plane.
0288      * UV_UBWC_Bottom_Field_Plane consists of UV data in compressed
0289      * macro-tile format for bottom field of an interlaced frame.
0290      * UBWC decoder block will use UV_Meta_Bottom_Field_Plane data together
0291      * with UV_UBWC_Bottom_Field_Plane data to produce loss-less
0292      * uncompressed 8 bit subsampled color difference samples for bottom
0293      * field of an interlaced frame.
0294      *
0295      * Each tile in Y_UBWC_Bottom_Field_Plane/UV_UBWC_Bottom_Field_Plane is
0296      * independently decodable and randomly accessible. There is no
0297      * dependency between tiles.
0298      *
0299      * <-----Y_TF_Meta_Stride---->
0300      * <-------- Width ------>
0301      * M M M M M M M M M M M M . .      ^           ^
0302      * M M M M M M M M M M M M . .      |           |
0303      * M M M M M M M M M M M M . . Half_height      |
0304      * M M M M M M M M M M M M . .      |         Meta_Y_TF_Scanlines
0305      * M M M M M M M M M M M M . .      |           |
0306      * M M M M M M M M M M M M . .      |           |
0307      * M M M M M M M M M M M M . .      |           |
0308      * M M M M M M M M M M M M . .      V           |
0309      * . . . . . . . . . . . . . .                  |
0310      * . . . . . . . . . . . . . .                  |
0311      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0312      * . . . . . . . . . . . . . .                  V
0313      * <-Compressed tile Y_TF Stride->
0314      * <------- Width ------->
0315      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^
0316      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0317      * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height  |
0318      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_TF_Scanlines
0319      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0320      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0321      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0322      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |
0323      * . . . . . . . . . . . . . . . .              |
0324      * . . . . . . . . . . . . . . . .              |
0325      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0326      * . . . . . . . . . . . . . . . .              V
0327      * <----UV_TF_Meta_Stride---->
0328      * M M M M M M M M M M M M . .      ^
0329      * M M M M M M M M M M M M . .      |
0330      * M M M M M M M M M M M M . .      |
0331      * M M M M M M M M M M M M . .      M_UV_TF_Scanlines
0332      * . . . . . . . . . . . . . .      |
0333      * . . . . . . . . . . . . . .      V
0334      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0335      * <-Compressed tile UV_TF Stride->
0336      * U* V* U* V* U* V* U* V* . . . .  ^
0337      * U* V* U* V* U* V* U* V* . . . .  |
0338      * U* V* U* V* U* V* U* V* . . . .  |
0339      * U* V* U* V* U* V* U* V* . . . .  UV_TF_Scanlines
0340      * . . . . . . . . . . . . . . . .  |
0341      * . . . . . . . . . . . . . . . .  V
0342      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0343      * <-----Y_BF_Meta_Stride---->
0344      * <-------- Width ------>
0345      * M M M M M M M M M M M M . .      ^           ^
0346      * M M M M M M M M M M M M . .      |           |
0347      * M M M M M M M M M M M M . . Half_height      |
0348      * M M M M M M M M M M M M . .      |         Meta_Y_BF_Scanlines
0349      * M M M M M M M M M M M M . .      |           |
0350      * M M M M M M M M M M M M . .      |           |
0351      * M M M M M M M M M M M M . .      |           |
0352      * M M M M M M M M M M M M . .      V           |
0353      * . . . . . . . . . . . . . .                  |
0354      * . . . . . . . . . . . . . .                  |
0355      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0356      * . . . . . . . . . . . . . .                  V
0357      * <-Compressed tile Y_BF Stride->
0358      * <------- Width ------->
0359      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^
0360      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0361      * Y* Y* Y* Y* Y* Y* Y* Y* . . . . Half_height  |
0362      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_BF_Scanlines
0363      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0364      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0365      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0366      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |
0367      * . . . . . . . . . . . . . . . .              |
0368      * . . . . . . . . . . . . . . . .              |
0369      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0370      * . . . . . . . . . . . . . . . .              V
0371      * <----UV_BF_Meta_Stride---->
0372      * M M M M M M M M M M M M . .      ^
0373      * M M M M M M M M M M M M . .      |
0374      * M M M M M M M M M M M M . .      |
0375      * M M M M M M M M M M M M . .      M_UV_BF_Scanlines
0376      * . . . . . . . . . . . . . .      |
0377      * . . . . . . . . . . . . . .      V
0378      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0379      * <-Compressed tile UV_BF Stride->
0380      * U* V* U* V* U* V* U* V* . . . .  ^
0381      * U* V* U* V* U* V* U* V* . . . .  |
0382      * U* V* U* V* U* V* U* V* . . . .  |
0383      * U* V* U* V* U* V* U* V* . . . .  UV_BF_Scanlines
0384      * . . . . . . . . . . . . . . . .  |
0385      * . . . . . . . . . . . . . . . .  V
0386      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0387      *
0388      * Half_height = (Height+1)>>1
0389      * Y_TF_Stride = align(Width, 128)
0390      * UV_TF_Stride = align(Width, 128)
0391      * Y_TF_Scanlines = align(Half_height, 32)
0392      * UV_TF_Scanlines = align((Half_height+1)/2, 32)
0393      * Y_UBWC_TF_Plane_size = align(Y_TF_Stride * Y_TF_Scanlines, 4096)
0394      * UV_UBWC_TF_Plane_size = align(UV_TF_Stride * UV_TF_Scanlines, 4096)
0395      * Y_TF_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
0396      * Y_TF_Meta_Scanlines = align(roundup(Half_height, Y_TileHeight), 16)
0397      * Y_TF_Meta_Plane_size =
0398      *     align(Y_TF_Meta_Stride * Y_TF_Meta_Scanlines, 4096)
0399      * UV_TF_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
0400      * UV_TF_Meta_Scanlines = align(roundup(Half_height, UV_TileHeight), 16)
0401      * UV_TF_Meta_Plane_size =
0402      *     align(UV_TF_Meta_Stride * UV_TF_Meta_Scanlines, 4096)
0403      * Y_BF_Stride = align(Width, 128)
0404      * UV_BF_Stride = align(Width, 128)
0405      * Y_BF_Scanlines = align(Half_height, 32)
0406      * UV_BF_Scanlines = align((Half_height+1)/2, 32)
0407      * Y_UBWC_BF_Plane_size = align(Y_BF_Stride * Y_BF_Scanlines, 4096)
0408      * UV_UBWC_BF_Plane_size = align(UV_BF_Stride * UV_BF_Scanlines, 4096)
0409      * Y_BF_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
0410      * Y_BF_Meta_Scanlines = align(roundup(Half_height, Y_TileHeight), 16)
0411      * Y_BF_Meta_Plane_size =
0412      *     align(Y_BF_Meta_Stride * Y_BF_Meta_Scanlines, 4096)
0413      * UV_BF_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
0414      * UV_BF_Meta_Scanlines = align(roundup(Half_height, UV_TileHeight), 16)
0415      * UV_BF_Meta_Plane_size =
0416      *     align(UV_BF_Meta_Stride * UV_BF_Meta_Scanlines, 4096)
0417      * Extradata = 8k
0418      *
0419      * Total size = align( Y_UBWC_TF_Plane_size + UV_UBWC_TF_Plane_size +
0420      *           Y_TF_Meta_Plane_size + UV_TF_Meta_Plane_size +
0421      *           Y_UBWC_BF_Plane_size + UV_UBWC_BF_Plane_size +
0422      *           Y_BF_Meta_Plane_size + UV_BF_Meta_Plane_size +
0423      *           + max(Extradata, Y_TF_Stride * 48), 4096)
0424      */
0425     COLOR_FMT_NV12_UBWC,
0426     /* Venus NV12 10-bit UBWC:
0427      * Compressed Macro-tile format for NV12.
0428      * Contains 4 planes in the following order -
0429      * (A) Y_Meta_Plane
0430      * (B) Y_UBWC_Plane
0431      * (C) UV_Meta_Plane
0432      * (D) UV_UBWC_Plane
0433      *
0434      * Y_Meta_Plane consists of meta information to decode compressed
0435      * tile data in Y_UBWC_Plane.
0436      * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
0437      * UBWC decoder block will use the Y_Meta_Plane data together with
0438      * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples.
0439      *
0440      * UV_Meta_Plane consists of meta information to decode compressed
0441      * tile data in UV_UBWC_Plane.
0442      * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
0443      * UBWC decoder block will use UV_Meta_Plane data together with
0444      * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2
0445      * subsampled color difference samples.
0446      *
0447      * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
0448      * and randomly accessible. There is no dependency between tiles.
0449      *
0450      * <----- Y_Meta_Stride ----->
0451      * <-------- Width ------>
0452      * M M M M M M M M M M M M . .      ^           ^
0453      * M M M M M M M M M M M M . .      |           |
0454      * M M M M M M M M M M M M . .      Height      |
0455      * M M M M M M M M M M M M . .      |         Meta_Y_Scanlines
0456      * M M M M M M M M M M M M . .      |           |
0457      * M M M M M M M M M M M M . .      |           |
0458      * M M M M M M M M M M M M . .      |           |
0459      * M M M M M M M M M M M M . .      V           |
0460      * . . . . . . . . . . . . . .                  |
0461      * . . . . . . . . . . . . . .                  |
0462      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0463      * . . . . . . . . . . . . . .                  V
0464      * <--Compressed tile Y Stride--->
0465      * <------- Width ------->
0466      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^
0467      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0468      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  Height      |
0469      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_Scanlines
0470      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0471      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0472      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0473      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |
0474      * . . . . . . . . . . . . . . . .              |
0475      * . . . . . . . . . . . . . . . .              |
0476      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0477      * . . . . . . . . . . . . . . . .              V
0478      * <----- UV_Meta_Stride ---->
0479      * M M M M M M M M M M M M . .      ^
0480      * M M M M M M M M M M M M . .      |
0481      * M M M M M M M M M M M M . .      |
0482      * M M M M M M M M M M M M . .      M_UV_Scanlines
0483      * . . . . . . . . . . . . . .      |
0484      * . . . . . . . . . . . . . .      V
0485      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0486      * <--Compressed tile UV Stride--->
0487      * U* V* U* V* U* V* U* V* . . . .  ^
0488      * U* V* U* V* U* V* U* V* . . . .  |
0489      * U* V* U* V* U* V* U* V* . . . .  |
0490      * U* V* U* V* U* V* U* V* . . . .  UV_Scanlines
0491      * . . . . . . . . . . . . . . . .  |
0492      * . . . . . . . . . . . . . . . .  V
0493      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0494      *
0495      *
0496      * Y_Stride = align(Width * 4/3, 128)
0497      * UV_Stride = align(Width * 4/3, 128)
0498      * Y_Scanlines = align(Height, 32)
0499      * UV_Scanlines = align(Height/2, 16)
0500      * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)
0501      * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)
0502      * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
0503      * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
0504      * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
0505      * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
0506      * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
0507      * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
0508      * Extradata = 8k
0509      *
0510      * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +
0511      *           Y_Meta_Plane_size + UV_Meta_Plane_size
0512      *           + max(Extradata, Y_Stride * 48), 4096)
0513      */
0514     COLOR_FMT_NV12_BPP10_UBWC,
0515     /* Venus RGBA8888 format:
0516      * Contains 1 plane in the following order -
0517      * (A) RGBA plane
0518      *
0519      * <-------- RGB_Stride -------->
0520      * <------- Width ------->
0521      * R R R R R R R R R R R R . . . .  ^           ^
0522      * R R R R R R R R R R R R . . . .  |           |
0523      * R R R R R R R R R R R R . . . .  Height      |
0524      * R R R R R R R R R R R R . . . .  |       RGB_Scanlines
0525      * R R R R R R R R R R R R . . . .  |           |
0526      * R R R R R R R R R R R R . . . .  |           |
0527      * R R R R R R R R R R R R . . . .  |           |
0528      * R R R R R R R R R R R R . . . .  V           |
0529      * . . . . . . . . . . . . . . . .              |
0530      * . . . . . . . . . . . . . . . .              |
0531      * . . . . . . . . . . . . . . . .              |
0532      * . . . . . . . . . . . . . . . .              V
0533      *
0534      * RGB_Stride = align(Width * 4, 128)
0535      * RGB_Scanlines = align(Height, 32)
0536      * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
0537      * Extradata = 8k
0538      *
0539      * Total size = align(RGB_Plane_size + Extradata, 4096)
0540      */
0541     COLOR_FMT_RGBA8888,
0542     /* Venus RGBA8888 UBWC format:
0543      * Contains 2 planes in the following order -
0544      * (A) Meta plane
0545      * (B) RGBA plane
0546      *
0547      * <--- RGB_Meta_Stride ---->
0548      * <-------- Width ------>
0549      * M M M M M M M M M M M M . .      ^           ^
0550      * M M M M M M M M M M M M . .      |           |
0551      * M M M M M M M M M M M M . .      Height      |
0552      * M M M M M M M M M M M M . .      |       Meta_RGB_Scanlines
0553      * M M M M M M M M M M M M . .      |           |
0554      * M M M M M M M M M M M M . .      |           |
0555      * M M M M M M M M M M M M . .      |           |
0556      * M M M M M M M M M M M M . .      V           |
0557      * . . . . . . . . . . . . . .                  |
0558      * . . . . . . . . . . . . . .                  |
0559      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0560      * . . . . . . . . . . . . . .                  V
0561      * <-------- RGB_Stride -------->
0562      * <------- Width ------->
0563      * R R R R R R R R R R R R . . . .  ^           ^
0564      * R R R R R R R R R R R R . . . .  |           |
0565      * R R R R R R R R R R R R . . . .  Height      |
0566      * R R R R R R R R R R R R . . . .  |       RGB_Scanlines
0567      * R R R R R R R R R R R R . . . .  |           |
0568      * R R R R R R R R R R R R . . . .  |           |
0569      * R R R R R R R R R R R R . . . .  |           |
0570      * R R R R R R R R R R R R . . . .  V           |
0571      * . . . . . . . . . . . . . . . .              |
0572      * . . . . . . . . . . . . . . . .              |
0573      * . . . . . . . . . . . . . . . .    -------> Buffer size aligned to 4k
0574      * . . . . . . . . . . . . . . . .              V
0575      *
0576      * RGB_Stride = align(Width * 4, 128)
0577      * RGB_Scanlines = align(Height, 32)
0578      * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
0579      * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
0580      * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
0581      * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
0582      *      RGB_Meta_Scanlines, 4096)
0583      * Extradata = 8k
0584      *
0585      * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
0586      *      Extradata, 4096)
0587      */
0588     COLOR_FMT_RGBA8888_UBWC,
0589     /* Venus RGBA1010102 UBWC format:
0590      * Contains 2 planes in the following order -
0591      * (A) Meta plane
0592      * (B) RGBA plane
0593      *
0594      * <--- RGB_Meta_Stride ---->
0595      * <-------- Width ------>
0596      * M M M M M M M M M M M M . .      ^           ^
0597      * M M M M M M M M M M M M . .      |           |
0598      * M M M M M M M M M M M M . .      Height      |
0599      * M M M M M M M M M M M M . .      |       Meta_RGB_Scanlines
0600      * M M M M M M M M M M M M . .      |           |
0601      * M M M M M M M M M M M M . .      |           |
0602      * M M M M M M M M M M M M . .      |           |
0603      * M M M M M M M M M M M M . .      V           |
0604      * . . . . . . . . . . . . . .                  |
0605      * . . . . . . . . . . . . . .                  |
0606      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0607      * . . . . . . . . . . . . . .                  V
0608      * <-------- RGB_Stride -------->
0609      * <------- Width ------->
0610      * R R R R R R R R R R R R . . . .  ^           ^
0611      * R R R R R R R R R R R R . . . .  |           |
0612      * R R R R R R R R R R R R . . . .  Height      |
0613      * R R R R R R R R R R R R . . . .  |       RGB_Scanlines
0614      * R R R R R R R R R R R R . . . .  |           |
0615      * R R R R R R R R R R R R . . . .  |           |
0616      * R R R R R R R R R R R R . . . .  |           |
0617      * R R R R R R R R R R R R . . . .  V           |
0618      * . . . . . . . . . . . . . . . .              |
0619      * . . . . . . . . . . . . . . . .              |
0620      * . . . . . . . . . . . . . . . .    -------> Buffer size aligned to 4k
0621      * . . . . . . . . . . . . . . . .              V
0622      *
0623      * RGB_Stride = align(Width * 4, 256)
0624      * RGB_Scanlines = align(Height, 16)
0625      * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
0626      * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
0627      * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
0628      * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
0629      *      RGB_Meta_Scanlines, 4096)
0630      * Extradata = 8k
0631      *
0632      * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
0633      *      Extradata, 4096)
0634      */
0635     COLOR_FMT_RGBA1010102_UBWC,
0636     /* Venus RGB565 UBWC format:
0637      * Contains 2 planes in the following order -
0638      * (A) Meta plane
0639      * (B) RGB plane
0640      *
0641      * <--- RGB_Meta_Stride ---->
0642      * <-------- Width ------>
0643      * M M M M M M M M M M M M . .      ^           ^
0644      * M M M M M M M M M M M M . .      |           |
0645      * M M M M M M M M M M M M . .      Height      |
0646      * M M M M M M M M M M M M . .      |       Meta_RGB_Scanlines
0647      * M M M M M M M M M M M M . .      |           |
0648      * M M M M M M M M M M M M . .      |           |
0649      * M M M M M M M M M M M M . .      |           |
0650      * M M M M M M M M M M M M . .      V           |
0651      * . . . . . . . . . . . . . .                  |
0652      * . . . . . . . . . . . . . .                  |
0653      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0654      * . . . . . . . . . . . . . .                  V
0655      * <-------- RGB_Stride -------->
0656      * <------- Width ------->
0657      * R R R R R R R R R R R R . . . .  ^           ^
0658      * R R R R R R R R R R R R . . . .  |           |
0659      * R R R R R R R R R R R R . . . .  Height      |
0660      * R R R R R R R R R R R R . . . .  |       RGB_Scanlines
0661      * R R R R R R R R R R R R . . . .  |           |
0662      * R R R R R R R R R R R R . . . .  |           |
0663      * R R R R R R R R R R R R . . . .  |           |
0664      * R R R R R R R R R R R R . . . .  V           |
0665      * . . . . . . . . . . . . . . . .              |
0666      * . . . . . . . . . . . . . . . .              |
0667      * . . . . . . . . . . . . . . . .    -------> Buffer size aligned to 4k
0668      * . . . . . . . . . . . . . . . .              V
0669      *
0670      * RGB_Stride = align(Width * 2, 128)
0671      * RGB_Scanlines = align(Height, 16)
0672      * RGB_Plane_size = align(RGB_Stride * RGB_Scanlines, 4096)
0673      * RGB_Meta_Stride = align(roundup(Width, RGB_TileWidth), 64)
0674      * RGB_Meta_Scanline = align(roundup(Height, RGB_TileHeight), 16)
0675      * RGB_Meta_Plane_size = align(RGB_Meta_Stride *
0676      *      RGB_Meta_Scanlines, 4096)
0677      * Extradata = 8k
0678      *
0679      * Total size = align(RGB_Meta_Plane_size + RGB_Plane_size +
0680      *      Extradata, 4096)
0681      */
0682     COLOR_FMT_RGB565_UBWC,
0683     /* P010 UBWC:
0684      * Compressed Macro-tile format for NV12.
0685      * Contains 4 planes in the following order -
0686      * (A) Y_Meta_Plane
0687      * (B) Y_UBWC_Plane
0688      * (C) UV_Meta_Plane
0689      * (D) UV_UBWC_Plane
0690      *
0691      * Y_Meta_Plane consists of meta information to decode compressed
0692      * tile data in Y_UBWC_Plane.
0693      * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
0694      * UBWC decoder block will use the Y_Meta_Plane data together with
0695      * Y_UBWC_Plane data to produce loss-less uncompressed 10 bit Y samples.
0696      *
0697      * UV_Meta_Plane consists of meta information to decode compressed
0698      * tile data in UV_UBWC_Plane.
0699      * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
0700      * UBWC decoder block will use UV_Meta_Plane data together with
0701      * UV_UBWC_Plane data to produce loss-less uncompressed 10 bit 2x2
0702      * subsampled color difference samples.
0703      *
0704      * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
0705      * and randomly accessible. There is no dependency between tiles.
0706      *
0707      * <----- Y_Meta_Stride ----->
0708      * <-------- Width ------>
0709      * M M M M M M M M M M M M . .      ^           ^
0710      * M M M M M M M M M M M M . .      |           |
0711      * M M M M M M M M M M M M . .      Height      |
0712      * M M M M M M M M M M M M . .      |         Meta_Y_Scanlines
0713      * M M M M M M M M M M M M . .      |           |
0714      * M M M M M M M M M M M M . .      |           |
0715      * M M M M M M M M M M M M . .      |           |
0716      * M M M M M M M M M M M M . .      V           |
0717      * . . . . . . . . . . . . . .                  |
0718      * . . . . . . . . . . . . . .                  |
0719      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0720      * . . . . . . . . . . . . . .                  V
0721      * <--Compressed tile Y Stride--->
0722      * <------- Width ------->
0723      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^
0724      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0725      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  Height      |
0726      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile_Y_Scanlines
0727      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0728      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0729      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
0730      * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |
0731      * . . . . . . . . . . . . . . . .              |
0732      * . . . . . . . . . . . . . . . .              |
0733      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0734      * . . . . . . . . . . . . . . . .              V
0735      * <----- UV_Meta_Stride ---->
0736      * M M M M M M M M M M M M . .      ^
0737      * M M M M M M M M M M M M . .      |
0738      * M M M M M M M M M M M M . .      |
0739      * M M M M M M M M M M M M . .      M_UV_Scanlines
0740      * . . . . . . . . . . . . . .      |
0741      * . . . . . . . . . . . . . .      V
0742      * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
0743      * <--Compressed tile UV Stride--->
0744      * U* V* U* V* U* V* U* V* . . . .  ^
0745      * U* V* U* V* U* V* U* V* . . . .  |
0746      * U* V* U* V* U* V* U* V* . . . .  |
0747      * U* V* U* V* U* V* U* V* . . . .  UV_Scanlines
0748      * . . . . . . . . . . . . . . . .  |
0749      * . . . . . . . . . . . . . . . .  V
0750      * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
0751      *
0752      *
0753      * Y_Stride = align(Width * 2, 256)
0754      * UV_Stride = align(Width * 2, 256)
0755      * Y_Scanlines = align(Height, 16)
0756      * UV_Scanlines = align(Height/2, 16)
0757      * Y_UBWC_Plane_Size = align(Y_Stride * Y_Scanlines, 4096)
0758      * UV_UBWC_Plane_Size = align(UV_Stride * UV_Scanlines, 4096)
0759      * Y_Meta_Stride = align(roundup(Width, Y_TileWidth), 64)
0760      * Y_Meta_Scanlines = align(roundup(Height, Y_TileHeight), 16)
0761      * Y_Meta_Plane_size = align(Y_Meta_Stride * Y_Meta_Scanlines, 4096)
0762      * UV_Meta_Stride = align(roundup(Width, UV_TileWidth), 64)
0763      * UV_Meta_Scanlines = align(roundup(Height, UV_TileHeight), 16)
0764      * UV_Meta_Plane_size = align(UV_Meta_Stride * UV_Meta_Scanlines, 4096)
0765      * Extradata = 8k
0766      *
0767      * Total size = align(Y_UBWC_Plane_size + UV_UBWC_Plane_size +
0768      *           Y_Meta_Plane_size + UV_Meta_Plane_size
0769      *           + max(Extradata, Y_Stride * 48), 4096)
0770      */
0771     COLOR_FMT_P010_UBWC,
0772     /* Venus P010:
0773      * YUV 4:2:0 image with a plane of 10 bit Y samples followed
0774      * by an interleaved U/V plane containing 10 bit 2x2 subsampled
0775      * colour difference samples.
0776      *
0777      * <-------- Y/UV_Stride -------->
0778      * <------- Width ------->
0779      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  ^           ^
0780      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0781      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  Height      |
0782      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |          Y_Scanlines
0783      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0784      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0785      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  |           |
0786      * Y Y Y Y Y Y Y Y Y Y Y Y . . . .  V           |
0787      * . . . . . . . . . . . . . . . .              |
0788      * . . . . . . . . . . . . . . . .              |
0789      * . . . . . . . . . . . . . . . .              |
0790      * . . . . . . . . . . . . . . . .              V
0791      * U V U V U V U V U V U V . . . .  ^
0792      * U V U V U V U V U V U V . . . .  |
0793      * U V U V U V U V U V U V . . . .  |
0794      * U V U V U V U V U V U V . . . .  UV_Scanlines
0795      * . . . . . . . . . . . . . . . .  |
0796      * . . . . . . . . . . . . . . . .  V
0797      * . . . . . . . . . . . . . . . .  --> Buffer size alignment
0798      *
0799      * Y_Stride : Width * 2 aligned to 128
0800      * UV_Stride : Width * 2 aligned to 128
0801      * Y_Scanlines: Height aligned to 32
0802      * UV_Scanlines: Height/2 aligned to 16
0803      * Extradata: Arbitrary (software-imposed) padding
0804      * Total size = align((Y_Stride * Y_Scanlines
0805      *          + UV_Stride * UV_Scanlines
0806      *          + max(Extradata, Y_Stride * 8), 4096)
0807      */
0808     COLOR_FMT_P010,
0809 };
0810 
0811 #define COLOR_FMT_RGBA1010102_UBWC  COLOR_FMT_RGBA1010102_UBWC
0812 #define COLOR_FMT_RGB565_UBWC       COLOR_FMT_RGB565_UBWC
0813 #define COLOR_FMT_P010_UBWC     COLOR_FMT_P010_UBWC
0814 #define COLOR_FMT_P010      COLOR_FMT_P010
0815 
0816 /*
0817  * Function arguments:
0818  * @color_fmt
0819  * @width
0820  * Progressive: width
0821  * Interlaced: width
0822  */
0823 static unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
0824 {
0825     unsigned int stride = 0;
0826 
0827     if (!width)
0828         return 0;
0829 
0830     switch (color_fmt) {
0831     case COLOR_FMT_NV21:
0832     case COLOR_FMT_NV12:
0833     case COLOR_FMT_NV12_MVTB:
0834     case COLOR_FMT_NV12_UBWC:
0835         stride = MSM_MEDIA_ALIGN(width, 128);
0836         break;
0837     case COLOR_FMT_NV12_BPP10_UBWC:
0838         stride = MSM_MEDIA_ALIGN(width, 192);
0839         stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
0840         break;
0841     case COLOR_FMT_P010_UBWC:
0842         stride = MSM_MEDIA_ALIGN(width * 2, 256);
0843         break;
0844     case COLOR_FMT_P010:
0845         stride = MSM_MEDIA_ALIGN(width * 2, 128);
0846         break;
0847     }
0848 
0849     return stride;
0850 }
0851 
0852 /*
0853  * Function arguments:
0854  * @color_fmt
0855  * @width
0856  * Progressive: width
0857  * Interlaced: width
0858  */
0859 static unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
0860 {
0861     unsigned int stride = 0;
0862 
0863     if (!width)
0864         return 0;
0865 
0866     switch (color_fmt) {
0867     case COLOR_FMT_NV21:
0868     case COLOR_FMT_NV12:
0869     case COLOR_FMT_NV12_MVTB:
0870     case COLOR_FMT_NV12_UBWC:
0871         stride = MSM_MEDIA_ALIGN(width, 128);
0872         break;
0873     case COLOR_FMT_NV12_BPP10_UBWC:
0874         stride = MSM_MEDIA_ALIGN(width, 192);
0875         stride = MSM_MEDIA_ALIGN(stride * 4 / 3, 256);
0876         break;
0877     case COLOR_FMT_P010_UBWC:
0878         stride = MSM_MEDIA_ALIGN(width * 2, 256);
0879         break;
0880     case COLOR_FMT_P010:
0881         stride = MSM_MEDIA_ALIGN(width * 2, 128);
0882         break;
0883     }
0884 
0885     return stride;
0886 }
0887 
0888 /*
0889  * Function arguments:
0890  * @color_fmt
0891  * @height
0892  * Progressive: height
0893  * Interlaced: (height+1)>>1
0894  */
0895 static unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)
0896 {
0897     unsigned int sclines = 0;
0898 
0899     if (!height)
0900         return 0;
0901 
0902     switch (color_fmt) {
0903     case COLOR_FMT_NV21:
0904     case COLOR_FMT_NV12:
0905     case COLOR_FMT_NV12_MVTB:
0906     case COLOR_FMT_NV12_UBWC:
0907     case COLOR_FMT_P010:
0908         sclines = MSM_MEDIA_ALIGN(height, 32);
0909         break;
0910     case COLOR_FMT_NV12_BPP10_UBWC:
0911     case COLOR_FMT_P010_UBWC:
0912         sclines = MSM_MEDIA_ALIGN(height, 16);
0913         break;
0914     }
0915 
0916     return sclines;
0917 }
0918 
0919 /*
0920  * Function arguments:
0921  * @color_fmt
0922  * @height
0923  * Progressive: height
0924  * Interlaced: (height+1)>>1
0925  */
0926 static unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
0927 {
0928     unsigned int sclines = 0;
0929 
0930     if (!height)
0931         return 0;
0932 
0933     switch (color_fmt) {
0934     case COLOR_FMT_NV21:
0935     case COLOR_FMT_NV12:
0936     case COLOR_FMT_NV12_MVTB:
0937     case COLOR_FMT_NV12_BPP10_UBWC:
0938     case COLOR_FMT_P010_UBWC:
0939     case COLOR_FMT_P010:
0940         sclines = MSM_MEDIA_ALIGN((height + 1) >> 1, 16);
0941         break;
0942     case COLOR_FMT_NV12_UBWC:
0943         sclines = MSM_MEDIA_ALIGN((height + 1) >> 1, 32);
0944         break;
0945     }
0946 
0947     return sclines;
0948 }
0949 
0950 /*
0951  * Function arguments:
0952  * @color_fmt
0953  * @width
0954  * Progressive: width
0955  * Interlaced: width
0956  */
0957 static unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
0958 {
0959     int y_tile_width = 0, y_meta_stride;
0960 
0961     if (!width)
0962         return 0;
0963 
0964     switch (color_fmt) {
0965     case COLOR_FMT_NV12_UBWC:
0966     case COLOR_FMT_P010_UBWC:
0967         y_tile_width = 32;
0968         break;
0969     case COLOR_FMT_NV12_BPP10_UBWC:
0970         y_tile_width = 48;
0971         break;
0972     default:
0973         return 0;
0974     }
0975 
0976     y_meta_stride = MSM_MEDIA_ROUNDUP(width, y_tile_width);
0977     return MSM_MEDIA_ALIGN(y_meta_stride, 64);
0978 }
0979 
0980 /*
0981  * Function arguments:
0982  * @color_fmt
0983  * @height
0984  * Progressive: height
0985  * Interlaced: (height+1)>>1
0986  */
0987 static unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
0988 {
0989     int y_tile_height = 0, y_meta_scanlines;
0990 
0991     if (!height)
0992         return 0;
0993 
0994     switch (color_fmt) {
0995     case COLOR_FMT_NV12_UBWC:
0996         y_tile_height = 8;
0997         break;
0998     case COLOR_FMT_NV12_BPP10_UBWC:
0999     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_fmt
1013  * @width
1014  * Progressive: width
1015  * Interlaced: width
1016  */
1017 static 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_fmt
1043  * @height
1044  * Progressive: height
1045  * Interlaced: (height+1)>>1
1046  */
1047 static 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 
1070 static 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 
1096 static 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 
1119 static 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 
1137 static 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 #endif