Lines Matching refs:cmdbuf
50 vsp_cmdbuf_p cmdbuf) in vsp_cmdbuf_create() argument
56 cmdbuf->size = 0; in vsp_cmdbuf_create()
57 cmdbuf->cmd_base = NULL; in vsp_cmdbuf_create()
58 cmdbuf->cmd_idx = NULL; in vsp_cmdbuf_create()
59 cmdbuf->reloc_base = NULL; in vsp_cmdbuf_create()
60 cmdbuf->reloc_idx = NULL; in vsp_cmdbuf_create()
61 cmdbuf->buffer_refs_count = 0; in vsp_cmdbuf_create()
62 cmdbuf->buffer_refs_allocated = 10; in vsp_cmdbuf_create()
63 …cmdbuf->buffer_refs = (psb_buffer_p *) calloc(1, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_alloca… in vsp_cmdbuf_create()
64 if (NULL == cmdbuf->buffer_refs) { in vsp_cmdbuf_create()
65 cmdbuf->buffer_refs_allocated = 0; in vsp_cmdbuf_create()
70 vaStatus = psb_buffer_create(driver_data, size, psb_bt_cpu_only, &cmdbuf->buf); in vsp_cmdbuf_create()
71 cmdbuf->size = size; in vsp_cmdbuf_create()
76 vaStatus = psb_buffer_create(driver_data, ctx->param_sz, psb_bt_cpu_vpu, &cmdbuf->param_mem); in vsp_cmdbuf_create()
82 psb_buffer_destroy(&cmdbuf->buf); in vsp_cmdbuf_create()
84 free(cmdbuf->buffer_refs); in vsp_cmdbuf_create()
85 cmdbuf->buffer_refs = NULL; in vsp_cmdbuf_create()
86 cmdbuf->buffer_refs_allocated = 0; in vsp_cmdbuf_create()
94 void vsp_cmdbuf_destroy(vsp_cmdbuf_p cmdbuf) in vsp_cmdbuf_destroy() argument
96 if (cmdbuf->size) { in vsp_cmdbuf_destroy()
97 psb_buffer_destroy(&cmdbuf->buf); in vsp_cmdbuf_destroy()
98 cmdbuf->size = 0; in vsp_cmdbuf_destroy()
100 if (cmdbuf->buffer_refs_allocated) { in vsp_cmdbuf_destroy()
101 free(cmdbuf->buffer_refs); in vsp_cmdbuf_destroy()
102 cmdbuf->buffer_refs = NULL; in vsp_cmdbuf_destroy()
103 cmdbuf->buffer_refs_allocated = 0; in vsp_cmdbuf_destroy()
105 psb_buffer_destroy(&cmdbuf->param_mem); in vsp_cmdbuf_destroy()
113 int vsp_cmdbuf_reset(vsp_cmdbuf_p cmdbuf) in vsp_cmdbuf_reset() argument
117 cmdbuf->cmd_base = NULL; in vsp_cmdbuf_reset()
118 cmdbuf->cmd_idx = NULL; in vsp_cmdbuf_reset()
119 cmdbuf->reloc_base = NULL; in vsp_cmdbuf_reset()
120 cmdbuf->reloc_idx = NULL; in vsp_cmdbuf_reset()
122 cmdbuf->buffer_refs_count = 0; in vsp_cmdbuf_reset()
123 cmdbuf->cmd_count = 0; in vsp_cmdbuf_reset()
125 ret = psb_buffer_map(&cmdbuf->buf, &cmdbuf->cmd_base); in vsp_cmdbuf_reset()
130 cmdbuf->cmd_start = cmdbuf->cmd_base; in vsp_cmdbuf_reset()
131 cmdbuf->cmd_idx = (uint32_t *) cmdbuf->cmd_base; in vsp_cmdbuf_reset()
133 cmdbuf->reloc_base = cmdbuf->cmd_base + CMD_SIZE; in vsp_cmdbuf_reset()
134 cmdbuf->reloc_idx = (struct drm_psb_reloc *) cmdbuf->reloc_base; in vsp_cmdbuf_reset()
137 vsp_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->buf); /* cmd buf == 0 */ in vsp_cmdbuf_reset()
147 int vsp_cmdbuf_unmap(vsp_cmdbuf_p cmdbuf) in vsp_cmdbuf_unmap() argument
149 cmdbuf->cmd_base = NULL; in vsp_cmdbuf_unmap()
150 cmdbuf->cmd_start = NULL; in vsp_cmdbuf_unmap()
151 cmdbuf->cmd_idx = NULL; in vsp_cmdbuf_unmap()
152 cmdbuf->reloc_base = NULL; in vsp_cmdbuf_unmap()
153 cmdbuf->reloc_idx = NULL; in vsp_cmdbuf_unmap()
154 cmdbuf->cmd_count = 0; in vsp_cmdbuf_unmap()
155 psb_buffer_unmap(&cmdbuf->buf); in vsp_cmdbuf_unmap()
164 int vsp_cmdbuf_buffer_ref(vsp_cmdbuf_p cmdbuf, psb_buffer_p buf) in vsp_cmdbuf_buffer_ref() argument
169 while ((item_loc < cmdbuf->buffer_refs_count) in vsp_cmdbuf_buffer_ref()
170 && (wsbmKBufHandle(wsbmKBuf(cmdbuf->buffer_refs[item_loc]->drm_buf)) in vsp_cmdbuf_buffer_ref()
174 if (item_loc == cmdbuf->buffer_refs_count) { in vsp_cmdbuf_buffer_ref()
176 if (item_loc >= cmdbuf->buffer_refs_allocated) { in vsp_cmdbuf_buffer_ref()
178 int new_size = cmdbuf->buffer_refs_allocated + 10; in vsp_cmdbuf_buffer_ref()
184 memcpy(new_array, cmdbuf->buffer_refs, sizeof(psb_buffer_p) * cmdbuf->buffer_refs_allocated); in vsp_cmdbuf_buffer_ref()
185 free(cmdbuf->buffer_refs); in vsp_cmdbuf_buffer_ref()
186 cmdbuf->buffer_refs_allocated = new_size; in vsp_cmdbuf_buffer_ref()
187 cmdbuf->buffer_refs = new_array; in vsp_cmdbuf_buffer_ref()
189 cmdbuf->buffer_refs[item_loc] = buf; in vsp_cmdbuf_buffer_ref()
190 cmdbuf->buffer_refs_count++; in vsp_cmdbuf_buffer_ref()
204 void vsp_cmdbuf_add_relocation(vsp_cmdbuf_p cmdbuf, in vsp_cmdbuf_add_relocation() argument
214 struct drm_psb_reloc *reloc = cmdbuf->reloc_idx; in vsp_cmdbuf_add_relocation()
219 reloc->buffer = vsp_cmdbuf_buffer_ref(cmdbuf, ref_buffer); in vsp_cmdbuf_add_relocation()
235 *addr_in_dst_buffer = reloc - (struct drm_psb_reloc *)cmdbuf->reloc_base; in vsp_cmdbuf_add_relocation()
242 cmdbuf->reloc_idx++; in vsp_cmdbuf_add_relocation()
244 ASSERT(((unsigned char *)(cmdbuf->reloc_idx)) < RELOC_END(cmdbuf)); in vsp_cmdbuf_add_relocation()
254 vsp_cmdbuf_p cmdbuf; in vsp_context_get_next_cmdbuf() local
266 cmdbuf = obj_context->vsp_cmdbuf_list[obj_context->cmdbuf_current]; in vsp_context_get_next_cmdbuf()
268 ret = vsp_cmdbuf_reset(cmdbuf); in vsp_context_get_next_cmdbuf()
271 obj_context->vsp_cmdbuf = cmdbuf; in vsp_context_get_next_cmdbuf()
274 cmdbuf->param_mem_loc = vsp_cmdbuf_buffer_ref(cmdbuf, &cmdbuf->param_mem); in vsp_context_get_next_cmdbuf()
402 vsp_cmdbuf_p cmdbuf = obj_context->vsp_cmdbuf; in vsp_context_flush_cmdbuf() local
409 unsigned int cmdbuffer_size = (unsigned char *)cmdbuf->cmd_idx - cmdbuf->cmd_start; /* In bytes */ in vsp_context_flush_cmdbuf()
412 ASSERT((void *) cmdbuf->cmd_idx < CMD_END(cmdbuf)); in vsp_context_flush_cmdbuf()
422 reloc_offset = cmdbuf->reloc_base - cmdbuf->cmd_base; in vsp_context_flush_cmdbuf()
423 …num_relocs = ((unsigned char *)cmdbuf->reloc_idx - cmdbuf->reloc_base) / sizeof(struct drm_psb_rel… in vsp_context_flush_cmdbuf()
425 vsp_cmdbuf_unmap(cmdbuf); in vsp_context_flush_cmdbuf()
427 ASSERT(NULL == cmdbuf->reloc_base); in vsp_context_flush_cmdbuf()
440 cmdbuf->buffer_refs, cmdbuf->buffer_refs_count, wsbmKBufHandle(wsbmKBuf(cmdbuf->buf.drm_buf)), in vsp_context_flush_cmdbuf()
442 wsbmKBufHandle(wsbmKBuf(cmdbuf->buf.drm_buf)), reloc_offset, num_relocs, in vsp_context_flush_cmdbuf()