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)
25 IPTR pftags_32bpp
[ARRAYSIZE_TRUECOLOR
] =
39 vHidd_StdPixFmt_BGR032
42 IPTR pftags_32bpp
[ARRAYSIZE_TRUECOLOR
] =
56 vHidd_StdPixFmt_RGB032
61 #if defined(VC_FMT_24)
63 IPTR pftags_24bpp
[ARRAYSIZE_TRUECOLOR
] =
80 IPTR pftags_24bpp
[ARRAYSIZE_TRUECOLOR
] =
99 #if defined(VC_FMT_16)
100 IPTR pftags_16bpp
[ARRAYSIZE_TRUECOLOR
] =
114 vHidd_StdPixFmt_RGB16_LE
118 #if defined(VC_FMT_15)
119 IPTR pftags_15bpp
[ARRAYSIZE_TRUECOLOR
] =
133 vHidd_StdPixFmt_RGB15_LE
137 #if defined(VC_FMT_8)
138 IPTR pftags_8bpp
[ARRAYSIZE_LUT
] =
160 #if defined(VC_FMT_32)
163 #if defined(VC_FMT_24)
166 #if defined(VC_FMT_16)
169 #if defined(VC_FMT_15)
172 #if defined(VC_FMT_8)
178 APTR
FNAME_SUPPORT(GenPixFmts
)(OOP_Class
*cl
)
180 struct TagItem
*pixfmtarray
= NULL
;
181 IPTR
**supportedfmts
= (IPTR
**)vc_fmts
;
184 while (supportedfmts
[fmtcount
] != 0)
187 D(bug("[VideoCore] %s: Allocating storage for %d pixfmts\n", __PRETTY_FUNCTION__
, fmtcount
));
189 if ((pixfmtarray
= AllocVec((fmtcount
+ 1) * sizeof(struct TagItem
), MEMF_PUBLIC
)) != NULL
)
191 for (fmtcount
= 0; supportedfmts
[fmtcount
] != 0; fmtcount
++)
193 struct TagItem
*newfmt_tags
= NULL
;
194 if (supportedfmts
[fmtcount
][0] == ARRAYSIZE_TRUECOLOR
)
196 D(bug("[VideoCore] %s: %dbit TRUECOLOR pixfmt\n", __PRETTY_FUNCTION__
, supportedfmts
[fmtcount
][9]));
197 newfmt_tags
= AllocVec((ARRAYSIZE_TRUECOLOR
+ 2) * sizeof(struct TagItem
), MEMF_PUBLIC
);
198 newfmt_tags
[0].ti_Tag
= aHidd_PixFmt_RedShift
;
199 newfmt_tags
[0].ti_Data
= supportedfmts
[fmtcount
][1];
200 newfmt_tags
[1].ti_Tag
= aHidd_PixFmt_GreenShift
;
201 newfmt_tags
[1].ti_Data
= supportedfmts
[fmtcount
][2];
202 newfmt_tags
[2].ti_Tag
= aHidd_PixFmt_BlueShift
;
203 newfmt_tags
[2].ti_Data
= supportedfmts
[fmtcount
][3];
204 newfmt_tags
[3].ti_Tag
= aHidd_PixFmt_AlphaShift
;
205 newfmt_tags
[3].ti_Data
= supportedfmts
[fmtcount
][4];
206 newfmt_tags
[4].ti_Tag
= aHidd_PixFmt_RedMask
;
207 newfmt_tags
[4].ti_Data
= supportedfmts
[fmtcount
][5];
208 newfmt_tags
[5].ti_Tag
= aHidd_PixFmt_GreenMask
;
209 newfmt_tags
[5].ti_Data
= supportedfmts
[fmtcount
][6];
210 newfmt_tags
[6].ti_Tag
= aHidd_PixFmt_BlueMask
;
211 newfmt_tags
[6].ti_Data
= supportedfmts
[fmtcount
][7];
212 newfmt_tags
[7].ti_Tag
= aHidd_PixFmt_AlphaMask
;
213 newfmt_tags
[7].ti_Data
= supportedfmts
[fmtcount
][8];
214 newfmt_tags
[8].ti_Tag
= aHidd_PixFmt_ColorModel
;
215 newfmt_tags
[8].ti_Data
= vHidd_ColorModel_TrueColor
;
216 newfmt_tags
[9].ti_Tag
= aHidd_PixFmt_Depth
;
217 newfmt_tags
[9].ti_Data
= supportedfmts
[fmtcount
][9];
218 newfmt_tags
[10].ti_Tag
= aHidd_PixFmt_BytesPerPixel
;
219 newfmt_tags
[10].ti_Data
= supportedfmts
[fmtcount
][10];
220 newfmt_tags
[11].ti_Tag
= aHidd_PixFmt_BitsPerPixel
;
221 newfmt_tags
[11].ti_Data
= supportedfmts
[fmtcount
][11];
222 newfmt_tags
[12].ti_Tag
= aHidd_PixFmt_StdPixFmt
;
223 newfmt_tags
[12].ti_Data
= supportedfmts
[fmtcount
][12];
224 newfmt_tags
[13].ti_Tag
= aHidd_PixFmt_BitMapType
;
225 newfmt_tags
[13].ti_Data
= vHidd_BitMapType_Chunky
;
226 newfmt_tags
[14].ti_Tag
= TAG_DONE
;
228 else if (supportedfmts
[fmtcount
][0] == ARRAYSIZE_LUT
)
230 D(bug("[VideoCore] %s: %dbit LUT pixfmt\n", __PRETTY_FUNCTION__
, supportedfmts
[fmtcount
][11]));
231 newfmt_tags
= AllocVec((ARRAYSIZE_LUT
+ 2) * sizeof(struct TagItem
), MEMF_PUBLIC
);
232 newfmt_tags
[0].ti_Tag
= aHidd_PixFmt_RedShift
;
233 newfmt_tags
[0].ti_Data
= supportedfmts
[fmtcount
][1];
234 newfmt_tags
[1].ti_Tag
= aHidd_PixFmt_GreenShift
;
235 newfmt_tags
[1].ti_Data
= supportedfmts
[fmtcount
][2];
236 newfmt_tags
[2].ti_Tag
= aHidd_PixFmt_BlueShift
;
237 newfmt_tags
[2].ti_Data
= supportedfmts
[fmtcount
][3];
238 newfmt_tags
[3].ti_Tag
= aHidd_PixFmt_AlphaShift
;
239 newfmt_tags
[3].ti_Data
= supportedfmts
[fmtcount
][4];
240 newfmt_tags
[4].ti_Tag
= aHidd_PixFmt_RedMask
;
241 newfmt_tags
[4].ti_Data
= supportedfmts
[fmtcount
][5];
242 newfmt_tags
[5].ti_Tag
= aHidd_PixFmt_GreenMask
;
243 newfmt_tags
[5].ti_Data
= supportedfmts
[fmtcount
][6];
244 newfmt_tags
[6].ti_Tag
= aHidd_PixFmt_BlueMask
;
245 newfmt_tags
[6].ti_Data
= supportedfmts
[fmtcount
][7];
246 newfmt_tags
[7].ti_Tag
= aHidd_PixFmt_AlphaMask
;
247 newfmt_tags
[7].ti_Data
= supportedfmts
[fmtcount
][8];
248 newfmt_tags
[8].ti_Tag
= aHidd_PixFmt_CLUTMask
;
249 newfmt_tags
[8].ti_Data
= supportedfmts
[fmtcount
][9];
250 newfmt_tags
[9].ti_Tag
= aHidd_PixFmt_CLUTShift
;
251 newfmt_tags
[9].ti_Data
= supportedfmts
[fmtcount
][10];
252 newfmt_tags
[10].ti_Tag
= aHidd_PixFmt_ColorModel
;
253 newfmt_tags
[10].ti_Data
= vHidd_ColorModel_Palette
;
254 newfmt_tags
[11].ti_Tag
= aHidd_PixFmt_Depth
;
255 newfmt_tags
[11].ti_Data
= supportedfmts
[fmtcount
][11];
256 newfmt_tags
[12].ti_Tag
= aHidd_PixFmt_BytesPerPixel
;
257 newfmt_tags
[12].ti_Data
= supportedfmts
[fmtcount
][12];
258 newfmt_tags
[13].ti_Tag
= aHidd_PixFmt_BitsPerPixel
;
259 newfmt_tags
[13].ti_Data
= supportedfmts
[fmtcount
][13];
260 newfmt_tags
[14].ti_Tag
= aHidd_PixFmt_StdPixFmt
;
261 newfmt_tags
[14].ti_Data
= supportedfmts
[fmtcount
][14];
262 newfmt_tags
[15].ti_Tag
= aHidd_PixFmt_BitMapType
;
263 newfmt_tags
[15].ti_Data
= vHidd_BitMapType_Chunky
;
264 newfmt_tags
[16].ti_Tag
= TAG_DONE
;
268 D(bug("[VideoCore] %s: ERROR - Unhandled pixfmt\n", __PRETTY_FUNCTION__
));
272 pixfmtarray
[fmtcount
].ti_Tag
= aHidd_Gfx_PixFmtTags
;
273 pixfmtarray
[fmtcount
].ti_Data
= (IPTR
)newfmt_tags
;
275 pixfmtarray
[fmtcount
].ti_Tag
= TAG_DONE
;
277 #if defined(DEBUGPIXFMT)
280 struct TagItem
*cur_pixfmt
= pixfmtarray
;
281 while (cur_pixfmt
->ti_Tag
!= TAG_DONE
)
283 D(bug("[VideoCoreGfx] %s: 0x%p: %08x, %08x\n", __PRETTY_FUNCTION__
, cur_pixfmt
, cur_pixfmt
->ti_Tag
, cur_pixfmt
->ti_Data
));
288 return (APTR
)pixfmtarray
;