Lines Matching refs:cmdbuf
74 #define MTXMSG_END(cmdbuf) (cmdbuf->reloc_base) argument
75 #define RELOC_END(cmdbuf) (cmdbuf->MTX_msg + cmdbuf->reloc_size) argument
77 #define CMD_END(cmdbuf) (cmdbuf->lldma_base) argument
78 #define LLDMA_END(cmdbuf) (cmdbuf->cmd_base + cmdbuf->size) argument
97 psb_cmdbuf_p cmdbuf in psb_cmdbuf_create() argument
105 cmdbuf->size = 0; in psb_cmdbuf_create()
106 cmdbuf->reloc_size = 0; in psb_cmdbuf_create()
107 cmdbuf->regio_size = 0; in psb_cmdbuf_create()
108 cmdbuf->MTX_msg = NULL; in psb_cmdbuf_create()
109 cmdbuf->cmd_base = NULL; in psb_cmdbuf_create()
110 cmdbuf->regio_base = NULL; in psb_cmdbuf_create()
111 cmdbuf->cmd_idx = NULL; in psb_cmdbuf_create()
112 cmdbuf->regio_idx = NULL; in psb_cmdbuf_create()
113 cmdbuf->cmd_bitstream_size = NULL; in psb_cmdbuf_create()
114 cmdbuf->lldma_base = NULL; in psb_cmdbuf_create()
115 cmdbuf->lldma_idx = NULL; in psb_cmdbuf_create()
116 cmdbuf->reloc_base = NULL; in psb_cmdbuf_create()
117 cmdbuf->reloc_idx = NULL; in psb_cmdbuf_create()
118 cmdbuf->reg_start = NULL; in psb_cmdbuf_create()
119 cmdbuf->rendec_block_start = NULL; in psb_cmdbuf_create()
120 cmdbuf->rendec_chunk_start = NULL; in psb_cmdbuf_create()
121 cmdbuf->skip_block_start = NULL; in psb_cmdbuf_create()
122 cmdbuf->last_next_segment_cmd = NULL; in psb_cmdbuf_create()
123 cmdbuf->buffer_refs_count = 0; in psb_cmdbuf_create()
124 cmdbuf->buffer_refs_allocated = 10; in psb_cmdbuf_create()
125 …cmdbuf->buffer_refs = (psb_buffer_p *) calloc(1, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_alloca… in psb_cmdbuf_create()
126 if (NULL == cmdbuf->buffer_refs) { in psb_cmdbuf_create()
127 cmdbuf->buffer_refs_allocated = 0; in psb_cmdbuf_create()
131 vaStatus = psb_buffer_create(driver_data, size, psb_bt_cpu_vpu, &cmdbuf->buf); in psb_cmdbuf_create()
132 cmdbuf->size = size; in psb_cmdbuf_create()
135 vaStatus = psb_buffer_create(driver_data, reloc_size, psb_bt_cpu_only, &cmdbuf->reloc_buf); in psb_cmdbuf_create()
136 cmdbuf->reloc_size = reloc_size; in psb_cmdbuf_create()
139 vaStatus = psb_buffer_create(driver_data, regio_size, psb_bt_cpu_only, &cmdbuf->regio_buf); in psb_cmdbuf_create()
140 cmdbuf->regio_size = regio_size; in psb_cmdbuf_create()
144 psb_cmdbuf_destroy(cmdbuf); in psb_cmdbuf_create()
152 void psb_cmdbuf_destroy(psb_cmdbuf_p cmdbuf) in psb_cmdbuf_destroy() argument
154 if (cmdbuf->size) { in psb_cmdbuf_destroy()
155 psb_buffer_destroy(&cmdbuf->buf); in psb_cmdbuf_destroy()
156 cmdbuf->size = 0; in psb_cmdbuf_destroy()
158 if (cmdbuf->reloc_size) { in psb_cmdbuf_destroy()
159 psb_buffer_destroy(&cmdbuf->reloc_buf); in psb_cmdbuf_destroy()
160 cmdbuf->reloc_size = 0; in psb_cmdbuf_destroy()
162 if (cmdbuf->regio_size) { in psb_cmdbuf_destroy()
163 psb_buffer_destroy(&cmdbuf->regio_buf); in psb_cmdbuf_destroy()
164 cmdbuf->regio_size = 0; in psb_cmdbuf_destroy()
166 if (cmdbuf->buffer_refs_allocated) { in psb_cmdbuf_destroy()
167 free(cmdbuf->buffer_refs); in psb_cmdbuf_destroy()
168 cmdbuf->buffer_refs = NULL; in psb_cmdbuf_destroy()
169 cmdbuf->buffer_refs_allocated = 0; in psb_cmdbuf_destroy()
178 int psb_cmdbuf_reset(psb_cmdbuf_p cmdbuf) in psb_cmdbuf_reset() argument
182 cmdbuf->MTX_msg = NULL; in psb_cmdbuf_reset()
183 cmdbuf->cmd_base = NULL; in psb_cmdbuf_reset()
184 cmdbuf->cmd_idx = NULL; in psb_cmdbuf_reset()
185 cmdbuf->cmd_bitstream_size = NULL; in psb_cmdbuf_reset()
186 cmdbuf->lldma_base = NULL; in psb_cmdbuf_reset()
187 cmdbuf->lldma_idx = NULL; in psb_cmdbuf_reset()
188 cmdbuf->reloc_base = NULL; in psb_cmdbuf_reset()
189 cmdbuf->reloc_idx = NULL; in psb_cmdbuf_reset()
190 cmdbuf->last_next_segment_cmd = NULL; in psb_cmdbuf_reset()
192 cmdbuf->buffer_refs_count = 0; in psb_cmdbuf_reset()
193 cmdbuf->cmd_count = 0; in psb_cmdbuf_reset()
194 cmdbuf->deblock_count = 0; in psb_cmdbuf_reset()
195 cmdbuf->oold_count = 0; in psb_cmdbuf_reset()
196 cmdbuf->host_be_opp_count = 0; in psb_cmdbuf_reset()
197 cmdbuf->frame_info_count = 0; in psb_cmdbuf_reset()
199 cmdbuf->parse_count = 0; in psb_cmdbuf_reset()
201 ret = psb_buffer_map(&cmdbuf->buf, &cmdbuf->cmd_base); in psb_cmdbuf_reset()
205 ret = psb_buffer_map(&cmdbuf->reloc_buf, &cmdbuf->MTX_msg); in psb_cmdbuf_reset()
207 psb_buffer_unmap(&cmdbuf->buf); in psb_cmdbuf_reset()
211 cmdbuf->cmd_start = cmdbuf->cmd_base; in psb_cmdbuf_reset()
212 cmdbuf->cmd_idx = (uint32_t *) cmdbuf->cmd_base; in psb_cmdbuf_reset()
213 cmdbuf->cmd_bitstream_size = NULL; in psb_cmdbuf_reset()
214 cmdbuf->lldma_base = cmdbuf->cmd_base + CMD_SIZE; in psb_cmdbuf_reset()
215 cmdbuf->lldma_idx = cmdbuf->lldma_base; in psb_cmdbuf_reset()
217 cmdbuf->reloc_base = cmdbuf->MTX_msg + MTXMSG_SIZE; in psb_cmdbuf_reset()
218 cmdbuf->reloc_idx = (struct drm_psb_reloc *) cmdbuf->reloc_base; in psb_cmdbuf_reset()
221 psb_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->reloc_buf); /* reloc buf == 0 */ in psb_cmdbuf_reset()
222 psb_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->buf); /* cmd buf == 1 */ in psb_cmdbuf_reset()
231 int psb_cmdbuf_unmap(psb_cmdbuf_p cmdbuf) in psb_cmdbuf_unmap() argument
233 cmdbuf->MTX_msg = NULL; in psb_cmdbuf_unmap()
234 cmdbuf->cmd_base = NULL; in psb_cmdbuf_unmap()
235 cmdbuf->cmd_start = NULL; in psb_cmdbuf_unmap()
236 cmdbuf->cmd_idx = NULL; in psb_cmdbuf_unmap()
237 cmdbuf->cmd_bitstream_size = NULL; in psb_cmdbuf_unmap()
238 cmdbuf->lldma_base = NULL; in psb_cmdbuf_unmap()
239 cmdbuf->lldma_idx = NULL; in psb_cmdbuf_unmap()
240 cmdbuf->reloc_base = NULL; in psb_cmdbuf_unmap()
241 cmdbuf->reloc_idx = NULL; in psb_cmdbuf_unmap()
242 cmdbuf->cmd_count = 0; in psb_cmdbuf_unmap()
243 psb_buffer_unmap(&cmdbuf->buf); in psb_cmdbuf_unmap()
244 psb_buffer_unmap(&cmdbuf->reloc_buf); in psb_cmdbuf_unmap()
254 int psb_cmdbuf_buffer_ref(psb_cmdbuf_p cmdbuf, psb_buffer_p buf) in psb_cmdbuf_buffer_ref() argument
259 while ((item_loc < cmdbuf->buffer_refs_count) in psb_cmdbuf_buffer_ref()
260 && (wsbmKBufHandle(wsbmKBuf(cmdbuf->buffer_refs[item_loc]->drm_buf)) in psb_cmdbuf_buffer_ref()
264 if (item_loc == cmdbuf->buffer_refs_count) { in psb_cmdbuf_buffer_ref()
266 if (item_loc >= cmdbuf->buffer_refs_allocated) { in psb_cmdbuf_buffer_ref()
268 int new_size = cmdbuf->buffer_refs_allocated + 10; in psb_cmdbuf_buffer_ref()
274 … memcpy(new_array, cmdbuf->buffer_refs, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_allocated); in psb_cmdbuf_buffer_ref()
275 free(cmdbuf->buffer_refs); in psb_cmdbuf_buffer_ref()
276 cmdbuf->buffer_refs_allocated = new_size; in psb_cmdbuf_buffer_ref()
277 cmdbuf->buffer_refs = new_array; in psb_cmdbuf_buffer_ref()
279 cmdbuf->buffer_refs[item_loc] = buf; in psb_cmdbuf_buffer_ref()
280 cmdbuf->buffer_refs_count++; in psb_cmdbuf_buffer_ref()
288 if ((cmdbuf->buffer_refs[item_loc] != buf) in psb_cmdbuf_buffer_ref()
290 psb_buffer_p tmp = cmdbuf->buffer_refs[item_loc]; in psb_cmdbuf_buffer_ref()
320 void psb_cmdbuf_add_relocation(psb_cmdbuf_p cmdbuf, in psb_cmdbuf_add_relocation() argument
329 struct drm_psb_reloc *reloc = cmdbuf->reloc_idx; in psb_cmdbuf_add_relocation()
334 ASSERT(((unsigned char *)(addr_in_cmdbuf)) >= cmdbuf->cmd_base); in psb_cmdbuf_add_relocation()
335 ASSERT(((unsigned char *)(addr_in_cmdbuf)) < LLDMA_END(cmdbuf)); in psb_cmdbuf_add_relocation()
336 reloc->where = addr_in_cmdbuf - (uint32_t *) cmdbuf->cmd_base; /* Location in DWORDs */ in psb_cmdbuf_add_relocation()
338 ASSERT(((unsigned char *)(addr_in_cmdbuf)) >= cmdbuf->MTX_msg); in psb_cmdbuf_add_relocation()
339 ASSERT(((unsigned char *)(addr_in_cmdbuf)) < MTXMSG_END(cmdbuf)); in psb_cmdbuf_add_relocation()
340 reloc->where = addr_in_cmdbuf - (uint32_t *) cmdbuf->MTX_msg; /* Location in DWORDs */ in psb_cmdbuf_add_relocation()
343 reloc->buffer = psb_cmdbuf_buffer_ref(cmdbuf, ref_buffer); in psb_cmdbuf_add_relocation()
365 cmdbuf->reloc_idx++; in psb_cmdbuf_add_relocation()
367 ASSERT(((unsigned char *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf)); in psb_cmdbuf_add_relocation()
377 psb_cmdbuf_p cmdbuf; in psb_context_get_next_cmdbuf() local
380 if (obj_context->cmdbuf) { in psb_context_get_next_cmdbuf()
388 cmdbuf = obj_context->cmdbuf_list[obj_context->cmdbuf_current]; in psb_context_get_next_cmdbuf()
389 ret = psb_cmdbuf_reset(cmdbuf); in psb_context_get_next_cmdbuf()
392 obj_context->cmdbuf = cmdbuf; in psb_context_get_next_cmdbuf()
618 static void psb_cmdbuf_close_segment(psb_cmdbuf_p __maybe_unused cmdbuf) in psb_cmdbuf_close_segment() argument
621 uint32_t bytes_used = ((unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start) % MTX_SEG_SIZE; in psb_cmdbuf_close_segment()
622 unsigned char *segment_start = (unsigned char *) cmdbuf->cmd_idx - bytes_used; in psb_cmdbuf_close_segment()
623 uint32_t lldma_record_offset = psb_cmdbuf_lldma_create(cmdbuf, in psb_cmdbuf_close_segment()
624 &(cmdbuf->buf), (segment_start - cmdbuf->cmd_base) /* offset */, in psb_cmdbuf_close_segment()
629 RELOC_SHIFT4(*cmdbuf->last_next_segment_cmd, lldma_record_offset, cmd, &(cmdbuf->buf)); in psb_cmdbuf_close_segment()
630 *(cmdbuf->last_next_segment_cmd + 1) = bytes_used; in psb_cmdbuf_close_segment()
648 psb_cmdbuf_p cmdbuf = obj_context->cmdbuf; in psb_context_submit_hw_deblock() local
654 uint32_t *msg = (uint32_t *)(cmdbuf->MTX_msg + item_size * cmdbuf->cmd_count); in psb_context_submit_hw_deblock()
681 cmdbuf->deblock_count++; in psb_context_submit_hw_deblock()
698 psb_cmdbuf_p cmdbuf = obj_context->cmdbuf; in psb_context_submit_host_be_opp() local
704 …uint32_t *msg = (uint32_t *)(cmdbuf->MTX_msg + item_size * cmdbuf->cmd_count + cmdbuf->deblock_cou… in psb_context_submit_host_be_opp()
726 cmdbuf->deblock_count++; in psb_context_submit_host_be_opp()
737 psb_cmdbuf_p cmdbuf = obj_context->cmdbuf; in psb_context_submit_cmdbuf() local
743 uint32_t cmdbuffer_size = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start; // In bytes in psb_context_submit_cmdbuf()
745 if (cmdbuf->last_next_segment_cmd) { in psb_context_submit_cmdbuf()
746 cmdbuffer_size = cmdbuf->first_segment_size; in psb_context_submit_cmdbuf()
747 psb_cmdbuf_close_segment(cmdbuf); in psb_context_submit_cmdbuf()
751 …uint32_t *msg = (uint32_t *)(cmdbuf->MTX_msg + cmdbuf->cmd_count * msg_size + cmdbuf->frame_info_c… in psb_context_submit_cmdbuf()
754 debug_cmd_start[cmdbuf->cmd_count] = cmdbuf->cmd_start - cmdbuf->cmd_base; in psb_context_submit_cmdbuf()
755 debug_cmd_size[cmdbuf->cmd_count] = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start; in psb_context_submit_cmdbuf()
756 debug_cmd_count = cmdbuf->cmd_count + 1; in psb_context_submit_cmdbuf()
770 ret = psb_cmdbuf_dump((unsigned int *)cmdbuf->cmd_start, cmdbuffer_size); in psb_context_submit_cmdbuf()
774 cmdbuf->cmd_count++; in psb_context_submit_cmdbuf()
777 *cmdbuf->cmd_idx = 0; // Add a trailing 0 just in case. in psb_context_submit_cmdbuf()
779 ASSERT((unsigned char *) cmdbuf->cmd_idx < CMD_END(cmdbuf)); in psb_context_submit_cmdbuf()
788 (cmdbuf->cmd_start - cmdbuf->cmd_base), &(cmdbuf->buf)); in psb_context_submit_cmdbuf()
794 debug_lldma_count = (cmdbuf->lldma_idx - cmdbuf->lldma_base) / sizeof(DMA_sLinkedList); in psb_context_submit_cmdbuf()
795 debug_lldma_start = cmdbuf->lldma_base - cmdbuf->cmd_base; in psb_context_submit_cmdbuf()
797 ((uint32_t *)cmdbuf->lldma_idx)[1] = 0; in psb_context_submit_cmdbuf()
800 cmdbuf->cmd_start = (unsigned char *)cmdbuf->cmd_idx; in psb_context_submit_cmdbuf()
805 if ((cmdbuf->cmd_count >= MAX_CMD_COUNT) || in psb_context_submit_cmdbuf()
806 (MTXMSG_END(cmdbuf) - (unsigned char *) msg < MTXMSG_MARGIN) || in psb_context_submit_cmdbuf()
807 (CMD_END(cmdbuf) - (unsigned char *) cmdbuf->cmd_idx < CMD_MARGIN) || in psb_context_submit_cmdbuf()
808 (LLDMA_END(cmdbuf) - cmdbuf->lldma_idx < LLDMA_MARGIN) || in psb_context_submit_cmdbuf()
809 (RELOC_END(cmdbuf) - (unsigned char *) cmdbuf->reloc_idx < RELOC_MARGIN)) { in psb_context_submit_cmdbuf()
821 psb_cmdbuf_p cmdbuf = obj_context->cmdbuf; in psb_context_flush_cmdbuf() local
832 if ((NULL == cmdbuf) || in psb_context_flush_cmdbuf()
833 (0 == (cmdbuf->cmd_count + cmdbuf->deblock_count + cmdbuf->host_be_opp_count + in psb_context_flush_cmdbuf()
834 cmdbuf->frame_info_count + cmdbuf->parse_count))) { in psb_context_flush_cmdbuf()
838 if ((NULL == cmdbuf) || in psb_context_flush_cmdbuf()
839 …(0 == (cmdbuf->cmd_count + cmdbuf->deblock_count + cmdbuf->host_be_opp_count + cmdbuf->frame_info_… in psb_context_flush_cmdbuf()
845 uint32_t *msg = (uint32_t *)cmdbuf->MTX_msg; in psb_context_flush_cmdbuf()
857 for (i = 1; i <= cmdbuf->frame_info_count; i++) { in psb_context_flush_cmdbuf()
862 for (i = 1; i <= cmdbuf->cmd_count; i++) { in psb_context_flush_cmdbuf()
868 int bBatchEnd = (i == (cmdbuf->cmd_count + cmdbuf->deblock_count + cmdbuf->oold_count in psb_context_flush_cmdbuf()
869 + cmdbuf->host_be_opp_count)); in psb_context_flush_cmdbuf()
897 for (i = 1; i <= cmdbuf->deblock_count; i++) { in psb_context_flush_cmdbuf()
901 for (i = 1; i <= cmdbuf->oold_count; i++) { in psb_context_flush_cmdbuf()
905 for (i = 1; i <= cmdbuf->host_be_opp_count; i++) { in psb_context_flush_cmdbuf()
909 for (i = 1; i <= cmdbuf->parse_count; i++) { in psb_context_flush_cmdbuf()
914 reloc_offset = cmdbuf->reloc_base - cmdbuf->MTX_msg; in psb_context_flush_cmdbuf()
915 …num_relocs = (((unsigned char *) cmdbuf->reloc_idx) - cmdbuf->reloc_base) / sizeof(struct drm_psb_… in psb_context_flush_cmdbuf()
918 …mdbuf CMD size = %08x - %d[%08x]\n", (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_base, cmdbuf-… in psb_context_flush_cmdbuf()
919 …_msg(VIDEO_DEBUG_GENERAL, "Cmdbuf LLDMA size = %08x [%08x]\n", cmdbuf->lldma_idx - cmdbuf->lldma_b… in psb_context_flush_cmdbuf()
922 psb_cmdbuf_unmap(cmdbuf); in psb_context_flush_cmdbuf()
926 ASSERT(NULL == cmdbuf->MTX_msg); in psb_context_flush_cmdbuf()
927 ASSERT(NULL == cmdbuf->reloc_base); in psb_context_flush_cmdbuf()
941 ret = psbDRMCmdBuf(driver_data->drm_fd, driver_data->execIoctlOffset, cmdbuf->buffer_refs, in psb_context_flush_cmdbuf()
942 cmdbuf->buffer_refs_count, in psb_context_flush_cmdbuf()
943 wsbmKBufHandle(wsbmKBuf(cmdbuf->reloc_buf.drm_buf)), in psb_context_flush_cmdbuf()
945 wsbmKBufHandle(wsbmKBuf(cmdbuf->reloc_buf.drm_buf)), in psb_context_flush_cmdbuf()
952 obj_context->cmdbuf = NULL; in psb_context_flush_cmdbuf()
968 psb_buffer_map(&cmdbuf->buf, &cmdbuf->cmd_base); in psb_context_flush_cmdbuf()
970 ret = psb_buffer_map(&cmdbuf->reloc_buf, &cmdbuf->MTX_msg); in psb_context_flush_cmdbuf()
972 psb_buffer_unmap(&cmdbuf->buf); in psb_context_flush_cmdbuf()
978 … debug_lldma_count, wsbmBOOffsetHint(cmdbuf->buf.drm_buf) + CMD_SIZE); in psb_context_flush_cmdbuf()
980 … DMA_sLinkedList* pasDmaList = (DMA_sLinkedList*)(cmdbuf->cmd_base + debug_lldma_start); in psb_context_flush_cmdbuf()
983 …_trace_message("\nLLDMA record at offset %08x\n", ((unsigned char*)pasDmaList) - cmdbuf->cmd_base); in psb_context_flush_cmdbuf()
1025 debug_cmd_count, wsbmBOOffsetHint(cmdbuf->buf.drm_buf)); in psb_context_flush_cmdbuf()
1027 uint32_t *msg = (uint32_t *)(cmdbuf->MTX_msg + index * item_size); in psb_context_flush_cmdbuf()
1030 … debug_dump_cmdbuf((uint32_t *)(cmdbuf->cmd_base + debug_cmd_start[index]), debug_cmd_size[index]); in psb_context_flush_cmdbuf()
1067 psb_buffer_unmap(&cmdbuf->buf); in psb_context_flush_cmdbuf()
1068 psb_buffer_unmap(&cmdbuf->reloc_buf); in psb_context_flush_cmdbuf()
1070 cmdbuf->cmd_base = NULL; in psb_context_flush_cmdbuf()
1083 obj_context->cmdbuf = NULL; in psb_context_flush_cmdbuf()
1239 void *psb_cmdbuf_alloc_space(psb_cmdbuf_p cmdbuf, uint32_t byte_size) in psb_cmdbuf_alloc_space() argument
1241 void *pos = (void *)cmdbuf->cmd_idx; in psb_cmdbuf_alloc_space()
1244 cmdbuf->cmd_idx += (byte_size / 4); in psb_cmdbuf_alloc_space()
1249 void psb_cmdbuf_dma_write_cmdbuf(psb_cmdbuf_p cmdbuf, in psb_cmdbuf_dma_write_cmdbuf() argument
1263 dma_cmd = (DMA_CMD_WITH_OFFSET*)psb_cmdbuf_alloc_space(cmdbuf, sizeof(DMA_CMD)); in psb_cmdbuf_dma_write_cmdbuf()
1268 … dma_cmd = (DMA_CMD_WITH_OFFSET*)psb_cmdbuf_alloc_space(cmdbuf, sizeof(DMA_CMD_WITH_OFFSET)); in psb_cmdbuf_dma_write_cmdbuf()
1283 void psb_cmdbuf_dma_write_bitstream(psb_cmdbuf_p cmdbuf, in psb_cmdbuf_dma_write_bitstream() argument
1308 *cmdbuf->cmd_idx++ = CMD_SR_SETUP | flags; in psb_cmdbuf_dma_write_bitstream()
1309 *cmdbuf->cmd_idx++ = offset_in_bits; in psb_cmdbuf_dma_write_bitstream()
1310 cmdbuf->cmd_bitstream_size = cmdbuf->cmd_idx; in psb_cmdbuf_dma_write_bitstream()
1311 *cmdbuf->cmd_idx++ = size_in_bytes; in psb_cmdbuf_dma_write_bitstream()
1312 *cmdbuf->cmd_idx++ = (CMD_BITSTREAM_DMA | size_in_bytes); in psb_cmdbuf_dma_write_bitstream()
1313 RELOC(*cmdbuf->cmd_idx++, buffer_offset, bitstream_buf); in psb_cmdbuf_dma_write_bitstream()
1320 void psb_cmdbuf_dma_write_key(psb_cmdbuf_p cmdbuf, in psb_cmdbuf_dma_write_key() argument
1325 *cmdbuf->cmd_idx++ = CMD_SR_SETUP | flags; in psb_cmdbuf_dma_write_key()
1326 *cmdbuf->cmd_idx++ = key; in psb_cmdbuf_dma_write_key()
1333 void psb_cmdbuf_dma_write_bitstream_chained(psb_cmdbuf_p cmdbuf, in psb_cmdbuf_dma_write_bitstream_chained() argument
1337 *cmdbuf->cmd_idx++ = (CMD_BITSTREAM_DMA | size_in_bytes); in psb_cmdbuf_dma_write_bitstream_chained()
1338 RELOC(*cmdbuf->cmd_idx++, bitstream_buf->buffer_ofs, bitstream_buf); in psb_cmdbuf_dma_write_bitstream_chained()
1340 *(cmdbuf->cmd_bitstream_size) += size_in_bytes; in psb_cmdbuf_dma_write_bitstream_chained()
1343 void psb_cmdbuf_reg_start_block(psb_cmdbuf_p cmdbuf, uint32_t flags) in psb_cmdbuf_reg_start_block() argument
1345 ASSERT(NULL == cmdbuf->reg_start); /* Can't have both */ in psb_cmdbuf_reg_start_block()
1347 cmdbuf->reg_wt_p = cmdbuf->cmd_idx; in psb_cmdbuf_reg_start_block()
1348 cmdbuf->reg_next = 0; in psb_cmdbuf_reg_start_block()
1349 cmdbuf->reg_flags = (flags << 4); /* flags are diff between DE2 & DE3 */ in psb_cmdbuf_reg_start_block()
1350 cmdbuf->reg_start = NULL; in psb_cmdbuf_reg_start_block()
1353 void psb_cmdbuf_reg_set(psb_cmdbuf_p cmdbuf, uint32_t reg, uint32_t val) in psb_cmdbuf_reg_set() argument
1355 if(cmdbuf->reg_start && (reg == cmdbuf->reg_next)) in psb_cmdbuf_reg_set()
1358 *cmdbuf->reg_start += (0x1 << 16); in psb_cmdbuf_reg_set()
1362 cmdbuf->reg_start = cmdbuf->reg_wt_p++; in psb_cmdbuf_reg_set()
1363 …*cmdbuf->reg_start = CMD_REGVALPAIR_WRITE | cmdbuf->reg_flags | 0x10000 | (reg & 0xfffff); /* We w… in psb_cmdbuf_reg_set()
1365 *cmdbuf->reg_wt_p++ = val; in psb_cmdbuf_reg_set()
1366 cmdbuf->reg_next = reg + 4; in psb_cmdbuf_reg_set()
1369 void psb_cmdbuf_reg_set_address(psb_cmdbuf_p cmdbuf, in psb_cmdbuf_reg_set_address() argument
1374 if(cmdbuf->reg_start && (reg == cmdbuf->reg_next)) in psb_cmdbuf_reg_set_address()
1377 *cmdbuf->reg_start += (0x1 << 16); in psb_cmdbuf_reg_set_address()
1381 cmdbuf->reg_start = cmdbuf->reg_wt_p++; in psb_cmdbuf_reg_set_address()
1382 …*cmdbuf->reg_start = CMD_REGVALPAIR_WRITE | cmdbuf->reg_flags | 0x10000 | (reg & 0xfffff); /* We w… in psb_cmdbuf_reg_set_address()
1385 RELOC(*cmdbuf->reg_wt_p++, buffer_offset, buffer); in psb_cmdbuf_reg_set_address()
1386 cmdbuf->reg_next = reg + 4; in psb_cmdbuf_reg_set_address()
1389 void psb_cmdbuf_reg_end_block(psb_cmdbuf_p cmdbuf) in psb_cmdbuf_reg_end_block() argument
1391 cmdbuf->cmd_idx = cmdbuf->reg_wt_p; in psb_cmdbuf_reg_end_block()
1392 cmdbuf->reg_start = NULL; in psb_cmdbuf_reg_end_block()
1405 void psb_cmdbuf_rendec_start(psb_cmdbuf_p cmdbuf, uint32_t dest_address) in psb_cmdbuf_rendec_start() argument
1408 cmdbuf->rendec_chunk_start = cmdbuf->cmd_idx++; in psb_cmdbuf_rendec_start()
1409 *cmdbuf->rendec_chunk_start = CMD_RENDEC_BLOCK | dest_address; in psb_cmdbuf_rendec_start()
1412 void psb_cmdbuf_rendec_write_block(psb_cmdbuf_p cmdbuf, in psb_cmdbuf_rendec_write_block() argument
1420 psb_cmdbuf_rendec_write(cmdbuf, val); in psb_cmdbuf_rendec_write_block()
1424 void psb_cmdbuf_rendec_write_address(psb_cmdbuf_p cmdbuf, in psb_cmdbuf_rendec_write_address() argument
1428 RELOC(*cmdbuf->cmd_idx++, buffer_offset, buffer); in psb_cmdbuf_rendec_write_address()
1434 void psb_cmdbuf_rendec_end(psb_cmdbuf_p cmdbuf) in psb_cmdbuf_rendec_end() argument
1436 ASSERT(NULL != cmdbuf->rendec_chunk_start); /* Must have an open RENDEC chunk */ in psb_cmdbuf_rendec_end()
1437 uint32_t dword_count = cmdbuf->cmd_idx - cmdbuf->rendec_chunk_start; in psb_cmdbuf_rendec_end()
1441 *cmdbuf->rendec_chunk_start += ((dword_count - 1) << 16); in psb_cmdbuf_rendec_end()
1442 cmdbuf->rendec_chunk_start = NULL; in psb_cmdbuf_rendec_end()
1448 void psb_cmdbuf_skip_start_block(psb_cmdbuf_p cmdbuf, uint32_t skip_condition) in psb_cmdbuf_skip_start_block() argument
1450 ASSERT(NULL == cmdbuf->rendec_block_start); /* Can't be inside a rendec block */ in psb_cmdbuf_skip_start_block()
1451 ASSERT(NULL == cmdbuf->reg_start); /* Can't be inside a reg block */ in psb_cmdbuf_skip_start_block()
1452 …ASSERT(NULL == cmdbuf->skip_block_start); /* Can't be inside another skip block (limitation of cur… in psb_cmdbuf_skip_start_block()
1454 cmdbuf->skip_condition = skip_condition; in psb_cmdbuf_skip_start_block()
1455 cmdbuf->skip_block_start = cmdbuf->cmd_idx++; in psb_cmdbuf_skip_start_block()
1461 void psb_cmdbuf_skip_end_block(psb_cmdbuf_p cmdbuf) in psb_cmdbuf_skip_end_block() argument
1463 ASSERT(NULL == cmdbuf->rendec_block_start); /* Rendec block must be closed */ in psb_cmdbuf_skip_end_block()
1464 ASSERT(NULL == cmdbuf->reg_start); /* Reg block must be closed */ in psb_cmdbuf_skip_end_block()
1465 ASSERT(NULL != cmdbuf->skip_block_start); /* Skip block must still be open */ in psb_cmdbuf_skip_end_block()
1467 uint32_t block_size = cmdbuf->cmd_idx - (cmdbuf->skip_block_start + 1); in psb_cmdbuf_skip_end_block()
1469 *cmdbuf->skip_block_start = CMD_CONDITIONAL_SKIP | (cmdbuf->skip_condition << 20) | block_size; in psb_cmdbuf_skip_end_block()
1470 cmdbuf->skip_block_start = NULL; in psb_cmdbuf_skip_end_block()