1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef EXYNOS_RESOURCE_RESTRICTION_ZUMA_H_
18 #define EXYNOS_RESOURCE_RESTRICTION_ZUMA_H_
19 
20 #include "../../gs201/libhwc2.1/ExynosResourceRestriction.h"
21 
22 namespace zuma {
23 
24 static feature_support_t feature_table[] = {
25     {MPP_DPP_GFS,
26         MPP_ATTR_AFBC | MPP_ATTR_BLOCK_MODE | MPP_ATTR_WINDOW_UPDATE |
27         MPP_ATTR_SCALE |MPP_ATTR_ROT_90 |
28         MPP_ATTR_FLIP_H | MPP_ATTR_FLIP_V |
29         MPP_ATTR_DIM |
30         MPP_ATTR_WCG | MPP_ATTR_HDR10 | MPP_ATTR_HDR10PLUS |
31         MPP_ATTR_LAYER_TRANSFORM
32     },
33 
34     {MPP_DPP_VGRFS,
35         MPP_ATTR_AFBC | MPP_ATTR_BLOCK_MODE | MPP_ATTR_WINDOW_UPDATE | MPP_ATTR_SCALE |
36         MPP_ATTR_FLIP_H | MPP_ATTR_FLIP_V | MPP_ATTR_ROT_90 |
37         MPP_ATTR_DIM |
38         MPP_ATTR_WCG | MPP_ATTR_HDR10 | MPP_ATTR_HDR10PLUS |
39         MPP_ATTR_LAYER_TRANSFORM
40     },
41 
42     {MPP_G2D,
43         MPP_ATTR_AFBC | MPP_ATTR_SCALE |
44         MPP_ATTR_FLIP_H | MPP_ATTR_FLIP_V | MPP_ATTR_ROT_90 |
45         MPP_ATTR_WCG | MPP_ATTR_HDR10 | MPP_ATTR_HDR10PLUS | MPP_ATTR_USE_CAPA |
46         MPP_ATTR_LAYER_TRANSFORM
47     }
48 };
49 
50 static const restriction_key_t restriction_format_table[] = {
51     {MPP_DPP_GFS, NODE_NONE, HAL_PIXEL_FORMAT_RGB_565, 0},
52     {MPP_DPP_GFS, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_8888, 0},
53     {MPP_DPP_GFS, NODE_NONE, HAL_PIXEL_FORMAT_RGBX_8888, 0},
54     {MPP_DPP_GFS, NODE_NONE, HAL_PIXEL_FORMAT_BGRA_8888, 0},
55     {MPP_DPP_GFS, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_1010102, 0},
56     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_RGB_565, 0},
57     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_8888, 0},
58     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_RGBX_8888, 0},
59     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_BGRA_8888, 0},
60     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_1010102, 0},
61     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M, 0},
62     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV, 0},
63     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M, 0},
64     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL, 0},
65     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN, 0},
66     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_S10B, 0},
67     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_S10B, 0},
68     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_P010_M, 0},
69     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_P010_SPN, 0},
70     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_YCBCR_P010, 0},
71     {MPP_DPP_VGRFS, NODE_NONE, MALI_GRALLOC_FORMAT_INTERNAL_P010, 0},
72     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_GOOGLE_NV12_SP, 0},
73     {MPP_DPP_VGRFS, NODE_NONE, HAL_PIXEL_FORMAT_GOOGLE_NV12_SP_10B, 0},
74     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGB_565, 0},
75     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGB_888, 0},
76     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_8888, 0},
77     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGBX_8888, 0},
78     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_BGRA_8888, 0},
79     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_RGBA_1010102, 0},
80     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M, 0},
81     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV, 0},
82     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED, 0},
83     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M, 0},
84     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL, 0},
85     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN, 0},
86     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_S10B, 0},
87     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_S10B, 0},
88     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_P010_M, 0},
89     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_P010_SPN, 0},
90     {MPP_G2D, NODE_NONE, MALI_GRALLOC_FORMAT_INTERNAL_P010, 0},
91     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_YCrCb_420_SP, 0},
92     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_TILED, 0},
93     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_GOOGLE_NV12_SP, 0},
94     {MPP_G2D, NODE_NONE, HAL_PIXEL_FORMAT_GOOGLE_NV12_SP_10B, 0},
95 };
96 
97 
98 static ppc_table ppc_table_map = {
99     /* G2D support only 2 plane YUV, so all YUV format should use YUV2P PPC table */
100     /* In case of Scale-Up, G2D should use same PPC table */
101     {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV420,PPC_ROT_NO),   {2.2, 2.4, 4.3, 5.0, 4.5, 3.4, 3.4}},
102     {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV420,PPC_ROT),      {2.2, 3.6, 4.2, 4.3, 3.6, 2.0, 2.0}},
103 
104     {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV422,PPC_ROT_NO),   {2.2, 2.4, 4.3, 5.0, 4.5, 3.4, 3.4}},
105     {PPC_IDX(MPP_G2D,PPC_FORMAT_YUV422,PPC_ROT),      {2.2, 3.6, 4.2, 4.3, 3.6, 2.0, 2.0}},
106 
107     {PPC_IDX(MPP_G2D,PPC_FORMAT_P010,PPC_ROT_NO),     {2.2, 2.4, 4.3, 5.0, 4.5, 3.4, 3.4}},
108     {PPC_IDX(MPP_G2D,PPC_FORMAT_P010,PPC_ROT),        {2.2, 3.6, 4.2, 4.3, 3.6, 2.0, 2.0}},
109 
110     {PPC_IDX(MPP_G2D,PPC_FORMAT_RGB32,PPC_ROT_NO),    {3.6, 2.0, 2.9, 2.3, 2.9, 3.9, 3.9}},
111     {PPC_IDX(MPP_G2D,PPC_FORMAT_RGB32,PPC_ROT),       {3.5, 3.2, 3.5, 3.4, 3.8, 3.8, 3.8}},
112 
113     {PPC_IDX(MPP_G2D,PPC_FORMAT_SBWC,PPC_ROT_NO),     {3.2, 2.8, 3.0, 3.5, 2.9, 3.3, 3.3}},
114     {PPC_IDX(MPP_G2D,PPC_FORMAT_SBWC,PPC_ROT),        {2.2, 3.1, 3.2, 3.2, 2.8, 1.9, 1.9}},
115 
116     {PPC_IDX(MPP_G2D,PPC_FORMAT_AFBC_RGB,PPC_ROT_NO), {3.1, 2.8, 2.6, 3.0, 3.7, 3.0, 3.0}},
117     {PPC_IDX(MPP_G2D,PPC_FORMAT_AFBC_RGB,PPC_ROT),    {2.1, 3.2, 3.2, 3.5, 3.4, 3.8, 3.8}},
118 
119     {PPC_IDX(MPP_G2D,PPC_FORMAT_AFBC_YUV,PPC_ROT_NO), {3.0, 3.3, 3.1, 3.2, 3.4, 3.3, 3.3}},
120     {PPC_IDX(MPP_G2D,PPC_FORMAT_AFBC_YUV,PPC_ROT),    {2.2, 3.0, 3.4, 3.6, 3.6, 2.0, 2.0}},
121 };
122 
123 } // namespace zuma
124 
125 #endif // EXYNOS_RESOURCE_RESTRICTION_ZUMA_H_
126