• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 #ifndef __HI_DRV_TDE_H__
20 #define __HI_DRV_TDE_H__
21 
22 #include "drv_tde_type.h"
23 
24 #ifdef __cplusplus
25 #if __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28 #endif /* __cplusplus */
29 
30 /* Use 't' as magic number */
31 #define TDE_IOC_MAGIC 't'
32 
33 typedef struct {
34     hi_u64 phy_addr; /* <Header address of a bitmap or the Y component */
35     hi_tde_color_fmt color_fmt; /* <Color format */
36 
37     hi_u32 height; /* <Bitmap height */
38 
39     hi_u32 width; /* <Bitmap width */
40     hi_u32 stride; /* <Stride of a bitmap or the Y component */
41 
42     /* <Address of the color look-up table (CLUT), for color extension or color correction */
43     hi_u64 clut_phy_addr;
44 
45     hi_bool is_ycbcr_clut; /* <Whether the CLUT is in the YCbCr space. */
46     hi_bool alpha_max_is_255; /* <The maximum alpha value of a bitmap is 255 or 128. */
47 
48     hi_bool support_alpha_ext_1555; /* <Whether to enable the alpha extension of an ARGB1555 bitmap. */
49     hi_u8 alpha0; /* <Values of alpha0 and alpha1, used as the ARGB1555 format */
50     hi_u8 alpha1; /* <Values of alpha0 and alpha1, used as the ARGB1555 format */
51     hi_u64 cbcr_phy_addr; /* Address of the CbCr component, pilot */
52     hi_u32 cbcr_stride; /* <Stride of the CbCr component, pilot */
53 } drv_tde_ioctl_surface;
54 
55 /* blit info */
56 typedef struct {
57     hi_s32 handle;                             /* < TDE handle */
58     drv_tde_ioctl_surface back_ground_surface; /* < background surface */
59     hi_tde_rect back_ground_rect;              /* < background surface operating rect */
60     drv_tde_ioctl_surface fore_ground_surface; /* < foreground surface */
61     hi_tde_rect fore_ground_rect;              /* < foreground surface operating rect */
62     drv_tde_ioctl_surface dst_surface;         /* < target surface */
63     hi_tde_rect dst_rect;                      /* < target surface operating rect */
64     hi_tde_opt option;                         /* < operating option */
65     hi_u32 null_indicator;                     /* < flag of mask , 1: valid ,0: invalid */
66 } drv_tde_bitblit_cmd;
67 
68 /* color fill info */
69 typedef struct {
70     hi_s32 handle;                             /* < TDE handle */
71     drv_tde_ioctl_surface fore_ground_surface; /* < background surface */
72     hi_tde_rect fore_ground_rect;              /* < background surface operating rect */
73     drv_tde_ioctl_surface dst_surface;         /* < foreground surface */
74     hi_tde_rect dst_rect;                      /* < foreground surface operating rect */
75     hi_tde_fill_color fill_color;              /* < fill color */
76     hi_tde_opt option;                         /* < operating option */
77     hi_u32 null_indicator;                     /* < flag of mask , 1: valid ,0: invalid */
78 } drv_tde_solid_draw_cmd;
79 
80 /* quick copy info */
81 typedef struct {
82     hi_s32 handle;                     /* < TDE handle */
83     drv_tde_ioctl_surface src_surface; /* < src surface */
84     hi_tde_rect src_rect;              /* < src surface rect */
85     drv_tde_ioctl_surface dst_surface; /* < target surface */
86     hi_tde_rect dst_rect;              /* < target rect */
87 } drv_tde_quick_copy_cmd;
88 
89 /* quick fill info */
90 typedef struct {
91     hi_s32 handle;                     /* < TDE handle */
92     drv_tde_ioctl_surface dst_surface; /* < target surface */
93     hi_tde_rect dst_rect;              /* < target surface rect */
94     hi_u32 fill_data;                  /* < fill color */
95 } drv_tde_quick_fill_cmd;
96 
97 /* quick defilicker info */
98 typedef struct {
99     hi_s32 handle;                     /* < TDE handle */
100     drv_tde_ioctl_surface src_surface; /* < src surface */
101     hi_tde_rect src_rect;              /* < src rect */
102     drv_tde_ioctl_surface dst_surface; /* < target surface */
103     hi_tde_rect dst_rect;              /* < target rect */
104 } drv_tde_quick_deflicker_cmd;
105 
106 /* quick scale info */
107 typedef struct {
108     hi_s32 handle;                     /* < TDE handle */
109     drv_tde_ioctl_surface src_surface; /* < src surface */
110     hi_tde_rect src_rect;              /* < src rect */
111     drv_tde_ioctl_surface dst_surface; /* < target surface */
112     hi_tde_rect dst_rect;              /* < target rect */
113 } drv_tde_quick_resize_cmd;
114 
115 /* semi-planar YUV to RGB info */
116 typedef struct {
117     hi_s32 handle;                     /* < TDE handle */
118     hi_tde_mb_surface mb_src_surface;  /* < src surface */
119     hi_tde_rect mb_src_rect;           /* < src rect */
120     drv_tde_ioctl_surface dst_surface; /* < target surface */
121     hi_tde_rect dst_rect;              /* < target rect */
122     hi_tde_mb_opt mb_option;           /* < operating option */
123 } drv_tde_mb_blit_cmd;
124 
125 /* mask blit rop blend info */
126 typedef struct {
127     hi_s32 handle;                             /* < TDE handle */
128     drv_tde_ioctl_surface back_ground_surface; /* < bk surface */
129     hi_tde_rect back_ground_rect;              /* < bk rect */
130     drv_tde_ioctl_surface fore_ground_surface; /* < fore surface */
131     hi_tde_rect fore_ground_rect;              /* < fore rect */
132     drv_tde_ioctl_surface mask_surface;        /* < mask surface  */
133     hi_tde_rect mask_rect;                     /* < mask surface rect */
134     drv_tde_ioctl_surface dst_surface;         /* < target surface */
135     hi_tde_rect dst_rect;                      /* < target rect */
136     hi_tde_rop_mode rop_color;                 /* < RGB rop type */
137     hi_tde_rop_mode rop_alpha;                 /* < alpha rop type */
138 } drv_tde_bitmap_maskrop_cmd;
139 
140 /* mask blit alpha blend info */
141 typedef struct {
142     hi_s32 handle;                             /* < TDE handle */
143     drv_tde_ioctl_surface back_ground_surface; /* < bk surface */
144     hi_tde_rect back_ground_rect;              /* < bk rect */
145     drv_tde_ioctl_surface fore_ground_surface; /* < fore surface */
146     hi_tde_rect fore_ground_rect;              /* < fore rect */
147     drv_tde_ioctl_surface mask_surface;        /* < mask surface  */
148     hi_tde_rect mask_rect;                     /* < mask surface rect */
149     drv_tde_ioctl_surface dst_surface;         /* < target surface */
150     hi_tde_rect dst_rect;                      /* < target rect */
151     hi_u8 alpha;                               /* < global alpha */
152     hi_u8 reserved0;
153     hi_u8 reserved1;
154     hi_u8 reserved2;
155     hi_tde_alpha_blending blend_mode; /* < blend opt */
156 } drv_tde_bitmap_maskblend_cmd;
157 
158 /* pattern fill */
159 typedef struct {
160     hi_s32 handle;                             /* < TDE handle */
161     drv_tde_ioctl_surface back_ground_surface; /* < bk surface */
162     hi_tde_rect back_ground_rect;              /* < bk rect */
163     drv_tde_ioctl_surface fore_ground_surface; /* < fore surface */
164     hi_tde_rect fore_ground_rect;              /* < fore rect */
165     drv_tde_ioctl_surface dst_surface;         /* < target surface */
166     hi_tde_rect dst_rect;                      /* < target rect */
167     hi_tde_pattern_fill_opt option;            /* < option */
168     hi_u32 null_indicator;                     /* < flag of mask , 1: valid ,0: invalid */
169 } drv_tde_pattern_fill_cmd;
170 
171 typedef struct {
172     hi_s32 handle;
173     drv_tde_ioctl_surface src_surface;
174     hi_tde_rect src_rect;
175     drv_tde_ioctl_surface dst_surface;
176     hi_tde_rect dst_rect;
177     hi_tde_rotate_angle rotate_angle;
178 } tde_rotate_cmd;
179 
180 #define TDE_BEGIN_JOB _IOR(TDE_IOC_MAGIC, 1, hi_s32)
181 #define TDE_BIT_BLIT _IOW(TDE_IOC_MAGIC, 2, drv_tde_bitblit_cmd)
182 #define TDE_SOLID_DRAW _IOW(TDE_IOC_MAGIC, 3, drv_tde_solid_draw_cmd)
183 #define TDE_QUICK_COPY _IOW(TDE_IOC_MAGIC, 4, drv_tde_quick_copy_cmd)
184 #define TDE_QUICK_RESIZE _IOW(TDE_IOC_MAGIC, 5, drv_tde_quick_resize_cmd)
185 #define TDE_QUICK_FILL _IOW(TDE_IOC_MAGIC, 6, drv_tde_quick_fill_cmd)
186 #define TDE_QUICK_DEFLICKER _IOW(TDE_IOC_MAGIC, 7, drv_tde_quick_deflicker_cmd)
187 #define TDE_MB_BITBLT _IOW(TDE_IOC_MAGIC, 8, drv_tde_mb_blit_cmd)
188 #define TDE_END_JOB _IOW(TDE_IOC_MAGIC, 9, drv_tde_end_job_cmd)
189 #define TDE_WAITFORDONE _IOW(TDE_IOC_MAGIC, 10, hi_s32)
190 #define TDE_CANCEL_JOB _IOW(TDE_IOC_MAGIC, 11, hi_s32)
191 #define TDE_BITMAP_MASKROP _IOW(TDE_IOC_MAGIC, 12, drv_tde_bitmap_maskrop_cmd)
192 #define TDE_BITMAP_MASKBLEND _IOW(TDE_IOC_MAGIC, 13, drv_tde_bitmap_maskblend_cmd)
193 #define TDE_WAITALLDONE _IO(TDE_IOC_MAGIC, 14)
194 #define TDE_RESET _IO(TDE_IOC_MAGIC, 15)
195 #define TDE_SET_DEFLICKERLEVEL _IOW(TDE_IOC_MAGIC, 17, hi_tde_deflicker_level)
196 #define TDE_GET_DEFLICKERLEVEL _IOR(TDE_IOC_MAGIC, 18, hi_tde_deflicker_level)
197 #define TDE_SET_ALPHATHRESHOLD_VALUE _IOW(TDE_IOC_MAGIC, 19, hi_u8)
198 #define TDE_GET_ALPHATHRESHOLD_VALUE _IOR(TDE_IOC_MAGIC, 20, hi_u8)
199 #define TDE_SET_ALPHATHRESHOLD_STATE _IOW(TDE_IOC_MAGIC, 21, hi_bool)
200 #define TDE_GET_ALPHATHRESHOLD_STATE _IOR(TDE_IOC_MAGIC, 22, hi_bool)
201 #define TDE_PATTERN_FILL _IOW(TDE_IOC_MAGIC, 23, drv_tde_pattern_fill_cmd)
202 #define TDE_ENABLE_REGIONDEFLICKER _IOW(TDE_IOC_MAGIC, 24, hi_bool)
203 #define TDE_ROTATE _IOW(TDE_IOC_MAGIC, 25, tde_rotate_cmd)
204 
205 #ifdef __cplusplus
206 #if __cplusplus
207 }
208 #endif /* __cplusplus */
209 #endif /* __cplusplus */
210 
211 #endif /* __HI_DRV_TDE_H__ */
212