hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/gpu/drm/msm/disp/dpu1/msm_media_info.h
....@@ -813,18 +813,6 @@
813813 #define COLOR_FMT_P010_UBWC COLOR_FMT_P010_UBWC
814814 #define COLOR_FMT_P010 COLOR_FMT_P010
815815
816
-static inline unsigned int VENUS_EXTRADATA_SIZE(int width, int height)
817
-{
818
- (void)height;
819
- (void)width;
820
-
821
- /*
822
- * In the future, calculate the size based on the w/h but just
823
- * hardcode it for now since 16K satisfies all current usecases.
824
- */
825
- return 16 * 1024;
826
-}
827
-
828816 /*
829817 * Function arguments:
830818 * @color_fmt
....@@ -832,114 +820,99 @@
832820 * Progressive: width
833821 * Interlaced: width
834822 */
835
-static inline unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
823
+static unsigned int VENUS_Y_STRIDE(int color_fmt, int width)
836824 {
837
- unsigned int alignment, stride = 0;
825
+ unsigned int stride = 0;
838826
839827 if (!width)
840
- goto invalid_input;
841
-
842
- switch (color_fmt) {
843
- case COLOR_FMT_NV21:
844
- case COLOR_FMT_NV12:
845
- case COLOR_FMT_NV12_MVTB:
846
- case COLOR_FMT_NV12_UBWC:
847
- alignment = 128;
848
- stride = MSM_MEDIA_ALIGN(width, alignment);
849
- break;
850
- case COLOR_FMT_NV12_BPP10_UBWC:
851
- alignment = 256;
852
- stride = MSM_MEDIA_ALIGN(width, 192);
853
- stride = MSM_MEDIA_ALIGN(stride * 4/3, alignment);
854
- break;
855
- case COLOR_FMT_P010_UBWC:
856
- alignment = 256;
857
- stride = MSM_MEDIA_ALIGN(width * 2, alignment);
858
- break;
859
- case COLOR_FMT_P010:
860
- alignment = 128;
861
- stride = MSM_MEDIA_ALIGN(width*2, alignment);
862
- break;
863
- default:
864
- break;
865
- }
866
-invalid_input:
867
- return stride;
868
-}
869
-
870
-/*
871
- * Function arguments:
872
- * @color_fmt
873
- * @width
874
- * Progressive: width
875
- * Interlaced: width
876
- */
877
-static inline unsigned int VENUS_UV_STRIDE(int color_fmt, int width)
878
-{
879
- unsigned int alignment, stride = 0;
880
-
881
- if (!width)
882
- goto invalid_input;
883
-
884
- switch (color_fmt) {
885
- case COLOR_FMT_NV21:
886
- case COLOR_FMT_NV12:
887
- case COLOR_FMT_NV12_MVTB:
888
- case COLOR_FMT_NV12_UBWC:
889
- alignment = 128;
890
- stride = MSM_MEDIA_ALIGN(width, alignment);
891
- break;
892
- case COLOR_FMT_NV12_BPP10_UBWC:
893
- alignment = 256;
894
- stride = MSM_MEDIA_ALIGN(width, 192);
895
- stride = MSM_MEDIA_ALIGN(stride * 4/3, alignment);
896
- break;
897
- case COLOR_FMT_P010_UBWC:
898
- alignment = 256;
899
- stride = MSM_MEDIA_ALIGN(width * 2, alignment);
900
- break;
901
- case COLOR_FMT_P010:
902
- alignment = 128;
903
- stride = MSM_MEDIA_ALIGN(width*2, alignment);
904
- break;
905
- default:
906
- break;
907
- }
908
-invalid_input:
909
- return stride;
910
-}
911
-
912
-/*
913
- * Function arguments:
914
- * @color_fmt
915
- * @height
916
- * Progressive: height
917
- * Interlaced: (height+1)>>1
918
- */
919
-static inline unsigned int VENUS_Y_SCANLINES(int color_fmt, int height)
920
-{
921
- unsigned int alignment, sclines = 0;
922
-
923
- if (!height)
924
- goto invalid_input;
925
-
926
- switch (color_fmt) {
927
- case COLOR_FMT_NV21:
928
- case COLOR_FMT_NV12:
929
- case COLOR_FMT_NV12_MVTB:
930
- case COLOR_FMT_NV12_UBWC:
931
- case COLOR_FMT_P010:
932
- alignment = 32;
933
- break;
934
- case COLOR_FMT_NV12_BPP10_UBWC:
935
- case COLOR_FMT_P010_UBWC:
936
- alignment = 16;
937
- break;
938
- default:
939828 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;
940847 }
941
- sclines = MSM_MEDIA_ALIGN(height, alignment);
942
-invalid_input:
848
+
849
+ return stride;
850
+}
851
+
852
+/*
853
+ * Function arguments:
854
+ * @color_fmt
855
+ * @width
856
+ * Progressive: width
857
+ * Interlaced: width
858
+ */
859
+static 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_fmt
891
+ * @height
892
+ * Progressive: height
893
+ * Interlaced: (height+1)>>1
894
+ */
895
+static 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
+
943916 return sclines;
944917 }
945918
....@@ -950,12 +923,12 @@
950923 * Progressive: height
951924 * Interlaced: (height+1)>>1
952925 */
953
-static inline unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
926
+static unsigned int VENUS_UV_SCANLINES(int color_fmt, int height)
954927 {
955
- unsigned int alignment, sclines = 0;
928
+ unsigned int sclines = 0;
956929
957930 if (!height)
958
- goto invalid_input;
931
+ return 0;
959932
960933 switch (color_fmt) {
961934 case COLOR_FMT_NV21:
....@@ -964,18 +937,13 @@
964937 case COLOR_FMT_NV12_BPP10_UBWC:
965938 case COLOR_FMT_P010_UBWC:
966939 case COLOR_FMT_P010:
967
- alignment = 16;
940
+ sclines = MSM_MEDIA_ALIGN((height + 1) >> 1, 16);
968941 break;
969942 case COLOR_FMT_NV12_UBWC:
970
- alignment = 32;
943
+ sclines = MSM_MEDIA_ALIGN((height + 1) >> 1, 32);
971944 break;
972
- default:
973
- goto invalid_input;
974945 }
975946
976
- sclines = MSM_MEDIA_ALIGN((height+1)>>1, alignment);
977
-
978
-invalid_input:
979947 return sclines;
980948 }
981949
....@@ -986,12 +954,12 @@
986954 * Progressive: width
987955 * Interlaced: width
988956 */
989
-static inline unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
957
+static unsigned int VENUS_Y_META_STRIDE(int color_fmt, int width)
990958 {
991
- int y_tile_width = 0, y_meta_stride = 0;
959
+ int y_tile_width = 0, y_meta_stride;
992960
993961 if (!width)
994
- goto invalid_input;
962
+ return 0;
995963
996964 switch (color_fmt) {
997965 case COLOR_FMT_NV12_UBWC:
....@@ -1002,14 +970,11 @@
1002970 y_tile_width = 48;
1003971 break;
1004972 default:
1005
- goto invalid_input;
973
+ return 0;
1006974 }
1007975
1008976 y_meta_stride = MSM_MEDIA_ROUNDUP(width, y_tile_width);
1009
- y_meta_stride = MSM_MEDIA_ALIGN(y_meta_stride, 64);
1010
-
1011
-invalid_input:
1012
- return y_meta_stride;
977
+ return MSM_MEDIA_ALIGN(y_meta_stride, 64);
1013978 }
1014979
1015980 /*
....@@ -1019,12 +984,12 @@
1019984 * Progressive: height
1020985 * Interlaced: (height+1)>>1
1021986 */
1022
-static inline unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
987
+static unsigned int VENUS_Y_META_SCANLINES(int color_fmt, int height)
1023988 {
1024
- int y_tile_height = 0, y_meta_scanlines = 0;
989
+ int y_tile_height = 0, y_meta_scanlines;
1025990
1026991 if (!height)
1027
- goto invalid_input;
992
+ return 0;
1028993
1029994 switch (color_fmt) {
1030995 case COLOR_FMT_NV12_UBWC:
....@@ -1035,14 +1000,11 @@
10351000 y_tile_height = 4;
10361001 break;
10371002 default:
1038
- goto invalid_input;
1003
+ return 0;
10391004 }
10401005
10411006 y_meta_scanlines = MSM_MEDIA_ROUNDUP(height, y_tile_height);
1042
- y_meta_scanlines = MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
1043
-
1044
-invalid_input:
1045
- return y_meta_scanlines;
1007
+ return MSM_MEDIA_ALIGN(y_meta_scanlines, 16);
10461008 }
10471009
10481010 /*
....@@ -1052,12 +1014,12 @@
10521014 * Progressive: width
10531015 * Interlaced: width
10541016 */
1055
-static inline unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)
1017
+static unsigned int VENUS_UV_META_STRIDE(int color_fmt, int width)
10561018 {
1057
- int uv_tile_width = 0, uv_meta_stride = 0;
1019
+ int uv_tile_width = 0, uv_meta_stride;
10581020
10591021 if (!width)
1060
- goto invalid_input;
1022
+ return 0;
10611023
10621024 switch (color_fmt) {
10631025 case COLOR_FMT_NV12_UBWC:
....@@ -1068,14 +1030,11 @@
10681030 uv_tile_width = 24;
10691031 break;
10701032 default:
1071
- goto invalid_input;
1033
+ return 0;
10721034 }
10731035
10741036 uv_meta_stride = MSM_MEDIA_ROUNDUP((width+1)>>1, uv_tile_width);
1075
- uv_meta_stride = MSM_MEDIA_ALIGN(uv_meta_stride, 64);
1076
-
1077
-invalid_input:
1078
- return uv_meta_stride;
1037
+ return MSM_MEDIA_ALIGN(uv_meta_stride, 64);
10791038 }
10801039
10811040 /*
....@@ -1085,12 +1044,12 @@
10851044 * Progressive: height
10861045 * Interlaced: (height+1)>>1
10871046 */
1088
-static inline unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)
1047
+static unsigned int VENUS_UV_META_SCANLINES(int color_fmt, int height)
10891048 {
1090
- int uv_tile_height = 0, uv_meta_scanlines = 0;
1049
+ int uv_tile_height = 0, uv_meta_scanlines;
10911050
10921051 if (!height)
1093
- goto invalid_input;
1052
+ return 0;
10941053
10951054 switch (color_fmt) {
10961055 case COLOR_FMT_NV12_UBWC:
....@@ -1101,22 +1060,19 @@
11011060 uv_tile_height = 4;
11021061 break;
11031062 default:
1104
- goto invalid_input;
1063
+ return 0;
11051064 }
11061065
11071066 uv_meta_scanlines = MSM_MEDIA_ROUNDUP((height+1)>>1, uv_tile_height);
1108
- uv_meta_scanlines = MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
1109
-
1110
-invalid_input:
1111
- return uv_meta_scanlines;
1067
+ return MSM_MEDIA_ALIGN(uv_meta_scanlines, 16);
11121068 }
11131069
1114
-static inline unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
1070
+static unsigned int VENUS_RGB_STRIDE(int color_fmt, int width)
11151071 {
1116
- unsigned int alignment = 0, stride = 0, bpp = 4;
1072
+ unsigned int alignment = 0, bpp = 4;
11171073
11181074 if (!width)
1119
- goto invalid_input;
1075
+ return 0;
11201076
11211077 switch (color_fmt) {
11221078 case COLOR_FMT_RGBA8888:
....@@ -1131,21 +1087,18 @@
11311087 alignment = 256;
11321088 break;
11331089 default:
1134
- goto invalid_input;
1090
+ return 0;
11351091 }
11361092
1137
- stride = MSM_MEDIA_ALIGN(width * bpp, alignment);
1138
-
1139
-invalid_input:
1140
- return stride;
1093
+ return MSM_MEDIA_ALIGN(width * bpp, alignment);
11411094 }
11421095
1143
-static inline unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)
1096
+static unsigned int VENUS_RGB_SCANLINES(int color_fmt, int height)
11441097 {
1145
- unsigned int alignment = 0, scanlines = 0;
1098
+ unsigned int alignment = 0;
11461099
11471100 if (!height)
1148
- goto invalid_input;
1101
+ return 0;
11491102
11501103 switch (color_fmt) {
11511104 case COLOR_FMT_RGBA8888:
....@@ -1157,220 +1110,46 @@
11571110 alignment = 16;
11581111 break;
11591112 default:
1160
- goto invalid_input;
1113
+ return 0;
11611114 }
11621115
1163
- scanlines = MSM_MEDIA_ALIGN(height, alignment);
1164
-
1165
-invalid_input:
1166
- return scanlines;
1116
+ return MSM_MEDIA_ALIGN(height, alignment);
11671117 }
11681118
1169
-static inline unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)
1119
+static unsigned int VENUS_RGB_META_STRIDE(int color_fmt, int width)
11701120 {
1171
- int rgb_tile_width = 0, rgb_meta_stride = 0;
1121
+ int rgb_meta_stride;
11721122
11731123 if (!width)
1174
- goto invalid_input;
1124
+ return 0;
11751125
11761126 switch (color_fmt) {
11771127 case COLOR_FMT_RGBA8888_UBWC:
11781128 case COLOR_FMT_RGBA1010102_UBWC:
11791129 case COLOR_FMT_RGB565_UBWC:
1180
- rgb_tile_width = 16;
1181
- break;
1182
- default:
1183
- goto invalid_input;
1130
+ rgb_meta_stride = MSM_MEDIA_ROUNDUP(width, 16);
1131
+ return MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
11841132 }
11851133
1186
- rgb_meta_stride = MSM_MEDIA_ROUNDUP(width, rgb_tile_width);
1187
- rgb_meta_stride = MSM_MEDIA_ALIGN(rgb_meta_stride, 64);
1188
-
1189
-invalid_input:
1190
- return rgb_meta_stride;
1134
+ return 0;
11911135 }
11921136
1193
-static inline unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)
1137
+static unsigned int VENUS_RGB_META_SCANLINES(int color_fmt, int height)
11941138 {
1195
- int rgb_tile_height = 0, rgb_meta_scanlines = 0;
1139
+ int rgb_meta_scanlines;
11961140
11971141 if (!height)
1198
- goto invalid_input;
1142
+ return 0;
11991143
12001144 switch (color_fmt) {
12011145 case COLOR_FMT_RGBA8888_UBWC:
12021146 case COLOR_FMT_RGBA1010102_UBWC:
12031147 case COLOR_FMT_RGB565_UBWC:
1204
- rgb_tile_height = 4;
1205
- break;
1206
- default:
1207
- goto invalid_input;
1148
+ rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(height, 4);
1149
+ return MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
12081150 }
12091151
1210
- rgb_meta_scanlines = MSM_MEDIA_ROUNDUP(height, rgb_tile_height);
1211
- rgb_meta_scanlines = MSM_MEDIA_ALIGN(rgb_meta_scanlines, 16);
1212
-
1213
-invalid_input:
1214
- return rgb_meta_scanlines;
1215
-}
1216
-
1217
-/*
1218
- * Function arguments:
1219
- * @color_fmt
1220
- * @width
1221
- * Progressive: width
1222
- * Interlaced: width
1223
- * @height
1224
- * Progressive: height
1225
- * Interlaced: height
1226
- */
1227
-static inline unsigned int VENUS_BUFFER_SIZE(
1228
- int color_fmt, int width, int height)
1229
-{
1230
- const unsigned int extra_size = VENUS_EXTRADATA_SIZE(width, height);
1231
- unsigned int uv_alignment = 0, size = 0;
1232
- unsigned int y_plane, uv_plane, y_stride,
1233
- uv_stride, y_sclines, uv_sclines;
1234
- unsigned int y_ubwc_plane = 0, uv_ubwc_plane = 0;
1235
- unsigned int y_meta_stride = 0, y_meta_scanlines = 0;
1236
- unsigned int uv_meta_stride = 0, uv_meta_scanlines = 0;
1237
- unsigned int y_meta_plane = 0, uv_meta_plane = 0;
1238
- unsigned int rgb_stride = 0, rgb_scanlines = 0;
1239
- unsigned int rgb_plane = 0, rgb_ubwc_plane = 0, rgb_meta_plane = 0;
1240
- unsigned int rgb_meta_stride = 0, rgb_meta_scanlines = 0;
1241
-
1242
- if (!width || !height)
1243
- goto invalid_input;
1244
-
1245
- y_stride = VENUS_Y_STRIDE(color_fmt, width);
1246
- uv_stride = VENUS_UV_STRIDE(color_fmt, width);
1247
- y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
1248
- uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
1249
- rgb_stride = VENUS_RGB_STRIDE(color_fmt, width);
1250
- rgb_scanlines = VENUS_RGB_SCANLINES(color_fmt, height);
1251
-
1252
- switch (color_fmt) {
1253
- case COLOR_FMT_NV21:
1254
- case COLOR_FMT_NV12:
1255
- case COLOR_FMT_P010:
1256
- uv_alignment = 4096;
1257
- y_plane = y_stride * y_sclines;
1258
- uv_plane = uv_stride * uv_sclines + uv_alignment;
1259
- size = y_plane + uv_plane +
1260
- MSM_MEDIA_MAX(extra_size, 8 * y_stride);
1261
- size = MSM_MEDIA_ALIGN(size, 4096);
1262
- break;
1263
- case COLOR_FMT_NV12_MVTB:
1264
- uv_alignment = 4096;
1265
- y_plane = y_stride * y_sclines;
1266
- uv_plane = uv_stride * uv_sclines + uv_alignment;
1267
- size = y_plane + uv_plane;
1268
- size = 2 * size + extra_size;
1269
- size = MSM_MEDIA_ALIGN(size, 4096);
1270
- break;
1271
- case COLOR_FMT_NV12_UBWC:
1272
- y_sclines = VENUS_Y_SCANLINES(color_fmt, (height+1)>>1);
1273
- y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
1274
- uv_sclines = VENUS_UV_SCANLINES(color_fmt, (height+1)>>1);
1275
- uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
1276
- y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
1277
- y_meta_scanlines =
1278
- VENUS_Y_META_SCANLINES(color_fmt, (height+1)>>1);
1279
- y_meta_plane = MSM_MEDIA_ALIGN(
1280
- y_meta_stride * y_meta_scanlines, 4096);
1281
- uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
1282
- uv_meta_scanlines =
1283
- VENUS_UV_META_SCANLINES(color_fmt, (height+1)>>1);
1284
- uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
1285
- uv_meta_scanlines, 4096);
1286
-
1287
- size = (y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
1288
- uv_meta_plane)*2 +
1289
- MSM_MEDIA_MAX(extra_size + 8192, 48 * y_stride);
1290
- size = MSM_MEDIA_ALIGN(size, 4096);
1291
- break;
1292
- case COLOR_FMT_NV12_BPP10_UBWC:
1293
- y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
1294
- uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
1295
- y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
1296
- y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt, height);
1297
- y_meta_plane = MSM_MEDIA_ALIGN(
1298
- y_meta_stride * y_meta_scanlines, 4096);
1299
- uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
1300
- uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt, height);
1301
- uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
1302
- uv_meta_scanlines, 4096);
1303
-
1304
- size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
1305
- uv_meta_plane +
1306
- MSM_MEDIA_MAX(extra_size + 8192, 48 * y_stride);
1307
- size = MSM_MEDIA_ALIGN(size, 4096);
1308
- break;
1309
- case COLOR_FMT_P010_UBWC:
1310
- y_ubwc_plane = MSM_MEDIA_ALIGN(y_stride * y_sclines, 4096);
1311
- uv_ubwc_plane = MSM_MEDIA_ALIGN(uv_stride * uv_sclines, 4096);
1312
- y_meta_stride = VENUS_Y_META_STRIDE(color_fmt, width);
1313
- y_meta_scanlines = VENUS_Y_META_SCANLINES(color_fmt, height);
1314
- y_meta_plane = MSM_MEDIA_ALIGN(
1315
- y_meta_stride * y_meta_scanlines, 4096);
1316
- uv_meta_stride = VENUS_UV_META_STRIDE(color_fmt, width);
1317
- uv_meta_scanlines = VENUS_UV_META_SCANLINES(color_fmt, height);
1318
- uv_meta_plane = MSM_MEDIA_ALIGN(uv_meta_stride *
1319
- uv_meta_scanlines, 4096);
1320
-
1321
- size = y_ubwc_plane + uv_ubwc_plane + y_meta_plane +
1322
- uv_meta_plane;
1323
- size = MSM_MEDIA_ALIGN(size, 4096);
1324
- break;
1325
- case COLOR_FMT_RGBA8888:
1326
- rgb_plane = MSM_MEDIA_ALIGN(rgb_stride * rgb_scanlines, 4096);
1327
- size = rgb_plane;
1328
- size = MSM_MEDIA_ALIGN(size, 4096);
1329
- break;
1330
- case COLOR_FMT_RGBA8888_UBWC:
1331
- case COLOR_FMT_RGBA1010102_UBWC:
1332
- case COLOR_FMT_RGB565_UBWC:
1333
- rgb_ubwc_plane = MSM_MEDIA_ALIGN(rgb_stride * rgb_scanlines,
1334
- 4096);
1335
- rgb_meta_stride = VENUS_RGB_META_STRIDE(color_fmt, width);
1336
- rgb_meta_scanlines = VENUS_RGB_META_SCANLINES(color_fmt,
1337
- height);
1338
- rgb_meta_plane = MSM_MEDIA_ALIGN(rgb_meta_stride *
1339
- rgb_meta_scanlines, 4096);
1340
- size = rgb_ubwc_plane + rgb_meta_plane;
1341
- size = MSM_MEDIA_ALIGN(size, 4096);
1342
- break;
1343
- default:
1344
- break;
1345
- }
1346
-invalid_input:
1347
- return size;
1348
-}
1349
-
1350
-static inline unsigned int VENUS_VIEW2_OFFSET(
1351
- int color_fmt, int width, int height)
1352
-{
1353
- unsigned int offset = 0;
1354
- unsigned int y_plane, uv_plane, y_stride,
1355
- uv_stride, y_sclines, uv_sclines;
1356
- if (!width || !height)
1357
- goto invalid_input;
1358
-
1359
- y_stride = VENUS_Y_STRIDE(color_fmt, width);
1360
- uv_stride = VENUS_UV_STRIDE(color_fmt, width);
1361
- y_sclines = VENUS_Y_SCANLINES(color_fmt, height);
1362
- uv_sclines = VENUS_UV_SCANLINES(color_fmt, height);
1363
- switch (color_fmt) {
1364
- case COLOR_FMT_NV12_MVTB:
1365
- y_plane = y_stride * y_sclines;
1366
- uv_plane = uv_stride * uv_sclines;
1367
- offset = y_plane + uv_plane;
1368
- break;
1369
- default:
1370
- break;
1371
- }
1372
-invalid_input:
1373
- return offset;
1152
+ return 0;
13741153 }
13751154
13761155 #endif