summaryrefslogtreecommitdiff
path: root/Source/DirectFB/gfxdrivers/unichrome/uc_hw.h
blob: 953af3795f5fa924dfd00fa61c5227d689e63754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Shared header file for uc_hwmap.c and uc_hwset.c.

#ifndef __UC_HW_H__
#define __UC_HW_H__

#include <direct/messages.h>

#include <core/coredefs.h>

#include "unichrome.h"
#include "uc_fifo.h"

// GPU - mapping functions (uc_hwmap.c)

/// Map a DirectFB destination surface pixel format to the hw. (3D)
static inline int uc_map_dst_format( DFBSurfacePixelFormat format )
{
     switch (format) {
          case DSPF_ARGB1555: return HC_HDBFM_ARGB1555;
          case DSPF_ARGB4444: return HC_HDBFM_ARGB4444;
          case DSPF_RGB16:    return HC_HDBFM_RGB565;
          case DSPF_RGB32:    return HC_HDBFM_ARGB0888;
          case DSPF_ARGB:     return HC_HDBFM_ARGB8888;
          case DSPF_AiRGB:    return HC_HDBFM_ARGB8888; // limited support

          case DSPF_YUY2:
          case DSPF_YV12:
          case DSPF_I420:
               // not supported for 3D but don't report an error
               return 0;

          default:
               D_BUG( "unexpected pixel format" );
     }

     return 0;
}

/// Map a DirectFB source surface pixel format to the hw. (3D)
static inline int uc_map_src_format_3d( DFBSurfacePixelFormat format )
{
     switch (format) {
          case DSPF_ARGB1555: return HC_HTXnFM_ARGB1555;
          case DSPF_ARGB4444: return HC_HTXnFM_ARGB4444;
          case DSPF_RGB16:    return HC_HTXnFM_RGB565;
          case DSPF_RGB32:    return HC_HTXnFM_ARGB0888;
          case DSPF_ARGB:     return HC_HTXnFM_ARGB8888;
          case DSPF_AiRGB:    return HC_HTXnFM_ARGB8888; // limited support
          case DSPF_A8:       return HC_HTXnFM_A8;
          case DSPF_LUT8:     return HC_HTXnFM_Index8;
          case DSPF_YUY2:     return HC_HTXnFM_YUY2;

          default:
               D_BUG( "unexpected pixel format" );
     }

     return 0;
}

void uc_map_blending_fn( struct uc_hw_alpha      *hwalpha,
                         DFBSurfaceBlendFunction  sblend,
                         DFBSurfaceBlendFunction  dblend,
                         DFBSurfacePixelFormat    dformat );

void uc_map_blitflags  ( struct uc_hw_texture    *tex,
                         DFBSurfaceBlittingFlags  bflags,
                         DFBSurfacePixelFormat    sformat,
                         DFBSurfacePixelFormat    dformat );

// GPU - setting functions (uc_hwset.c)

void uc_set_blending_fn( UcDriverData *ucdrv,
                         UcDeviceData *ucdev,
                         CardState    *state );

void uc_set_texenv     ( UcDriverData *ucdrv,
                         UcDeviceData *ucdev,
                         CardState    *state );

void uc_set_clip       ( UcDriverData *ucdrv,
                         UcDeviceData *ucdev,
                         CardState    *state );

void uc_set_destination( UcDriverData *ucdrv,
                         UcDeviceData *ucdev,
                         CardState    *state );

void uc_set_source_2d  ( UcDriverData *ucdrv,
                         UcDeviceData *ucdev,
                         CardState    *state );

void uc_set_source_3d  ( UcDriverData *ucdrv,
                         UcDeviceData *ucdev,
                         CardState    *state );

void uc_set_color_2d   ( UcDriverData *ucdrv,
                         UcDeviceData *ucdev,
                         CardState    *state );

void uc_set_colorkey_2d( UcDriverData *ucdrv,
                         UcDeviceData *ucdev,
                         CardState    *state );

#endif // __UC_HW_H__