Lines Matching refs:buffer
25 static inline void OUT(struct etnaviv_cmdbuf *buffer, u32 data) in OUT() argument
27 u32 *vaddr = (u32 *)buffer->vaddr; in OUT()
29 BUG_ON(buffer->user_size >= buffer->size); in OUT()
31 vaddr[buffer->user_size / 4] = data; in OUT()
32 buffer->user_size += 4; in OUT()
35 static inline void CMD_LOAD_STATE(struct etnaviv_cmdbuf *buffer, in CMD_LOAD_STATE() argument
40 buffer->user_size = ALIGN(buffer->user_size, 8); in CMD_LOAD_STATE()
43 OUT(buffer, VIV_FE_LOAD_STATE_HEADER_OP_LOAD_STATE | in CMD_LOAD_STATE()
46 OUT(buffer, value); in CMD_LOAD_STATE()
49 static inline void CMD_END(struct etnaviv_cmdbuf *buffer) in CMD_END() argument
51 buffer->user_size = ALIGN(buffer->user_size, 8); in CMD_END()
53 OUT(buffer, VIV_FE_END_HEADER_OP_END); in CMD_END()
56 static inline void CMD_WAIT(struct etnaviv_cmdbuf *buffer, in CMD_WAIT() argument
59 buffer->user_size = ALIGN(buffer->user_size, 8); in CMD_WAIT()
61 OUT(buffer, VIV_FE_WAIT_HEADER_OP_WAIT | waitcycles); in CMD_WAIT()
64 static inline void CMD_LINK(struct etnaviv_cmdbuf *buffer, in CMD_LINK() argument
67 buffer->user_size = ALIGN(buffer->user_size, 8); in CMD_LINK()
69 OUT(buffer, VIV_FE_LINK_HEADER_OP_LINK | in CMD_LINK()
71 OUT(buffer, address); in CMD_LINK()
74 static inline void CMD_STALL(struct etnaviv_cmdbuf *buffer, in CMD_STALL() argument
77 buffer->user_size = ALIGN(buffer->user_size, 8); in CMD_STALL()
79 OUT(buffer, VIV_FE_STALL_HEADER_OP_STALL); in CMD_STALL()
80 OUT(buffer, VIV_FE_STALL_TOKEN_FROM(from) | VIV_FE_STALL_TOKEN_TO(to)); in CMD_STALL()
83 static inline void CMD_SEM(struct etnaviv_cmdbuf *buffer, u32 from, u32 to) in CMD_SEM() argument
85 CMD_LOAD_STATE(buffer, VIVS_GL_SEMAPHORE_TOKEN, in CMD_SEM()
91 struct etnaviv_cmdbuf *buffer, u8 pipe) in etnaviv_cmd_select_pipe() argument
108 CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_CACHE, flush); in etnaviv_cmd_select_pipe()
109 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_cmd_select_pipe()
110 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_cmd_select_pipe()
112 CMD_LOAD_STATE(buffer, VIVS_GL_PIPE_SELECT, in etnaviv_cmd_select_pipe()
137 static void etnaviv_buffer_replace_wait(struct etnaviv_cmdbuf *buffer, in etnaviv_buffer_replace_wait() argument
140 u32 *lw = buffer->vaddr + wl_offset; in etnaviv_buffer_replace_wait()
153 struct etnaviv_cmdbuf *buffer, unsigned int cmd_dwords) in etnaviv_buffer_reserve() argument
155 if (buffer->user_size + cmd_dwords * sizeof(u64) > buffer->size) in etnaviv_buffer_reserve()
156 buffer->user_size = 0; in etnaviv_buffer_reserve()
158 return etnaviv_cmdbuf_get_va(buffer, in etnaviv_buffer_reserve()
160 buffer->user_size; in etnaviv_buffer_reserve()
165 struct etnaviv_cmdbuf *buffer = &gpu->buffer; in etnaviv_buffer_init() local
170 buffer->user_size = 0; in etnaviv_buffer_init()
172 CMD_WAIT(buffer, gpu->fe_waitcycles); in etnaviv_buffer_init()
173 CMD_LINK(buffer, 2, in etnaviv_buffer_init()
174 etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping) in etnaviv_buffer_init()
175 + buffer->user_size - 4); in etnaviv_buffer_init()
177 return buffer->user_size / 8; in etnaviv_buffer_init()
182 struct etnaviv_cmdbuf *buffer = &gpu->buffer; in etnaviv_buffer_config_mmuv2() local
186 buffer->user_size = 0; in etnaviv_buffer_config_mmuv2()
189 CMD_LOAD_STATE(buffer, VIVS_GL_PIPE_SELECT, in etnaviv_buffer_config_mmuv2()
191 CMD_LOAD_STATE(buffer, VIVS_MMUv2_CONFIGURATION, in etnaviv_buffer_config_mmuv2()
193 CMD_LOAD_STATE(buffer, VIVS_MMUv2_SAFE_ADDRESS, safe_addr); in etnaviv_buffer_config_mmuv2()
194 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_config_mmuv2()
195 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_config_mmuv2()
199 CMD_LOAD_STATE(buffer, VIVS_GL_PIPE_SELECT, in etnaviv_buffer_config_mmuv2()
201 CMD_LOAD_STATE(buffer, VIVS_MMUv2_CONFIGURATION, in etnaviv_buffer_config_mmuv2()
203 CMD_LOAD_STATE(buffer, VIVS_MMUv2_SAFE_ADDRESS, safe_addr); in etnaviv_buffer_config_mmuv2()
204 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_config_mmuv2()
205 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_config_mmuv2()
208 CMD_END(buffer); in etnaviv_buffer_config_mmuv2()
210 buffer->user_size = ALIGN(buffer->user_size, 8); in etnaviv_buffer_config_mmuv2()
212 return buffer->user_size / 8; in etnaviv_buffer_config_mmuv2()
217 struct etnaviv_cmdbuf *buffer = &gpu->buffer; in etnaviv_buffer_config_pta() local
221 buffer->user_size = 0; in etnaviv_buffer_config_pta()
223 CMD_LOAD_STATE(buffer, VIVS_MMUv2_PTA_CONFIG, in etnaviv_buffer_config_pta()
226 CMD_END(buffer); in etnaviv_buffer_config_pta()
228 buffer->user_size = ALIGN(buffer->user_size, 8); in etnaviv_buffer_config_pta()
230 return buffer->user_size / 8; in etnaviv_buffer_config_pta()
235 struct etnaviv_cmdbuf *buffer = &gpu->buffer; in etnaviv_buffer_end() local
236 unsigned int waitlink_offset = buffer->user_size - 16; in etnaviv_buffer_end()
258 link_target = etnaviv_buffer_reserve(gpu, buffer, dwords); in etnaviv_buffer_end()
260 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_end()
261 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_end()
263 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1); in etnaviv_buffer_end()
264 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_BLT); in etnaviv_buffer_end()
265 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_BLT); in etnaviv_buffer_end()
266 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0); in etnaviv_buffer_end()
268 CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_CACHE, flush); in etnaviv_buffer_end()
271 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1); in etnaviv_buffer_end()
272 CMD_LOAD_STATE(buffer, VIVS_BLT_SET_COMMAND, 0x1); in etnaviv_buffer_end()
273 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0); in etnaviv_buffer_end()
275 CMD_LOAD_STATE(buffer, VIVS_TS_FLUSH_CACHE, in etnaviv_buffer_end()
279 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_end()
280 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_end()
282 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1); in etnaviv_buffer_end()
283 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_BLT); in etnaviv_buffer_end()
284 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_BLT); in etnaviv_buffer_end()
285 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0); in etnaviv_buffer_end()
287 CMD_END(buffer); in etnaviv_buffer_end()
289 etnaviv_buffer_replace_wait(buffer, waitlink_offset, in etnaviv_buffer_end()
295 etnaviv_buffer_replace_wait(buffer, waitlink_offset, in etnaviv_buffer_end()
303 struct etnaviv_cmdbuf *buffer = &gpu->buffer; in etnaviv_sync_point_queue() local
304 unsigned int waitlink_offset = buffer->user_size - 16; in etnaviv_sync_point_queue()
314 target = etnaviv_buffer_reserve(gpu, buffer, dwords); in etnaviv_sync_point_queue()
317 CMD_LOAD_STATE(buffer, VIVS_GL_EVENT, VIVS_GL_EVENT_EVENT_ID(event) | in etnaviv_sync_point_queue()
321 CMD_END(buffer); in etnaviv_sync_point_queue()
324 CMD_WAIT(buffer, gpu->fe_waitcycles); in etnaviv_sync_point_queue()
325 CMD_LINK(buffer, 2, in etnaviv_sync_point_queue()
326 etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping) in etnaviv_sync_point_queue()
327 + buffer->user_size - 4); in etnaviv_sync_point_queue()
333 etnaviv_buffer_replace_wait(buffer, waitlink_offset, in etnaviv_sync_point_queue()
344 struct etnaviv_cmdbuf *buffer = &gpu->buffer; in etnaviv_buffer_queue() local
345 unsigned int waitlink_offset = buffer->user_size - 16; in etnaviv_buffer_queue()
358 etnaviv_buffer_dump(gpu, buffer, 0, 0x50); in etnaviv_buffer_queue()
391 target = etnaviv_buffer_reserve(gpu, buffer, extra_dwords); in etnaviv_buffer_queue()
408 CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_MMU, in etnaviv_buffer_queue()
422 CMD_LOAD_STATE(buffer, in etnaviv_buffer_queue()
430 CMD_LOAD_STATE(buffer, VIVS_MMUv2_CONFIGURATION, in etnaviv_buffer_queue()
432 CMD_SEM(buffer, SYNC_RECIPIENT_FE, in etnaviv_buffer_queue()
434 CMD_STALL(buffer, SYNC_RECIPIENT_FE, in etnaviv_buffer_queue()
442 etnaviv_cmd_select_pipe(gpu, buffer, exec_state); in etnaviv_buffer_queue()
449 CMD_LINK(buffer, link_dwords, link_target); in etnaviv_buffer_queue()
472 return_target = etnaviv_buffer_reserve(gpu, buffer, return_dwords); in etnaviv_buffer_queue()
480 CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_CACHE, in etnaviv_buffer_queue()
483 CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_CACHE, in etnaviv_buffer_queue()
487 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1); in etnaviv_buffer_queue()
488 CMD_LOAD_STATE(buffer, VIVS_BLT_SET_COMMAND, 0x1); in etnaviv_buffer_queue()
489 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0); in etnaviv_buffer_queue()
491 CMD_LOAD_STATE(buffer, VIVS_TS_FLUSH_CACHE, in etnaviv_buffer_queue()
495 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_queue()
496 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE); in etnaviv_buffer_queue()
499 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1); in etnaviv_buffer_queue()
500 CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_BLT); in etnaviv_buffer_queue()
501 CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_BLT); in etnaviv_buffer_queue()
502 CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0); in etnaviv_buffer_queue()
505 CMD_LOAD_STATE(buffer, VIVS_GL_EVENT, VIVS_GL_EVENT_EVENT_ID(event) | in etnaviv_buffer_queue()
507 CMD_WAIT(buffer, gpu->fe_waitcycles); in etnaviv_buffer_queue()
508 CMD_LINK(buffer, 2, in etnaviv_buffer_queue()
509 etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping) in etnaviv_buffer_queue()
510 + buffer->user_size - 4); in etnaviv_buffer_queue()
522 pr_info("link op: %p\n", buffer->vaddr + waitlink_offset); in etnaviv_buffer_queue()
532 etnaviv_buffer_replace_wait(buffer, waitlink_offset, in etnaviv_buffer_queue()
538 etnaviv_buffer_dump(gpu, buffer, 0, 0x50); in etnaviv_buffer_queue()