Lines Matching refs:cmdbuf
59 #define RELOC_END(cmdbuf) (cmdbuf->cmd_base + cmdbuf->size) argument
60 #define CMD_END(cmdbuf) (cmdbuf->reloc_base) argument
80 void tng_cmdbuf_mem_unmap(tng_cmdbuf_p cmdbuf) in tng_cmdbuf_mem_unmap() argument
82 psb_buffer_unmap(&cmdbuf->frame_mem); in tng_cmdbuf_mem_unmap()
83 psb_buffer_unmap(&cmdbuf->jpeg_pic_params); in tng_cmdbuf_mem_unmap()
84 psb_buffer_unmap(&cmdbuf->jpeg_header_mem); in tng_cmdbuf_mem_unmap()
85 psb_buffer_unmap(&cmdbuf->jpeg_header_interface_mem); in tng_cmdbuf_mem_unmap()
92 static void tng_cmdbuf_clear(tng_cmdbuf_p cmdbuf, int flag) in tng_cmdbuf_clear() argument
97 psb_buffer_destroy(&cmdbuf->jpeg_header_mem); in tng_cmdbuf_clear()
99 psb_buffer_destroy(&cmdbuf->jpeg_pic_params); in tng_cmdbuf_clear()
102 psb_buffer_destroy(&cmdbuf->frame_mem); in tng_cmdbuf_clear()
106 if (cmdbuf->size) { in tng_cmdbuf_clear()
107 psb_buffer_destroy(&cmdbuf->buf); in tng_cmdbuf_clear()
108 cmdbuf->size = 0; in tng_cmdbuf_clear()
110 if (cmdbuf->buffer_refs_allocated) { in tng_cmdbuf_clear()
111 free(cmdbuf->buffer_refs); in tng_cmdbuf_clear()
112 cmdbuf->buffer_refs = NULL; in tng_cmdbuf_clear()
113 cmdbuf->buffer_refs_allocated = 0; in tng_cmdbuf_clear()
125 tng_cmdbuf_p cmdbuf) in tng_cmdbuf_create() argument
132 cmdbuf->size = 0; in tng_cmdbuf_create()
133 cmdbuf->cmd_base = NULL; in tng_cmdbuf_create()
134 cmdbuf->cmd_idx = NULL; in tng_cmdbuf_create()
135 cmdbuf->reloc_base = NULL; in tng_cmdbuf_create()
136 cmdbuf->reloc_idx = NULL; in tng_cmdbuf_create()
137 cmdbuf->buffer_refs_count = 0; in tng_cmdbuf_create()
138 cmdbuf->buffer_refs_allocated = 10; in tng_cmdbuf_create()
139 …cmdbuf->buffer_refs = (psb_buffer_p *) calloc(1, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_alloca… in tng_cmdbuf_create()
140 if (NULL == cmdbuf->buffer_refs) { in tng_cmdbuf_create()
141 cmdbuf->buffer_refs_allocated = 0; in tng_cmdbuf_create()
146 vaStatus = psb_buffer_create(driver_data, size, psb_bt_cpu_only, &cmdbuf->buf); in tng_cmdbuf_create()
147 cmdbuf->size = size; in tng_cmdbuf_create()
152 tng_cmdbuf_clear(cmdbuf, 1); in tng_cmdbuf_create()
153 free(cmdbuf->buffer_refs); in tng_cmdbuf_create()
154 cmdbuf->buffer_refs = NULL; in tng_cmdbuf_create()
155 cmdbuf->buffer_refs_allocated = 0; in tng_cmdbuf_create()
159 cmdbuf->mem_size = tng_align_KB(TNG_HEADER_SIZE); in tng_cmdbuf_create()
160 drv_debug_msg(VIDEO_DEBUG_GENERAL, "mem size %d\n", __FUNCTION__, cmdbuf->mem_size); in tng_cmdbuf_create()
165 …psb_buffer_create(driver_data, COMM_CMD_FRAME_BUF_NUM * cmdbuf->mem_size, psb_bt_cpu_vpu, &cmdbuf-… in tng_cmdbuf_create()
168 free(cmdbuf->buffer_refs); in tng_cmdbuf_create()
169 cmdbuf->buffer_refs = NULL; in tng_cmdbuf_create()
170 cmdbuf->buffer_refs_allocated = 0; in tng_cmdbuf_create()
178 …vaStatus = psb_buffer_create(driver_data, ctx->jpeg_pic_params_size, psb_bt_cpu_vpu, &cmdbuf->jpeg… in tng_cmdbuf_create()
181 tng_cmdbuf_clear(cmdbuf, 2); in tng_cmdbuf_create()
186 …vaStatus = psb_buffer_create(driver_data, ctx->jpeg_header_mem_size, psb_bt_cpu_vpu, &cmdbuf->jpeg… in tng_cmdbuf_create()
189 tng_cmdbuf_clear(cmdbuf, 3); in tng_cmdbuf_create()
194 …reate(driver_data, ctx->jpeg_header_interface_mem_size, psb_bt_cpu_vpu, &cmdbuf->jpeg_header_inter… in tng_cmdbuf_create()
197 tng_cmdbuf_clear(cmdbuf, 4); in tng_cmdbuf_create()
207 void tng_cmdbuf_destroy(tng_cmdbuf_p cmdbuf) in tng_cmdbuf_destroy() argument
209 psb_buffer_destroy(&cmdbuf->frame_mem); in tng_cmdbuf_destroy()
210 psb_buffer_destroy(&cmdbuf->jpeg_header_mem); in tng_cmdbuf_destroy()
211 psb_buffer_destroy(&cmdbuf->jpeg_pic_params); in tng_cmdbuf_destroy()
212 psb_buffer_destroy(&cmdbuf->jpeg_header_interface_mem); in tng_cmdbuf_destroy()
214 if (cmdbuf->size) { in tng_cmdbuf_destroy()
215 psb_buffer_destroy(&cmdbuf->buf); in tng_cmdbuf_destroy()
216 cmdbuf->size = 0; in tng_cmdbuf_destroy()
218 if (cmdbuf->buffer_refs_allocated) { in tng_cmdbuf_destroy()
219 free(cmdbuf->buffer_refs); in tng_cmdbuf_destroy()
220 cmdbuf->buffer_refs = NULL; in tng_cmdbuf_destroy()
221 cmdbuf->buffer_refs_allocated = 0; in tng_cmdbuf_destroy()
231 int tng_cmdbuf_reset(tng_cmdbuf_p cmdbuf) in tng_cmdbuf_reset() argument
234 cmdbuf->cmd_base = NULL; in tng_cmdbuf_reset()
235 cmdbuf->cmd_idx = NULL; in tng_cmdbuf_reset()
236 cmdbuf->reloc_base = NULL; in tng_cmdbuf_reset()
237 cmdbuf->reloc_idx = NULL; in tng_cmdbuf_reset()
239 cmdbuf->buffer_refs_count = 0; in tng_cmdbuf_reset()
240 cmdbuf->frame_mem_index = 0; in tng_cmdbuf_reset()
241 cmdbuf->cmd_count = 0; in tng_cmdbuf_reset()
242 cmdbuf->mem_size = tng_align_KB(TNG_HEADER_SIZE); in tng_cmdbuf_reset()
244 ret = psb_buffer_map(&cmdbuf->buf, &cmdbuf->cmd_base); in tng_cmdbuf_reset()
249 cmdbuf->cmd_start = cmdbuf->cmd_base; in tng_cmdbuf_reset()
250 cmdbuf->cmd_idx = (IMG_UINT32 *) cmdbuf->cmd_base; in tng_cmdbuf_reset()
252 cmdbuf->reloc_base = cmdbuf->cmd_base + CMD_SIZE; in tng_cmdbuf_reset()
253 cmdbuf->reloc_idx = (struct drm_psb_reloc *) cmdbuf->reloc_base; in tng_cmdbuf_reset()
256 tng_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->buf); /* cmd buf == 0 */ in tng_cmdbuf_reset()
265 int tng_cmdbuf_unmap(tng_cmdbuf_p cmdbuf) in tng_cmdbuf_unmap() argument
267 cmdbuf->cmd_base = NULL; in tng_cmdbuf_unmap()
268 cmdbuf->cmd_start = NULL; in tng_cmdbuf_unmap()
269 cmdbuf->cmd_idx = NULL; in tng_cmdbuf_unmap()
270 cmdbuf->reloc_base = NULL; in tng_cmdbuf_unmap()
271 cmdbuf->reloc_idx = NULL; in tng_cmdbuf_unmap()
272 cmdbuf->cmd_count = 0; in tng_cmdbuf_unmap()
273 psb_buffer_unmap(&cmdbuf->buf); in tng_cmdbuf_unmap()
283 int tng_cmdbuf_buffer_ref(tng_cmdbuf_p cmdbuf, psb_buffer_p buf) in tng_cmdbuf_buffer_ref() argument
288 while ((item_loc < cmdbuf->buffer_refs_count) in tng_cmdbuf_buffer_ref()
289 && (wsbmKBufHandle(wsbmKBuf(cmdbuf->buffer_refs[item_loc]->drm_buf)) in tng_cmdbuf_buffer_ref()
295 if (item_loc == cmdbuf->buffer_refs_count) { in tng_cmdbuf_buffer_ref()
297 if (item_loc >= cmdbuf->buffer_refs_allocated) { in tng_cmdbuf_buffer_ref()
299 int new_size = cmdbuf->buffer_refs_allocated + 10; in tng_cmdbuf_buffer_ref()
305 … memcpy(new_array, cmdbuf->buffer_refs, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_allocated); in tng_cmdbuf_buffer_ref()
306 free(cmdbuf->buffer_refs); in tng_cmdbuf_buffer_ref()
307 cmdbuf->buffer_refs_allocated = new_size; in tng_cmdbuf_buffer_ref()
308 cmdbuf->buffer_refs = new_array; in tng_cmdbuf_buffer_ref()
310 cmdbuf->buffer_refs[item_loc] = buf; in tng_cmdbuf_buffer_ref()
311 cmdbuf->buffer_refs_count++; in tng_cmdbuf_buffer_ref()
325 void tng_cmdbuf_add_relocation(tng_cmdbuf_p cmdbuf, in tng_cmdbuf_add_relocation() argument
335 struct drm_psb_reloc *reloc = cmdbuf->reloc_idx; in tng_cmdbuf_add_relocation()
340 reloc->buffer = tng_cmdbuf_buffer_ref(cmdbuf, ref_buffer); in tng_cmdbuf_add_relocation()
356 *addr_in_dst_buffer = reloc - (struct drm_psb_reloc *)cmdbuf->reloc_base; in tng_cmdbuf_add_relocation()
363 cmdbuf->reloc_idx++; in tng_cmdbuf_add_relocation()
365 ASSERT(((void *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf)); in tng_cmdbuf_add_relocation()
381 tng_cmdbuf_p cmdbuf = obj_context->tng_cmdbuf; in tng_cmdbuf_insert_command() local
411 *cmdbuf->cmd_idx++ = cmd_word; in tng_cmdbuf_insert_command()
415 *cmdbuf->cmd_idx++ = cmd_data; in tng_cmdbuf_insert_command()
419 *cmdbuf->cmd_idx++ = (IMG_UINT32)data_addr; in tng_cmdbuf_insert_command()
422 __FUNCTION__, *(cmdbuf->cmd_idx)); in tng_cmdbuf_insert_command()
426 TNG_RELOC_CMDBUF_START(cmdbuf->cmd_idx, offset, data_addr); in tng_cmdbuf_insert_command()
428 tng_cmdbuf_set_phys(cmdbuf->cmd_idx, 0, data_addr, offset, 0); in tng_cmdbuf_insert_command()
431 TNG_RELOC_CMDBUF_START(cmdbuf->cmd_idx, offset, data_addr); in tng_cmdbuf_insert_command()
433 tng_cmdbuf_set_phys(cmdbuf->cmd_idx, 0, data_addr, offset, 0); in tng_cmdbuf_insert_command()
438 __FUNCTION__, *(cmdbuf->cmd_idx)); in tng_cmdbuf_insert_command()
439 cmdbuf->cmd_idx++; in tng_cmdbuf_insert_command()
442 *cmdbuf->cmd_idx++ = 0; in tng_cmdbuf_insert_command()
446 *cmdbuf->cmd_idx++ = ctx->ui16IntraRefresh; in tng_cmdbuf_insert_command()
447 *cmdbuf->cmd_idx++ = ctx->sRCParams.ui32InitialQp; in tng_cmdbuf_insert_command()
448 *cmdbuf->cmd_idx++ = ctx->sRCParams.iMinQP; in tng_cmdbuf_insert_command()
449 *cmdbuf->cmd_idx++ = ctx->ctx_mem_size.mb_ctrl_in_params; in tng_cmdbuf_insert_command()
450 *cmdbuf->cmd_idx++ = ctx->ui32pseudo_rand_seed; in tng_cmdbuf_insert_command()
454 *cmdbuf->cmd_idx++ = ctx->sAirInfo.i16AIRSkipCnt; in tng_cmdbuf_insert_command()
455 *cmdbuf->cmd_idx++ = ctx->sAirInfo.i32NumAIRSPerFrame; in tng_cmdbuf_insert_command()
456 *cmdbuf->cmd_idx++ = ctx->ctx_mem_size.mb_ctrl_in_params; in tng_cmdbuf_insert_command()
457 *cmdbuf->cmd_idx++ = ctx->ui32FrameCount[0]; in tng_cmdbuf_insert_command()
461 *cmdbuf->cmd_idx++ = ctx->ctx_mem_size.first_pass_out_best_multipass_param; in tng_cmdbuf_insert_command()
462 *cmdbuf->cmd_idx++ = ctx->sAirInfo.i32SAD_Threshold; in tng_cmdbuf_insert_command()
463 *cmdbuf->cmd_idx++ = ctx->ui8EnableSelStatsFlags; in tng_cmdbuf_insert_command()
468 *(cmdbuf->cmd_idx)++ = wsbmKBufHandle(wsbmKBuf(ctx->bufs_writeback.drm_buf)); in tng_cmdbuf_insert_command()
471 __FUNCTION__, *(cmdbuf->cmd_idx - 1)); in tng_cmdbuf_insert_command()
474 *(cmdbuf->cmd_idx)++ = wsbmKBufHandle(wsbmKBuf(data_addr->drm_buf)); in tng_cmdbuf_insert_command()
476 *(cmdbuf->cmd_idx)++ = wsbmKBufHandle(wsbmKBuf(ps_mem->bufs_mb_ctrl_in_params.drm_buf)); in tng_cmdbuf_insert_command()
477 … *(cmdbuf->cmd_idx)++ = wsbmKBufHandle(wsbmKBuf(ps_mem->bufs_first_pass_out_params.drm_buf)); in tng_cmdbuf_insert_command()
478 …*(cmdbuf->cmd_idx)++ = wsbmKBufHandle(wsbmKBuf(ps_mem->bufs_first_pass_out_best_multipass_param.d… in tng_cmdbuf_insert_command()
482 *(cmdbuf->cmd_idx)++ = wsbmKBufHandle(wsbmKBuf(ctx->bufs_writeback.drm_buf)); in tng_cmdbuf_insert_command()
485 __FUNCTION__, *(cmdbuf->cmd_idx - 1)); in tng_cmdbuf_insert_command()
489 *(cmdbuf->cmd_idx)++ = ctx->eCodec; in tng_cmdbuf_insert_command()
493 __FUNCTION__, *(cmdbuf->cmd_idx - 1)); in tng_cmdbuf_insert_command()
507 tng_cmdbuf_p cmdbuf; in tng_context_get_next_cmdbuf() local
521 cmdbuf = obj_context->tng_cmdbuf_list[obj_context->cmdbuf_current]; in tng_context_get_next_cmdbuf()
522 ret = tng_cmdbuf_reset(cmdbuf); in tng_context_get_next_cmdbuf()
525 obj_context->tng_cmdbuf = cmdbuf; in tng_context_get_next_cmdbuf()
741 tng_cmdbuf_p cmdbuf = obj_context->tng_cmdbuf; in tng_context_flush_cmdbuf() local
748 …unsigned int cmdbuffer_size = (unsigned int) (((unsigned char *)(cmdbuf->cmd_idx)) - cmdbuf->cmd_s… in tng_context_flush_cmdbuf()
751 ASSERT((void *) cmdbuf->cmd_idx < CMD_END(cmdbuf)); in tng_context_flush_cmdbuf()
761 reloc_offset = cmdbuf->reloc_base - cmdbuf->cmd_base; in tng_context_flush_cmdbuf()
762 …num_relocs = (((unsigned char *) (cmdbuf->reloc_idx)) - cmdbuf->reloc_base) / sizeof(struct drm_ps… in tng_context_flush_cmdbuf()
764 tng_cmdbuf_unmap(cmdbuf); in tng_context_flush_cmdbuf()
766 ASSERT(NULL == cmdbuf->reloc_base); in tng_context_flush_cmdbuf()
778 … cmdbuf->buffer_refs, cmdbuf->buffer_refs_count, wsbmKBufHandle(wsbmKBuf(cmdbuf->buf.drm_buf)), in tng_context_flush_cmdbuf()
780 wsbmKBufHandle(wsbmKBuf(cmdbuf->buf.drm_buf)), reloc_offset, num_relocs, in tng_context_flush_cmdbuf()