diff --git a/driver/variant/iris2/src/msm_vidc_iris2.c b/driver/variant/iris2/src/msm_vidc_iris2.c index f2f701591d..2361b04357 100644 --- a/driver/variant/iris2/src/msm_vidc_iris2.c +++ b/driver/variant/iris2/src/msm_vidc_iris2.c @@ -262,7 +262,7 @@ static int __power_off_iris2(struct msm_vidc_core *vidc_core) __read_register(core, AON_WRAPPER_MVP_NOC_LPI_STATUS); reg_status = lpi_status & BIT(0); - d_vpr_h("Noc: lpi_status %d noc_status %d (count %d)\n", + d_vpr_l("Noc: lpi_status %d noc_status %d (count %d)\n", lpi_status, reg_status, count); usleep_range(50, 100); count++; @@ -282,7 +282,7 @@ static int __power_off_iris2(struct msm_vidc_core *vidc_core) lpi_status = __read_register(core, WRAPPER_DEBUG_BRIDGE_LPI_STATUS_IRIS2); reg_status = lpi_status & 0x7; - d_vpr_h("DBLP Set : lpi_status %d reg_status %d (count %d)\n", + d_vpr_l("DBLP Set : lpi_status %d reg_status %d (count %d)\n", lpi_status, reg_status, count); usleep_range(50, 100); count++; @@ -300,7 +300,7 @@ static int __power_off_iris2(struct msm_vidc_core *vidc_core) while (lpi_status && count < max_count) { lpi_status = __read_register(core, WRAPPER_DEBUG_BRIDGE_LPI_STATUS_IRIS2); - d_vpr_h("DBLP Release: lpi_status %d(count %d)\n", + d_vpr_l("DBLP Release: lpi_status %d(count %d)\n", lpi_status, count); usleep_range(50, 100); count++; diff --git a/driver/vidc/inc/msm_vidc_debug.h b/driver/vidc/inc/msm_vidc_debug.h index 1203cb17a6..6858b7e653 100644 --- a/driver/vidc/inc/msm_vidc_debug.h +++ b/driver/vidc/inc/msm_vidc_debug.h @@ -81,6 +81,9 @@ enum vidc_msg_prio { #define i_vpr_t(inst, __fmt, ...) dprintk_inst(VIDC_PKT, "pkt ", inst, __fmt, ##__VA_ARGS__) #define i_vpr_b(inst, __fmt, ...) dprintk_inst(VIDC_BUS, "bus ", inst, __fmt, ##__VA_ARGS__) +#define i_vpr_hp(inst, __fmt, ...) \ + dprintk_inst(VIDC_HIGH | VIDC_PERF, "high", inst, __fmt, ##__VA_ARGS__) + #define dprintk_core(__level, __level_str, __fmt, ...) \ do { \ if (msm_vidc_debug & __level) { \ diff --git a/driver/vidc/inc/msm_vidc_driver.h b/driver/vidc/inc/msm_vidc_driver.h index e4f12ca632..31a7ecd0b6 100644 --- a/driver/vidc/inc/msm_vidc_driver.h +++ b/driver/vidc/inc/msm_vidc_driver.h @@ -247,6 +247,8 @@ static inline bool is_secure_region(enum msm_vidc_buffer_region region) } const char *cap_name(enum msm_vidc_inst_capability_type cap); +const char *v4l2_pixelfmt_name(u32 pixelfmt); +const char *v4l2_type_name(u32 port); void print_vidc_buffer(u32 tag, const char *tag_str, const char *str, struct msm_vidc_inst *inst, struct msm_vidc_buffer *vbuf); void print_vb2_buffer(const char *str, struct msm_vidc_inst *inst, diff --git a/driver/vidc/src/hfi_packet.c b/driver/vidc/src/hfi_packet.c index 07f9c6d13f..100cbc6a5e 100644 --- a/driver/vidc/src/hfi_packet.c +++ b/driver/vidc/src/hfi_packet.c @@ -646,11 +646,10 @@ int hfi_packet_sys_debug_config(struct msm_vidc_core *core, if (rc) goto err_debug; - d_vpr_h("Debug packet created\n"); - return rc; - err_debug: - d_vpr_e("%s: create packet failed\n", __func__); + if (rc) + d_vpr_e("%s: create packet failed\n", __func__); + return rc; } diff --git a/driver/vidc/src/msm_vdec.c b/driver/vidc/src/msm_vdec.c index 312226c9bb..f7e402fb6b 100644 --- a/driver/vidc/src/msm_vdec.c +++ b/driver/vidc/src/msm_vdec.c @@ -86,8 +86,9 @@ static int msm_vdec_codec_change(struct msm_vidc_inst *inst, u32 v4l2_codec) if (inst->codec && inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat == v4l2_codec) return 0; - i_vpr_h(inst, "%s: codec changed from %#x to %#x\n", - __func__, inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat, v4l2_codec); + i_vpr_h(inst, "%s: codec changed from %s to %s\n", + __func__, v4l2_pixelfmt_name(inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat), + v4l2_pixelfmt_name(v4l2_codec)); inst->codec = v4l2_codec_to_driver(v4l2_codec, __func__); rc = msm_vidc_update_debug_str(inst); @@ -2093,10 +2094,6 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) if (f->type == INPUT_MPLANE) { if (inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat != f->fmt.pix_mp.pixelformat) { - i_vpr_h(inst, - "%s: codec changed from %#x to %#x\n", __func__, - inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat, - f->fmt.pix_mp.pixelformat); rc = msm_vdec_codec_change(inst, f->fmt.pix_mp.pixelformat); if (rc) goto err_invalid_fmt; @@ -2132,9 +2129,9 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) inst->crop.width = f->fmt.pix_mp.width; inst->crop.height = f->fmt.pix_mp.height; i_vpr_h(inst, - "%s: input: codec %#x width %d height %d size %d min_count %d extra_count %d\n", - __func__, f->fmt.pix_mp.pixelformat, f->fmt.pix_mp.width, - f->fmt.pix_mp.height, + "%s: type: INPUT, codec %s width %d height %d size %u min_count %d extra_count %d\n", + __func__, v4l2_pixelfmt_name(f->fmt.pix_mp.pixelformat), + f->fmt.pix_mp.width, f->fmt.pix_mp.height, fmt->fmt.pix_mp.plane_fmt[0].sizeimage, inst->buffers.input.min_count, inst->buffers.input.extra_count); @@ -2160,7 +2157,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) inst->buffers.input_meta.size = 0; } i_vpr_h(inst, - "%s: input meta: size %d min_count %d extra_count %d\n", + "%s: type: INPUT_META, size %u min_count %d extra_count %d\n", __func__, fmt->fmt.meta.buffersize, inst->buffers.input_meta.min_count, inst->buffers.input_meta.extra_count); @@ -2202,9 +2199,9 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) pix_fmt = v4l2_colorformat_to_driver(f->fmt.pix_mp.pixelformat, __func__); msm_vidc_update_cap_value(inst, PIX_FMTS, pix_fmt, __func__); i_vpr_h(inst, - "%s: output: format %#x width %d height %d size %d min_count %d extra_count %d\n", - __func__, fmt->fmt.pix_mp.pixelformat, fmt->fmt.pix_mp.width, - fmt->fmt.pix_mp.height, + "%s: type: OUTPUT, format %s width %d height %d size %u min_count %d extra_count %d\n", + __func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat), + fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height, fmt->fmt.pix_mp.plane_fmt[0].sizeimage, inst->buffers.output.min_count, inst->buffers.output.extra_count); @@ -2230,7 +2227,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) inst->buffers.output_meta.size = 0; } i_vpr_h(inst, - "%s: output meta: size %d min_count %d extra_count %d\n", + "%s: type: OUTPUT_META, size %u min_count %d extra_count %d\n", __func__, fmt->fmt.meta.buffersize, inst->buffers.output_meta.min_count, inst->buffers.output_meta.extra_count); @@ -2295,8 +2292,8 @@ int msm_vdec_g_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s) s->r.height = inst->crop.height; break; } - i_vpr_h(inst, "%s: type %d target %d, r [%d, %d, %d, %d]\n", - __func__, s->type, s->target, s->r.top, s->r.left, + i_vpr_h(inst, "%s: target %d, r [%d, %d, %d, %d]\n", + __func__, s->target, s->r.top, s->r.left, s->r.width, s->r.height); return 0; } @@ -2508,9 +2505,8 @@ int msm_vdec_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } memset(f->reserved, 0, sizeof(f->reserved)); - i_vpr_h(inst, "%s: index %d, %s : %#x, flags %#x, driver colorfmt %#x\n", - __func__, f->index, f->description, f->pixelformat, f->flags, - v4l2_colorformat_to_driver(f->pixelformat, __func__)); + i_vpr_h(inst, "%s: index %d, %s: %s, flags %#x\n", + __func__, f->index, f->description, v4l2_pixelfmt_name(f->pixelformat), f->flags); return rc; } @@ -2606,6 +2602,8 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst) rc = msm_vdec_codec_change(inst, inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat); + if (rc) + return rc; return rc; } @@ -2621,6 +2619,8 @@ int msm_vdec_inst_deinit(struct msm_vidc_inst *inst) /* cancel pending batch work */ cancel_batch_work(inst); rc = msm_vidc_ctrl_deinit(inst); + if (rc) + return rc; return rc; } diff --git a/driver/vidc/src/msm_venc.c b/driver/vidc/src/msm_venc.c index c4d2eae674..ab1fe5a309 100644 --- a/driver/vidc/src/msm_venc.c +++ b/driver/vidc/src/msm_venc.c @@ -67,8 +67,9 @@ static int msm_venc_codec_change(struct msm_vidc_inst *inst, u32 v4l2_codec) if (inst->codec && inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat == v4l2_codec) return 0; - i_vpr_h(inst, "%s: codec changed from %#x to %#x\n", - __func__, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat, v4l2_codec); + i_vpr_h(inst, "%s: codec changed from %s to %s\n", + __func__, v4l2_pixelfmt_name(inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat), + v4l2_pixelfmt_name(v4l2_codec)); inst->codec = v4l2_codec_to_driver(v4l2_codec, __func__); rc = msm_vidc_update_debug_str(inst); @@ -108,8 +109,8 @@ static int msm_venc_set_colorformat(struct msm_vidc_inst *inst, pixelformat = inst->fmts[INPUT_PORT].fmt.pix_mp.pixelformat; colorformat = v4l2_colorformat_to_driver(pixelformat, __func__); if (!(colorformat & inst->capabilities->cap[PIX_FMTS].step_or_mask)) { - i_vpr_e(inst, "%s: invalid pixelformat %#x\n", - __func__, pixelformat); + i_vpr_e(inst, "%s: invalid pixelformat %s\n", + __func__, v4l2_pixelfmt_name(pixelformat)); return -EINVAL; } @@ -1045,9 +1046,6 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f) fmt = &inst->fmts[OUTPUT_PORT]; if (fmt->fmt.pix_mp.pixelformat != f->fmt.pix_mp.pixelformat) { - i_vpr_h(inst, - "%s: codec changed from %#x to %#x\n", __func__, - fmt->fmt.pix_mp.pixelformat, f->fmt.pix_mp.pixelformat); rc = msm_venc_codec_change(inst, f->fmt.pix_mp.pixelformat); if (rc) return rc; @@ -1100,6 +1098,14 @@ int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format *f) /* reset metadata buffer size with updated resolution*/ msm_vidc_update_meta_port_settings(inst); + i_vpr_h(inst, + "%s: type: OUTPUT, codec %s width %d height %d size %u min_count %d extra_count %d\n", + __func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat), + fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height, + fmt->fmt.pix_mp.plane_fmt[0].sizeimage, + inst->buffers.output.min_count, + inst->buffers.output.extra_count); + return rc; } @@ -1137,6 +1143,12 @@ static int msm_venc_s_fmt_output_meta(struct msm_vidc_inst *inst, struct v4l2_fo } memcpy(f, fmt, sizeof(struct v4l2_format)); + + i_vpr_h(inst, "%s: type: OUTPUT_META, size %u min_count %d extra_count %d\n", + __func__, fmt->fmt.meta.buffersize, + inst->buffers.output_meta.min_count, + inst->buffers.output_meta.extra_count); + return rc; } @@ -1224,19 +1236,20 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format * rc = msm_venc_s_fmt_output(inst, output_fmt); if (rc) return rc; - - i_vpr_h(inst, - "%s: type %d: format %#x width %d height %d size %d\n", - __func__, output_fmt->type, output_fmt->fmt.pix_mp.pixelformat, - output_fmt->fmt.pix_mp.width, - output_fmt->fmt.pix_mp.height, - output_fmt->fmt.pix_mp.plane_fmt[0].sizeimage); } memcpy(f, fmt, sizeof(struct v4l2_format)); /* reset metadata buffer size with updated resolution*/ msm_vidc_update_meta_port_settings(inst); + i_vpr_h(inst, + "%s: type: INPUT, format %s width %d height %d size %u min_count %d extra_count %d\n", + __func__, v4l2_pixelfmt_name(fmt->fmt.pix_mp.pixelformat), + fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height, + fmt->fmt.pix_mp.plane_fmt[0].sizeimage, + inst->buffers.input.min_count, + inst->buffers.input.extra_count); + return rc; } @@ -1274,14 +1287,18 @@ static int msm_venc_s_fmt_input_meta(struct msm_vidc_inst *inst, struct v4l2_for } memcpy(f, fmt, sizeof(struct v4l2_format)); + + i_vpr_h(inst, "%s: type: INPUT_META, size %u min_count %d extra_count %d\n", + __func__, fmt->fmt.meta.buffersize, + inst->buffers.input_meta.min_count, + inst->buffers.input_meta.extra_count); + return rc; } -// TODO: use PIX_FMTS caps to check supported color format int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) { int rc = 0; - struct v4l2_format *fmt = NULL; if (!inst) { d_vpr_e("%s: invalid params\n", __func__); @@ -1289,41 +1306,30 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f) } if (f->type == INPUT_MPLANE) { - fmt = &inst->fmts[INPUT_PORT]; rc = msm_venc_s_fmt_input(inst, f); if (rc) - return rc; + goto exit; } else if (f->type == INPUT_META_PLANE) { - fmt = &inst->fmts[INPUT_META_PORT]; rc = msm_venc_s_fmt_input_meta(inst, f); if (rc) - return rc; + goto exit; } else if (f->type == OUTPUT_MPLANE) { - fmt = &inst->fmts[OUTPUT_PORT]; rc = msm_venc_s_fmt_output(inst, f); if (rc) - return rc; + goto exit; } else if (f->type == OUTPUT_META_PLANE) { - fmt = &inst->fmts[OUTPUT_META_PORT]; rc = msm_venc_s_fmt_output_meta(inst, f); if (rc) - return rc; + goto exit; } else { i_vpr_e(inst, "%s: invalid type %d\n", __func__, f->type); - return rc; + rc = -EINVAL; + goto exit; } - if (f->type == INPUT_MPLANE || f->type == OUTPUT_MPLANE) { - i_vpr_h(inst, - "%s: type %d: format %#x width %d height %d size %d\n", - __func__, f->type, fmt->fmt.pix_mp.pixelformat, - fmt->fmt.pix_mp.width, - fmt->fmt.pix_mp.height, - fmt->fmt.pix_mp.plane_fmt[0].sizeimage); - } else { - i_vpr_h(inst, "%s: type %d: size %d\n", - __func__, f->type, fmt->fmt.meta.buffersize); - } +exit: + if (rc) + i_vpr_e(inst, "%s: failed\n", __func__); return rc; } @@ -1397,12 +1403,6 @@ int msm_venc_s_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s) rc = msm_venc_s_fmt_output(inst, output_fmt); if (rc) return rc; - i_vpr_h(inst, - "%s: type %d: format %#x width %d height %d size %d\n", - __func__, output_fmt->type, output_fmt->fmt.pix_mp.pixelformat, - output_fmt->fmt.pix_mp.width, - output_fmt->fmt.pix_mp.height, - output_fmt->fmt.pix_mp.plane_fmt[0].sizeimage); break; case V4L2_SEL_TGT_COMPOSE_BOUNDS: case V4L2_SEL_TGT_COMPOSE_PADDED: @@ -1451,12 +1451,6 @@ int msm_venc_s_selection(struct msm_vidc_inst* inst, struct v4l2_selection* s) rc = msm_venc_s_fmt_output(inst, output_fmt); if (rc) return rc; - i_vpr_h(inst, - "%s: type %d: format %#x width %d height %d size %d\n", - __func__, output_fmt->type, output_fmt->fmt.pix_mp.pixelformat, - output_fmt->fmt.pix_mp.width, - output_fmt->fmt.pix_mp.height, - output_fmt->fmt.pix_mp.plane_fmt[0].sizeimage); break; default: i_vpr_e(inst, "%s: invalid target %d\n", @@ -1574,8 +1568,8 @@ int msm_venc_s_param(struct msm_vidc_inst *inst, set_default: q16_rate = (u32)input_rate << 16; - i_vpr_h(inst, "%s: type %u value %#x\n", - __func__, s_parm->type, q16_rate); + i_vpr_h(inst, "%s: type %s, value %#x\n", + __func__, v4l2_type_name(s_parm->type), q16_rate); msm_vidc_update_cap_value(inst, is_frame_rate ? FRAME_RATE : OPERATING_RATE, @@ -1652,8 +1646,8 @@ int msm_venc_g_param(struct msm_vidc_inst *inst, capability->cap[FRAME_RATE].value >> 16; } - i_vpr_h(inst, "%s: type %u, num %u denom %u\n", - __func__, s_parm->type, timeperframe->numerator, + i_vpr_h(inst, "%s: type %s, num %u denom %u\n", + __func__, v4l2_type_name(s_parm->type), timeperframe->numerator, timeperframe->denominator); return 0; } @@ -1721,9 +1715,9 @@ int msm_venc_enum_fmt(struct msm_vidc_inst *inst, struct v4l2_fmtdesc *f) } memset(f->reserved, 0, sizeof(f->reserved)); - i_vpr_h(inst, "%s: index %d, %s : %#x, flags %#x, driver colorfmt %#x\n", - __func__, f->index, f->description, f->pixelformat, f->flags, - v4l2_colorformat_to_driver(f->pixelformat, __func__)); + i_vpr_h(inst, "%s: index %d, %s: %s, flags %#x\n", + __func__, f->index, f->description, + v4l2_pixelfmt_name(f->pixelformat), f->flags); return rc; } @@ -1825,6 +1819,8 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst) rc = msm_venc_codec_change(inst, inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat); + if (rc) + return rc; return rc; } @@ -1838,6 +1834,8 @@ int msm_venc_inst_deinit(struct msm_vidc_inst *inst) return -EINVAL; } rc = msm_vidc_ctrl_deinit(inst); + if (rc) + return rc; return rc; } diff --git a/driver/vidc/src/msm_vidc.c b/driver/vidc/src/msm_vidc.c index 336fe27e14..4b3a35a61d 100644 --- a/driver/vidc/src/msm_vidc.c +++ b/driver/vidc/src/msm_vidc.c @@ -248,21 +248,23 @@ int msm_vidc_g_fmt(void *instance, struct v4l2_format *f) return -EINVAL; } - if (inst->domain == MSM_VIDC_DECODER) + if (is_decode_session(inst)) rc = msm_vdec_g_fmt(inst, f); - if (inst->domain == MSM_VIDC_ENCODER) + if (is_encode_session(inst)) rc = msm_venc_g_fmt(inst, f); if (rc) return rc; if (f->type == INPUT_MPLANE || f->type == OUTPUT_MPLANE) - i_vpr_h(inst, - "%s: type %d format %#x width %d height %d size %d\n", - __func__, f->type, f->fmt.pix_mp.pixelformat, f->fmt.pix_mp.width, - f->fmt.pix_mp.height, f->fmt.pix_mp.plane_fmt[0].sizeimage); + i_vpr_h(inst, "%s: type %s format %s width %d height %d size %d\n", + __func__, v4l2_type_name(f->type), + v4l2_pixelfmt_name(f->fmt.pix_mp.pixelformat), + f->fmt.pix_mp.width, f->fmt.pix_mp.height, + f->fmt.pix_mp.plane_fmt[0].sizeimage); else if (f->type == INPUT_META_PLANE || f->type == OUTPUT_META_PLANE) - i_vpr_h(inst, "%s: meta type %d size %d\n", - __func__, f->type, f->fmt.meta.buffersize); + i_vpr_h(inst, "%s: type %s size %d\n", + __func__, v4l2_type_name(f->type), f->fmt.meta.buffersize); + return 0; } EXPORT_SYMBOL(msm_vidc_g_fmt); diff --git a/driver/vidc/src/msm_vidc_control.c b/driver/vidc/src/msm_vidc_control.c index 59e8b83568..3bb8c0bf11 100644 --- a/driver/vidc/src/msm_vidc_control.c +++ b/driver/vidc/src/msm_vidc_control.c @@ -542,7 +542,7 @@ int msm_vidc_ctrl_init(struct msm_vidc_inst *inst) rc = -EINVAL; goto error; } - i_vpr_h(inst, + i_vpr_l(inst, "%s: cap[%d] %24s, value %d min %d max %d step_or_mask %#x flags %#x v4l2_id %#x hfi_id %#x\n", __func__, idx, cap_name(idx), capability->cap[idx].value, @@ -728,13 +728,6 @@ int msm_v4l2_op_s_ctrl(struct v4l2_ctrl *ctrl) rc = msm_venc_s_fmt_output(inst, output_fmt); if (rc) return rc; - - i_vpr_h(inst, - "%s: type %d: format %#x width %d height %d size %d\n", - __func__, output_fmt->type, output_fmt->fmt.pix_mp.pixelformat, - output_fmt->fmt.pix_mp.width, - output_fmt->fmt.pix_mp.height, - output_fmt->fmt.pix_mp.plane_fmt[0].sizeimage); } } diff --git a/driver/vidc/src/msm_vidc_driver.c b/driver/vidc/src/msm_vidc_driver.c index c2c074f959..c0b08737b1 100644 --- a/driver/vidc/src/msm_vidc_driver.c +++ b/driver/vidc/src/msm_vidc_driver.c @@ -302,6 +302,41 @@ exit: return name; } +const char *v4l2_type_name(u32 port) +{ + switch (port) { + case INPUT_MPLANE: return "INPUT"; + case OUTPUT_MPLANE: return "OUTPUT"; + case INPUT_META_PLANE: return "INPUT_META"; + case OUTPUT_META_PLANE: return "OUTPUT_META"; + } + + return "UNKNOWN"; +} + +const char *v4l2_pixelfmt_name(u32 pixfmt) +{ + switch (pixfmt) { + /* raw port: color format */ + case V4L2_PIX_FMT_NV12: return "NV12"; + case V4L2_PIX_FMT_NV21: return "NV21"; + case V4L2_PIX_FMT_VIDC_NV12C: return "NV12C"; + case V4L2_PIX_FMT_VIDC_P010: return "P010"; + case V4L2_PIX_FMT_VIDC_TP10C: return "TP10C"; + case V4L2_PIX_FMT_RGBA32: return "RGBA"; + case V4L2_PIX_FMT_VIDC_ARGB32C: return "RGBAC"; + /* bitstream port: codec type */ + case V4L2_PIX_FMT_H264: return "AVC"; + case V4L2_PIX_FMT_HEVC: return "HEVC"; + case V4L2_PIX_FMT_HEIC: return "HEIC"; + case V4L2_PIX_FMT_VP9: return "VP9"; + /* meta port */ + case V4L2_META_FMT_VIDC: return "META"; + } + + return "UNKNOWN"; +} + void print_vidc_buffer(u32 tag, const char *tag_str, const char *str, struct msm_vidc_inst *inst, struct msm_vidc_buffer *vbuf) { @@ -2719,7 +2754,7 @@ void msm_vidc_allow_dcvs(struct msm_vidc_inst *inst) } exit: - i_vpr_h(inst, "%s: dcvs: %s\n", __func__, allow ? "enabled" : "disabled"); + i_vpr_hp(inst, "%s: dcvs: %s\n", __func__, allow ? "enabled" : "disabled"); inst->power.dcvs_flags = 0; inst->power.dcvs_mode = allow; @@ -2804,7 +2839,7 @@ bool msm_vidc_allow_decode_batch(struct msm_vidc_inst *inst) } exit: - i_vpr_h(inst, "%s: batching: %s\n", __func__, allow ? "enabled" : "disabled"); + i_vpr_hp(inst, "%s: batching: %s\n", __func__, allow ? "enabled" : "disabled"); return allow; } diff --git a/driver/vidc/src/msm_vidc_power.c b/driver/vidc/src/msm_vidc_power.c index 3f7fe40473..9978c77e58 100644 --- a/driver/vidc/src/msm_vidc_power.c +++ b/driver/vidc/src/msm_vidc_power.c @@ -515,7 +515,7 @@ int msm_vidc_scale_power(struct msm_vidc_inst *inst, bool scale_buses) i_vpr_e(inst, "failed to scale bus\n"); } - i_vpr_h(inst, + i_vpr_hp(inst, "power: inst: clk %lld ddr %d llcc %d dcvs flags %#x, core: clk %lld ddr %lld llcc %lld\n", inst->power.curr_freq, inst->power.ddr_bw, inst->power.sys_cache_bw, inst->power.dcvs_flags, @@ -569,7 +569,7 @@ void msm_vidc_power_data_reset(struct msm_vidc_inst *inst) d_vpr_e("%s: invalid params\n", __func__); return; } - i_vpr_h(inst, "%s\n", __func__); + i_vpr_hp(inst, "%s\n", __func__); msm_vidc_dcvs_data_reset(inst); diff --git a/driver/vidc/src/msm_vidc_v4l2.c b/driver/vidc/src/msm_vidc_v4l2.c index e752f16181..cf37cd4bc9 100644 --- a/driver/vidc/src/msm_vidc_v4l2.c +++ b/driver/vidc/src/msm_vidc_v4l2.c @@ -74,9 +74,10 @@ int msm_v4l2_querycap(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_querycap((void *)inst, cap); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -97,9 +98,10 @@ int msm_v4l2_enum_fmt(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_enum_fmt((void *)inst, f); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -125,7 +127,7 @@ int msm_v4l2_s_fmt(struct file *filp, void *fh, } rc = msm_vidc_s_fmt((void *)inst, f); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -149,9 +151,10 @@ int msm_v4l2_g_fmt(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_g_fmt((void *)inst, f); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -177,7 +180,7 @@ int msm_v4l2_s_selection(struct file *filp, void *fh, } rc = msm_vidc_s_selection((void *)inst, s); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -201,9 +204,10 @@ int msm_v4l2_g_selection(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_g_selection((void *)inst, s); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -229,7 +233,7 @@ int msm_v4l2_s_parm(struct file *filp, void *fh, } rc = msm_vidc_s_param((void *)inst, a); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -253,9 +257,10 @@ int msm_v4l2_g_parm(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_g_param((void *)inst, a); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -281,7 +286,7 @@ int msm_v4l2_s_ctrl(struct file *filp, void *fh, } rc = msm_vidc_s_ctrl((void *)inst, a); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -305,9 +310,10 @@ int msm_v4l2_g_ctrl(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_g_ctrl((void *)inst, a); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -328,9 +334,10 @@ int msm_v4l2_reqbufs(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_reqbufs((void *)inst, b); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -357,7 +364,7 @@ int msm_v4l2_qbuf(struct file *filp, void *fh, } rc = msm_vidc_qbuf(inst, vdev->v4l2_dev->mdev, b); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -380,8 +387,11 @@ int msm_v4l2_dqbuf(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_dqbuf(inst, b); - inst_unlock(inst, __func__); + if (rc) + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -407,7 +417,7 @@ int msm_v4l2_streamon(struct file *filp, void *fh, } rc = msm_vidc_streamon((void *)inst, i); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -431,9 +441,10 @@ int msm_v4l2_streamoff(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_streamoff((void *)inst, i); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -460,7 +471,7 @@ int msm_v4l2_subscribe_event(struct v4l2_fh *fh, } rc = msm_vidc_subscribe_event((void *)inst, sub); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -485,9 +496,10 @@ int msm_v4l2_unsubscribe_event(struct v4l2_fh *fh, inst_lock(inst, __func__); rc = msm_vidc_unsubscribe_event((void *)inst, sub); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -513,7 +525,7 @@ int msm_v4l2_decoder_cmd(struct file *filp, void *fh, } rc = msm_vidc_cmd((void *)inst, (union msm_v4l2_cmd *)dec); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -542,7 +554,7 @@ int msm_v4l2_encoder_cmd(struct file *filp, void *fh, } rc = msm_vidc_cmd((void *)inst, (union msm_v4l2_cmd *)enc); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); + goto unlock; unlock: inst_unlock(inst, __func__); @@ -566,9 +578,10 @@ int msm_v4l2_enum_framesizes(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_enum_framesizes((void *)inst, fsize); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -589,9 +602,10 @@ int msm_v4l2_enum_frameintervals(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_enum_frameintervals((void *)inst, fival); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -612,9 +626,10 @@ int msm_v4l2_queryctrl(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_query_ctrl((void *)inst, ctrl); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; @@ -635,9 +650,10 @@ int msm_v4l2_querymenu(struct file *filp, void *fh, inst_lock(inst, __func__); rc = msm_vidc_query_menu((void *)inst, qmenu); if (rc) - i_vpr_e(inst, "%s: failed with %d\n", __func__, rc); - inst_unlock(inst, __func__); + goto unlock; +unlock: + inst_unlock(inst, __func__); put_inst(inst); return rc; diff --git a/driver/vidc/src/msm_vidc_vb2.c b/driver/vidc/src/msm_vidc_vb2.c index 3a509bf295..f7972639ef 100644 --- a/driver/vidc/src/msm_vidc_vb2.c +++ b/driver/vidc/src/msm_vidc_vb2.c @@ -142,8 +142,8 @@ int msm_vidc_queue_setup(struct vb2_queue *q, } i_vpr_h(inst, - "queue_setup: type %d num_buffers %d sizes[0] %d\n", - q->type, *num_buffers, sizes[0]); + "queue_setup: type %s num_buffers %d sizes[0] %d\n", + v4l2_type_name(q->type), *num_buffers, sizes[0]); return rc; } @@ -163,8 +163,8 @@ int msm_vidc_start_streaming(struct vb2_queue *q, unsigned int count) return -EINVAL; } if (q->type == INPUT_META_PLANE || q->type == OUTPUT_META_PLANE) { - i_vpr_h(inst, "%s: nothing to start on meta port %d\n", - __func__, q->type); + i_vpr_h(inst, "%s: nothing to start on %s\n", + __func__, v4l2_type_name(q->type)); return 0; } if (!is_decode_session(inst) && !is_encode_session(inst)) { @@ -172,7 +172,7 @@ int msm_vidc_start_streaming(struct vb2_queue *q, unsigned int count) __func__, inst->domain); return -EINVAL; } - i_vpr_h(inst, "Streamon: %d\n", q->type); + i_vpr_h(inst, "Streamon: %s\n", v4l2_type_name(q->type)); if (!inst->once_per_session_set) { inst->once_per_session_set = true; @@ -236,12 +236,12 @@ int msm_vidc_start_streaming(struct vb2_queue *q, unsigned int count) if (rc) goto error; - i_vpr_h(inst, "Streamon: %d successful\n", q->type); + i_vpr_h(inst, "Streamon: %s successful\n", v4l2_type_name(q->type)); return rc; error: - i_vpr_h(inst, "Streamon: %d failed\n", q->type); + i_vpr_h(inst, "Streamon: %s failed\n", v4l2_type_name(q->type)); return -EINVAL; } @@ -260,8 +260,8 @@ void msm_vidc_stop_streaming(struct vb2_queue *q) return; } if (q->type == INPUT_META_PLANE || q->type == OUTPUT_META_PLANE) { - i_vpr_h(inst, "%s: nothing to stop on meta port %d\n", - __func__, q->type); + i_vpr_h(inst, "%s: nothing to stop on %s\n", + __func__, v4l2_type_name(q->type)); return; } if (!is_decode_session(inst) && !is_encode_session(inst)) { @@ -269,7 +269,7 @@ void msm_vidc_stop_streaming(struct vb2_queue *q) __func__, inst->domain); return; } - i_vpr_h(inst, "Streamoff: %d\n", q->type); + i_vpr_h(inst, "Streamoff: %s\n", v4l2_type_name(q->type)); if (q->type == INPUT_MPLANE) { if (is_decode_session(inst)) @@ -292,11 +292,11 @@ void msm_vidc_stop_streaming(struct vb2_queue *q) if (q->type == INPUT_MPLANE) msm_vidc_flush_ts(inst); - i_vpr_h(inst, "Streamoff: %d successful\n", q->type); + i_vpr_h(inst, "Streamoff: %s successful\n", v4l2_type_name(q->type)); return; error: - i_vpr_e(inst, "Streamoff: %d failed\n", q->type); + i_vpr_e(inst, "Streamoff: %s failed\n", v4l2_type_name(q->type)); return; } diff --git a/driver/vidc/src/venus_hfi.c b/driver/vidc/src/venus_hfi.c index e45643cc59..1aaaa79816 100644 --- a/driver/vidc/src/venus_hfi.c +++ b/driver/vidc/src/venus_hfi.c @@ -250,8 +250,7 @@ int __write_register(struct msm_vidc_core *core, } base_addr = core->register_base_addr; - d_vpr_l("Base addr: %pK, writing to: %#x, Value: %#x...\n", - base_addr, hwiosymaddr, value); + d_vpr_l("regwrite(%pK + %#x) = %#x\n", base_addr, hwiosymaddr, value); base_addr += hwiosymaddr; writel_relaxed(value, base_addr); @@ -335,8 +334,7 @@ int __read_register(struct msm_vidc_core *core, u32 reg) * register. */ rmb(); - d_vpr_l("Base addr: %pK, read from: %#x, value: %#x...\n", - base_addr, reg, rc); + d_vpr_l("regread(%pK + %#x) = %#x\n", base_addr, reg, rc); return rc; }