Lines Matching refs:inst

118 static void vdec_vp8_slice_get_pic_info(struct vdec_vp8_slice_inst *inst)  in vdec_vp8_slice_get_pic_info()  argument
120 struct mtk_vcodec_dec_ctx *ctx = inst->ctx; in vdec_vp8_slice_get_pic_info()
126 vpu_dec_get_param(&inst->vpu, data, 3, GET_PARAM_PIC_INFO); in vdec_vp8_slice_get_pic_info()
130 ctx->picinfo.fb_sz[0] = inst->vpu.fb_sz[0]; in vdec_vp8_slice_get_pic_info()
131 ctx->picinfo.fb_sz[1] = inst->vpu.fb_sz[1]; in vdec_vp8_slice_get_pic_info()
133 inst->vsi->pic.pic_w = ctx->picinfo.pic_w; in vdec_vp8_slice_get_pic_info()
134 inst->vsi->pic.pic_h = ctx->picinfo.pic_h; in vdec_vp8_slice_get_pic_info()
135 inst->vsi->pic.buf_w = ctx->picinfo.buf_w; in vdec_vp8_slice_get_pic_info()
136 inst->vsi->pic.buf_h = ctx->picinfo.buf_h; in vdec_vp8_slice_get_pic_info()
137 inst->vsi->pic.fb_sz[0] = ctx->picinfo.fb_sz[0]; in vdec_vp8_slice_get_pic_info()
138 inst->vsi->pic.fb_sz[1] = ctx->picinfo.fb_sz[1]; in vdec_vp8_slice_get_pic_info()
139 mtk_vdec_debug(inst->ctx, "pic(%d, %d), buf(%d, %d)", in vdec_vp8_slice_get_pic_info()
142 mtk_vdec_debug(inst->ctx, "fb size: Y(%d), C(%d)", in vdec_vp8_slice_get_pic_info()
146 static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst) in vdec_vp8_slice_alloc_working_buf() argument
151 mem = &inst->seg_id_buf; in vdec_vp8_slice_alloc_working_buf()
153 err = mtk_vcodec_mem_alloc(inst->ctx, mem); in vdec_vp8_slice_alloc_working_buf()
155 mtk_vdec_err(inst->ctx, "Cannot allocate working buffer"); in vdec_vp8_slice_alloc_working_buf()
158 inst->vsi->dec.seg_id_buf_dma = (u64)mem->dma_addr; in vdec_vp8_slice_alloc_working_buf()
160 mem = &inst->wrap_y_buf; in vdec_vp8_slice_alloc_working_buf()
162 err = mtk_vcodec_mem_alloc(inst->ctx, mem); in vdec_vp8_slice_alloc_working_buf()
164 mtk_vdec_err(inst->ctx, "cannot allocate WRAP Y buffer"); in vdec_vp8_slice_alloc_working_buf()
167 inst->vsi->dec.wrap_y_dma = (u64)mem->dma_addr; in vdec_vp8_slice_alloc_working_buf()
169 mem = &inst->wrap_c_buf; in vdec_vp8_slice_alloc_working_buf()
171 err = mtk_vcodec_mem_alloc(inst->ctx, mem); in vdec_vp8_slice_alloc_working_buf()
173 mtk_vdec_err(inst->ctx, "cannot allocate WRAP C buffer"); in vdec_vp8_slice_alloc_working_buf()
176 inst->vsi->dec.wrap_c_dma = (u64)mem->dma_addr; in vdec_vp8_slice_alloc_working_buf()
178 mem = &inst->vld_wrapper_buf; in vdec_vp8_slice_alloc_working_buf()
180 err = mtk_vcodec_mem_alloc(inst->ctx, mem); in vdec_vp8_slice_alloc_working_buf()
182 mtk_vdec_err(inst->ctx, "cannot allocate vld wrapper buffer"); in vdec_vp8_slice_alloc_working_buf()
185 inst->vsi->dec.vld_wrapper_dma = (u64)mem->dma_addr; in vdec_vp8_slice_alloc_working_buf()
190 static void vdec_vp8_slice_free_working_buf(struct vdec_vp8_slice_inst *inst) in vdec_vp8_slice_free_working_buf() argument
194 mem = &inst->seg_id_buf; in vdec_vp8_slice_free_working_buf()
196 mtk_vcodec_mem_free(inst->ctx, mem); in vdec_vp8_slice_free_working_buf()
197 inst->vsi->dec.seg_id_buf_dma = 0; in vdec_vp8_slice_free_working_buf()
199 mem = &inst->wrap_y_buf; in vdec_vp8_slice_free_working_buf()
201 mtk_vcodec_mem_free(inst->ctx, mem); in vdec_vp8_slice_free_working_buf()
202 inst->vsi->dec.wrap_y_dma = 0; in vdec_vp8_slice_free_working_buf()
204 mem = &inst->wrap_c_buf; in vdec_vp8_slice_free_working_buf()
206 mtk_vcodec_mem_free(inst->ctx, mem); in vdec_vp8_slice_free_working_buf()
207 inst->vsi->dec.wrap_c_dma = 0; in vdec_vp8_slice_free_working_buf()
209 mem = &inst->vld_wrapper_buf; in vdec_vp8_slice_free_working_buf()
211 mtk_vcodec_mem_free(inst->ctx, mem); in vdec_vp8_slice_free_working_buf()
212 inst->vsi->dec.vld_wrapper_dma = 0; in vdec_vp8_slice_free_working_buf()
232 static int vdec_vp8_slice_get_decode_parameters(struct vdec_vp8_slice_inst *inst) in vdec_vp8_slice_get_decode_parameters() argument
235 struct mtk_vcodec_dec_ctx *ctx = inst->ctx; in vdec_vp8_slice_get_decode_parameters()
241 frame_header = vdec_vp8_slice_get_ctrl_ptr(inst->ctx, V4L2_CID_STATELESS_VP8_FRAME); in vdec_vp8_slice_get_decode_parameters()
251 mtk_vdec_err(inst->ctx, "reference invalid: index(%d) ts(%lld)", in vdec_vp8_slice_get_decode_parameters()
253 inst->vsi->vp8_dpb_info[index].reference_flag = 0; in vdec_vp8_slice_get_decode_parameters()
256 inst->vsi->vp8_dpb_info[index].reference_flag = 1; in vdec_vp8_slice_get_decode_parameters()
258 inst->vsi->vp8_dpb_info[index].y_dma_addr = in vdec_vp8_slice_get_decode_parameters()
261 inst->vsi->vp8_dpb_info[index].c_dma_addr = in vdec_vp8_slice_get_decode_parameters()
264 inst->vsi->vp8_dpb_info[index].c_dma_addr = in vdec_vp8_slice_get_decode_parameters()
265 inst->vsi->vp8_dpb_info[index].y_dma_addr + in vdec_vp8_slice_get_decode_parameters()
269 inst->vsi->dec.frame_header_type = frame_header->flags >> 1; in vdec_vp8_slice_get_decode_parameters()
276 struct vdec_vp8_slice_inst *inst; in vdec_vp8_slice_init() local
279 inst = kzalloc(sizeof(*inst), GFP_KERNEL); in vdec_vp8_slice_init()
280 if (!inst) in vdec_vp8_slice_init()
283 inst->ctx = ctx; in vdec_vp8_slice_init()
285 inst->vpu.id = SCP_IPI_VDEC_LAT; in vdec_vp8_slice_init()
286 inst->vpu.core_id = SCP_IPI_VDEC_CORE; in vdec_vp8_slice_init()
287 inst->vpu.ctx = ctx; in vdec_vp8_slice_init()
288 inst->vpu.codec_type = ctx->current_codec; in vdec_vp8_slice_init()
289 inst->vpu.capture_type = ctx->capture_fourcc; in vdec_vp8_slice_init()
291 err = vpu_dec_init(&inst->vpu); in vdec_vp8_slice_init()
297 inst->vsi = inst->vpu.vsi; in vdec_vp8_slice_init()
298 err = vdec_vp8_slice_alloc_working_buf(inst); in vdec_vp8_slice_init()
306 inst, inst->vpu.codec_type, inst->vpu.vsi); in vdec_vp8_slice_init()
308 ctx->drv_handle = inst; in vdec_vp8_slice_init()
312 vpu_dec_deinit(&inst->vpu); in vdec_vp8_slice_init()
314 kfree(inst); in vdec_vp8_slice_init()
321 struct vdec_vp8_slice_inst *inst = h_vdec; in vdec_vp8_slice_decode() local
322 struct vdec_vpu_inst *vpu = &inst->vpu; in vdec_vp8_slice_decode()
337 fb = inst->ctx->dev->vdec_pdata->get_cap_buffer(inst->ctx); in vdec_vp8_slice_decode()
341 if (inst->ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 1) in vdec_vp8_slice_decode()
343 inst->ctx->picinfo.buf_w * inst->ctx->picinfo.buf_h; in vdec_vp8_slice_decode()
347 inst->vsi->dec.bs_dma = (u64)bs->dma_addr; in vdec_vp8_slice_decode()
348 inst->vsi->dec.bs_sz = bs->size; in vdec_vp8_slice_decode()
349 inst->vsi->dec.cur_y_fb_dma = y_fb_dma; in vdec_vp8_slice_decode()
350 inst->vsi->dec.cur_c_fb_dma = c_fb_dma; in vdec_vp8_slice_decode()
352 mtk_vdec_debug(inst->ctx, "frame[%d] bs(%zu 0x%llx) y/c(0x%llx 0x%llx)", in vdec_vp8_slice_decode()
353 inst->ctx->decoded_frame_cnt, in vdec_vp8_slice_decode()
360 err = vdec_vp8_slice_get_decode_parameters(inst); in vdec_vp8_slice_decode()
366 mtk_vdec_debug(inst->ctx, "vp8 dec start err!"); in vdec_vp8_slice_decode()
370 if (inst->vsi->dec.resolution_changed) { in vdec_vp8_slice_decode()
371 mtk_vdec_debug(inst->ctx, "- resolution_changed -"); in vdec_vp8_slice_decode()
377 timeout = mtk_vcodec_wait_for_done_ctx(inst->ctx, MTK_INST_IRQ_RECEIVED, in vdec_vp8_slice_decode()
382 mtk_vdec_debug(inst->ctx, "vp8 dec error timeout:%d err: %d pic_%d", in vdec_vp8_slice_decode()
383 timeout, err, inst->ctx->decoded_frame_cnt); in vdec_vp8_slice_decode()
385 mtk_vdec_debug(inst->ctx, "pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x", in vdec_vp8_slice_decode()
386 inst->ctx->decoded_frame_cnt, in vdec_vp8_slice_decode()
387 inst->vsi->dec.crc[0], inst->vsi->dec.crc[1], in vdec_vp8_slice_decode()
388 inst->vsi->dec.crc[2], inst->vsi->dec.crc[3], in vdec_vp8_slice_decode()
389 inst->vsi->dec.crc[4], inst->vsi->dec.crc[5], in vdec_vp8_slice_decode()
390 inst->vsi->dec.crc[6], inst->vsi->dec.crc[7]); in vdec_vp8_slice_decode()
392 inst->ctx->decoded_frame_cnt++; in vdec_vp8_slice_decode()
399 struct vdec_vp8_slice_inst *inst = h_vdec; in vdec_vp8_slice_get_param() local
403 vdec_vp8_slice_get_pic_info(inst); in vdec_vp8_slice_get_param()
406 mtk_vdec_debug(inst->ctx, "No need to get vp8 crop information."); in vdec_vp8_slice_get_param()
412 mtk_vdec_err(inst->ctx, "invalid get parameter type=%d", type); in vdec_vp8_slice_get_param()
421 struct vdec_vp8_slice_inst *inst = h_vdec; in vdec_vp8_slice_deinit() local
423 vpu_dec_deinit(&inst->vpu); in vdec_vp8_slice_deinit()
424 vdec_vp8_slice_free_working_buf(inst); in vdec_vp8_slice_deinit()
425 kfree(inst); in vdec_vp8_slice_deinit()