blob: 8fba6e16f9b495762db60cf1e2399b74158a7a73 [file] [log] [blame]
Sudip Mukherjee81dee672015-03-03 16:21:06 +05301#ifndef ACCEL_H__
2#define ACCEL_H__
3
4#define HW_ROP2_COPY 0xc
5#define HW_ROP2_XOR 0x6
6
7/* notes: below address are the offset value from de_base_address (0x100000)*/
8
9/* for sm718/750/502 de_base is at mmreg_1mb*/
Juston Li78376532015-07-14 21:14:30 -070010#define DE_BASE_ADDR_TYPE1 0x100000
Sudip Mukherjee81dee672015-03-03 16:21:06 +053011/* for sm712,de_base is at mmreg_32kb */
12#define DE_BASE_ADDR_TYPE2 0x8000
13/* for sm722,de_base is at mmreg_0 */
14#define DE_BASE_ADDR_TYPE3 0
15
16/* type1 data port address is at mmreg_0x110000*/
17#define DE_PORT_ADDR_TYPE1 0x110000
18/* for sm712,data port address is at mmreg_0 */
19#define DE_PORT_ADDR_TYPE2 0x100000
20/* for sm722,data port address is at mmreg_1mb */
21#define DE_PORT_ADDR_TYPE3 0x100000
22
23#define DE_SOURCE 0x0
Mike Rapoportcf6d8f02016-02-15 19:53:57 +020024#define DE_SOURCE_WRAP BIT(31)
25#define DE_SOURCE_X_K1_SHIFT 16
26#define DE_SOURCE_X_K1_MASK (0x3fff << 16)
27#define DE_SOURCE_X_K1_MONO_MASK (0x1f << 16)
28#define DE_SOURCE_Y_K2_MASK 0xffff
Sudip Mukherjee81dee672015-03-03 16:21:06 +053029
30#define DE_DESTINATION 0x4
Mike Rapoportaeaab182016-02-15 19:53:58 +020031#define DE_DESTINATION_WRAP BIT(31)
32#define DE_DESTINATION_X_SHIFT 16
33#define DE_DESTINATION_X_MASK (0x1fff << 16)
34#define DE_DESTINATION_Y_MASK 0xffff
Sudip Mukherjee81dee672015-03-03 16:21:06 +053035
36#define DE_DIMENSION 0x8
Mike Rapoport0fab34b2016-02-15 19:53:59 +020037#define DE_DIMENSION_X_SHIFT 16
38#define DE_DIMENSION_X_MASK (0x1fff << 16)
39#define DE_DIMENSION_Y_ET_MASK 0x1fff
Sudip Mukherjee81dee672015-03-03 16:21:06 +053040
41#define DE_CONTROL 0xC
Mike Rapoporte2e22582016-02-15 19:54:00 +020042#define DE_CONTROL_STATUS BIT(31)
43#define DE_CONTROL_PATTERN BIT(30)
44#define DE_CONTROL_UPDATE_DESTINATION_X BIT(29)
45#define DE_CONTROL_QUICK_START BIT(28)
46#define DE_CONTROL_DIRECTION BIT(27)
47#define DE_CONTROL_MAJOR BIT(26)
48#define DE_CONTROL_STEP_X BIT(25)
49#define DE_CONTROL_STEP_Y BIT(24)
50#define DE_CONTROL_STRETCH BIT(23)
51#define DE_CONTROL_HOST BIT(22)
52#define DE_CONTROL_LAST_PIXEL BIT(21)
53#define DE_CONTROL_COMMAND_SHIFT 16
54#define DE_CONTROL_COMMAND_MASK (0x1f << 16)
55#define DE_CONTROL_COMMAND_BITBLT (0x0 << 16)
56#define DE_CONTROL_COMMAND_RECTANGLE_FILL (0x1 << 16)
57#define DE_CONTROL_COMMAND_DE_TILE (0x2 << 16)
58#define DE_CONTROL_COMMAND_TRAPEZOID_FILL (0x3 << 16)
59#define DE_CONTROL_COMMAND_ALPHA_BLEND (0x4 << 16)
60#define DE_CONTROL_COMMAND_RLE_STRIP (0x5 << 16)
61#define DE_CONTROL_COMMAND_SHORT_STROKE (0x6 << 16)
62#define DE_CONTROL_COMMAND_LINE_DRAW (0x7 << 16)
63#define DE_CONTROL_COMMAND_HOST_WRITE (0x8 << 16)
64#define DE_CONTROL_COMMAND_HOST_READ (0x9 << 16)
65#define DE_CONTROL_COMMAND_HOST_WRITE_BOTTOM_UP (0xa << 16)
66#define DE_CONTROL_COMMAND_ROTATE (0xb << 16)
67#define DE_CONTROL_COMMAND_FONT (0xc << 16)
68#define DE_CONTROL_COMMAND_TEXTURE_LOAD (0xe << 16)
69#define DE_CONTROL_ROP_SELECT BIT(15)
70#define DE_CONTROL_ROP2_SOURCE BIT(14)
71#define DE_CONTROL_MONO_DATA_SHIFT 12
72#define DE_CONTROL_MONO_DATA_MASK (0x3 << 12)
73#define DE_CONTROL_MONO_DATA_NOT_PACKED (0x0 << 12)
74#define DE_CONTROL_MONO_DATA_8_PACKED (0x1 << 12)
75#define DE_CONTROL_MONO_DATA_16_PACKED (0x2 << 12)
76#define DE_CONTROL_MONO_DATA_32_PACKED (0x3 << 12)
77#define DE_CONTROL_REPEAT_ROTATE BIT(11)
78#define DE_CONTROL_TRANSPARENCY_MATCH BIT(10)
79#define DE_CONTROL_TRANSPARENCY_SELECT BIT(9)
80#define DE_CONTROL_TRANSPARENCY BIT(8)
81#define DE_CONTROL_ROP_MASK 0xff
Sudip Mukherjee81dee672015-03-03 16:21:06 +053082
Juston Li5ee35ea2015-06-12 03:17:22 -070083/* Pseudo fields. */
Sudip Mukherjee81dee672015-03-03 16:21:06 +053084
85#define DE_CONTROL_SHORT_STROKE_DIR 27:24
86#define DE_CONTROL_SHORT_STROKE_DIR_225 0
87#define DE_CONTROL_SHORT_STROKE_DIR_135 1
88#define DE_CONTROL_SHORT_STROKE_DIR_315 2
89#define DE_CONTROL_SHORT_STROKE_DIR_45 3
90#define DE_CONTROL_SHORT_STROKE_DIR_270 4
91#define DE_CONTROL_SHORT_STROKE_DIR_90 5
92#define DE_CONTROL_SHORT_STROKE_DIR_180 8
93#define DE_CONTROL_SHORT_STROKE_DIR_0 10
94#define DE_CONTROL_ROTATION 25:24
95#define DE_CONTROL_ROTATION_0 0
96#define DE_CONTROL_ROTATION_270 1
97#define DE_CONTROL_ROTATION_90 2
98#define DE_CONTROL_ROTATION_180 3
99
100#define DE_PITCH 0x000010
101#define DE_PITCH_DESTINATION 28:16
102#define DE_PITCH_SOURCE 12:0
103
104#define DE_FOREGROUND 0x000014
105#define DE_FOREGROUND_COLOR 31:0
106
107#define DE_BACKGROUND 0x000018
108#define DE_BACKGROUND_COLOR 31:0
109
110#define DE_STRETCH_FORMAT 0x00001C
111#define DE_STRETCH_FORMAT_PATTERN_XY 30:30
112#define DE_STRETCH_FORMAT_PATTERN_XY_NORMAL 0
113#define DE_STRETCH_FORMAT_PATTERN_XY_OVERWRITE 1
114#define DE_STRETCH_FORMAT_PATTERN_Y 29:27
115#define DE_STRETCH_FORMAT_PATTERN_X 25:23
116#define DE_STRETCH_FORMAT_PIXEL_FORMAT 21:20
117#define DE_STRETCH_FORMAT_PIXEL_FORMAT_8 0
118#define DE_STRETCH_FORMAT_PIXEL_FORMAT_16 1
119#define DE_STRETCH_FORMAT_PIXEL_FORMAT_32 2
120#define DE_STRETCH_FORMAT_PIXEL_FORMAT_24 3
121
122#define DE_STRETCH_FORMAT_ADDRESSING 19:16
123#define DE_STRETCH_FORMAT_ADDRESSING_XY 0
124#define DE_STRETCH_FORMAT_ADDRESSING_LINEAR 15
125#define DE_STRETCH_FORMAT_SOURCE_HEIGHT 11:0
126
127#define DE_COLOR_COMPARE 0x000020
128#define DE_COLOR_COMPARE_COLOR 23:0
129
130#define DE_COLOR_COMPARE_MASK 0x000024
131#define DE_COLOR_COMPARE_MASK_MASKS 23:0
132
133#define DE_MASKS 0x000028
134#define DE_MASKS_BYTE_MASK 31:16
135#define DE_MASKS_BIT_MASK 15:0
136
137#define DE_CLIP_TL 0x00002C
138#define DE_CLIP_TL_TOP 31:16
139#define DE_CLIP_TL_STATUS 13:13
140#define DE_CLIP_TL_STATUS_DISABLE 0
141#define DE_CLIP_TL_STATUS_ENABLE 1
142#define DE_CLIP_TL_INHIBIT 12:12
143#define DE_CLIP_TL_INHIBIT_OUTSIDE 0
144#define DE_CLIP_TL_INHIBIT_INSIDE 1
145#define DE_CLIP_TL_LEFT 11:0
146
147#define DE_CLIP_BR 0x000030
148#define DE_CLIP_BR_BOTTOM 31:16
149#define DE_CLIP_BR_RIGHT 12:0
150
151#define DE_MONO_PATTERN_LOW 0x000034
152#define DE_MONO_PATTERN_LOW_PATTERN 31:0
153
154#define DE_MONO_PATTERN_HIGH 0x000038
155#define DE_MONO_PATTERN_HIGH_PATTERN 31:0
156
157#define DE_WINDOW_WIDTH 0x00003C
158#define DE_WINDOW_WIDTH_DESTINATION 28:16
159#define DE_WINDOW_WIDTH_SOURCE 12:0
160
161#define DE_WINDOW_SOURCE_BASE 0x000040
162#define DE_WINDOW_SOURCE_BASE_EXT 27:27
163#define DE_WINDOW_SOURCE_BASE_EXT_LOCAL 0
164#define DE_WINDOW_SOURCE_BASE_EXT_EXTERNAL 1
165#define DE_WINDOW_SOURCE_BASE_CS 26:26
166#define DE_WINDOW_SOURCE_BASE_CS_0 0
167#define DE_WINDOW_SOURCE_BASE_CS_1 1
168#define DE_WINDOW_SOURCE_BASE_ADDRESS 25:0
169
170#define DE_WINDOW_DESTINATION_BASE 0x000044
171#define DE_WINDOW_DESTINATION_BASE_EXT 27:27
172#define DE_WINDOW_DESTINATION_BASE_EXT_LOCAL 0
173#define DE_WINDOW_DESTINATION_BASE_EXT_EXTERNAL 1
174#define DE_WINDOW_DESTINATION_BASE_CS 26:26
175#define DE_WINDOW_DESTINATION_BASE_CS_0 0
176#define DE_WINDOW_DESTINATION_BASE_CS_1 1
177#define DE_WINDOW_DESTINATION_BASE_ADDRESS 25:0
178
179#define DE_ALPHA 0x000048
180#define DE_ALPHA_VALUE 7:0
181
182#define DE_WRAP 0x00004C
183#define DE_WRAP_X 31:16
184#define DE_WRAP_Y 15:0
185
186#define DE_STATUS 0x000050
187#define DE_STATUS_CSC 1:1
188#define DE_STATUS_CSC_CLEAR 0
189#define DE_STATUS_CSC_NOT_ACTIVE 0
190#define DE_STATUS_CSC_ACTIVE 1
191#define DE_STATUS_2D 0:0
192#define DE_STATUS_2D_CLEAR 0
193#define DE_STATUS_2D_NOT_ACTIVE 0
194#define DE_STATUS_2D_ACTIVE 1
195
196
197
198/* blt direction */
199#define TOP_TO_BOTTOM 0
200#define LEFT_TO_RIGHT 0
201#define BOTTOM_TO_TOP 1
202#define RIGHT_TO_LEFT 1
203
Greg Donaldeb0f4272015-06-18 15:06:56 -0500204void hw_set2dformat(struct lynx_accel *accel, int fmt);
Sudip Mukherjee81dee672015-03-03 16:21:06 +0530205
Greg Donaldeb0f4272015-06-18 15:06:56 -0500206void hw_de_init(struct lynx_accel *accel);
Sudip Mukherjee81dee672015-03-03 16:21:06 +0530207
Greg Donaldeb0f4272015-06-18 15:06:56 -0500208int hw_fillrect(struct lynx_accel *accel,
Isaac Assegai5e935812015-06-02 03:14:23 -0700209 u32 base, u32 pitch, u32 Bpp,
210 u32 x, u32 y, u32 width, u32 height,
211 u32 color, u32 rop);
Sudip Mukherjee81dee672015-03-03 16:21:06 +0530212
213int hw_copyarea(
Greg Donaldeb0f4272015-06-18 15:06:56 -0500214struct lynx_accel *accel,
Sudip Mukherjee81dee672015-03-03 16:21:06 +0530215unsigned int sBase, /* Address of source: offset in frame buffer */
216unsigned int sPitch, /* Pitch value of source surface in BYTE */
217unsigned int sx,
218unsigned int sy, /* Starting coordinate of source surface */
219unsigned int dBase, /* Address of destination: offset in frame buffer */
220unsigned int dPitch, /* Pitch value of destination surface in BYTE */
221unsigned int bpp, /* Color depth of destination surface */
222unsigned int dx,
223unsigned int dy, /* Starting coordinate of destination surface */
224unsigned int width,
225unsigned int height, /* width and height of rectangle in pixel value */
226unsigned int rop2);
227
Greg Kroah-Hartman7c6f3fd2015-03-10 22:03:01 +0100228int hw_imageblit(struct lynx_accel *accel,
229 const char *pSrcbuf, /* pointer to start of source buffer in system memory */
230 u32 srcDelta, /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */
231 u32 startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */
232 u32 dBase, /* Address of destination: offset in frame buffer */
233 u32 dPitch, /* Pitch value of destination surface in BYTE */
234 u32 bytePerPixel, /* Color depth of destination surface */
235 u32 dx,
236 u32 dy, /* Starting coordinate of destination surface */
237 u32 width,
Matej Vasekfbb8c962016-01-25 16:02:33 +0100238 u32 height, /* width and height of rectangle in pixel value */
Greg Kroah-Hartman7c6f3fd2015-03-10 22:03:01 +0100239 u32 fColor, /* Foreground color (corresponding to a 1 in the monochrome data */
240 u32 bColor, /* Background color (corresponding to a 0 in the monochrome data */
241 u32 rop2);
Sudip Mukherjee81dee672015-03-03 16:21:06 +0530242#endif