summaryrefslogtreecommitdiff
path: root/bsp/allwinner/libraries/libos/include/misc/fb.h
blob: a88a50b1434ad6ca28e4d3672e3db345425d044a (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/*
 * =====================================================================================
 *
 *       Filename:  fb.h
 *
 *    Description:  misc definition for display pixel format.
 *
 *        Version:  Melis3.0
 *         Create:  2017-11-03 11:38:28
 *       Revision:  none
 *       Compiler:  gcc version 6.3.0 (crosstool-NG crosstool-ng-1.23.0)
 *
 *         Author:  [email protected]
 *   Organization:  BU1-PSW
 *  Last Modified:  2019-03-29 17:49:54
 *
 * =====================================================================================
 */

#ifndef FRAMEBUFFER_H
#define FRAMEBUFFER_H
#include <typedef.h>
#include <kconfig.h>

typedef enum __PIXEL_YUVFMT
{
    PIXEL_YUV444                = 0x71,
    PIXEL_YUV422,
    PIXEL_YUV420,
    PIXEL_YUV411,
    PIXEL_CSIRGB,
    PIXEL_OTHERFMT,
} __pixel_yuvfmt_t;

typedef enum __YUV_MODE
{
    YUV_MOD_INTERLEAVED         = 0,
    YUV_MOD_NON_MB_PLANAR,
    YUV_MOD_MB_PLANAR,
    YUV_MOD_UV_NON_MB_COMBINED,
    YUV_MOD_UV_MB_COMBINED
} __yuv_mod_t;

typedef enum
{
    YUV_SEQ_UYVY                = 0,
    YUV_SEQ_YUYV,
    YUV_SEQ_VYUY,
    YUV_SEQ_YVYU,
    YUV_SEQ_AYUV                = 0x10,
    YUV_SEQ_VUYA,
    YUV_SEQ_UVUV                = 0x20,
    YUV_SEQ_VUVU,
    YUV_SEQ_OTHRS               = 0xff,
} __yuv_seq_t;


typedef struct
{
    __u32 width;
    __u32 height;
} SIZE;

typedef enum
{
    BT601                       = 0,
    BT709,
    YCC,
    VXYCC,
    MONO
} __cs_mode_t;

typedef struct
{
    __s32 x;
    __s32 y;
    __u32 width;
    __u32 height;
} RECT;

typedef enum
{
    FB_TYPE_RGB                 = 0,
    FB_TYPE_YUV                 = 1
} __fb_type_t;

typedef enum __PIXEL_RGBFMT
{
    PIXEL_MONO_1BPP             = 0x51,
    PIXEL_MONO_2BPP,
    PIXEL_MONO_4BPP,
    PIXEL_MONO_8BPP,
    PIXEL_COLOR_RGB655,
    PIXEL_COLOR_RGB565,
    PIXEL_COLOR_RGB556,
    PIXEL_COLOR_ARGB1555,
    PIXEL_COLOR_RGBA5551,
    PIXEL_COLOR_RGB0888,
    PIXEL_COLOR_ARGB8888,
} __pixel_rgbfmt_t;

typedef enum
{
    RGB_SEQ_ARGB                = 0x00,//for 32bpp
    RGB_SEQ_BRGA                = 0x02,
    RGB_SEQ_P10                 = 0x10,//for 16bpp
    RGB_SEQ_P01                 = 0x11,
    RGB_SEQ_P3210               = 0x20,//for 8bpp
    RGB_SEQ_P0123               = 0x21,
    RGB_SEQ_P76543210           = 0x30,//for 4bpp
    RGB_SEQ_P67452301           = 0x31,
    RGB_SEQ_P10325476           = 0x32,
    RGB_SEQ_P01234567           = 0x33,
    RGB_SEQ_2BPP_BIG_BIG        = 0x40,//for 2bpp
    RGB_SEQ_2BPP_BIG_LITTER     = 0x41,
    RGB_SEQ_2BPP_LITTER_BIG     = 0x42,
    RGB_SEQ_2BPP_LITTER_LITTER  = 0x43,
    RGB_SEQ_1BPP_BIG_BIG        = 0x50,//for 1bpp
    RGB_SEQ_1BPP_BIG_LITTER     = 0x51,
    RGB_SEQ_1BPP_LITTER_BIG     = 0x52,
    RGB_SEQ_1BPP_LITTER_LITTER  = 0x53,
} __rgb_seq_t;

typedef struct
{
    __fb_type_t                 type;
    union
    {
        struct
        {
            __pixel_rgbfmt_t    pixelfmt;
            __bool              br_swap;
            __rgb_seq_t         pixseq;
            struct
            {
                void            *addr;
                __u32           size;
            } palette;
        } rgb;
        struct
        {
            __pixel_yuvfmt_t    pixelfmt;
            __yuv_mod_t         mod;
            __yuv_seq_t         yuvseq;
        } yuv;
    } fmt;
    __cs_mode_t                 cs_mode;
} __fb_format_t;


typedef struct __FB
{
    SIZE                        size;
    void                        *addr[3];
    __fb_format_t               fmt;
} FB;

typedef struct
{
    __u8    alpha;
    __u8    red;
    __u8    green;
    __u8    blue;
} COLOR;        /* 32-bit (ARGB) color                  */

typedef struct
{
    __s32 x;
    __s32 y;
} OFFSET;       /* coordinate (x, y)                    */

typedef COLOR  __color_t;
typedef RECT   __rect_t;
typedef OFFSET __pos_t;
typedef SIZE   __rectsz_t;

#endif  /*FRAMEBUFFER_H*/