Commit 0db2fc4e authored by Yunfei Dong's avatar Yunfei Dong Committed by Mauro Carvalho Chehab

media: mediatek: vcodec: remove the dependency of vcodec debug log

'mtk_vcodec_debug' and 'mtk_vcodec_err' depends on 'mtk_vcodec_ctx'
to get the index of each instance. Define two different macro
mtk_vdec_debug and mtk_venc_debug for decoder and encoder, and re-write
macro mtk_vcodec_debug as the common interface which is called
by mtk_vdec_debug and mtk_venc_debug. The vcodec debug log can be
separeated by encoder and decoder.
Signed-off-by: default avatarYunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 17834e0a
......@@ -31,9 +31,8 @@ struct mtk_vcodec_dev;
#define mtk_v4l2_err(fmt, args...) \
pr_err("[MTK_V4L2][ERROR] " fmt "\n", ##args)
#define mtk_vcodec_err(h, fmt, args...) \
pr_err("[MTK_VCODEC][ERROR][%d]: " fmt "\n", \
((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args)
#define mtk_vcodec_err(inst_id, plat_dev, fmt, args...) \
dev_err(&(plat_dev)->dev, "[MTK_VCODEC][ERROR][%d]: " fmt "\n", inst_id, ##args)
#if defined(CONFIG_DEBUG_FS)
extern int mtk_v4l2_dbg_level;
......@@ -46,22 +45,31 @@ extern int mtk_vcodec_dbg;
__func__, __LINE__, ##args); \
} while (0)
#define mtk_vcodec_debug(h, fmt, args...) \
#define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \
do { \
if (mtk_vcodec_dbg) \
dev_dbg(&(((struct mtk_vcodec_ctx *)(h)->ctx)->dev->plat_dev->dev), \
"[MTK_VCODEC][%d]: %s, %d " fmt "\n", \
((struct mtk_vcodec_ctx *)(h)->ctx)->id, \
__func__, __LINE__, ##args); \
dev_dbg(&(plat_dev)->dev, "[MTK_VCODEC][%d]: %s, %d " fmt "\n", \
inst_id, __func__, __LINE__, ##args); \
} while (0)
#else
#define mtk_v4l2_debug(level, fmt, args...) pr_debug(fmt, ##args)
#define mtk_vcodec_debug(h, fmt, args...) \
pr_debug("[MTK_VCODEC][%d]: " fmt "\n", \
((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args)
#define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \
dev_dbg(&(plat_dev)->dev, "[MTK_VCODEC][%d]: " fmt "\n", inst_id, ##args)
#endif
#define mtk_vdec_err(ctx, fmt, args...) \
mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_vdec_debug(ctx, fmt, args...) \
mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_venc_err(ctx, fmt, args...) \
mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_venc_debug(ctx, fmt, args...) \
mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx);
int mtk_vcodec_write_vdecsys(struct mtk_vcodec_ctx *ctx, unsigned int reg, unsigned int val);
int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem);
......
......@@ -144,7 +144,7 @@ static int allocate_predication_buf(struct vdec_h264_inst *inst)
inst->pred_buf.size = BUF_PREDICTION_SZ;
err = mtk_vcodec_mem_alloc(inst->ctx, &inst->pred_buf);
if (err) {
mtk_vcodec_err(inst, "failed to allocate ppl buf");
mtk_vdec_err(inst->ctx, "failed to allocate ppl buf");
return err;
}
......@@ -176,7 +176,7 @@ static int alloc_mv_buf(struct vdec_h264_inst *inst, struct vdec_pic_info *pic)
mem->size = buf_sz;
err = mtk_vcodec_mem_alloc(inst->ctx, mem);
if (err) {
mtk_vcodec_err(inst, "failed to allocate mv buf");
mtk_vdec_err(inst->ctx, "failed to allocate mv buf");
return err;
}
inst->vsi->mv_buf_dma[i] = mem->dma_addr;
......@@ -207,7 +207,7 @@ static int check_list_validity(struct vdec_h264_inst *inst, bool disp_list)
if (list->count > H264_MAX_FB_NUM ||
list->read_idx >= H264_MAX_FB_NUM ||
list->write_idx >= H264_MAX_FB_NUM) {
mtk_vcodec_err(inst, "%s list err: cnt=%d r_idx=%d w_idx=%d",
mtk_vdec_err(inst->ctx, "%s list err: cnt=%d r_idx=%d w_idx=%d",
disp_list ? "disp" : "free", list->count,
list->read_idx, list->write_idx);
return -EINVAL;
......@@ -226,11 +226,11 @@ static void put_fb_to_free(struct vdec_h264_inst *inst, struct vdec_fb *fb)
list = &inst->vsi->list_free;
if (list->count == H264_MAX_FB_NUM) {
mtk_vcodec_err(inst, "[FB] put fb free_list full");
mtk_vdec_err(inst->ctx, "[FB] put fb free_list full");
return;
}
mtk_vcodec_debug(inst, "[FB] put fb into free_list @(%p, %llx)",
mtk_vdec_debug(inst->ctx, "[FB] put fb into free_list @(%p, %llx)",
fb->base_y.va, (u64)fb->base_y.dma_addr);
list->fb_list[list->write_idx].vdec_fb_va = (u64)(uintptr_t)fb;
......@@ -244,10 +244,9 @@ static void get_pic_info(struct vdec_h264_inst *inst,
struct vdec_pic_info *pic)
{
*pic = inst->vsi->pic;
mtk_vcodec_debug(inst, "pic(%d, %d), buf(%d, %d)",
mtk_vdec_debug(inst->ctx, "pic(%d, %d), buf(%d, %d)",
pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h);
mtk_vcodec_debug(inst, "fb size: Y(%d), C(%d)",
pic->fb_sz[0], pic->fb_sz[1]);
mtk_vdec_debug(inst->ctx, "fb size: Y(%d), C(%d)", pic->fb_sz[0], pic->fb_sz[1]);
}
static void get_crop_info(struct vdec_h264_inst *inst, struct v4l2_rect *cr)
......@@ -257,14 +256,14 @@ static void get_crop_info(struct vdec_h264_inst *inst, struct v4l2_rect *cr)
cr->width = inst->vsi->crop.width;
cr->height = inst->vsi->crop.height;
mtk_vcodec_debug(inst, "l=%d, t=%d, w=%d, h=%d",
cr->left, cr->top, cr->width, cr->height);
mtk_vdec_debug(inst->ctx, "l=%d, t=%d, w=%d, h=%d", cr->left, cr->top,
cr->width, cr->height);
}
static void get_dpb_size(struct vdec_h264_inst *inst, unsigned int *dpb_sz)
{
*dpb_sz = inst->vsi->dec.dpb_sz;
mtk_vcodec_debug(inst, "sz=%d", *dpb_sz);
mtk_vdec_debug(inst->ctx, "sz=%d", *dpb_sz);
}
static int vdec_h264_init(struct mtk_vcodec_ctx *ctx)
......@@ -283,7 +282,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx)
err = vpu_dec_init(&inst->vpu);
if (err) {
mtk_vcodec_err(inst, "vdec_h264 init err=%d", err);
mtk_vdec_err(ctx, "vdec_h264 init err=%d", err);
goto error_free_inst;
}
......@@ -292,7 +291,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx)
if (err)
goto error_deinit;
mtk_vcodec_debug(inst, "H264 Instance >> %p", inst);
mtk_vdec_debug(ctx, "H264 Instance >> %p", inst);
ctx->drv_handle = inst;
return 0;
......@@ -344,7 +343,7 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
uint64_t y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
uint64_t c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
mtk_vcodec_debug(inst, "+ [%d] FB y_dma=%llx c_dma=%llx va=%p",
mtk_vdec_debug(inst->ctx, "+ [%d] FB y_dma=%llx c_dma=%llx va=%p",
++inst->num_nalu, y_fb_dma, c_fb_dma, fb);
/* bs NULL means flush decoder */
......@@ -355,14 +354,14 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
buf_sz = bs->size;
nal_start_idx = find_start_code(buf, buf_sz);
if (nal_start_idx < 0) {
mtk_vcodec_err(inst, "invalid nal start code");
mtk_vdec_err(inst->ctx, "invalid nal start code");
err = -EIO;
goto err_free_fb_out;
}
nal_start = buf[nal_start_idx];
nal_type = NAL_TYPE(buf[nal_start_idx]);
mtk_vcodec_debug(inst, "\n + NALU[%d] type %d +\n", inst->num_nalu,
mtk_vdec_debug(inst->ctx, "\n + NALU[%d] type %d +\n", inst->num_nalu,
nal_type);
if (nal_type == NAL_H264_PPS) {
......@@ -384,8 +383,7 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
err = vpu_dec_start(vpu, data, 2);
if (err) {
if (err > 0 && (DEC_ERR_RET(err) == H264_ERR_NOT_VALID)) {
mtk_vcodec_err(inst, "- error bitstream - err = %d -",
err);
mtk_vdec_err(inst->ctx, "- error bitstream - err = %d -", err);
err = -EIO;
}
goto err_free_fb_out;
......@@ -395,7 +393,7 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
if (*res_chg) {
struct vdec_pic_info pic;
mtk_vcodec_debug(inst, "- resolution changed -");
mtk_vdec_debug(inst->ctx, "- resolution changed -");
get_pic_info(inst, &pic);
if (inst->vsi->dec.realloc_mv_buf) {
......@@ -416,13 +414,12 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
vpu_dec_end(vpu);
}
mtk_vcodec_debug(inst, "\n - NALU[%d] type=%d -\n", inst->num_nalu,
nal_type);
mtk_vdec_debug(inst->ctx, "\n - NALU[%d] type=%d -\n", inst->num_nalu, nal_type);
return 0;
err_free_fb_out:
put_fb_to_free(inst, fb);
mtk_vcodec_err(inst, "\n - NALU[%d] err=%d -\n", inst->num_nalu, err);
mtk_vdec_err(inst->ctx, "\n - NALU[%d] err=%d -\n", inst->num_nalu, err);
return err;
}
......@@ -436,8 +433,7 @@ static void vdec_h264_get_fb(struct vdec_h264_inst *inst,
return;
if (list->count == 0) {
mtk_vcodec_debug(inst, "[FB] there is no %s fb",
disp_list ? "disp" : "free");
mtk_vdec_debug(inst->ctx, "[FB] there is no %s fb", disp_list ? "disp" : "free");
*out_fb = NULL;
return;
}
......@@ -447,7 +443,7 @@ static void vdec_h264_get_fb(struct vdec_h264_inst *inst,
fb->status |= (disp_list ? FB_ST_DISPLAY : FB_ST_FREE);
*out_fb = fb;
mtk_vcodec_debug(inst, "[FB] get %s fb st=%d poc=%d %llx",
mtk_vdec_debug(inst->ctx, "[FB] get %s fb st=%d poc=%d %llx",
disp_list ? "disp" : "free",
fb->status, list->fb_list[list->read_idx].poc,
list->fb_list[list->read_idx].vdec_fb_va);
......@@ -484,7 +480,7 @@ static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,
break;
default:
mtk_vcodec_err(inst, "invalid get parameter type=%d", type);
mtk_vdec_err(inst->ctx, "invalid get parameter type=%d", type);
return -EINVAL;
}
......
......@@ -162,7 +162,7 @@ static int allocate_predication_buf(struct vdec_h264_slice_inst *inst)
inst->pred_buf.size = BUF_PREDICTION_SZ;
err = mtk_vcodec_mem_alloc(inst->ctx, &inst->pred_buf);
if (err) {
mtk_vcodec_err(inst, "failed to allocate ppl buf");
mtk_vdec_err(inst->ctx, "failed to allocate ppl buf");
return err;
}
......@@ -195,7 +195,7 @@ static int alloc_mv_buf(struct vdec_h264_slice_inst *inst,
mem->size = buf_sz;
err = mtk_vcodec_mem_alloc(inst->ctx, mem);
if (err) {
mtk_vcodec_err(inst, "failed to allocate mv buf");
mtk_vdec_err(inst->ctx, "failed to allocate mv buf");
return err;
}
inst->vsi_ctx.mv_buf_dma[i] = mem->dma_addr;
......@@ -230,10 +230,10 @@ static void get_pic_info(struct vdec_h264_slice_inst *inst,
ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes;
*pic = ctx->picinfo;
mtk_vcodec_debug(inst, "pic(%d, %d), buf(%d, %d)",
mtk_vdec_debug(inst->ctx, "pic(%d, %d), buf(%d, %d)",
ctx->picinfo.pic_w, ctx->picinfo.pic_h,
ctx->picinfo.buf_w, ctx->picinfo.buf_h);
mtk_vcodec_debug(inst, "Y/C(%d, %d)", ctx->picinfo.fb_sz[0],
mtk_vdec_debug(inst->ctx, "Y/C(%d, %d)", ctx->picinfo.fb_sz[0],
ctx->picinfo.fb_sz[1]);
if (ctx->last_decoded_picinfo.pic_w != ctx->picinfo.pic_w ||
......@@ -259,14 +259,14 @@ static void get_crop_info(struct vdec_h264_slice_inst *inst, struct v4l2_rect *c
cr->width = inst->vsi_ctx.crop.width;
cr->height = inst->vsi_ctx.crop.height;
mtk_vcodec_debug(inst, "l=%d, t=%d, w=%d, h=%d",
mtk_vdec_debug(inst->ctx, "l=%d, t=%d, w=%d, h=%d",
cr->left, cr->top, cr->width, cr->height);
}
static void get_dpb_size(struct vdec_h264_slice_inst *inst, unsigned int *dpb_sz)
{
*dpb_sz = inst->vsi_ctx.dec.dpb_sz;
mtk_vcodec_debug(inst, "sz=%d", *dpb_sz);
mtk_vdec_debug(inst->ctx, "sz=%d", *dpb_sz);
}
static int vdec_h264_slice_init(struct mtk_vcodec_ctx *ctx)
......@@ -285,7 +285,7 @@ static int vdec_h264_slice_init(struct mtk_vcodec_ctx *ctx)
err = vpu_dec_init(&inst->vpu);
if (err) {
mtk_vcodec_err(inst, "vdec_h264 init err=%d", err);
mtk_vdec_err(ctx, "vdec_h264 init err=%d", err);
goto error_free_inst;
}
......@@ -297,13 +297,13 @@ static int vdec_h264_slice_init(struct mtk_vcodec_ctx *ctx)
if (err)
goto error_deinit;
mtk_vcodec_debug(inst, "struct size = %zu,%zu,%zu,%zu\n",
mtk_vdec_debug(ctx, "struct size = %zu,%zu,%zu,%zu\n",
sizeof(struct mtk_h264_sps_param),
sizeof(struct mtk_h264_pps_param),
sizeof(struct mtk_h264_dec_slice_param),
sizeof(struct mtk_h264_dpb_info));
mtk_vcodec_debug(inst, "H264 Instance >> %p", inst);
mtk_vdec_debug(ctx, "H264 Instance >> %p", inst);
ctx->drv_handle = inst;
return 0;
......@@ -354,7 +354,7 @@ static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
mtk_vcodec_debug(inst, "+ [%d] FB y_dma=%llx c_dma=%llx va=%p",
mtk_vdec_debug(inst->ctx, "+ [%d] FB y_dma=%llx c_dma=%llx va=%p",
inst->num_nalu, y_fb_dma, c_fb_dma, fb);
inst->vsi_ctx.dec.bs_dma = (uint64_t)bs->dma_addr;
......@@ -380,7 +380,7 @@ static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
*res_chg = inst->vsi_ctx.dec.resolution_changed;
if (*res_chg) {
mtk_vcodec_debug(inst, "- resolution changed -");
mtk_vdec_debug(inst->ctx, "- resolution changed -");
if (inst->vsi_ctx.dec.realloc_mv_buf) {
err = alloc_mv_buf(inst, &inst->ctx->picinfo);
inst->vsi_ctx.dec.realloc_mv_buf = false;
......@@ -404,11 +404,11 @@ static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
vpu_dec_end(vpu);
memcpy(&inst->vsi_ctx, inst->vpu.vsi, sizeof(inst->vsi_ctx));
mtk_vcodec_debug(inst, "\n - NALU[%d]", inst->num_nalu);
mtk_vdec_debug(inst->ctx, "\n - NALU[%d]", inst->num_nalu);
return 0;
err_free_fb_out:
mtk_vcodec_err(inst, "\n - NALU[%d] err=%d -\n", inst->num_nalu, err);
mtk_vdec_err(inst->ctx, "\n - NALU[%d] err=%d -\n", inst->num_nalu, err);
return err;
}
......@@ -430,7 +430,7 @@ static int vdec_h264_slice_get_param(void *h_vdec, enum vdec_get_param_type type
break;
default:
mtk_vcodec_err(inst, "invalid get parameter type=%d", type);
mtk_vdec_err(inst->ctx, "invalid get parameter type=%d", type);
return -EINVAL;
}
......
......@@ -657,7 +657,7 @@ static int vdec_hevc_slice_alloc_mv_buf(struct vdec_hevc_slice_inst *inst,
mem->size = buf_sz;
err = mtk_vcodec_mem_alloc(inst->ctx, mem);
if (err) {
mtk_vcodec_err(inst, "failed to allocate mv buf");
mtk_vdec_err(inst->ctx, "failed to allocate mv buf");
return err;
}
}
......@@ -694,10 +694,10 @@ static void vdec_hevc_slice_get_pic_info(struct vdec_hevc_slice_inst *inst)
inst->cap_num_planes =
ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes;
mtk_vcodec_debug(inst, "pic(%d, %d), buf(%d, %d)",
mtk_vdec_debug(ctx, "pic(%d, %d), buf(%d, %d)",
ctx->picinfo.pic_w, ctx->picinfo.pic_h,
ctx->picinfo.buf_w, ctx->picinfo.buf_h);
mtk_vcodec_debug(inst, "Y/C(%d, %d)", ctx->picinfo.fb_sz[0],
mtk_vdec_debug(ctx, "Y/C(%d, %d)", ctx->picinfo.fb_sz[0],
ctx->picinfo.fb_sz[1]);
if (ctx->last_decoded_picinfo.pic_w != ctx->picinfo.pic_w ||
......@@ -724,7 +724,7 @@ static void vdec_hevc_slice_get_crop_info(struct vdec_hevc_slice_inst *inst,
cr->width = inst->ctx->picinfo.pic_w;
cr->height = inst->ctx->picinfo.pic_h;
mtk_vcodec_debug(inst, "l=%d, t=%d, w=%d, h=%d",
mtk_vdec_debug(inst->ctx, "l=%d, t=%d, w=%d, h=%d",
cr->left, cr->top, cr->width, cr->height);
}
......@@ -747,7 +747,7 @@ static int vdec_hevc_slice_setup_lat_buffer(struct vdec_hevc_slice_inst *inst,
*res_chg = inst->resolution_changed;
if (inst->resolution_changed) {
mtk_vcodec_debug(inst, "- resolution changed -");
mtk_vdec_debug(inst->ctx, "- resolution changed -");
if (inst->realloc_mv_buf) {
err = vdec_hevc_slice_alloc_mv_buf(inst, &inst->ctx->picinfo);
inst->realloc_mv_buf = false;
......@@ -779,12 +779,12 @@ static int vdec_hevc_slice_setup_lat_buffer(struct vdec_hevc_slice_inst *inst,
share_info->trans.dma_addr = inst->vsi->trans.dma_addr;
share_info->trans.dma_addr_end = inst->vsi->trans.dma_addr_end;
mtk_vcodec_debug(inst, "lat: ube addr/size(0x%llx 0x%llx) err:0x%llx",
mtk_vdec_debug(inst->ctx, "lat: ube addr/size(0x%llx 0x%llx) err:0x%llx",
inst->vsi->ube.buf,
inst->vsi->ube.padding,
inst->vsi->err_map.buf);
mtk_vcodec_debug(inst, "slice addr/size(0x%llx 0x%llx) trans start/end((0x%llx 0x%llx))",
mtk_vdec_debug(inst->ctx, "slice addr/size(0x%llx 0x%llx) trans start/end((0x%llx 0x%llx))",
inst->vsi->slice_bc.buf,
inst->vsi->slice_bc.padding,
inst->vsi->trans.buf,
......@@ -806,7 +806,7 @@ static int vdec_hevc_slice_setup_core_buffer(struct vdec_hevc_slice_inst *inst,
fb = ctx->dev->vdec_pdata->get_cap_buffer(ctx);
if (!fb) {
mtk_vcodec_err(inst, "fb buffer is NULL");
mtk_vdec_err(inst->ctx, "fb buffer is NULL");
return -EBUSY;
}
......@@ -817,8 +817,7 @@ static int vdec_hevc_slice_setup_core_buffer(struct vdec_hevc_slice_inst *inst,
else
c_fb_dma = (u64)fb->base_c.dma_addr;
mtk_vcodec_debug(inst, "[hevc-core] y/c addr = 0x%llx 0x%llx", y_fb_dma,
c_fb_dma);
mtk_vdec_debug(inst->ctx, "[hevc-core] y/c addr = 0x%llx 0x%llx", y_fb_dma, c_fb_dma);
inst->vsi_core->fb.y.dma_addr = y_fb_dma;
inst->vsi_core->fb.y.size = ctx->picinfo.fb_sz[0];
......@@ -874,7 +873,7 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_ctx *ctx)
ctx->drv_handle = inst;
err = vpu_dec_init(&inst->vpu);
if (err) {
mtk_vcodec_err(inst, "vdec_hevc init err=%d", err);
mtk_vdec_err(ctx, "vdec_hevc init err=%d", err);
goto error_free_inst;
}
......@@ -891,13 +890,13 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_ctx *ctx)
if (err)
goto error_free_inst;
mtk_vcodec_debug(inst, "lat struct size = %d,%d,%d,%d vsi: %d\n",
mtk_vdec_debug(ctx, "lat struct size = %d,%d,%d,%d vsi: %d\n",
(int)sizeof(struct mtk_hevc_sps_param),
(int)sizeof(struct mtk_hevc_pps_param),
(int)sizeof(struct vdec_hevc_slice_lat_dec_param),
(int)sizeof(struct mtk_hevc_dpb_info),
vsi_size);
mtk_vcodec_debug(inst, "lat hevc instance >> %p, codec_type = 0x%x",
mtk_vdec_debug(ctx, "lat hevc instance >> %p, codec_type = 0x%x",
inst, inst->vpu.codec_type);
return 0;
......@@ -930,7 +929,7 @@ static int vdec_hevc_slice_core_decode(struct vdec_lat_buf *lat_buf)
struct vdec_hevc_slice_share_info *share_info = lat_buf->private_data;
struct vdec_vpu_inst *vpu = &inst->vpu;
mtk_vcodec_debug(inst, "[hevc-core] vdec_hevc core decode");
mtk_vdec_debug(ctx, "[hevc-core] vdec_hevc core decode");
memcpy(&inst->vsi_core->hevc_slice_params, &share_info->hevc_slice_params,
sizeof(share_info->hevc_slice_params));
......@@ -942,7 +941,7 @@ static int vdec_hevc_slice_core_decode(struct vdec_lat_buf *lat_buf)
share_info);
err = vpu_dec_core(vpu);
if (err) {
mtk_vcodec_err(inst, "core decode err=%d", err);
mtk_vdec_err(ctx, "core decode err=%d", err);
goto vdec_dec_end;
}
......@@ -950,12 +949,11 @@ static int vdec_hevc_slice_core_decode(struct vdec_lat_buf *lat_buf)
timeout = mtk_vcodec_wait_for_done_ctx(inst->ctx, MTK_INST_IRQ_RECEIVED,
WAIT_INTR_TIMEOUT_MS, MTK_VDEC_CORE);
if (timeout)
mtk_vcodec_err(inst, "core decode timeout: pic_%d",
ctx->decoded_frame_cnt);
mtk_vdec_err(ctx, "core decode timeout: pic_%d", ctx->decoded_frame_cnt);
inst->vsi_core->dec.timeout = !!timeout;
vpu_dec_core_end(vpu);
mtk_vcodec_debug(inst, "pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
mtk_vdec_debug(ctx, "pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
ctx->decoded_frame_cnt,
inst->vsi_core->dec.crc[0], inst->vsi_core->dec.crc[1],
inst->vsi_core->dec.crc[2], inst->vsi_core->dec.crc[3],
......@@ -965,7 +963,7 @@ static int vdec_hevc_slice_core_decode(struct vdec_lat_buf *lat_buf)
vdec_dec_end:
vdec_msg_queue_update_ube_rptr(&lat_buf->ctx->msg_queue, share_info->trans.dma_addr_end);
ctx->dev->vdec_pdata->cap_to_disp(ctx, !!err, lat_buf->src_buf_req);
mtk_vcodec_debug(inst, "core decode done err=%d", err);
mtk_vdec_debug(ctx, "core decode done err=%d", err);
ctx->decoded_frame_cnt++;
return 0;
}
......@@ -993,7 +991,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
lat_buf = vdec_msg_queue_dqbuf(&inst->ctx->msg_queue.lat_ctx);
if (!lat_buf) {
mtk_vcodec_debug(inst, "failed to get lat buffer");
mtk_vdec_debug(inst->ctx, "failed to get lat buffer");
return -EAGAIN;
}
......@@ -1008,7 +1006,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
err = vpu_dec_start(vpu, data, 2);
if (err) {
mtk_vcodec_debug(inst, "lat decode err: %d", err);
mtk_vdec_debug(inst->ctx, "lat decode err: %d", err);
goto err_free_fb_out;
}
......@@ -1022,7 +1020,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
timeout = mtk_vcodec_wait_for_done_ctx(inst->ctx, MTK_INST_IRQ_RECEIVED,
WAIT_INTR_TIMEOUT_MS, MTK_VDEC_LAT0);
if (timeout)
mtk_vcodec_err(inst, "lat decode timeout: pic_%d", inst->slice_dec_num);
mtk_vdec_err(inst->ctx, "lat decode timeout: pic_%d", inst->slice_dec_num);
inst->vsi->dec.timeout = !!timeout;
err = vpu_dec_end(vpu);
......@@ -1030,7 +1028,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
if (!IS_VDEC_INNER_RACING(inst->ctx->dev->dec_capability))
vdec_msg_queue_qbuf(&inst->ctx->msg_queue.lat_ctx, lat_buf);
inst->slice_dec_num++;
mtk_vcodec_err(inst, "lat dec fail: pic_%d err:%d", inst->slice_dec_num, err);
mtk_vdec_err(inst->ctx, "lat dec fail: pic_%d err:%d", inst->slice_dec_num, err);
return -EINVAL;
}
......@@ -1043,14 +1041,14 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
sizeof(share_info->hevc_slice_params));
vdec_msg_queue_qbuf(&inst->ctx->msg_queue.core_ctx, lat_buf);
}
mtk_vcodec_debug(inst, "dec num: %d lat crc: 0x%x 0x%x 0x%x", inst->slice_dec_num,
mtk_vdec_debug(inst->ctx, "dec num: %d lat crc: 0x%x 0x%x 0x%x", inst->slice_dec_num,
inst->vsi->dec.crc[0], inst->vsi->dec.crc[1], inst->vsi->dec.crc[2]);
inst->slice_dec_num++;
return 0;
err_free_fb_out:
vdec_msg_queue_qbuf(&inst->ctx->msg_queue.lat_ctx, lat_buf);
mtk_vcodec_err(inst, "slice dec number: %d err: %d", inst->slice_dec_num, err);
mtk_vdec_err(inst->ctx, "slice dec number: %d err: %d", inst->slice_dec_num, err);
return err;
}
......@@ -1081,7 +1079,7 @@ static int vdec_hevc_slice_get_param(void *h_vdec, enum vdec_get_param_type type
vdec_hevc_slice_get_crop_info(inst, out);
break;
default:
mtk_vcodec_err(inst, "invalid get parameter type=%d", type);
mtk_vdec_err(inst->ctx, "invalid get parameter type=%d", type);
return -EINVAL;
}
return 0;
......
......@@ -282,9 +282,9 @@ static void get_pic_info(struct vdec_vp8_inst *inst, struct vdec_pic_info *pic)
{
*pic = inst->vsi->pic;
mtk_vcodec_debug(inst, "pic(%d, %d), buf(%d, %d)",
mtk_vdec_debug(inst->ctx, "pic(%d, %d), buf(%d, %d)",
pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h);
mtk_vcodec_debug(inst, "fb size: Y(%d), C(%d)",
mtk_vdec_debug(inst->ctx, "fb size: Y(%d), C(%d)",
pic->fb_sz[0], pic->fb_sz[1]);
}
......@@ -293,7 +293,7 @@ static void vp8_dec_finish(struct vdec_vp8_inst *inst)
struct vdec_fb_node *node;
uint64_t prev_y_dma = inst->vsi->dec.prev_y_dma;
mtk_vcodec_debug(inst, "prev fb base dma=%llx", prev_y_dma);
mtk_vdec_debug(inst->ctx, "prev fb base dma=%llx", prev_y_dma);
/* put last decode ok frame to fb_free_list */
if (prev_y_dma != 0) {
......@@ -368,7 +368,7 @@ static int alloc_working_buf(struct vdec_vp8_inst *inst)
mem->size = VP8_WORKING_BUF_SZ;
err = mtk_vcodec_mem_alloc(inst->ctx, mem);
if (err) {
mtk_vcodec_err(inst, "Cannot allocate working buffer");
mtk_vdec_err(inst->ctx, "Cannot allocate working buffer");
return err;
}
......@@ -402,7 +402,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx)
err = vpu_dec_init(&inst->vpu);
if (err) {
mtk_vcodec_err(inst, "vdec_vp8 init err=%d", err);
mtk_vdec_err(ctx, "vdec_vp8 init err=%d", err);
goto error_free_inst;
}
......@@ -413,7 +413,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx)
goto error_deinit;
get_hw_reg_base(inst);
mtk_vcodec_debug(inst, "VP8 Instance >> %p", inst);
mtk_vdec_debug(ctx, "VP8 Instance >> %p", inst);
ctx->drv_handle = inst;
return 0;
......@@ -446,7 +446,7 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
mtk_vcodec_debug(inst, "+ [%d] FB y_dma=%llx c_dma=%llx fb=%p",
mtk_vdec_debug(inst->ctx, "+ [%d] FB y_dma=%llx c_dma=%llx fb=%p",
inst->frm_cnt, y_fb_dma, c_fb_dma, fb);
inst->cur_fb = fb;
......@@ -455,7 +455,7 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
dec->cur_y_fb_dma = y_fb_dma;
dec->cur_c_fb_dma = c_fb_dma;
mtk_vcodec_debug(inst, "\n + FRAME[%d] +\n", inst->frm_cnt);
mtk_vdec_debug(inst->ctx, "\n + FRAME[%d] +\n", inst->frm_cnt);
write_hw_segmentation_data(inst);
enable_hw_rw_function(inst);
......@@ -470,7 +470,7 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
if (err) {
add_fb_to_free_list(inst, fb);
if (dec->wait_key_frame) {
mtk_vcodec_debug(inst, "wait key frame !");
mtk_vdec_debug(inst->ctx, "wait key frame !");
return 0;
}
......@@ -478,7 +478,7 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
}
if (dec->resolution_changed) {
mtk_vcodec_debug(inst, "- resolution_changed -");
mtk_vdec_debug(inst->ctx, "- resolution_changed -");
*res_chg = true;
add_fb_to_free_list(inst, fb);
return 0;
......@@ -498,14 +498,13 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
if (err)
goto error;
mtk_vcodec_debug(inst, "\n - FRAME[%d] - show=%d\n", inst->frm_cnt,
dec->show_frame);
mtk_vdec_debug(inst->ctx, "\n - FRAME[%d] - show=%d\n", inst->frm_cnt, dec->show_frame);
inst->frm_cnt++;
*res_chg = false;
return 0;
error:
mtk_vcodec_err(inst, "\n - FRAME[%d] - err=%d\n", inst->frm_cnt, err);
mtk_vdec_err(inst->ctx, "\n - FRAME[%d] - err=%d\n", inst->frm_cnt, err);
return err;
}
......@@ -520,11 +519,10 @@ static void get_disp_fb(struct vdec_vp8_inst *inst, struct vdec_fb **out_fb)
list_move_tail(&node->list, &inst->available_fb_node_list);
fb = (struct vdec_fb *)node->fb;
fb->status |= FB_ST_DISPLAY;
mtk_vcodec_debug(inst, "[FB] get disp fb %p st=%d",
node->fb, fb->status);
mtk_vdec_debug(inst->ctx, "[FB] get disp fb %p st=%d", node->fb, fb->status);
} else {
fb = NULL;
mtk_vcodec_debug(inst, "[FB] there is no disp fb");
mtk_vdec_debug(inst->ctx, "[FB] there is no disp fb");
}
*out_fb = fb;
......@@ -541,11 +539,10 @@ static void get_free_fb(struct vdec_vp8_inst *inst, struct vdec_fb **out_fb)
list_move_tail(&node->list, &inst->available_fb_node_list);
fb = (struct vdec_fb *)node->fb;
fb->status |= FB_ST_FREE;
mtk_vcodec_debug(inst, "[FB] get free fb %p st=%d",
node->fb, fb->status);
mtk_vdec_debug(inst->ctx, "[FB] get free fb %p st=%d", node->fb, fb->status);
} else {
fb = NULL;
mtk_vcodec_debug(inst, "[FB] there is no free fb");
mtk_vdec_debug(inst->ctx, "[FB] there is no free fb");
}
*out_fb = fb;
......@@ -557,7 +554,7 @@ static void get_crop_info(struct vdec_vp8_inst *inst, struct v4l2_rect *cr)
cr->top = 0;
cr->width = inst->vsi->pic.pic_w;
cr->height = inst->vsi->pic.pic_h;
mtk_vcodec_debug(inst, "get crop info l=%d, t=%d, w=%d, h=%d",
mtk_vdec_debug(inst->ctx, "get crop info l=%d, t=%d, w=%d, h=%d",
cr->left, cr->top, cr->width, cr->height);
}
......@@ -588,7 +585,7 @@ static int vdec_vp8_get_param(void *h_vdec, enum vdec_get_param_type type,
break;
default:
mtk_vcodec_err(inst, "invalid get parameter type=%d", type);
mtk_vdec_err(inst->ctx, "invalid get parameter type=%d", type);
return -EINVAL;
}
......
......@@ -137,10 +137,10 @@ static void vdec_vp8_slice_get_pic_info(struct vdec_vp8_slice_inst *inst)
inst->vsi->pic.buf_h = ctx->picinfo.buf_h;
inst->vsi->pic.fb_sz[0] = ctx->picinfo.fb_sz[0];
inst->vsi->pic.fb_sz[1] = ctx->picinfo.fb_sz[1];
mtk_vcodec_debug(inst, "pic(%d, %d), buf(%d, %d)",
mtk_vdec_debug(inst->ctx, "pic(%d, %d), buf(%d, %d)",
ctx->picinfo.pic_w, ctx->picinfo.pic_h,
ctx->picinfo.buf_w, ctx->picinfo.buf_h);
mtk_vcodec_debug(inst, "fb size: Y(%d), C(%d)",
mtk_vdec_debug(inst->ctx, "fb size: Y(%d), C(%d)",
ctx->picinfo.fb_sz[0], ctx->picinfo.fb_sz[1]);
}
......@@ -153,7 +153,7 @@ static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst)
mem->size = VP8_SEG_ID_SZ;
err = mtk_vcodec_mem_alloc(inst->ctx, mem);
if (err) {
mtk_vcodec_err(inst, "Cannot allocate working buffer");
mtk_vdec_err(inst->ctx, "Cannot allocate working buffer");
return err;
}
inst->vsi->dec.seg_id_buf_dma = (u64)mem->dma_addr;
......@@ -162,7 +162,7 @@ static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst)
mem->size = VP8_PP_WRAPY_SZ;
err = mtk_vcodec_mem_alloc(inst->ctx, mem);
if (err) {
mtk_vcodec_err(inst, "cannot allocate WRAP Y buffer");
mtk_vdec_err(inst->ctx, "cannot allocate WRAP Y buffer");
return err;
}
inst->vsi->dec.wrap_y_dma = (u64)mem->dma_addr;
......@@ -171,7 +171,7 @@ static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst)
mem->size = VP8_PP_WRAPC_SZ;
err = mtk_vcodec_mem_alloc(inst->ctx, mem);
if (err) {
mtk_vcodec_err(inst, "cannot allocate WRAP C buffer");
mtk_vdec_err(inst->ctx, "cannot allocate WRAP C buffer");
return err;
}
inst->vsi->dec.wrap_c_dma = (u64)mem->dma_addr;
......@@ -180,7 +180,7 @@ static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst)
mem->size = VP8_VLD_PRED_SZ;
err = mtk_vcodec_mem_alloc(inst->ctx, mem);
if (err) {
mtk_vcodec_err(inst, "cannot allocate vld wrapper buffer");
mtk_vdec_err(inst->ctx, "cannot allocate vld wrapper buffer");
return err;
}
inst->vsi->dec.vld_wrapper_dma = (u64)mem->dma_addr;
......@@ -249,7 +249,7 @@ static int vdec_vp8_slice_get_decode_parameters(struct vdec_vp8_slice_inst *inst
vb = vb2_find_buffer(vq, referenct_ts);
if (!vb) {
if (!V4L2_VP8_FRAME_IS_KEY_FRAME(frame_header))
mtk_vcodec_err(inst, "reference invalid: index(%d) ts(%lld)",
mtk_vdec_err(inst->ctx, "reference invalid: index(%d) ts(%lld)",
index, referenct_ts);
inst->vsi->vp8_dpb_info[index].reference_flag = 0;
continue;
......@@ -291,7 +291,7 @@ static int vdec_vp8_slice_init(struct mtk_vcodec_ctx *ctx)
err = vpu_dec_init(&inst->vpu);
if (err) {
mtk_vcodec_err(inst, "vdec_vp8 init err=%d", err);
mtk_vdec_err(ctx, "vdec_vp8 init err=%d", err);
goto error_free_inst;
}
......@@ -300,10 +300,10 @@ static int vdec_vp8_slice_init(struct mtk_vcodec_ctx *ctx)
if (err)
goto error_deinit;
mtk_vcodec_debug(inst, "vp8 struct size = %d vsi: %d\n",
mtk_vdec_debug(ctx, "vp8 struct size = %d vsi: %d\n",
(int)sizeof(struct v4l2_ctrl_vp8_frame),
(int)sizeof(struct vdec_vp8_slice_vsi));
mtk_vcodec_debug(inst, "vp8:%p, codec_type = 0x%x vsi: 0x%p",
mtk_vdec_debug(ctx, "vp8:%p, codec_type = 0x%x vsi: 0x%p",
inst, inst->vpu.codec_type, inst->vpu.vsi);
ctx->drv_handle = inst;
......@@ -350,7 +350,7 @@ static int vdec_vp8_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
inst->vsi->dec.cur_y_fb_dma = y_fb_dma;
inst->vsi->dec.cur_c_fb_dma = c_fb_dma;
mtk_vcodec_debug(inst, "frame[%d] bs(%zu 0x%llx) y/c(0x%llx 0x%llx)",
mtk_vdec_debug(inst->ctx, "frame[%d] bs(%zu 0x%llx) y/c(0x%llx 0x%llx)",
inst->ctx->decoded_frame_cnt,
bs->size, (u64)bs->dma_addr,
y_fb_dma, c_fb_dma);
......@@ -364,12 +364,12 @@ static int vdec_vp8_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
err = vpu_dec_start(vpu, &data, 1);
if (err) {
mtk_vcodec_debug(inst, "vp8 dec start err!");
mtk_vdec_debug(inst->ctx, "vp8 dec start err!");
goto error;
}
if (inst->vsi->dec.resolution_changed) {
mtk_vcodec_debug(inst, "- resolution_changed -");
mtk_vdec_debug(inst->ctx, "- resolution_changed -");
*res_chg = true;
return 0;
}
......@@ -380,10 +380,10 @@ static int vdec_vp8_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
err = vpu_dec_end(vpu);
if (err || timeout)
mtk_vcodec_debug(inst, "vp8 dec error timeout:%d err: %d pic_%d",
mtk_vdec_debug(inst->ctx, "vp8 dec error timeout:%d err: %d pic_%d",
timeout, err, inst->ctx->decoded_frame_cnt);
mtk_vcodec_debug(inst, "pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
mtk_vdec_debug(inst->ctx, "pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x",
inst->ctx->decoded_frame_cnt,
inst->vsi->dec.crc[0], inst->vsi->dec.crc[1],
inst->vsi->dec.crc[2], inst->vsi->dec.crc[3],
......@@ -404,13 +404,13 @@ static int vdec_vp8_slice_get_param(void *h_vdec, enum vdec_get_param_type type,
vdec_vp8_slice_get_pic_info(inst);
break;
case GET_PARAM_CROP_INFO:
mtk_vcodec_debug(inst, "No need to get vp8 crop information.");
mtk_vdec_debug(inst->ctx, "No need to get vp8 crop information.");
break;
case GET_PARAM_DPB_SIZE:
*((unsigned int *)out) = VP8_DPB_SIZE;
break;
default:
mtk_vcodec_err(inst, "invalid get parameter type=%d", type);
mtk_vdec_err(inst->ctx, "invalid get parameter type=%d", type);
return -EINVAL;
}
......
......@@ -16,7 +16,7 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg)
struct vdec_vpu_inst *vpu = (struct vdec_vpu_inst *)
(unsigned long)msg->ap_inst_addr;
mtk_vcodec_debug(vpu, "+ ap_inst_addr = 0x%llx", msg->ap_inst_addr);
mtk_vdec_debug(vpu->ctx, "+ ap_inst_addr = 0x%llx", msg->ap_inst_addr);
/* mapping VPU address to kernel virtual address */
/* the content in vsi is initialized to 0 in VPU */
......@@ -24,7 +24,7 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg)
msg->vpu_inst_addr);
vpu->inst_addr = msg->vpu_inst_addr;
mtk_vcodec_debug(vpu, "- vpu_inst_addr = 0x%x", vpu->inst_addr);
mtk_vdec_debug(vpu->ctx, "- vpu_inst_addr = 0x%x", vpu->inst_addr);
/* Set default ABI version if dealing with unversioned firmware. */
vpu->fw_abi_version = 0;
......@@ -40,7 +40,7 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg)
/* Check firmware version. */
vpu->fw_abi_version = msg->vdec_abi_version;
mtk_vcodec_debug(vpu, "firmware version 0x%x\n", vpu->fw_abi_version);
mtk_vdec_debug(vpu->ctx, "firmware version 0x%x\n", vpu->fw_abi_version);
switch (vpu->fw_abi_version) {
case 1:
break;
......@@ -48,8 +48,7 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg)
vpu->inst_id = msg->inst_id;
break;
default:
mtk_vcodec_err(vpu, "unhandled firmware version 0x%x\n",
vpu->fw_abi_version);
mtk_vdec_err(vpu->ctx, "unhandled firmware version 0x%x\n", vpu->fw_abi_version);
vpu->failure = 1;
break;
}
......@@ -60,7 +59,7 @@ static void handle_get_param_msg_ack(const struct vdec_vpu_ipi_get_param_ack *ms
struct vdec_vpu_inst *vpu = (struct vdec_vpu_inst *)
(unsigned long)msg->ap_inst_addr;
mtk_vcodec_debug(vpu, "+ ap_inst_addr = 0x%llx", msg->ap_inst_addr);
mtk_vdec_debug(vpu->ctx, "+ ap_inst_addr = 0x%llx", msg->ap_inst_addr);
/* param_type is enum vdec_get_param_type */
switch (msg->param_type) {
......@@ -69,7 +68,7 @@ static void handle_get_param_msg_ack(const struct vdec_vpu_ipi_get_param_ack *ms
vpu->fb_sz[1] = msg->data[1];
break;
default:
mtk_vcodec_err(vpu, "invalid get param type=%d", msg->param_type);
mtk_vdec_err(vpu->ctx, "invalid get param type=%d", msg->param_type);
vpu->failure = 1;
break;
}
......@@ -96,7 +95,7 @@ static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv)
return;
}
mtk_vcodec_debug(vpu, "+ id=%X", msg->msg_id);
mtk_vdec_debug(vpu->ctx, "+ id=%X", msg->msg_id);
vpu->failure = msg->status;
vpu->signaled = 1;
......@@ -119,12 +118,12 @@ static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv)
handle_get_param_msg_ack(data);
break;
default:
mtk_vcodec_err(vpu, "invalid msg=%X", msg->msg_id);
mtk_vdec_err(vpu->ctx, "invalid msg=%X", msg->msg_id);
break;
}
}
mtk_vcodec_debug(vpu, "- id=%X", msg->msg_id);
mtk_vdec_debug(vpu->ctx, "- id=%X", msg->msg_id);
}
static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len)
......@@ -132,7 +131,7 @@ static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len)
int err, id, msgid;
msgid = *(uint32_t *)msg;
mtk_vcodec_debug(vpu, "id=%X", msgid);
mtk_vdec_debug(vpu->ctx, "id=%X", msgid);
vpu->failure = 0;
vpu->signaled = 0;
......@@ -150,7 +149,7 @@ static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len)
err = mtk_vcodec_fw_ipi_send(vpu->ctx->dev->fw_handler, id, msg,
len, 2000);
if (err) {
mtk_vcodec_err(vpu, "send fail vpu_id=%d msg_id=%X status=%d",
mtk_vdec_err(vpu->ctx, "send fail vpu_id=%d msg_id=%X status=%d",
id, msgid, err);
return err;
}
......@@ -163,7 +162,7 @@ static int vcodec_send_ap_ipi(struct vdec_vpu_inst *vpu, unsigned int msg_id)
struct vdec_ap_ipi_cmd msg;
int err = 0;
mtk_vcodec_debug(vpu, "+ id=%X", msg_id);
mtk_vdec_debug(vpu->ctx, "+ id=%X", msg_id);
memset(&msg, 0, sizeof(msg));
msg.msg_id = msg_id;
......@@ -174,7 +173,7 @@ static int vcodec_send_ap_ipi(struct vdec_vpu_inst *vpu, unsigned int msg_id)
msg.codec_type = vpu->codec_type;
err = vcodec_vpu_send_msg(vpu, &msg, sizeof(msg));
mtk_vcodec_debug(vpu, "- id=%X ret=%d", msg_id, err);
mtk_vdec_debug(vpu->ctx, "- id=%X ret=%d", msg_id, err);
return err;
}
......@@ -189,7 +188,7 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)
err = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler, vpu->id,
vpu->handler, "vdec", NULL);
if (err) {
mtk_vcodec_err(vpu, "vpu_ipi_register fail status=%d", err);
mtk_vdec_err(vpu->ctx, "vpu_ipi_register fail status=%d", err);
return err;
}
......@@ -198,7 +197,7 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)
vpu->core_id, vpu->handler,
"vdec", NULL);
if (err) {
mtk_vcodec_err(vpu, "vpu_ipi_register core fail status=%d", err);
mtk_vdec_err(vpu->ctx, "vpu_ipi_register core fail status=%d", err);
return err;
}
}
......@@ -208,10 +207,10 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)
msg.ap_inst_addr = (unsigned long)vpu;
msg.codec_type = vpu->codec_type;
mtk_vcodec_debug(vpu, "vdec_inst=%p", vpu);
mtk_vdec_debug(vpu->ctx, "vdec_inst=%p", vpu);
err = vcodec_vpu_send_msg(vpu, (void *)&msg, sizeof(msg));
mtk_vcodec_debug(vpu, "- ret=%d", err);
mtk_vdec_debug(vpu->ctx, "- ret=%d", err);
return err;
}
......@@ -222,7 +221,7 @@ int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len)
int err = 0;
if (len > ARRAY_SIZE(msg.data)) {
mtk_vcodec_err(vpu, "invalid len = %d\n", len);
mtk_vdec_err(vpu->ctx, "invalid len = %d\n", len);
return -EINVAL;
}
......@@ -238,7 +237,7 @@ int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len)
msg.codec_type = vpu->codec_type;
err = vcodec_vpu_send_msg(vpu, (void *)&msg, sizeof(msg));
mtk_vcodec_debug(vpu, "- ret=%d", err);
mtk_vdec_debug(vpu->ctx, "- ret=%d", err);
return err;
}
......@@ -249,7 +248,7 @@ int vpu_dec_get_param(struct vdec_vpu_inst *vpu, uint32_t *data,
int err;
if (len > ARRAY_SIZE(msg.data)) {
mtk_vcodec_err(vpu, "invalid len = %d\n", len);
mtk_vdec_err(vpu->ctx, "invalid len = %d\n", len);
return -EINVAL;
}
......@@ -261,7 +260,7 @@ int vpu_dec_get_param(struct vdec_vpu_inst *vpu, uint32_t *data,
msg.codec_type = vpu->codec_type;
err = vcodec_vpu_send_msg(vpu, (void *)&msg, sizeof(msg));
mtk_vcodec_debug(vpu, "- ret=%d", err);
mtk_vdec_debug(vpu->ctx, "- ret=%d", err);
return err;
}
......
......@@ -240,13 +240,13 @@ static unsigned int h264_get_profile(struct venc_h264_inst *inst,
case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH:
return 100;
case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE:
mtk_vcodec_err(inst, "unsupported CONSTRAINED_BASELINE");
mtk_venc_err(inst->ctx, "unsupported CONSTRAINED_BASELINE");
return 0;
case V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED:
mtk_vcodec_err(inst, "unsupported EXTENDED");
mtk_venc_err(inst->ctx, "unsupported EXTENDED");
return 0;
default:
mtk_vcodec_debug(inst, "unsupported profile %d", profile);
mtk_venc_debug(inst->ctx, "unsupported profile %d", profile);
return 100;
}
}
......@@ -256,7 +256,7 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
{
switch (level) {
case V4L2_MPEG_VIDEO_H264_LEVEL_1B:
mtk_vcodec_err(inst, "unsupported 1B");
mtk_venc_err(inst->ctx, "unsupported 1B");
return 0;
case V4L2_MPEG_VIDEO_H264_LEVEL_1_0:
return 10;
......@@ -289,7 +289,7 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,
case V4L2_MPEG_VIDEO_H264_LEVEL_5_1:
return 51;
default:
mtk_vcodec_debug(inst, "unsupported level %d", level);
mtk_venc_debug(inst->ctx, "unsupported level %d", level);
return 31;
}
}
......@@ -360,8 +360,7 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit)
ret = mtk_vcodec_mem_alloc(inst->ctx,
&inst->work_bufs[i]);
if (ret) {
mtk_vcodec_err(inst,
"cannot allocate buf %d", i);
mtk_venc_err(inst->ctx, "cannot allocate buf %d", i);
goto err_alloc;
}
/*
......@@ -385,8 +384,7 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit)
else
wb[i].iova = inst->work_bufs[i].dma_addr;
mtk_vcodec_debug(inst,
"work_buf[%d] va=0x%p iova=%pad size=%zu",
mtk_venc_debug(inst->ctx, "work_buf[%d] va=0x%p iova=%pad size=%zu",
i, inst->work_bufs[i].va,
&inst->work_bufs[i].dma_addr,
inst->work_bufs[i].size);
......@@ -396,7 +394,7 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit)
inst->pps_buf.size = 128;
ret = mtk_vcodec_mem_alloc(inst->ctx, &inst->pps_buf);
if (ret) {
mtk_vcodec_err(inst, "cannot allocate pps_buf");
mtk_venc_err(inst->ctx, "cannot allocate pps_buf");
goto err_alloc;
}
......@@ -416,7 +414,7 @@ static unsigned int h264_enc_wait_venc_done(struct venc_h264_inst *inst)
if (!mtk_vcodec_wait_for_done_ctx(ctx, MTK_INST_IRQ_RECEIVED,
WAIT_INTR_TIMEOUT_MS, 0)) {
irq_status = ctx->irq_status;
mtk_vcodec_debug(inst, "irq_status %x <-", irq_status);
mtk_venc_debug(ctx, "irq_status %x <-", irq_status);
}
return irq_status;
}
......@@ -450,13 +448,12 @@ static int h264_encode_sps(struct venc_h264_inst *inst,
irq_status = h264_enc_wait_venc_done(inst);
if (irq_status != MTK_VENC_IRQ_STATUS_SPS) {
mtk_vcodec_err(inst, "expect irq status %d",
MTK_VENC_IRQ_STATUS_SPS);
mtk_venc_err(inst->ctx, "expect irq status %d", MTK_VENC_IRQ_STATUS_SPS);
return -EINVAL;
}
*bs_size = h264_read_reg(inst, VENC_PIC_BITSTREAM_BYTE_CNT);
mtk_vcodec_debug(inst, "bs size %d <-", *bs_size);
mtk_venc_debug(inst->ctx, "bs size %d <-", *bs_size);
return ret;
}
......@@ -474,13 +471,12 @@ static int h264_encode_pps(struct venc_h264_inst *inst,
irq_status = h264_enc_wait_venc_done(inst);
if (irq_status != MTK_VENC_IRQ_STATUS_PPS) {
mtk_vcodec_err(inst, "expect irq status %d",
MTK_VENC_IRQ_STATUS_PPS);
mtk_venc_err(inst->ctx, "expect irq status %d", MTK_VENC_IRQ_STATUS_PPS);
return -EINVAL;
}
*bs_size = h264_read_reg(inst, VENC_PIC_BITSTREAM_BYTE_CNT);
mtk_vcodec_debug(inst, "bs size %d <-", *bs_size);
mtk_venc_debug(inst->ctx, "bs size %d <-", *bs_size);
return ret;
}
......@@ -519,7 +515,7 @@ static int h264_encode_frame(struct venc_h264_inst *inst,
struct venc_frame_info frame_info;
struct mtk_vcodec_ctx *ctx = inst->ctx;
mtk_vcodec_debug(inst, "frm_cnt = %d\n ", inst->frm_cnt);
mtk_venc_debug(ctx, "frm_cnt = %d\n ", inst->frm_cnt);
if (MTK_ENC_IOVA_IS_34BIT(ctx)) {
gop_size = inst->vsi_34->config.gop_size;
......@@ -532,7 +528,7 @@ static int h264_encode_frame(struct venc_h264_inst *inst,
frame_info.skip_frm_count = inst->skip_frm_cnt;
frame_info.frm_type = h264_frame_type(inst->frm_cnt, gop_size,
intra_period);
mtk_vcodec_debug(inst, "frm_count = %d,skip_frm_count =%d,frm_type=%d.\n",
mtk_venc_debug(ctx, "frm_count = %d,skip_frm_count =%d,frm_type=%d.\n",
frame_info.frm_count, frame_info.skip_frm_count,
frame_info.frm_type);
......@@ -557,14 +553,14 @@ static int h264_encode_frame(struct venc_h264_inst *inst,
irq_status = h264_enc_wait_venc_done(inst);
if (irq_status != MTK_VENC_IRQ_STATUS_FRM) {
mtk_vcodec_err(inst, "irq_status=%d failed", irq_status);
mtk_venc_err(ctx, "irq_status=%d failed", irq_status);
return -EIO;
}
*bs_size = h264_read_reg(inst, VENC_PIC_BITSTREAM_BYTE_CNT);
++inst->frm_cnt;
mtk_vcodec_debug(inst, "frm %d bs_size %d key_frm %d <-",
mtk_venc_debug(ctx, "frm %d bs_size %d key_frm %d <-",
inst->frm_cnt, *bs_size, inst->vpu_inst.is_key_frm);
return 0;
......@@ -576,7 +572,7 @@ static void h264_encode_filler(struct venc_h264_inst *inst, void *buf,
unsigned char *p = buf;
if (size < H264_FILLER_MARKER_SIZE) {
mtk_vcodec_err(inst, "filler size too small %d", size);
mtk_venc_err(inst->ctx, "filler size too small %d", size);
return;
}
......@@ -626,7 +622,7 @@ static int h264_enc_encode(void *handle,
struct venc_h264_inst *inst = (struct venc_h264_inst *)handle;
struct mtk_vcodec_ctx *ctx = inst->ctx;
mtk_vcodec_debug(inst, "opt %d ->", opt);
mtk_venc_debug(ctx, "opt %d ->", opt);
enable_irq(ctx->dev->enc_irq);
......@@ -661,7 +657,7 @@ static int h264_enc_encode(void *handle,
break;
}
mtk_vcodec_debug(inst, "h264_encode_frame prepend SPS/PPS");
mtk_venc_debug(ctx, "h264_encode_frame prepend SPS/PPS");
ret = h264_encode_header(inst, bs_buf, &bs_size_hdr);
if (ret)
......@@ -688,9 +684,8 @@ static int h264_enc_encode(void *handle,
result->bs_size = hdr_sz + filler_sz + bs_size_frm;
mtk_vcodec_debug(inst, "hdr %d filler %d frame %d bs %d",
hdr_sz, filler_sz, bs_size_frm,
result->bs_size);
mtk_venc_debug(ctx, "hdr %d filler %d frame %d bs %d",
hdr_sz, filler_sz, bs_size_frm, result->bs_size);
inst->prepend_hdr = 0;
result->is_key_frm = inst->vpu_inst.is_key_frm;
......@@ -698,7 +693,7 @@ static int h264_enc_encode(void *handle,
}
default:
mtk_vcodec_err(inst, "venc_start_opt %d not supported", opt);
mtk_venc_err(ctx, "venc_start_opt %d not supported", opt);
ret = -EINVAL;
break;
}
......@@ -706,7 +701,7 @@ static int h264_enc_encode(void *handle,
encode_err:
disable_irq(ctx->dev->enc_irq);
mtk_vcodec_debug(inst, "opt %d <-", opt);
mtk_venc_debug(ctx, "opt %d <-", opt);
return ret;
}
......@@ -758,7 +753,7 @@ static int h264_enc_set_param(void *handle,
struct mtk_vcodec_ctx *ctx = inst->ctx;
const bool is_34bit = MTK_ENC_IOVA_IS_34BIT(ctx);
mtk_vcodec_debug(inst, "->type=%d", type);
mtk_venc_debug(ctx, "->type=%d", type);
switch (type) {
case VENC_SET_PARAM_ENC:
......@@ -781,7 +776,7 @@ static int h264_enc_set_param(void *handle,
case VENC_SET_PARAM_PREPEND_HEADER:
inst->prepend_hdr = 1;
mtk_vcodec_debug(inst, "set prepend header mode");
mtk_venc_debug(ctx, "set prepend header mode");
break;
case VENC_SET_PARAM_FORCE_INTRA:
case VENC_SET_PARAM_GOP_SIZE:
......
......@@ -171,8 +171,7 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst)
inst->work_bufs[i].size = wb[i].size;
ret = mtk_vcodec_mem_alloc(inst->ctx, &inst->work_bufs[i]);
if (ret) {
mtk_vcodec_err(inst,
"cannot alloc work_bufs[%d]", i);
mtk_venc_err(inst->ctx, "cannot alloc work_bufs[%d]", i);
goto err_alloc;
}
/*
......@@ -193,8 +192,7 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst)
}
wb[i].iova = inst->work_bufs[i].dma_addr;
mtk_vcodec_debug(inst,
"work_bufs[%d] va=0x%p,iova=%pad,size=%zu",
mtk_venc_debug(inst->ctx, "work_bufs[%d] va=0x%p,iova=%pad,size=%zu",
i, inst->work_bufs[i].va,
&inst->work_bufs[i].dma_addr,
inst->work_bufs[i].size);
......@@ -216,7 +214,7 @@ static unsigned int vp8_enc_wait_venc_done(struct venc_vp8_inst *inst)
if (!mtk_vcodec_wait_for_done_ctx(ctx, MTK_INST_IRQ_RECEIVED,
WAIT_INTR_TIMEOUT_MS, 0)) {
irq_status = ctx->irq_status;
mtk_vcodec_debug(inst, "isr return %x", irq_status);
mtk_venc_debug(ctx, "isr return %x", irq_status);
}
return irq_status;
}
......@@ -261,8 +259,7 @@ static int vp8_enc_compose_one_frame(struct venc_vp8_inst *inst,
}
if (bs_buf->size < bs_hdr_len + bs_frm_size + ac_tag_size) {
mtk_vcodec_err(inst, "bitstream buf size is too small(%zu)",
bs_buf->size);
mtk_venc_err(inst->ctx, "bitstream buf size is too small(%zu)", bs_buf->size);
return -EINVAL;
}
......@@ -292,7 +289,7 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,
int ret = 0;
unsigned int irq_status;
mtk_vcodec_debug(inst, "->frm_cnt=%d", inst->frm_cnt);
mtk_venc_debug(inst->ctx, "->frm_cnt=%d", inst->frm_cnt);
ret = vpu_enc_encode(&inst->vpu_inst, 0, frm_buf, bs_buf, NULL);
if (ret)
......@@ -300,18 +297,17 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,
irq_status = vp8_enc_wait_venc_done(inst);
if (irq_status != MTK_VENC_IRQ_STATUS_FRM) {
mtk_vcodec_err(inst, "irq_status=%d failed", irq_status);
mtk_venc_err(inst->ctx, "irq_status=%d failed", irq_status);
return -EIO;
}
if (vp8_enc_compose_one_frame(inst, bs_buf, bs_size)) {
mtk_vcodec_err(inst, "vp8_enc_compose_one_frame failed");
mtk_venc_err(inst->ctx, "vp8_enc_compose_one_frame failed");
return -EINVAL;
}
inst->frm_cnt++;
mtk_vcodec_debug(inst, "<-size=%d key_frm=%d", *bs_size,
inst->vpu_inst.is_key_frm);
mtk_venc_debug(inst->ctx, "<-size=%d key_frm=%d", *bs_size, inst->vpu_inst.is_key_frm);
return ret;
}
......@@ -364,7 +360,7 @@ static int vp8_enc_encode(void *handle,
break;
default:
mtk_vcodec_err(inst, "opt not support:%d", opt);
mtk_venc_err(ctx, "opt not support:%d", opt);
ret = -EINVAL;
break;
}
......@@ -382,7 +378,7 @@ static int vp8_enc_set_param(void *handle,
int ret = 0;
struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle;
mtk_vcodec_debug(inst, "->type=%d", type);
mtk_venc_debug(inst->ctx, "->type=%d", type);
switch (type) {
case VENC_SET_PARAM_ENC:
......@@ -413,7 +409,7 @@ static int vp8_enc_set_param(void *handle,
*/
case VENC_SET_PARAM_TS_MODE:
inst->ts_mode = 1;
mtk_vcodec_debug(inst, "set ts_mode");
mtk_venc_debug(inst->ctx, "set ts_mode");
break;
default:
......
......@@ -22,13 +22,12 @@ static void handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data)
return;
/* Check firmware version. */
mtk_vcodec_debug(vpu, "firmware version: 0x%x\n",
msg->venc_abi_version);
mtk_venc_debug(vpu->ctx, "firmware version: 0x%x\n", msg->venc_abi_version);
switch (msg->venc_abi_version) {
case 1:
break;
default:
mtk_vcodec_err(vpu, "unhandled firmware version 0x%x\n",
mtk_venc_err(vpu->ctx, "unhandled firmware version 0x%x\n",
msg->venc_abi_version);
vpu->failure = 1;
break;
......@@ -50,13 +49,12 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv)
struct venc_vpu_inst *vpu =
(struct venc_vpu_inst *)(unsigned long)msg->venc_inst;
mtk_vcodec_debug(vpu, "msg_id %x inst %p status %d",
msg->msg_id, vpu, msg->status);
mtk_venc_debug(vpu->ctx, "msg_id %x inst %p status %d", msg->msg_id, vpu, msg->status);
vpu->signaled = 1;
vpu->failure = (msg->status != VENC_IPI_MSG_STATUS_OK);
if (vpu->failure) {
mtk_vcodec_err(vpu, "vpu enc status failure %d", vpu->failure);
mtk_venc_err(vpu->ctx, "vpu enc status failure %d", vpu->failure);
return;
}
......@@ -72,7 +70,7 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv)
case VPU_IPIMSG_ENC_DEINIT_DONE:
break;
default:
mtk_vcodec_err(vpu, "unknown msg id %x", msg->msg_id);
mtk_venc_err(vpu->ctx, "unknown msg id %x", msg->msg_id);
break;
}
}
......@@ -83,14 +81,14 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg,
int status;
if (!vpu->ctx->dev->fw_handler) {
mtk_vcodec_err(vpu, "inst dev is NULL");
mtk_venc_err(vpu->ctx, "inst dev is NULL");
return -EINVAL;
}
status = mtk_vcodec_fw_ipi_send(vpu->ctx->dev->fw_handler, vpu->id, msg,
len, 2000);
if (status) {
mtk_vcodec_err(vpu, "vpu_ipi_send msg_id %x len %d fail %d",
mtk_venc_err(vpu->ctx, "vpu_ipi_send msg_id %x len %d fail %d",
*(uint32_t *)msg, len, status);
return -EINVAL;
}
......@@ -113,7 +111,7 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)
vpu_enc_ipi_handler, "venc", NULL);
if (status) {
mtk_vcodec_err(vpu, "vpu_ipi_register fail %d", status);
mtk_venc_err(vpu->ctx, "vpu_ipi_register fail %d", status);
return -EINVAL;
}
......@@ -121,7 +119,7 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)
out.msg_id = AP_IPIMSG_ENC_INIT;
out.venc_inst = (unsigned long)vpu;
if (vpu_enc_send_msg(vpu, &out, sizeof(out))) {
mtk_vcodec_err(vpu, "AP_IPIMSG_ENC_INIT fail");
mtk_venc_err(vpu->ctx, "AP_IPIMSG_ENC_INIT fail");
return -EINVAL;
}
......@@ -157,7 +155,7 @@ int vpu_enc_set_param(struct venc_vpu_inst *vpu,
sizeof(struct venc_ap_ipi_msg_set_param);
struct venc_ap_ipi_msg_set_param_ext out;
mtk_vcodec_debug(vpu, "id %d ->", id);
mtk_venc_debug(vpu->ctx, "id %d ->", id);
memset(&out, 0, sizeof(out));
out.base.msg_id = AP_IPIMSG_ENC_SET_PARAM;
......@@ -199,16 +197,15 @@ int vpu_enc_set_param(struct venc_vpu_inst *vpu,
out.base.data_item = 0;
break;
default:
mtk_vcodec_err(vpu, "id %d not supported", id);
mtk_venc_err(vpu->ctx, "id %d not supported", id);
return -EINVAL;
}
if (vpu_enc_send_msg(vpu, &out, msg_size)) {
mtk_vcodec_err(vpu,
"AP_IPIMSG_ENC_SET_PARAM %d fail", id);
mtk_venc_err(vpu->ctx, "AP_IPIMSG_ENC_SET_PARAM %d fail", id);
return -EINVAL;
}
mtk_vcodec_debug(vpu, "id %d <-", id);
mtk_venc_debug(vpu->ctx, "id %d <-", id);
return 0;
}
......@@ -225,7 +222,7 @@ static int vpu_enc_encode_32bits(struct venc_vpu_inst *vpu,
sizeof(struct venc_ap_ipi_msg_enc);
struct venc_ap_ipi_msg_enc_ext out;
mtk_vcodec_debug(vpu, "bs_mode %d ->", bs_mode);
mtk_venc_debug(vpu->ctx, "bs_mode %d ->", bs_mode);
memset(&out, 0, sizeof(out));
out.base.msg_id = AP_IPIMSG_ENC_ENCODE;
......@@ -239,7 +236,7 @@ static int vpu_enc_encode_32bits(struct venc_vpu_inst *vpu,
out.base.input_addr[1] = frm_buf->fb_addr[1].dma_addr;
out.base.input_addr[2] = frm_buf->fb_addr[2].dma_addr;
} else {
mtk_vcodec_err(vpu, "dma_addr not align to 16");
mtk_venc_err(vpu->ctx, "dma_addr not align to 16");
return -EINVAL;
}
}
......@@ -254,8 +251,7 @@ static int vpu_enc_encode_32bits(struct venc_vpu_inst *vpu,
out.data[2] = frame_info->frm_type;
}
if (vpu_enc_send_msg(vpu, &out, msg_size)) {
mtk_vcodec_err(vpu, "AP_IPIMSG_ENC_ENCODE %d fail",
bs_mode);
mtk_venc_err(vpu->ctx, "AP_IPIMSG_ENC_ENCODE %d fail", bs_mode);
return -EINVAL;
}
......@@ -271,7 +267,7 @@ static int vpu_enc_encode_34bits(struct venc_vpu_inst *vpu,
struct venc_ap_ipi_msg_enc_ext_34 out;
size_t msg_size = sizeof(struct venc_ap_ipi_msg_enc_ext_34);
mtk_vcodec_debug(vpu, "bs_mode %d ->", bs_mode);
mtk_venc_debug(vpu->ctx, "bs_mode %d ->", bs_mode);
memset(&out, 0, sizeof(out));
out.msg_id = AP_IPIMSG_ENC_ENCODE;
......@@ -286,7 +282,7 @@ static int vpu_enc_encode_34bits(struct venc_vpu_inst *vpu,
out.input_addr[1] = frm_buf->fb_addr[1].dma_addr;
out.input_addr[2] = frm_buf->fb_addr[2].dma_addr;
} else {
mtk_vcodec_err(vpu, "dma_addr not align to 16");
mtk_venc_err(vpu->ctx, "dma_addr not align to 16");
return -EINVAL;
}
}
......@@ -301,8 +297,7 @@ static int vpu_enc_encode_34bits(struct venc_vpu_inst *vpu,
out.data[2] = frame_info->frm_type;
}
if (vpu_enc_send_msg(vpu, &out, msg_size)) {
mtk_vcodec_err(vpu, "AP_IPIMSG_ENC_ENCODE %d fail",
bs_mode);
mtk_venc_err(vpu->ctx, "AP_IPIMSG_ENC_ENCODE %d fail", bs_mode);
return -EINVAL;
}
......@@ -326,7 +321,7 @@ int vpu_enc_encode(struct venc_vpu_inst *vpu, unsigned int bs_mode,
if (ret)
return ret;
mtk_vcodec_debug(vpu, "bs_mode %d state %d size %d key_frm %d <-",
mtk_venc_debug(vpu->ctx, "bs_mode %d state %d size %d key_frm %d <-",
bs_mode, vpu->state, vpu->bs_size, vpu->is_key_frm);
return 0;
......@@ -340,7 +335,7 @@ int vpu_enc_deinit(struct venc_vpu_inst *vpu)
out.msg_id = AP_IPIMSG_ENC_DEINIT;
out.vpu_inst_addr = vpu->inst_addr;
if (vpu_enc_send_msg(vpu, &out, sizeof(out))) {
mtk_vcodec_err(vpu, "AP_IPIMSG_ENC_DEINIT fail");
mtk_venc_err(vpu->ctx, "AP_IPIMSG_ENC_DEINIT fail");
return -EINVAL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment