1 // Shared header file for uc_hwmap.c and uc_hwset.c.
2
3 #ifndef __UC_HW_H__
4 #define __UC_HW_H__
5
6 #include <direct/messages.h>
7
8 #include <core/coredefs.h>
9
10 #include "unichrome.h"
11 #include "uc_fifo.h"
12
13 // GPU - mapping functions (uc_hwmap.c)
14
15 /// Map a DirectFB destination surface pixel format to the hw. (3D)
uc_map_dst_format(DFBSurfacePixelFormat format)16 static inline int uc_map_dst_format( DFBSurfacePixelFormat format )
17 {
18 switch (format) {
19 case DSPF_ARGB1555: return HC_HDBFM_ARGB1555;
20 case DSPF_RGB16: return HC_HDBFM_RGB565;
21 case DSPF_RGB32: return HC_HDBFM_ARGB0888;
22 case DSPF_ARGB: return HC_HDBFM_ARGB8888;
23
24 default:
25 D_BUG( "unexpected pixel format" );
26 }
27
28 return 0;
29 }
30
31 /// Map a DirectFB source surface pixel format to the hw. (3D)
uc_map_src_format_3d(DFBSurfacePixelFormat format)32 static inline int uc_map_src_format_3d( DFBSurfacePixelFormat format )
33 {
34 switch (format) {
35 case DSPF_ARGB1555: return HC_HTXnFM_ARGB1555;
36 case DSPF_RGB16: return HC_HTXnFM_RGB565;
37 case DSPF_RGB32: return HC_HTXnFM_ARGB0888;
38 case DSPF_ARGB: return HC_HTXnFM_ARGB8888;
39 case DSPF_A8: return HC_HTXnFM_A8;
40 case DSPF_LUT8: return HC_HTXnFM_Index8;
41
42 default:
43 D_BUG( "unexpected pixel format" );
44 }
45
46 return 0;
47 }
48
49 void uc_map_blending_fn( struct uc_hw_alpha *hwalpha,
50 DFBSurfaceBlendFunction sblend,
51 DFBSurfaceBlendFunction dblend,
52 DFBSurfacePixelFormat dformat );
53
54 void uc_map_blitflags ( struct uc_hw_texture *tex,
55 DFBSurfaceBlittingFlags bflags,
56 DFBSurfacePixelFormat sformat );
57
58 // GPU - setting functions (uc_hwset.c)
59
60 void uc_set_blending_fn( UcDriverData *ucdrv,
61 UcDeviceData *ucdev,
62 CardState *state );
63
64 void uc_set_texenv ( UcDriverData *ucdrv,
65 UcDeviceData *ucdev,
66 CardState *state );
67
68 void uc_set_clip ( UcDriverData *ucdrv,
69 UcDeviceData *ucdev,
70 CardState *state );
71
72 void uc_set_destination( UcDriverData *ucdrv,
73 UcDeviceData *ucdev,
74 CardState *state );
75
76 void uc_set_source_2d ( UcDriverData *ucdrv,
77 UcDeviceData *ucdev,
78 CardState *state );
79
80 void uc_set_source_3d ( UcDriverData *ucdrv,
81 UcDeviceData *ucdev,
82 CardState *state );
83
84 void uc_set_color_2d ( UcDriverData *ucdrv,
85 UcDeviceData *ucdev,
86 CardState *state );
87
88 void uc_set_colorkey_2d( UcDriverData *ucdrv,
89 UcDeviceData *ucdev,
90 CardState *state );
91
92 #endif // __UC_HW_H__
93
94