static void h264_enc_free_work_buf(struct venc_h264_inst *inst) { int i; mtk_vcodec_debug_enter(inst); /* Except the SKIP_FRAME buffers, * other buffers need to be freed by AP. */ for (i = 0; i < VENC_H264_VPU_WORK_BUF_MAX; i++) { if (i != VENC_H264_VPU_WORK_BUF_SKIP_FRAME) mtk_vcodec_mem_free(inst->ctx, &inst->work_bufs[i]); } mtk_vcodec_mem_free(inst->ctx, &inst->pps_buf); mtk_vcodec_debug_leave(inst); }
static void free_predication_buf(struct vdec_h264_inst *inst) { struct mtk_vcodec_mem *mem = NULL; mtk_vcodec_debug_enter(inst); inst->vsi->pred_buf_dma = 0; mem = &inst->pred_buf; if (mem->va) mtk_vcodec_mem_free(inst->ctx, mem); }
static void free_mv_buf(struct vdec_h264_inst *inst) { int i; struct mtk_vcodec_mem *mem = NULL; for (i = 0; i < H264_MAX_FB_NUM; i++) { inst->vsi->mv_buf_dma[i] = 0; mem = &inst->mv_buf[i]; if (mem->va) mtk_vcodec_mem_free(inst->ctx, mem); } }
static int alloc_mv_buf(struct vdec_h264_inst *inst, struct vdec_pic_info *pic) { int i; int err; struct mtk_vcodec_mem *mem = NULL; unsigned int buf_sz = get_mv_buf_size(pic->buf_w, pic->buf_h); for (i = 0; i < H264_MAX_FB_NUM; i++) { mem = &inst->mv_buf[i]; if (mem->va) mtk_vcodec_mem_free(inst->ctx, mem); mem->size = buf_sz; err = mtk_vcodec_mem_alloc(inst->ctx, mem); if (err) { mtk_vcodec_err(inst, "failed to allocate mv buf"); return err; } inst->vsi->mv_buf_dma[i] = mem->dma_addr; } return 0; }