Lines Matching refs:cmdbuf

52 #define RELOC_END(cmdbuf)     (cmdbuf->cmd_base + cmdbuf->size)  argument
54 #define CMD_END(cmdbuf) (cmdbuf->reloc_base) argument
76 pnw_cmdbuf_p cmdbuf) in pnw_cmdbuf_create() argument
82 cmdbuf->size = 0; in pnw_cmdbuf_create()
83 cmdbuf->cmd_base = NULL; in pnw_cmdbuf_create()
84 cmdbuf->cmd_idx = NULL; in pnw_cmdbuf_create()
85 cmdbuf->reloc_base = NULL; in pnw_cmdbuf_create()
86 cmdbuf->reloc_idx = NULL; in pnw_cmdbuf_create()
87 cmdbuf->buffer_refs_count = 0; in pnw_cmdbuf_create()
88 cmdbuf->buffer_refs_allocated = 10; in pnw_cmdbuf_create()
89cmdbuf->buffer_refs = (psb_buffer_p *) calloc(1, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_alloca… in pnw_cmdbuf_create()
90 if (NULL == cmdbuf->buffer_refs) { in pnw_cmdbuf_create()
91 cmdbuf->buffer_refs_allocated = 0; in pnw_cmdbuf_create()
95 vaStatus = psb_buffer_create(driver_data, size, psb_bt_cpu_only, &cmdbuf->buf); in pnw_cmdbuf_create()
96 cmdbuf->size = size; in pnw_cmdbuf_create()
100 free(cmdbuf->buffer_refs); in pnw_cmdbuf_create()
101 cmdbuf->buffer_refs = NULL; in pnw_cmdbuf_create()
102 cmdbuf->buffer_refs_allocated = 0; in pnw_cmdbuf_create()
107 …r_create(driver_data, ctx->pic_params_size * MAX_TOPAZ_CORES, psb_bt_cpu_vpu, &cmdbuf->pic_params); in pnw_cmdbuf_create()
112 …vaStatus = psb_buffer_create(driver_data, ctx->header_buffer_size, psb_bt_cpu_vpu, &cmdbuf->header… in pnw_cmdbuf_create()
117 …vaStatus = psb_buffer_create(driver_data, ctx->sliceparam_buffer_size, psb_bt_cpu_vpu, &cmdbuf->sl… in pnw_cmdbuf_create()
125 cmdbuf->topaz_in_params_I = &ctx->topaz_in_params_I; in pnw_cmdbuf_create()
126 cmdbuf->topaz_in_params_P = &ctx->topaz_in_params_P; in pnw_cmdbuf_create()
128 cmdbuf->topaz_below_params = &ctx->topaz_below_params; in pnw_cmdbuf_create()
129 cmdbuf->topaz_above_params = &ctx->topaz_above_params; in pnw_cmdbuf_create()
134 psb_buffer_destroy(&cmdbuf->header_mem); in pnw_cmdbuf_create()
136 psb_buffer_destroy(&cmdbuf->pic_params); in pnw_cmdbuf_create()
138 pnw_cmdbuf_destroy(cmdbuf); in pnw_cmdbuf_create()
146 void pnw_cmdbuf_destroy(pnw_cmdbuf_p cmdbuf) in pnw_cmdbuf_destroy() argument
148 if (cmdbuf->size) { in pnw_cmdbuf_destroy()
149 psb_buffer_destroy(&cmdbuf->buf); in pnw_cmdbuf_destroy()
150 cmdbuf->size = 0; in pnw_cmdbuf_destroy()
152 if (cmdbuf->buffer_refs_allocated) { in pnw_cmdbuf_destroy()
153 free(cmdbuf->buffer_refs); in pnw_cmdbuf_destroy()
154 cmdbuf->buffer_refs = NULL; in pnw_cmdbuf_destroy()
155 cmdbuf->buffer_refs_allocated = 0; in pnw_cmdbuf_destroy()
158 psb_buffer_destroy(&cmdbuf->pic_params); in pnw_cmdbuf_destroy()
159 psb_buffer_destroy(&cmdbuf->header_mem); in pnw_cmdbuf_destroy()
160 psb_buffer_destroy(&cmdbuf->slice_params); in pnw_cmdbuf_destroy()
169 int pnw_cmdbuf_reset(pnw_cmdbuf_p cmdbuf) in pnw_cmdbuf_reset() argument
173 cmdbuf->cmd_base = NULL; in pnw_cmdbuf_reset()
174 cmdbuf->cmd_idx = NULL; in pnw_cmdbuf_reset()
175 cmdbuf->reloc_base = NULL; in pnw_cmdbuf_reset()
176 cmdbuf->reloc_idx = NULL; in pnw_cmdbuf_reset()
178 cmdbuf->buffer_refs_count = 0; in pnw_cmdbuf_reset()
179 cmdbuf->cmd_count = 0; in pnw_cmdbuf_reset()
181 ret = psb_buffer_map(&cmdbuf->buf, &cmdbuf->cmd_base); in pnw_cmdbuf_reset()
186 cmdbuf->cmd_start = cmdbuf->cmd_base; in pnw_cmdbuf_reset()
187 cmdbuf->cmd_idx = (uint32_t *) cmdbuf->cmd_base; in pnw_cmdbuf_reset()
189 cmdbuf->reloc_base = cmdbuf->cmd_base + CMD_SIZE; in pnw_cmdbuf_reset()
190 cmdbuf->reloc_idx = (struct drm_psb_reloc *) cmdbuf->reloc_base; in pnw_cmdbuf_reset()
193 pnw_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->buf); /* cmd buf == 0 */ in pnw_cmdbuf_reset()
202 int pnw_cmdbuf_unmap(pnw_cmdbuf_p cmdbuf) in pnw_cmdbuf_unmap() argument
204 cmdbuf->cmd_base = NULL; in pnw_cmdbuf_unmap()
205 cmdbuf->cmd_start = NULL; in pnw_cmdbuf_unmap()
206 cmdbuf->cmd_idx = NULL; in pnw_cmdbuf_unmap()
207 cmdbuf->reloc_base = NULL; in pnw_cmdbuf_unmap()
208 cmdbuf->reloc_idx = NULL; in pnw_cmdbuf_unmap()
209 cmdbuf->cmd_count = 0; in pnw_cmdbuf_unmap()
210 psb_buffer_unmap(&cmdbuf->buf); in pnw_cmdbuf_unmap()
220 int pnw_cmdbuf_buffer_ref(pnw_cmdbuf_p cmdbuf, psb_buffer_p buf) in pnw_cmdbuf_buffer_ref() argument
225 while ((item_loc < cmdbuf->buffer_refs_count) in pnw_cmdbuf_buffer_ref()
226 && (wsbmKBufHandle(wsbmKBuf(cmdbuf->buffer_refs[item_loc]->drm_buf)) in pnw_cmdbuf_buffer_ref()
232 if (item_loc == cmdbuf->buffer_refs_count) { in pnw_cmdbuf_buffer_ref()
234 if (item_loc >= cmdbuf->buffer_refs_allocated) { in pnw_cmdbuf_buffer_ref()
236 int new_size = cmdbuf->buffer_refs_allocated + 10; in pnw_cmdbuf_buffer_ref()
242 … memcpy(new_array, cmdbuf->buffer_refs, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_allocated); in pnw_cmdbuf_buffer_ref()
243 free(cmdbuf->buffer_refs); in pnw_cmdbuf_buffer_ref()
244 cmdbuf->buffer_refs_allocated = new_size; in pnw_cmdbuf_buffer_ref()
245 cmdbuf->buffer_refs = new_array; in pnw_cmdbuf_buffer_ref()
247 cmdbuf->buffer_refs[item_loc] = buf; in pnw_cmdbuf_buffer_ref()
248 cmdbuf->buffer_refs_count++; in pnw_cmdbuf_buffer_ref()
262 void pnw_cmdbuf_add_relocation(pnw_cmdbuf_p cmdbuf, in pnw_cmdbuf_add_relocation() argument
272 struct drm_psb_reloc *reloc = cmdbuf->reloc_idx; in pnw_cmdbuf_add_relocation()
277 reloc->buffer = pnw_cmdbuf_buffer_ref(cmdbuf, ref_buffer); in pnw_cmdbuf_add_relocation()
293 *addr_in_dst_buffer = reloc - (struct drm_psb_reloc *)cmdbuf->reloc_base; in pnw_cmdbuf_add_relocation()
300 cmdbuf->reloc_idx++; in pnw_cmdbuf_add_relocation()
302 ASSERT(((unsigned char *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf)); in pnw_cmdbuf_add_relocation()
314 pnw_cmdbuf_p cmdbuf = obj_context->pnw_cmdbuf; in pnw_cmdbuf_insert_command_package() local
333 *cmdbuf->cmd_idx++ = cmd_word; in pnw_cmdbuf_insert_command_package()
337 RELOC_CMDBUF_PNW(cmdbuf->cmd_idx, offset, command_data); in pnw_cmdbuf_insert_command_package()
338 cmdbuf->cmd_idx++; in pnw_cmdbuf_insert_command_package()
340 *cmdbuf->cmd_idx++ = 0; in pnw_cmdbuf_insert_command_package()
344 *cmdbuf->cmd_idx++ = 0; /* Write back buffer address */ in pnw_cmdbuf_insert_command_package()
346 *cmdbuf->cmd_idx++ = 0; /*ctx->CmdCount; */ /* Write back value */ in pnw_cmdbuf_insert_command_package()
361 pnw_cmdbuf_p cmdbuf; in pnw_context_get_next_cmdbuf() local
373 cmdbuf = obj_context->pnw_cmdbuf_list[obj_context->cmdbuf_current]; in pnw_context_get_next_cmdbuf()
374 ret = pnw_cmdbuf_reset(cmdbuf); in pnw_context_get_next_cmdbuf()
377 obj_context->pnw_cmdbuf = cmdbuf; in pnw_context_get_next_cmdbuf()
381 pnw_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->pic_params); in pnw_context_get_next_cmdbuf()
382 pnw_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->slice_params); in pnw_context_get_next_cmdbuf()
563 pnw_cmdbuf_p cmdbuf = obj_context->pnw_cmdbuf; in pnw_context_flush_cmdbuf() local
570 …unsigned int cmdbuffer_size = (unsigned char *) cmdbuf->cmd_idx - cmdbuf->cmd_start; /* In bytes */ in pnw_context_flush_cmdbuf()
573 ASSERT((unsigned char *) cmdbuf->cmd_idx < CMD_END(cmdbuf)); in pnw_context_flush_cmdbuf()
583 reloc_offset = cmdbuf->reloc_base - cmdbuf->cmd_base; in pnw_context_flush_cmdbuf()
584 …num_relocs = (((unsigned char *) cmdbuf->reloc_idx) - cmdbuf->reloc_base) / sizeof(struct drm_psb_… in pnw_context_flush_cmdbuf()
586 pnw_cmdbuf_unmap(cmdbuf); in pnw_context_flush_cmdbuf()
588 ASSERT(NULL == cmdbuf->reloc_base); in pnw_context_flush_cmdbuf()
601cmdbuf->buffer_refs, cmdbuf->buffer_refs_count, wsbmKBufHandle(wsbmKBuf(cmdbuf->buf.drm_buf)), in pnw_context_flush_cmdbuf()
603 wsbmKBufHandle(wsbmKBuf(cmdbuf->buf.drm_buf)), reloc_offset, num_relocs, in pnw_context_flush_cmdbuf()