diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2022-11-21 23:52:25 +0100 |
---|---|---|
committer | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2023-02-22 15:43:46 +0100 |
commit | 25d8a07641b15c3ed33fdfa3aa69e1624ffdafc1 (patch) | |
tree | f688b096645ad353fe8fa3fcb10fbd47d805d6f7 | |
parent | 4a5e1ee50e5bf062da091c44861aea390fd6dc28 (diff) | |
download | linux-25d8a07641b15c3ed33fdfa3aa69e1624ffdafc1.tar.gz |
rkvdec: rename decoded and coded to src and dst
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
-rw-r--r-- | drivers/staging/media/rkvdec/rkvdec-h264.c | 8 | ||||
-rw-r--r-- | drivers/staging/media/rkvdec/rkvdec-vp9.c | 36 | ||||
-rw-r--r-- | drivers/staging/media/rkvdec/rkvpu.c | 162 | ||||
-rw-r--r-- | drivers/staging/media/rkvdec/rkvpu.h | 34 |
4 files changed, 120 insertions, 120 deletions
diff --git a/drivers/staging/media/rkvdec/rkvdec-h264.c b/drivers/staging/media/rkvdec/rkvdec-h264.c index 2b0f596519545..86d4b92757da7 100644 --- a/drivers/staging/media/rkvdec/rkvdec-h264.c +++ b/drivers/staging/media/rkvdec/rkvdec-h264.c @@ -907,7 +907,7 @@ static void config_registers(struct rkvpu_ctx *ctx, reg = RKVDEC_MODE(RKVDEC_MODE_H264); writel_relaxed(reg, rkvpu->regs + RKVDEC_REG_SYSCTRL); - f = &ctx->decoded_fmt; + f = &ctx->dst_fmt; dst_fmt = &f->fmt.pix_mp; hor_virstride = (sps->bit_depth_luma_minus8 + 8) * dst_fmt->width / 8; ver_virstride = round_up(dst_fmt->height, 16); @@ -1057,8 +1057,8 @@ static int rkvdec_h264_validate_sps(struct rkvpu_ctx *ctx, if (!(sps->flags & V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY)) height *= 2; - if (width > ctx->coded_fmt.fmt.pix_mp.width || - height > ctx->coded_fmt.fmt.pix_mp.height) + if (width > ctx->src_fmt.fmt.pix_mp.width || + height > ctx->src_fmt.fmt.pix_mp.height) return -EINVAL; return 0; @@ -1183,7 +1183,7 @@ static int rkvdec_h264_try_ctrl(struct rkvpu_ctx *ctx, struct v4l2_ctrl *ctrl) return 0; } -const struct rkvpu_coded_fmt_ops rkvdec_h264_fmt_ops = { +const struct rkvpu_ops rkvdec_h264_fmt_ops = { .adjust_fmt = rkvdec_h264_adjust_fmt, .start = rkvdec_h264_start, .stop = rkvdec_h264_stop, diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c index 8af888085e510..ed2dbef779eca 100644 --- a/drivers/staging/media/rkvdec/rkvdec-vp9.c +++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c @@ -380,8 +380,8 @@ static struct rkvdec_vp9_ref_reg ref_regs[] = { } }; -static struct rkvpu_decoded_buffer * -get_ref_buf(struct rkvdec_ctx *ctx, struct vb2_v4l2_buffer *dst, u64 timestamp) +static struct rkvpu_src_buffer * +get_ref_buf(struct rkvpu_ctx *ctx, struct vb2_v4l2_buffer *dst, u64 timestamp) { struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx; struct vb2_queue *cap_q = &m2m_ctx->cap_q_ctx.q; @@ -395,10 +395,10 @@ get_ref_buf(struct rkvdec_ctx *ctx, struct vb2_v4l2_buffer *dst, u64 timestamp) if (!buf) buf = &dst->vb2_buf; - return vb2_to_rkvpu_decoded_buf(buf); + return vb2_to_rkvpu_src_buf(buf); } -static dma_addr_t get_mv_base_addr(struct rkvdec_decoded_buffer *buf) +static dma_addr_t get_mv_base_addr(struct rkvpu_src_buffer *buf) { unsigned int aligned_pitch, aligned_height, yuv_len; @@ -412,7 +412,7 @@ static dma_addr_t get_mv_base_addr(struct rkvdec_decoded_buffer *buf) static void config_ref_registers(struct rkvpu_ctx *ctx, const struct rkvdec_vp9_run *run, - struct rkvpu_decoded_buffer *ref_buf, + struct rkvpu_src_buffer *ref_buf, struct rkvdec_vp9_ref_reg *ref_reg) { unsigned int aligned_pitch, aligned_height, y_len, yuv_len; @@ -488,7 +488,7 @@ static void config_seg_registers(struct rkvpu_ctx *ctx, unsigned int segid) writel_relaxed(val, rkvpu->regs + RKVDEC_VP9_SEGID_GRP(segid)); } -static void update_dec_buf_info(struct rkvpu_decoded_buffer *buf, +static void update_dec_buf_info(struct rkvpu_src_buffer *buf, const struct v4l2_ctrl_vp9_frame *dec_params) { buf->vp9.width = dec_params->frame_width_minus_1 + 1; @@ -497,7 +497,7 @@ static void update_dec_buf_info(struct rkvpu_decoded_buffer *buf, } static void update_ctx_cur_info(struct rkvdec_vp9_ctx *vp9_ctx, - struct rkvpu_decoded_buffer *buf, + struct rkvpu_src_buffer *buf, const struct v4l2_ctrl_vp9_frame *dec_params) { vp9_ctx->cur.valid = true; @@ -519,8 +519,8 @@ static void config_registers(struct rkvpu_ctx *ctx, { unsigned int y_len, uv_len, yuv_len, bit_depth, aligned_height, aligned_pitch, stream_len; const struct v4l2_ctrl_vp9_frame *dec_params; - struct rkvpu_decoded_buffer *ref_bufs[3]; - struct rkvpu_decoded_buffer *dst, *last, *mv_ref; + struct rkvpu_src_buffer *ref_bufs[3]; + struct rkvpu_src_buffer *dst, *last, *mv_ref; struct rkvdec_vp9_ctx *vp9_ctx = ctx->priv; u32 val, last_frame_info = 0; const struct v4l2_vp9_segmentation *seg; @@ -530,7 +530,7 @@ static void config_registers(struct rkvpu_ctx *ctx, unsigned int i; dec_params = run->decode_params; - dst = vb2_to_rkvpu_decoded_buf(&run->base.bufs.dst->vb2_buf); + dst = vb2_to_rkvpu_src_buf(&run->base.bufs.dst->vb2_buf); ref_bufs[0] = get_ref_buf(ctx, &dst->base.vb, dec_params->last_frame_ts); ref_bufs[1] = get_ref_buf(ctx, &dst->base.vb, dec_params->golden_frame_ts); ref_bufs[2] = get_ref_buf(ctx, &dst->base.vb, dec_params->alt_frame_ts); @@ -552,9 +552,9 @@ static void config_registers(struct rkvpu_ctx *ctx, rkvpu->regs + RKVDEC_REG_SYSCTRL); bit_depth = dec_params->bit_depth; - aligned_height = round_up(ctx->decoded_fmt.fmt.pix_mp.height, 64); + aligned_height = round_up(ctx->dst_fmt.fmt.pix_mp.height, 64); - aligned_pitch = round_up(ctx->decoded_fmt.fmt.pix_mp.width * + aligned_pitch = round_up(ctx->dst_fmt.fmt.pix_mp.width * bit_depth, 512) / 8; y_len = aligned_height * aligned_pitch; @@ -689,8 +689,8 @@ static void config_registers(struct rkvpu_ctx *ctx, writel_relaxed(get_mv_base_addr(mv_ref), rkvpu->regs + RKVDEC_VP9_REF_COLMV_BASE); - writel_relaxed(ctx->decoded_fmt.fmt.pix_mp.width | - (ctx->decoded_fmt.fmt.pix_mp.height << 16), + writel_relaxed(ctx->dst_fmt.fmt.pix_mp.width | + (ctx->dst_fmt.fmt.pix_mp.height << 16), rkvpu->regs + RKVDEC_REG_PERFORMANCE_CYCLE); } @@ -710,11 +710,11 @@ static int validate_dec_params(struct rkvpu_ctx *ctx, aligned_height = round_up(dec_params->frame_height_minus_1 + 1, 64); /* - * Userspace should update the capture/decoded format when the + * Userspace should update the capture/src format when the * resolution changes. */ - if (aligned_width != ctx->decoded_fmt.fmt.pix_mp.width || - aligned_height != ctx->decoded_fmt.fmt.pix_mp.height) { + if (aligned_width != ctx->dst_fmt.fmt.pix_mp.width || + aligned_height != ctx->dst_fmt.fmt.pix_mp.height) { dev_err(ctx->dev->dev, "unexpected bitstream resolution %dx%d\n", dec_params->frame_width_minus_1 + 1, @@ -1064,7 +1064,7 @@ static int rkvdec_vp9_adjust_fmt(struct rkvpu_ctx *ctx, return 0; } -const struct rkvpu_coded_fmt_ops rkvdec_vp9_fmt_ops = { +const struct rkvpu_ops rkvdec_vp9_fmt_ops = { .adjust_fmt = rkvdec_vp9_adjust_fmt, .start = rkvdec_vp9_start, .stop = rkvdec_vp9_stop, diff --git a/drivers/staging/media/rkvdec/rkvpu.c b/drivers/staging/media/rkvdec/rkvpu.c index e6ee77f5fb03a..c8441d3413372 100644 --- a/drivers/staging/media/rkvdec/rkvpu.c +++ b/drivers/staging/media/rkvdec/rkvpu.c @@ -30,7 +30,7 @@ static int rkvpu_try_ctrl(struct v4l2_ctrl *ctrl) { struct rkvpu_ctx *ctx = container_of(ctrl->handler, struct rkvpu_ctx, ctrl_hdl); - const struct rkvpu_coded_fmt_desc *desc = ctx->coded_fmt_desc; + const struct rkvpu_fmt_desc *desc = ctx->src_fmt_desc; if (desc->ops->try_ctrl) return desc->ops->try_ctrl(ctx, ctrl); @@ -88,7 +88,7 @@ static const struct rkvpu_ctrls rkvdec_h264_ctrls = { .num_ctrls = ARRAY_SIZE(rkvdec_h264_ctrl_descs), }; -static const u32 rkvpu_h264_vp9_decoded_fmts[] = { +static const u32 rkvpu_h264_vp9_dst_fmts[] = { V4L2_PIX_FMT_NV12, }; @@ -112,7 +112,7 @@ static const struct rkvpu_ctrls rkvdec_vp9_ctrls = { .num_ctrls = ARRAY_SIZE(rkvdec_vp9_ctrl_descs), }; -static const struct rkvpu_coded_fmt_desc rkvdec_coded_fmts[] = { +static const struct rkvpu_fmt_desc rkvpu_src_fmts[] = { { .fourcc = V4L2_PIX_FMT_H264_SLICE, .frmsize = { @@ -125,8 +125,8 @@ static const struct rkvpu_coded_fmt_desc rkvdec_coded_fmts[] = { }, .ctrls = &rkvdec_h264_ctrls, .ops = &rkvdec_h264_fmt_ops, - .num_decoded_fmts = ARRAY_SIZE(rkvpu_h264_vp9_decoded_fmts), - .decoded_fmts = rkvpu_h264_vp9_decoded_fmts, + .num_dst_fmts = ARRAY_SIZE(rkvpu_h264_vp9_dst_fmts), + .dst_fmts = rkvpu_h264_vp9_dst_fmts, .subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF, }, { @@ -141,19 +141,19 @@ static const struct rkvpu_coded_fmt_desc rkvdec_coded_fmts[] = { }, .ctrls = &rkvdec_vp9_ctrls, .ops = &rkvdec_vp9_fmt_ops, - .num_decoded_fmts = ARRAY_SIZE(rkvpu_h264_vp9_decoded_fmts), - .decoded_fmts = rkvpu_h264_vp9_decoded_fmts, + .num_dst_fmts = ARRAY_SIZE(rkvpu_h264_vp9_dst_fmts), + .dst_fmts = rkvpu_h264_vp9_dst_fmts, } }; -static const struct rkvpu_coded_fmt_desc * -rkvpu_find_coded_fmt_desc(u32 fourcc) +static const struct rkvpu_fmt_desc * +rkvpu_find_src_fmt_desc(u32 fourcc) { unsigned int i; - for (i = 0; i < ARRAY_SIZE(rkvpu_coded_fmts); i++) { - if (rkvpu_coded_fmts[i].fourcc == fourcc) - return &rkvpu_coded_fmts[i]; + for (i = 0; i < ARRAY_SIZE(rkvpu_src_fmts); i++) { + if (rkvpu_src_fmts[i].fourcc == fourcc) + return &rkvpu_src_fmts[i]; } return NULL; @@ -171,31 +171,31 @@ static void rkvpu_reset_fmt(struct rkvpu_ctx *ctx, struct v4l2_format *f, f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT; } -static void rkvpu_reset_coded_fmt(struct rkvdec_ctx *ctx) +static void rkvpu_reset_src_fmt(struct rkvpu_ctx *ctx) { - struct v4l2_format *f = &ctx->coded_fmt; + struct v4l2_format *f = &ctx->src_fmt; - ctx->coded_fmt_desc = &rkvpu_coded_fmts[0]; - rkvpu_reset_fmt(ctx, f, ctx->coded_fmt_desc->fourcc); + ctx->src_fmt_desc = &rkvpu_src_fmts[0]; + rkvpu_reset_fmt(ctx, f, ctx->src_fmt_desc->fourcc); f->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; - f->fmt.pix_mp.width = ctx->coded_fmt_desc->frmsize.min_width; - f->fmt.pix_mp.height = ctx->coded_fmt_desc->frmsize.min_height; + f->fmt.pix_mp.width = ctx->src_fmt_desc->frmsize.min_width; + f->fmt.pix_mp.height = ctx->src_fmt_desc->frmsize.min_height; - if (ctx->coded_fmt_desc->ops->adjust_fmt) - ctx->coded_fmt_desc->ops->adjust_fmt(ctx, f); + if (ctx->src_fmt_desc->ops->adjust_fmt) + ctx->src_fmt_desc->ops->adjust_fmt(ctx, f); } -static void rkvpu_reset_decoded_fmt(struct rkvdec_ctx *ctx) +static void rkvpu_reset_dst_fmt(struct rkvpu_ctx *ctx) { - struct v4l2_format *f = &ctx->decoded_fmt; + struct v4l2_format *f = &ctx->dst_fmt; - rkvpu_reset_fmt(ctx, f, ctx->coded_fmt_desc->decoded_fmts[0]); + rkvpu_reset_fmt(ctx, f, ctx->src_fmt_desc->dst_fmts[0]); f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; v4l2_fill_pixfmt_mp(&f->fmt.pix_mp, - ctx->coded_fmt_desc->decoded_fmts[0], - ctx->coded_fmt.fmt.pix_mp.width, - ctx->coded_fmt.fmt.pix_mp.height); + ctx->src_fmt_desc->dst_fmts[0], + ctx->src_fmt.fmt.pix_mp.width, + ctx->src_fmt.fmt.pix_mp.height); f->fmt.pix_mp.plane_fmt[0].sizeimage += 128 * DIV_ROUND_UP(f->fmt.pix_mp.width, 16) * DIV_ROUND_UP(f->fmt.pix_mp.height, 16); @@ -204,12 +204,12 @@ static void rkvpu_reset_decoded_fmt(struct rkvdec_ctx *ctx) static int rkvpu_enum_framesizes(struct file *file, void *priv, struct v4l2_frmsizeenum *fsize) { - const struct rkvpu_coded_fmt_desc *fmt; + const struct rkvpu_fmt_desc *fmt; if (fsize->index != 0) return -EINVAL; - fmt = rkvpu_find_coded_fmt_desc(fsize->pixel_format); + fmt = rkvpu_find_src_fmt_desc(fsize->pixel_format); if (!fmt) return -EINVAL; @@ -237,32 +237,32 @@ static int rkvpu_try_capture_fmt(struct file *file, void *priv, { struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp; struct rkvpu_ctx *ctx = fh_to_rkvpu_ctx(priv); - const struct rkvpu_coded_fmt_desc *coded_desc; + const struct rkvpu_fmt_desc *src_desc; unsigned int i; /* - * The codec context should point to a coded format desc, if the format - * on the coded end has not been set yet, it should point to the + * The codec context should point to a src format desc, if the format + * on the src end has not been set yet, it should point to the * default value. */ - coded_desc = ctx->coded_fmt_desc; - if (WARN_ON(!coded_desc)) + src_desc = ctx->src_fmt_desc; + if (WARN_ON(!src_desc)) return -EINVAL; - for (i = 0; i < coded_desc->num_decoded_fmts; i++) { - if (coded_desc->decoded_fmts[i] == pix_mp->pixelformat) + for (i = 0; i < src_desc->num_dst_fmts; i++) { + if (src_desc->dst_fmts[i] == pix_mp->pixelformat) break; } - if (i == coded_desc->num_decoded_fmts) - pix_mp->pixelformat = coded_desc->decoded_fmts[0]; + if (i == src_desc->num_dst_fmts) + pix_mp->pixelformat = src_desc->dst_fmts[0]; - /* Always apply the frmsize constraint of the coded end. */ - pix_mp->width = max(pix_mp->width, ctx->coded_fmt.fmt.pix_mp.width); - pix_mp->height = max(pix_mp->height, ctx->coded_fmt.fmt.pix_mp.height); + /* Always apply the frmsize constraint of the src end. */ + pix_mp->width = max(pix_mp->width, ctx->src_fmt.fmt.pix_mp.width); + pix_mp->height = max(pix_mp->height, ctx->src_fmt.fmt.pix_mp.height); v4l2_apply_frmsize_constraints(&pix_mp->width, &pix_mp->height, - &coded_desc->frmsize); + &src_desc->frmsize); v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, pix_mp->width, pix_mp->height); @@ -280,12 +280,12 @@ static int rkvpu_try_output_fmt(struct file *file, void *priv, { struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp; struct rkvpu_ctx *ctx = fh_to_rkvpu_ctx(priv); - const struct rkvpu_coded_fmt_desc *desc; + const struct rkvpu_fmt_desc *desc; - desc = rkvpu_find_coded_fmt_desc(pix_mp->pixelformat); + desc = rkvpu_find_src_fmt_desc(pix_mp->pixelformat); if (!desc) { - pix_mp->pixelformat = rkvpu_coded_fmts[0].fourcc; - desc = &rkvpu_coded_fmts[0]; + pix_mp->pixelformat = rkvpu_src_fmts[0].fourcc; + desc = &rkvpu_src_fmts[0]; } v4l2_apply_frmsize_constraints(&pix_mp->width, @@ -293,7 +293,7 @@ static int rkvpu_try_output_fmt(struct file *file, void *priv, &desc->frmsize); pix_mp->field = V4L2_FIELD_NONE; - /* All coded formats are considered single planar for now. */ + /* All src formats are considered single planar for now. */ pix_mp->num_planes = 1; if (desc->ops->adjust_fmt) { @@ -324,7 +324,7 @@ static int rkvpu_s_capture_fmt(struct file *file, void *priv, if (ret) return ret; - ctx->decoded_fmt = *f; + ctx->dst_fmt = *f; return 0; } @@ -333,7 +333,7 @@ static int rkvpu_s_output_fmt(struct file *file, void *priv, { struct rkvpu_ctx *ctx = fh_to_rkvpu_ctx(priv); struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx; - const struct rkvpu_coded_fmt_desc *desc; + const struct rkvpu_fmt_desc *desc; struct v4l2_format *cap_fmt; struct vb2_queue *peer_vq, *vq; int ret; @@ -346,7 +346,7 @@ static int rkvpu_s_output_fmt(struct file *file, void *priv, vq = v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); if (vb2_is_streaming(vq) || (vb2_is_busy(vq) && - f->fmt.pix_mp.pixelformat != ctx->coded_fmt.fmt.pix_mp.pixelformat)) + f->fmt.pix_mp.pixelformat != ctx->src_fmt.fmt.pix_mp.pixelformat)) return -EBUSY; /* @@ -362,25 +362,25 @@ static int rkvpu_s_output_fmt(struct file *file, void *priv, if (ret) return ret; - desc = rkvpu_find_coded_fmt_desc(f->fmt.pix_mp.pixelformat); + desc = rkvpu_find_src_fmt_desc(f->fmt.pix_mp.pixelformat); if (!desc) return -EINVAL; - ctx->coded_fmt_desc = desc; - ctx->coded_fmt = *f; + ctx->src_fmt_desc = desc; + ctx->src_fmt = *f; /* - * Current decoded format might have become invalid with newly + * Current desrc format might have become invalid with newly * selected codec, so reset it to default just to be safe and * keep internal driver state sane. User is mandated to set - * the decoded format again after we return, so we don't need + * the desrc format again after we return, so we don't need * anything smarter. * - * Note that this will propagates any size changes to the decoded format. + * Note that this will propagates any size changes to the desrc format. */ - rkvpu_reset_decoded_fmt(ctx); + rkvpu_reset_dst_fmt(ctx); /* Propagate colorspace information to capture. */ - cap_fmt = &ctx->decoded_fmt; + cap_fmt = &ctx->dst_fmt; cap_fmt->fmt.pix_mp.colorspace = f->fmt.pix_mp.colorspace; cap_fmt->fmt.pix_mp.xfer_func = f->fmt.pix_mp.xfer_func; cap_fmt->fmt.pix_mp.ycbcr_enc = f->fmt.pix_mp.ycbcr_enc; @@ -397,7 +397,7 @@ static int rkvpu_g_output_fmt(struct file *file, void *priv, { struct rkvpu_ctx *ctx = fh_to_rkvpu_ctx(priv); - *f = ctx->coded_fmt; + *f = ctx->src_fmt; return 0; } @@ -406,17 +406,17 @@ static int rkvpu_g_capture_fmt(struct file *file, void *priv, { struct rkvpu_ctx *ctx = fh_to_rkvpu_ctx(priv); - *f = ctx->decoded_fmt; + *f = ctx->dst_fmt; return 0; } static int rkvpu_enum_output_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - if (f->index >= ARRAY_SIZE(rkvpu_coded_fmts)) + if (f->index >= ARRAY_SIZE(rkvpu_src_fmts)) return -EINVAL; - f->pixelformat = rkvpu_coded_fmts[f->index].fourcc; + f->pixelformat = rkvpu_src_fmts[f->index].fourcc; return 0; } @@ -425,13 +425,13 @@ static int rkvpu_enum_capture_fmt(struct file *file, void *priv, { struct rkvpu_ctx *ctx = fh_to_rkvpu_ctx(priv); - if (WARN_ON(!ctx->coded_fmt_desc)) + if (WARN_ON(!ctx->src_fmt_desc)) return -EINVAL; - if (f->index >= ctx->coded_fmt_desc->num_decoded_fmts) + if (f->index >= ctx->src_fmt_desc->num_dst_fmts) return -EINVAL; - f->pixelformat = ctx->coded_fmt_desc->decoded_fmts[f->index]; + f->pixelformat = ctx->src_fmt_desc->dst_fmts[f->index]; return 0; } @@ -472,9 +472,9 @@ static int rkvpu_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers, unsigned int i; if (V4L2_TYPE_IS_OUTPUT(vq->type)) - f = &ctx->coded_fmt; + f = &ctx->src_fmt; else - f = &ctx->decoded_fmt; + f = &ctx->dst_fmt; if (*num_planes) { if (*num_planes != f->fmt.pix_mp.num_planes) @@ -501,9 +501,9 @@ static int rkvpu_buf_prepare(struct vb2_buffer *vb) unsigned int i; if (V4L2_TYPE_IS_OUTPUT(vq->type)) - f = &ctx->coded_fmt; + f = &ctx->src_fmt; else - f = &ctx->decoded_fmt; + f = &ctx->dst_fmt; for (i = 0; i < f->fmt.pix_mp.num_planes; ++i) { u32 sizeimage = f->fmt.pix_mp.plane_fmt[i].sizeimage; @@ -549,13 +549,13 @@ static void rkvpu_buf_request_complete(struct vb2_buffer *vb) static int rkvpu_start_streaming(struct vb2_queue *q, unsigned int count) { struct rkvpu_ctx *ctx = vb2_get_drv_priv(q); - const struct rkvpu_coded_fmt_desc *desc; + const struct rkvpu_fmt_desc *desc; int ret; if (V4L2_TYPE_IS_CAPTURE(q->type)) return 0; - desc = ctx->coded_fmt_desc; + desc = ctx->src_fmt_desc; if (WARN_ON(!desc)) return -EINVAL; @@ -594,7 +594,7 @@ static void rkvpu_stop_streaming(struct vb2_queue *q) struct rkvpu_ctx *ctx = vb2_get_drv_priv(q); if (V4L2_TYPE_IS_OUTPUT(q->type)) { - const struct rkvpu_coded_fmt_desc *desc = ctx->coded_fmt_desc; + const struct rkvpu_fmt_desc *desc = ctx->src_fmt_desc; if (WARN_ON(!desc)) return; @@ -639,12 +639,12 @@ static const struct media_device_ops rkvpu_media_ops = { static void rkvpu_job_finish_no_pm(struct rkvpu_ctx *ctx, enum vb2_buffer_state result) { - if (ctx->coded_fmt_desc->ops->done) { + if (ctx->src_fmt_desc->ops->done) { struct vb2_v4l2_buffer *src_buf, *dst_buf; src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); - ctx->coded_fmt_desc->ops->done(ctx, src_buf, dst_buf, result); + ctx->src_fmt_desc->ops->done(ctx, src_buf, dst_buf, result); } v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, @@ -690,7 +690,7 @@ static void rkvpu_device_run(void *priv) { struct rkvpu_ctx *ctx = priv; struct rkvpu_dev *rkvpu = ctx->dev; - const struct rkvpu_coded_fmt_desc *desc = ctx->coded_fmt_desc; + const struct rkvpu_fmt_desc *desc = ctx->src_fmt_desc; int ret; if (WARN_ON(!desc)) @@ -751,7 +751,7 @@ static int rkvpu_queue_init(void *priv, dst_vq->io_modes = VB2_MMAP | VB2_DMABUF; dst_vq->drv_priv = ctx; dst_vq->ops = &rkvpu_queue_ops; - dst_vq->buf_struct_size = sizeof(struct rkvpu_decoded_buffer); + dst_vq->buf_struct_size = sizeof(struct rkvpu_src_buffer); dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; dst_vq->lock = &rkvpu->vdev_lock; dst_vq->dev = rkvpu->v4l2_dev.dev; @@ -780,13 +780,13 @@ static int rkvpu_init_ctrls(struct rkvpu_ctx *ctx) unsigned int i, nctrls = 0; int ret; - for (i = 0; i < ARRAY_SIZE(rkvpu_coded_fmts); i++) - nctrls += rkvpu_coded_fmts[i].ctrls->num_ctrls; + for (i = 0; i < ARRAY_SIZE(rkvpu_src_fmts); i++) + nctrls += rkvpu_src_fmts[i].ctrls->num_ctrls; v4l2_ctrl_handler_init(&ctx->ctrl_hdl, nctrls); - for (i = 0; i < ARRAY_SIZE(rkvpu_coded_fmts); i++) { - ret = rkvpu_add_ctrls(ctx, rkvpu_coded_fmts[i].ctrls); + for (i = 0; i < ARRAY_SIZE(rkvpu_src_fmts); i++) { + ret = rkvpu_add_ctrls(ctx, rkvpu_src_fmts[i].ctrls); if (ret) goto err_free_handler; } @@ -814,8 +814,8 @@ static int rkvpu_open(struct file *filp) return -ENOMEM; ctx->dev = rkvpu; - rkvpu_reset_coded_fmt(ctx); - rkvpu_reset_decoded_fmt(ctx); + rkvpu_reset_src_fmt(ctx); + rkvpu_reset_dst_fmt(ctx); v4l2_fh_init(&ctx->fh, video_devdata(filp)); ret = rkvpu_init_ctrls(ctx); diff --git a/drivers/staging/media/rkvdec/rkvpu.h b/drivers/staging/media/rkvdec/rkvpu.h index 9e237c3c6942a..ad63d5c465901 100644 --- a/drivers/staging/media/rkvdec/rkvpu.h +++ b/drivers/staging/media/rkvdec/rkvpu.h @@ -40,30 +40,30 @@ struct rkvpu_run { } bufs; }; -struct rkvpu_vp9_decoded_buffer_info { - /* Info needed when the decoded frame serves as a reference frame. */ +struct rkvpu_vp9_src_buffer_info { + /* Info needed when the src frame serves as a reference frame. */ unsigned short width; unsigned short height; unsigned int bit_depth : 4; }; -struct rkvpu_decoded_buffer { +struct rkvpu_src_buffer { /* Must be the first field in this struct. */ struct v4l2_m2m_buffer base; union { - struct rkvpu_vp9_decoded_buffer_info vp9; + struct rkvpu_vp9_src_buffer_info vp9; }; }; -static inline struct rkvpu_decoded_buffer * -vb2_to_rkvpu_decoded_buf(struct vb2_buffer *buf) +static inline struct rkvpu_src_buffer * +vb2_to_rkvpu_src_buf(struct vb2_buffer *buf) { - return container_of(buf, struct rkvpu_decoded_buffer, + return container_of(buf, struct rkvpu_src_buffer, base.vb.vb2_buf); } -struct rkvpu_coded_fmt_ops { +struct rkvpu_ops { int (*adjust_fmt)(struct rkvpu_ctx *ctx, struct v4l2_format *f); int (*start)(struct rkvpu_ctx *ctx); @@ -75,13 +75,13 @@ struct rkvpu_coded_fmt_ops { int (*try_ctrl)(struct rkvpu_ctx *ctx, struct v4l2_ctrl *ctrl); }; -struct rkvpu_coded_fmt_desc { +struct rkvpu_fmt_desc { u32 fourcc; struct v4l2_frmsize_stepwise frmsize; const struct rkvpu_ctrls *ctrls; - const struct rkvpu_coded_fmt_ops *ops; - unsigned int num_decoded_fmts; - const u32 *decoded_fmts; + const struct rkvpu_ops *ops; + unsigned int num_dst_fmts; + const u32 *dst_fmts; u32 subsystem_flags; }; @@ -99,9 +99,9 @@ struct rkvpu_dev { struct rkvpu_ctx { struct v4l2_fh fh; - struct v4l2_format coded_fmt; - struct v4l2_format decoded_fmt; - const struct rkvpu_coded_fmt_desc *coded_fmt_desc; + struct v4l2_format src_fmt; + struct v4l2_format dst_fmt; + const struct rkvpu_fmt_desc *src_fmt_desc; struct v4l2_ctrl_handler ctrl_hdl; struct rkvpu_dev *dev; void *priv; @@ -121,7 +121,7 @@ struct rkvpu_aux_buf { void rkvpu_run_preamble(struct rkvpu_ctx *ctx, struct rkvpu_run *run); void rkvpu_run_postamble(struct rkvpu_ctx *ctx, struct rkvpu_run *run); -extern const struct rkvpu_coded_fmt_ops rkvdec_h264_fmt_ops; -extern const struct rkvpu_coded_fmt_ops rkvdec_vp9_fmt_ops; +extern const struct rkvpu_ops rkvdec_h264_fmt_ops; +extern const struct rkvpu_ops rkvdec_vp9_fmt_ops; #endif /* RKVDEC_H_ */ |