• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright@ Samsung Electronics Co. LTD
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _SEC_G2D_DRIVER_H_
18 #define _SEC_G2D_DRIVER_H_
19 typedef unsigned char  u8;
20 typedef unsigned short u16;
21 typedef unsigned long  u32;
22 
23 #define SEC_G2D_DEV_NAME        "/dev/fimg2d"
24 
25 #define G2D_IOCTL_MAGIC 'G'
26 
27 #define G2D_BLIT                    _IO(G2D_IOCTL_MAGIC,0)
28 #define G2D_GET_VERSION             _IO(G2D_IOCTL_MAGIC,1)
29 #define G2D_GET_MEMORY              _IOR(G2D_IOCTL_MAGIC,2, unsigned int)
30 #define G2D_GET_MEMORY_SIZE         _IOR(G2D_IOCTL_MAGIC,3, unsigned int)
31 #define G2D_DMA_CACHE_CLEAN         _IOWR(G2D_IOCTL_MAGIC,4, struct g2d_dma_info)
32 #define G2D_DMA_CACHE_FLUSH         _IOWR(G2D_IOCTL_MAGIC,5, struct g2d_dma_info)
33 #define G2D_SYNC                    _IO(G2D_IOCTL_MAGIC,6)
34 #define G2D_RESET                   _IO(G2D_IOCTL_MAGIC,7)
35 
36 #define G2D_MAX_WIDTH   (2048)
37 #define G2D_MAX_HEIGHT  (2048)
38 
39 #define G2D_ALPHA_VALUE_MAX (255)
40 
41 #define G2D_POLLING (1<<0)
42 #define G2D_INTERRUPT (0<<0)
43 #define G2D_CACHE_OP (1<<1)
44 #define G2D_NONE_INVALIDATE (0<<1)
45 #define G2D_HYBRID_MODE (1<<2)
46 
47 typedef enum {
48     G2D_ROT_0 = 0,
49     G2D_ROT_90,
50     G2D_ROT_180,
51     G2D_ROT_270,
52     G2D_ROT_X_FLIP,
53     G2D_ROT_Y_FLIP
54 } G2D_ROT_DEG;
55 
56 typedef enum {
57     G2D_ALPHA_BLENDING_MIN    = 0,   // wholly transparent
58     G2D_ALPHA_BLENDING_MAX    = 255, // 255
59     G2D_ALPHA_BLENDING_OPAQUE = 256, // opaque
60 } G2D_ALPHA_BLENDING_MODE;
61 
62 typedef enum {
63     G2D_COLORKEY_NONE = 0,
64     G2D_COLORKEY_SRC_ON,
65     G2D_COLORKEY_DST_ON,
66     G2D_COLORKEY_SRC_DST_ON,
67 } G2D_COLORKEY_MODE;
68 
69 typedef enum {
70     G2D_BLUE_SCREEN_NONE = 0,
71     G2D_BLUE_SCREEN_TRANSPARENT,
72     G2D_BLUE_SCREEN_WITH_COLOR,
73 } G2D_BLUE_SCREEN_MODE;
74 
75 typedef enum {
76     G2D_ROP_SRC = 0,
77     G2D_ROP_DST,
78     G2D_ROP_SRC_AND_DST,
79     G2D_ROP_SRC_OR_DST,
80     G2D_ROP_3RD_OPRND,
81     G2D_ROP_SRC_AND_3RD_OPRND,
82     G2D_ROP_SRC_OR_3RD_OPRND,
83     G2D_ROP_SRC_XOR_3RD_OPRND,
84     G2D_ROP_DST_OR_3RD,
85 } G2D_ROP_TYPE;
86 
87 typedef enum {
88     G2D_THIRD_OP_NONE = 0,
89     G2D_THIRD_OP_PATTERN,
90     G2D_THIRD_OP_FG,
91     G2D_THIRD_OP_BG
92 } G2D_THIRD_OP_MODE;
93 
94 typedef enum {
95     G2D_BLACK = 0,
96     G2D_RED,
97     G2D_GREEN,
98     G2D_BLUE,
99     G2D_WHITE,
100     G2D_YELLOW,
101     G2D_CYAN,
102     G2D_MAGENTA
103 } G2D_COLOR;
104 
105 typedef enum {
106     G2D_RGB_565 = ((0<<4)|2),
107 
108     G2D_ABGR_8888 = ((2<<4)|1),
109     G2D_BGRA_8888 = ((3<<4)|1),
110     G2D_ARGB_8888 = ((0<<4)|1),
111     G2D_RGBA_8888 = ((1<<4)|1),
112 
113     G2D_XBGR_8888 = ((2<<4)|0),
114     G2D_BGRX_8888 = ((3<<4)|0),
115     G2D_XRGB_8888 = ((0<<4)|0),
116     G2D_RGBX_8888 = ((1<<4)|0),
117 
118     G2D_ABGR_1555 = ((2<<4)|4),
119     G2D_BGRA_5551 = ((3<<4)|4),
120     G2D_ARGB_1555 = ((0<<4)|4),
121     G2D_RGBA_5551 = ((1<<4)|4),
122 
123     G2D_XBGR_1555 = ((2<<4)|3),
124     G2D_BGRX_5551 = ((3<<4)|3),
125     G2D_XRGB_1555 = ((0<<4)|3),
126     G2D_RGBX_5551 = ((1<<4)|3),
127 
128     G2D_ABGR_4444 = ((2<<4)|6),
129     G2D_BGRA_4444 = ((3<<4)|6),
130     G2D_ARGB_4444 = ((0<<4)|6),
131     G2D_RGBA_4444 = ((1<<4)|6),
132 
133     G2D_XBGR_4444 = ((2<<4)|5),
134     G2D_BGRX_4444 = ((3<<4)|5),
135     G2D_XRGB_4444 = ((0<<4)|5),
136     G2D_RGBX_4444 = ((1<<4)|5),
137 
138     G2D_PACKED_BGR_888 = ((2<<4)|7),
139     G2D_PACKED_RGB_888 = ((0<<4)|7),
140 
141     G2D_MAX_COLOR_SPACE
142 } G2D_COLOR_SPACE;
143 
144 typedef enum {
145     G2D_Clear_Mode,    //!< [0, 0]
146     G2D_Src_Mode,      //!< [Sa, Sc]
147     G2D_Dst_Mode,      //!< [Da, Dc]
148     G2D_SrcOver_Mode,  //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc]
149     G2D_DstOver_Mode,  //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc]
150     G2D_SrcIn_Mode,    //!< [Sa * Da, Sc * Da]
151     G2D_DstIn_Mode,    //!< [Sa * Da, Sa * Dc]
152     G2D_SrcOut_Mode,   //!< [Sa * (1 - Da), Sc * (1 - Da)]
153     G2D_DstOut_Mode,   //!< [Da * (1 - Sa), Dc * (1 - Sa)]
154     G2D_SrcATop_Mode,  //!< [Da, Sc * Da + (1 - Sa) * Dc]
155     G2D_DstATop_Mode,  //!< [Sa, Sa * Dc + Sc * (1 - Da)]
156     G2D_Xor_Mode,      //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc]
157 
158     // these modes are defined in the SVG Compositing standard
159     // http://www.w3.org/TR/2009/WD-SVGCompositing-20090430/
160     G2D_Plus_Mode,
161     G2D_Multiply_Mode,
162     G2D_Screen_Mode,
163     G2D_Overlay_Mode,
164     G2D_Darken_Mode,
165     G2D_Lighten_Mode,
166     G2D_ColorDodge_Mode,
167     G2D_ColorBurn_Mode,
168     G2D_HardLight_Mode,
169     G2D_SoftLight_Mode,
170     G2D_Difference_Mode,
171     G2D_Exclusion_Mode,
172 
173     kLastMode = G2D_Exclusion_Mode
174 } G2D_PORTTERDUFF_MODE;
175 
176 typedef enum {
177        G2D_MEMORY_KERNEL,
178        G2D_MEMORY_USER
179 } G2D_MEMORY_TYPE;
180 
181 typedef struct {
182     int    x;
183     int    y;
184     unsigned int    w;
185     unsigned int    h;
186     unsigned int    full_w;
187     unsigned int    full_h;
188     int             color_format;
189     unsigned int    bytes_per_pixel;
190     unsigned char * addr;
191 } g2d_rect;
192 
193 typedef struct {
194     unsigned int    rotate_val;
195     unsigned int    alpha_val;
196 
197     unsigned int    blue_screen_mode;     //true : enable, false : disable
198     unsigned int    color_key_val;        //screen color value
199     unsigned int    color_switch_val;     //one color
200 
201     unsigned int    src_color;            // when set one color on SRC
202 
203     unsigned int    third_op_mode;
204     unsigned int    rop_mode;
205     unsigned int    mask_mode;
206     unsigned int    render_mode;
207     unsigned int    potterduff_mode;
208         unsigned int    memory_type;
209 } g2d_flag;
210 
211 typedef struct {
212     unsigned int    t;
213     unsigned int    b;
214     unsigned int    l;
215     unsigned int    r;
216 } g2d_clip;
217 
218 typedef struct {
219     g2d_rect src_rect;
220     g2d_rect dst_rect;
221     g2d_clip clip;
222     g2d_flag flag;
223 } g2d_params;
224 
225 struct g2d_dma_info {
226     unsigned long addr;
227     unsigned int  size;
228 };
229 
230 typedef struct _sec_g2d_t {
231     int dev_fd;
232     g2d_params  params;
233 }sec_g2d_t;
234 
235 typedef struct __s5p_rect {
236     uint32_t x;
237     uint32_t y;
238     uint32_t w;
239     uint32_t h;
240 } __s5p_rect;
241 
242 typedef struct __s5p_img {
243     uint32_t width;
244     uint32_t height;
245     uint32_t format;
246     uint32_t offset;
247     uint32_t base;
248     int memory_id;
249 } __s5p_img;
250 
251 #endif /*_SEC_G2D_DRIVER_H_*/
252