1 /*
2  * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
3  * Copyright (C) 2017 Linaro Ltd.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 and
7  * only version 2 as published by the Free Software Foundation.
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  */
15 #ifndef __VENUS_HFI_MSGS_H__
16 #define __VENUS_HFI_MSGS_H__
17 
18 /* message calls */
19 #define HFI_MSG_SYS_INIT			0x20001
20 #define HFI_MSG_SYS_PC_PREP			0x20002
21 #define HFI_MSG_SYS_RELEASE_RESOURCE		0x20003
22 #define HFI_MSG_SYS_DEBUG			0x20004
23 #define HFI_MSG_SYS_SESSION_INIT		0x20006
24 #define HFI_MSG_SYS_SESSION_END			0x20007
25 #define HFI_MSG_SYS_IDLE			0x20008
26 #define HFI_MSG_SYS_COV				0x20009
27 #define HFI_MSG_SYS_PROPERTY_INFO		0x2000a
28 
29 #define HFI_MSG_EVENT_NOTIFY			0x21001
30 #define HFI_MSG_SESSION_GET_SEQUENCE_HEADER	0x21002
31 
32 #define HFI_MSG_SYS_PING_ACK			0x220002
33 #define HFI_MSG_SYS_SESSION_ABORT		0x220004
34 
35 #define HFI_MSG_SESSION_LOAD_RESOURCES		0x221001
36 #define HFI_MSG_SESSION_START			0x221002
37 #define HFI_MSG_SESSION_STOP			0x221003
38 #define HFI_MSG_SESSION_SUSPEND			0x221004
39 #define HFI_MSG_SESSION_RESUME			0x221005
40 #define HFI_MSG_SESSION_FLUSH			0x221006
41 #define HFI_MSG_SESSION_EMPTY_BUFFER		0x221007
42 #define HFI_MSG_SESSION_FILL_BUFFER		0x221008
43 #define HFI_MSG_SESSION_PROPERTY_INFO		0x221009
44 #define HFI_MSG_SESSION_RELEASE_RESOURCES	0x22100a
45 #define HFI_MSG_SESSION_PARSE_SEQUENCE_HEADER	0x22100b
46 #define HFI_MSG_SESSION_RELEASE_BUFFERS		0x22100c
47 
48 #define HFI_PICTURE_I				0x00000001
49 #define HFI_PICTURE_P				0x00000002
50 #define HFI_PICTURE_B				0x00000004
51 #define HFI_PICTURE_IDR				0x00000008
52 #define HFI_FRAME_NOTCODED			0x7f002000
53 #define HFI_FRAME_YUV				0x7f004000
54 #define HFI_UNUSED_PICT				0x10000000
55 
56 /* message packets */
57 struct hfi_msg_event_notify_pkt {
58 	struct hfi_session_hdr_pkt shdr;
59 	u32 event_id;
60 	u32 event_data1;
61 	u32 event_data2;
62 	u32 ext_event_data[1];
63 };
64 
65 struct hfi_msg_event_release_buffer_ref_pkt {
66 	u32 packet_buffer;
67 	u32 extradata_buffer;
68 	u32 output_tag;
69 };
70 
71 struct hfi_msg_sys_init_done_pkt {
72 	struct hfi_pkt_hdr hdr;
73 	u32 error_type;
74 	u32 num_properties;
75 	u32 data[1];
76 };
77 
78 struct hfi_msg_sys_pc_prep_done_pkt {
79 	struct hfi_pkt_hdr hdr;
80 	u32 error_type;
81 };
82 
83 struct hfi_msg_sys_release_resource_done_pkt {
84 	struct hfi_pkt_hdr hdr;
85 	u32 resource_handle;
86 	u32 error_type;
87 };
88 
89 struct hfi_msg_session_init_done_pkt {
90 	struct hfi_session_hdr_pkt shdr;
91 	u32 error_type;
92 	u32 num_properties;
93 	u32 data[1];
94 };
95 
96 struct hfi_msg_session_end_done_pkt {
97 	struct hfi_session_hdr_pkt shdr;
98 	u32 error_type;
99 };
100 
101 struct hfi_msg_session_get_sequence_hdr_done_pkt {
102 	struct hfi_session_hdr_pkt shdr;
103 	u32 error_type;
104 	u32 header_len;
105 	u32 sequence_header;
106 };
107 
108 struct hfi_msg_sys_session_abort_done_pkt {
109 	struct hfi_session_hdr_pkt shdr;
110 	u32 error_type;
111 };
112 
113 struct hfi_msg_sys_idle_pkt {
114 	struct hfi_pkt_hdr hdr;
115 };
116 
117 struct hfi_msg_sys_ping_ack_pkt {
118 	struct hfi_pkt_hdr hdr;
119 	u32 client_data;
120 };
121 
122 struct hfi_msg_sys_property_info_pkt {
123 	struct hfi_pkt_hdr hdr;
124 	u32 num_properties;
125 	u32 data[1];
126 };
127 
128 struct hfi_msg_session_load_resources_done_pkt {
129 	struct hfi_session_hdr_pkt shdr;
130 	u32 error_type;
131 };
132 
133 struct hfi_msg_session_start_done_pkt {
134 	struct hfi_session_hdr_pkt shdr;
135 	u32 error_type;
136 };
137 
138 struct hfi_msg_session_stop_done_pkt {
139 	struct hfi_session_hdr_pkt shdr;
140 	u32 error_type;
141 };
142 
143 struct hfi_msg_session_suspend_done_pkt {
144 	struct hfi_session_hdr_pkt shdr;
145 	u32 error_type;
146 };
147 
148 struct hfi_msg_session_resume_done_pkt {
149 	struct hfi_session_hdr_pkt shdr;
150 	u32 error_type;
151 };
152 
153 struct hfi_msg_session_flush_done_pkt {
154 	struct hfi_session_hdr_pkt shdr;
155 	u32 error_type;
156 	u32 flush_type;
157 };
158 
159 struct hfi_msg_session_empty_buffer_done_pkt {
160 	struct hfi_session_hdr_pkt shdr;
161 	u32 error_type;
162 	u32 offset;
163 	u32 filled_len;
164 	u32 input_tag;
165 	u32 packet_buffer;
166 	u32 extradata_buffer;
167 	u32 data[0];
168 };
169 
170 struct hfi_msg_session_fbd_compressed_pkt {
171 	struct hfi_session_hdr_pkt shdr;
172 	u32 time_stamp_hi;
173 	u32 time_stamp_lo;
174 	u32 error_type;
175 	u32 flags;
176 	u32 mark_target;
177 	u32 mark_data;
178 	u32 stats;
179 	u32 offset;
180 	u32 alloc_len;
181 	u32 filled_len;
182 	u32 input_tag;
183 	u32 output_tag;
184 	u32 picture_type;
185 	u32 packet_buffer;
186 	u32 extradata_buffer;
187 	u32 data[0];
188 };
189 
190 struct hfi_msg_session_fbd_uncompressed_plane0_pkt {
191 	struct hfi_session_hdr_pkt shdr;
192 	u32 stream_id;
193 	u32 view_id;
194 	u32 error_type;
195 	u32 time_stamp_hi;
196 	u32 time_stamp_lo;
197 	u32 flags;
198 	u32 mark_target;
199 	u32 mark_data;
200 	u32 stats;
201 	u32 alloc_len;
202 	u32 filled_len;
203 	u32 offset;
204 	u32 frame_width;
205 	u32 frame_height;
206 	u32 start_x_coord;
207 	u32 start_y_coord;
208 	u32 input_tag;
209 	u32 input_tag2;
210 	u32 output_tag;
211 	u32 picture_type;
212 	u32 packet_buffer;
213 	u32 extradata_buffer;
214 	u32 data[0];
215 };
216 
217 struct hfi_msg_session_fbd_uncompressed_plane1_pkt {
218 	u32 flags;
219 	u32 alloc_len;
220 	u32 filled_len;
221 	u32 offset;
222 	u32 packet_buffer2;
223 	u32 data[0];
224 };
225 
226 struct hfi_msg_session_fbd_uncompressed_plane2_pkt {
227 	u32 flags;
228 	u32 alloc_len;
229 	u32 filled_len;
230 	u32 offset;
231 	u32 packet_buffer3;
232 	u32 data[0];
233 };
234 
235 struct hfi_msg_session_parse_sequence_header_done_pkt {
236 	struct hfi_session_hdr_pkt shdr;
237 	u32 error_type;
238 	u32 num_properties;
239 	u32 data[1];
240 };
241 
242 struct hfi_msg_session_property_info_pkt {
243 	struct hfi_session_hdr_pkt shdr;
244 	u32 num_properties;
245 	u32 data[1];
246 };
247 
248 struct hfi_msg_session_release_resources_done_pkt {
249 	struct hfi_session_hdr_pkt shdr;
250 	u32 error_type;
251 };
252 
253 struct hfi_msg_session_release_buffers_done_pkt {
254 	struct hfi_session_hdr_pkt shdr;
255 	u32 error_type;
256 	u32 num_buffers;
257 	u32 buffer_info[1];
258 };
259 
260 struct hfi_msg_sys_debug_pkt {
261 	struct hfi_pkt_hdr hdr;
262 	u32 msg_type;
263 	u32 msg_size;
264 	u32 time_stamp_hi;
265 	u32 time_stamp_lo;
266 	u8 msg_data[1];
267 };
268 
269 struct hfi_msg_sys_coverage_pkt {
270 	struct hfi_pkt_hdr hdr;
271 	u32 msg_size;
272 	u32 time_stamp_hi;
273 	u32 time_stamp_lo;
274 	u8 msg_data[1];
275 };
276 
277 struct venus_core;
278 struct hfi_pkt_hdr;
279 
280 void hfi_process_watchdog_timeout(struct venus_core *core);
281 u32 hfi_process_msg_packet(struct venus_core *core, struct hfi_pkt_hdr *hdr);
282 
283 #endif
284