1 /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12 
13 #include "dpu_hw_mdss.h"
14 
15 static const struct dpu_format_extended plane_formats[] = {
16 	{DRM_FORMAT_ARGB8888, 0},
17 	{DRM_FORMAT_ABGR8888, 0},
18 	{DRM_FORMAT_RGBA8888, 0},
19 	{DRM_FORMAT_ABGR8888, DRM_FORMAT_MOD_QCOM_COMPRESSED},
20 	{DRM_FORMAT_BGRA8888, 0},
21 	{DRM_FORMAT_XRGB8888, 0},
22 	{DRM_FORMAT_RGBX8888, 0},
23 	{DRM_FORMAT_BGRX8888, 0},
24 	{DRM_FORMAT_XBGR8888, 0},
25 	{DRM_FORMAT_XBGR8888, DRM_FORMAT_MOD_QCOM_COMPRESSED},
26 	{DRM_FORMAT_RGB888, 0},
27 	{DRM_FORMAT_BGR888, 0},
28 	{DRM_FORMAT_RGB565, 0},
29 	{DRM_FORMAT_BGR565, DRM_FORMAT_MOD_QCOM_COMPRESSED},
30 	{DRM_FORMAT_BGR565, 0},
31 	{DRM_FORMAT_ARGB1555, 0},
32 	{DRM_FORMAT_ABGR1555, 0},
33 	{DRM_FORMAT_RGBA5551, 0},
34 	{DRM_FORMAT_BGRA5551, 0},
35 	{DRM_FORMAT_XRGB1555, 0},
36 	{DRM_FORMAT_XBGR1555, 0},
37 	{DRM_FORMAT_RGBX5551, 0},
38 	{DRM_FORMAT_BGRX5551, 0},
39 	{DRM_FORMAT_ARGB4444, 0},
40 	{DRM_FORMAT_ABGR4444, 0},
41 	{DRM_FORMAT_RGBA4444, 0},
42 	{DRM_FORMAT_BGRA4444, 0},
43 	{DRM_FORMAT_XRGB4444, 0},
44 	{DRM_FORMAT_XBGR4444, 0},
45 	{DRM_FORMAT_RGBX4444, 0},
46 	{DRM_FORMAT_BGRX4444, 0},
47 	{0, 0},
48 };
49 
50 static const struct dpu_format_extended plane_formats_yuv[] = {
51 	{DRM_FORMAT_ARGB8888, 0},
52 	{DRM_FORMAT_ABGR8888, 0},
53 	{DRM_FORMAT_RGBA8888, 0},
54 	{DRM_FORMAT_BGRX8888, 0},
55 	{DRM_FORMAT_ABGR8888, DRM_FORMAT_MOD_QCOM_COMPRESSED},
56 	{DRM_FORMAT_BGRA8888, 0},
57 	{DRM_FORMAT_XRGB8888, 0},
58 	{DRM_FORMAT_XBGR8888, 0},
59 	{DRM_FORMAT_RGBX8888, 0},
60 	{DRM_FORMAT_XBGR8888, DRM_FORMAT_MOD_QCOM_COMPRESSED},
61 	{DRM_FORMAT_RGB888, 0},
62 	{DRM_FORMAT_BGR888, 0},
63 	{DRM_FORMAT_RGB565, 0},
64 	{DRM_FORMAT_BGR565, DRM_FORMAT_MOD_QCOM_COMPRESSED},
65 	{DRM_FORMAT_BGR565, 0},
66 	{DRM_FORMAT_ARGB1555, 0},
67 	{DRM_FORMAT_ABGR1555, 0},
68 	{DRM_FORMAT_RGBA5551, 0},
69 	{DRM_FORMAT_BGRA5551, 0},
70 	{DRM_FORMAT_XRGB1555, 0},
71 	{DRM_FORMAT_XBGR1555, 0},
72 	{DRM_FORMAT_RGBX5551, 0},
73 	{DRM_FORMAT_BGRX5551, 0},
74 	{DRM_FORMAT_ARGB4444, 0},
75 	{DRM_FORMAT_ABGR4444, 0},
76 	{DRM_FORMAT_RGBA4444, 0},
77 	{DRM_FORMAT_BGRA4444, 0},
78 	{DRM_FORMAT_XRGB4444, 0},
79 	{DRM_FORMAT_XBGR4444, 0},
80 	{DRM_FORMAT_RGBX4444, 0},
81 	{DRM_FORMAT_BGRX4444, 0},
82 
83 	{DRM_FORMAT_NV12, 0},
84 	{DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_COMPRESSED},
85 	{DRM_FORMAT_NV21, 0},
86 	{DRM_FORMAT_NV16, 0},
87 	{DRM_FORMAT_NV61, 0},
88 	{DRM_FORMAT_VYUY, 0},
89 	{DRM_FORMAT_UYVY, 0},
90 	{DRM_FORMAT_YUYV, 0},
91 	{DRM_FORMAT_YVYU, 0},
92 	{DRM_FORMAT_YUV420, 0},
93 	{DRM_FORMAT_YVU420, 0},
94 	{0, 0},
95 };
96 
97 static const struct dpu_format_extended cursor_formats[] = {
98 	{DRM_FORMAT_ARGB8888, 0},
99 	{DRM_FORMAT_ABGR8888, 0},
100 	{DRM_FORMAT_RGBA8888, 0},
101 	{DRM_FORMAT_BGRA8888, 0},
102 	{DRM_FORMAT_XRGB8888, 0},
103 	{DRM_FORMAT_ARGB1555, 0},
104 	{DRM_FORMAT_ABGR1555, 0},
105 	{DRM_FORMAT_RGBA5551, 0},
106 	{DRM_FORMAT_BGRA5551, 0},
107 	{DRM_FORMAT_ARGB4444, 0},
108 	{DRM_FORMAT_ABGR4444, 0},
109 	{DRM_FORMAT_RGBA4444, 0},
110 	{DRM_FORMAT_BGRA4444, 0},
111 	{0, 0},
112 };
113 
114 static const struct dpu_format_extended wb2_formats[] = {
115 	{DRM_FORMAT_RGB565, 0},
116 	{DRM_FORMAT_BGR565, DRM_FORMAT_MOD_QCOM_COMPRESSED},
117 	{DRM_FORMAT_RGB888, 0},
118 	{DRM_FORMAT_ARGB8888, 0},
119 	{DRM_FORMAT_RGBA8888, 0},
120 	{DRM_FORMAT_ABGR8888, DRM_FORMAT_MOD_QCOM_COMPRESSED},
121 	{DRM_FORMAT_XRGB8888, 0},
122 	{DRM_FORMAT_RGBX8888, 0},
123 	{DRM_FORMAT_XBGR8888, DRM_FORMAT_MOD_QCOM_COMPRESSED},
124 	{DRM_FORMAT_ARGB1555, 0},
125 	{DRM_FORMAT_RGBA5551, 0},
126 	{DRM_FORMAT_XRGB1555, 0},
127 	{DRM_FORMAT_RGBX5551, 0},
128 	{DRM_FORMAT_ARGB4444, 0},
129 	{DRM_FORMAT_RGBA4444, 0},
130 	{DRM_FORMAT_RGBX4444, 0},
131 	{DRM_FORMAT_XRGB4444, 0},
132 
133 	{DRM_FORMAT_BGR565, 0},
134 	{DRM_FORMAT_BGR888, 0},
135 	{DRM_FORMAT_ABGR8888, 0},
136 	{DRM_FORMAT_BGRA8888, 0},
137 	{DRM_FORMAT_BGRX8888, 0},
138 	{DRM_FORMAT_XBGR8888, 0},
139 	{DRM_FORMAT_ABGR1555, 0},
140 	{DRM_FORMAT_BGRA5551, 0},
141 	{DRM_FORMAT_XBGR1555, 0},
142 	{DRM_FORMAT_BGRX5551, 0},
143 	{DRM_FORMAT_ABGR4444, 0},
144 	{DRM_FORMAT_BGRA4444, 0},
145 	{DRM_FORMAT_BGRX4444, 0},
146 	{DRM_FORMAT_XBGR4444, 0},
147 
148 	{DRM_FORMAT_YUV420, 0},
149 	{DRM_FORMAT_NV12, 0},
150 	{DRM_FORMAT_NV12, DRM_FORMAT_MOD_QCOM_COMPRESSED},
151 	{DRM_FORMAT_NV16, 0},
152 	{DRM_FORMAT_YUYV, 0},
153 
154 	{0, 0},
155 };
156 
157 static const struct dpu_format_extended rgb_10bit_formats[] = {
158 	{DRM_FORMAT_BGRA1010102, 0},
159 	{DRM_FORMAT_BGRX1010102, 0},
160 	{DRM_FORMAT_RGBA1010102, 0},
161 	{DRM_FORMAT_RGBX1010102, 0},
162 	{DRM_FORMAT_ABGR2101010, 0},
163 	{DRM_FORMAT_ABGR2101010, DRM_FORMAT_MOD_QCOM_COMPRESSED},
164 	{DRM_FORMAT_XBGR2101010, 0},
165 	{DRM_FORMAT_XBGR2101010, DRM_FORMAT_MOD_QCOM_COMPRESSED},
166 	{DRM_FORMAT_ARGB2101010, 0},
167 	{DRM_FORMAT_XRGB2101010, 0},
168 };
169