2 Copyright � 2013-2017, The AROS Development Team. All rights reserved.
7 #include <aros/debug.h>
9 #define __OOP_NOATTRBASES__
11 #include <proto/oop.h>
12 #include <proto/utility.h>
14 #include <graphics/gfx.h>
18 #include "vc4gfx_hidd.h"
20 #define ARRAYSIZE_TRUECOLOR 13
21 #define ARRAYSIZE_LUT 15
23 #if defined(VC_FMT_32)
24 IPTR pftags_32bpp
[ARRAYSIZE_TRUECOLOR
] =
38 vHidd_StdPixFmt_BGR032
42 #if defined(VC_FMT_24)
43 IPTR pftags_24bpp
[ARRAYSIZE_TRUECOLOR
] =
61 #if defined(VC_FMT_16)
62 IPTR pftags_16bpp
[ARRAYSIZE_TRUECOLOR
] =
76 vHidd_StdPixFmt_RGB16_LE
80 #if defined(VC_FMT_15)
81 IPTR pftags_15bpp
[ARRAYSIZE_TRUECOLOR
] =
95 vHidd_StdPixFmt_RGB15_LE
100 IPTR pftags_8bpp
[ARRAYSIZE_LUT
] =
122 #if defined(VC_FMT_32)
125 #if defined(VC_FMT_24)
128 #if defined(VC_FMT_16)
131 #if defined(VC_FMT_15)
134 #if defined(VC_FMT_8)
140 APTR
FNAME_SUPPORT(GenPixFmts
)(OOP_Class
*cl
)
142 struct TagItem
*pixfmtarray
= NULL
;
143 IPTR
**supportedfmts
= (IPTR
**)vc_fmts
;
146 while (supportedfmts
[fmtcount
] != 0)
149 D(bug("[VideoCore] %s: Allocating storage for %d pixfmts\n", __PRETTY_FUNCTION__
, fmtcount
));
151 if ((pixfmtarray
= AllocVec((fmtcount
+ 1) * sizeof(struct TagItem
), MEMF_PUBLIC
)) != NULL
)
153 for (fmtcount
= 0; supportedfmts
[fmtcount
] != 0; fmtcount
++)
155 struct TagItem
*newfmt_tags
= NULL
;
156 if (supportedfmts
[fmtcount
][0] == ARRAYSIZE_TRUECOLOR
)
158 D(bug("[VideoCore] %s: %dbit TRUECOLOR pixfmt\n", __PRETTY_FUNCTION__
, supportedfmts
[fmtcount
][9]));
159 newfmt_tags
= AllocVec((ARRAYSIZE_TRUECOLOR
+ 2) * sizeof(struct TagItem
), MEMF_PUBLIC
);
160 newfmt_tags
[0].ti_Tag
= aHidd_PixFmt_RedShift
;
161 newfmt_tags
[0].ti_Data
= supportedfmts
[fmtcount
][1];
162 newfmt_tags
[1].ti_Tag
= aHidd_PixFmt_GreenShift
;
163 newfmt_tags
[1].ti_Data
= supportedfmts
[fmtcount
][2];
164 newfmt_tags
[2].ti_Tag
= aHidd_PixFmt_BlueShift
;
165 newfmt_tags
[2].ti_Data
= supportedfmts
[fmtcount
][3];
166 newfmt_tags
[3].ti_Tag
= aHidd_PixFmt_AlphaShift
;
167 newfmt_tags
[3].ti_Data
= supportedfmts
[fmtcount
][4];
168 newfmt_tags
[4].ti_Tag
= aHidd_PixFmt_RedMask
;
169 newfmt_tags
[4].ti_Data
= supportedfmts
[fmtcount
][5];
170 newfmt_tags
[5].ti_Tag
= aHidd_PixFmt_GreenMask
;
171 newfmt_tags
[5].ti_Data
= supportedfmts
[fmtcount
][6];
172 newfmt_tags
[6].ti_Tag
= aHidd_PixFmt_BlueMask
;
173 newfmt_tags
[6].ti_Data
= supportedfmts
[fmtcount
][7];
174 newfmt_tags
[7].ti_Tag
= aHidd_PixFmt_AlphaMask
;
175 newfmt_tags
[7].ti_Data
= supportedfmts
[fmtcount
][8];
176 newfmt_tags
[8].ti_Tag
= aHidd_PixFmt_ColorModel
;
177 newfmt_tags
[8].ti_Data
= vHidd_ColorModel_TrueColor
;
178 newfmt_tags
[9].ti_Tag
= aHidd_PixFmt_Depth
;
179 newfmt_tags
[9].ti_Data
= supportedfmts
[fmtcount
][9];
180 newfmt_tags
[10].ti_Tag
= aHidd_PixFmt_BytesPerPixel
;
181 newfmt_tags
[10].ti_Data
= supportedfmts
[fmtcount
][10];
182 newfmt_tags
[11].ti_Tag
= aHidd_PixFmt_BitsPerPixel
;
183 newfmt_tags
[11].ti_Data
= supportedfmts
[fmtcount
][11];
184 newfmt_tags
[12].ti_Tag
= aHidd_PixFmt_StdPixFmt
;
185 newfmt_tags
[12].ti_Data
= supportedfmts
[fmtcount
][12];
186 newfmt_tags
[13].ti_Tag
= aHidd_PixFmt_BitMapType
;
187 newfmt_tags
[13].ti_Data
= vHidd_BitMapType_Chunky
;
188 newfmt_tags
[14].ti_Tag
= TAG_DONE
;
190 else if (supportedfmts
[fmtcount
][0] == ARRAYSIZE_LUT
)
192 D(bug("[VideoCore] %s: %dbit LUT pixfmt\n", __PRETTY_FUNCTION__
, supportedfmts
[fmtcount
][11]));
193 newfmt_tags
= AllocVec((ARRAYSIZE_LUT
+ 2) * sizeof(struct TagItem
), MEMF_PUBLIC
);
194 newfmt_tags
[0].ti_Tag
= aHidd_PixFmt_RedShift
;
195 newfmt_tags
[0].ti_Data
= supportedfmts
[fmtcount
][1];
196 newfmt_tags
[1].ti_Tag
= aHidd_PixFmt_GreenShift
;
197 newfmt_tags
[1].ti_Data
= supportedfmts
[fmtcount
][2];
198 newfmt_tags
[2].ti_Tag
= aHidd_PixFmt_BlueShift
;
199 newfmt_tags
[2].ti_Data
= supportedfmts
[fmtcount
][3];
200 newfmt_tags
[3].ti_Tag
= aHidd_PixFmt_AlphaShift
;
201 newfmt_tags
[3].ti_Data
= supportedfmts
[fmtcount
][4];
202 newfmt_tags
[4].ti_Tag
= aHidd_PixFmt_RedMask
;
203 newfmt_tags
[4].ti_Data
= supportedfmts
[fmtcount
][5];
204 newfmt_tags
[5].ti_Tag
= aHidd_PixFmt_GreenMask
;
205 newfmt_tags
[5].ti_Data
= supportedfmts
[fmtcount
][6];
206 newfmt_tags
[6].ti_Tag
= aHidd_PixFmt_BlueMask
;
207 newfmt_tags
[6].ti_Data
= supportedfmts
[fmtcount
][7];
208 newfmt_tags
[7].ti_Tag
= aHidd_PixFmt_AlphaMask
;
209 newfmt_tags
[7].ti_Data
= supportedfmts
[fmtcount
][8];
210 newfmt_tags
[8].ti_Tag
= aHidd_PixFmt_CLUTMask
;
211 newfmt_tags
[8].ti_Data
= supportedfmts
[fmtcount
][9];
212 newfmt_tags
[9].ti_Tag
= aHidd_PixFmt_CLUTShift
;
213 newfmt_tags
[9].ti_Data
= supportedfmts
[fmtcount
][10];
214 newfmt_tags
[10].ti_Tag
= aHidd_PixFmt_ColorModel
;
215 newfmt_tags
[10].ti_Data
= vHidd_ColorModel_Palette
;
216 newfmt_tags
[11].ti_Tag
= aHidd_PixFmt_Depth
;
217 newfmt_tags
[11].ti_Data
= supportedfmts
[fmtcount
][11];
218 newfmt_tags
[12].ti_Tag
= aHidd_PixFmt_BytesPerPixel
;
219 newfmt_tags
[12].ti_Data
= supportedfmts
[fmtcount
][12];
220 newfmt_tags
[13].ti_Tag
= aHidd_PixFmt_BitsPerPixel
;
221 newfmt_tags
[13].ti_Data
= supportedfmts
[fmtcount
][13];
222 newfmt_tags
[14].ti_Tag
= aHidd_PixFmt_StdPixFmt
;
223 newfmt_tags
[14].ti_Data
= supportedfmts
[fmtcount
][14];
224 newfmt_tags
[15].ti_Tag
= aHidd_PixFmt_BitMapType
;
225 newfmt_tags
[15].ti_Data
= vHidd_BitMapType_Chunky
;
226 newfmt_tags
[16].ti_Tag
= TAG_DONE
;
230 D(bug("[VideoCore] %s: ERROR - Unhandled pixfmt\n", __PRETTY_FUNCTION__
));
234 pixfmtarray
[fmtcount
].ti_Tag
= aHidd_Gfx_PixFmtTags
;
235 pixfmtarray
[fmtcount
].ti_Data
= (IPTR
)newfmt_tags
;
237 pixfmtarray
[fmtcount
].ti_Tag
= TAG_DONE
;
239 #if defined(DEBUGPIXFMT)
242 struct TagItem
*cur_pixfmt
= pixfmtarray
;
243 while (cur_pixfmt
->ti_Tag
!= TAG_DONE
)
245 D(bug("[VideoCoreGfx] %s: 0x%p: %08x, %08x\n", __PRETTY_FUNCTION__
, cur_pixfmt
, cur_pixfmt
->ti_Tag
, cur_pixfmt
->ti_Data
));
250 return (APTR
)pixfmtarray
;