.ops = &rkvdec_hevc_fmt_ops,
.num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts),
.decoded_fmts = rkvdec_hevc_decoded_fmts,
- .capability = RKVDEC_CAPABILITY_HEVC,
},
{
.fourcc = V4L2_PIX_FMT_H264_SLICE,
.num_decoded_fmts = ARRAY_SIZE(rkvdec_h264_decoded_fmts),
.decoded_fmts = rkvdec_h264_decoded_fmts,
.subsystem_flags = VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF,
- .capability = RKVDEC_CAPABILITY_H264,
},
{
.fourcc = V4L2_PIX_FMT_VP9_FRAME,
.ops = &rkvdec_vp9_fmt_ops,
.num_decoded_fmts = ARRAY_SIZE(rkvdec_vp9_decoded_fmts),
.decoded_fmts = rkvdec_vp9_decoded_fmts,
- .capability = RKVDEC_CAPABILITY_VP9,
}
};
-static bool rkvdec_is_capable(struct rkvdec_ctx *ctx, unsigned int capability)
-{
- return (ctx->dev->variant->capabilities & capability) == capability;
-}
+static const struct rkvdec_coded_fmt_desc rk3288_coded_fmts[] = {
+ {
+ .fourcc = V4L2_PIX_FMT_HEVC_SLICE,
+ .frmsize = {
+ .min_width = 64,
+ .max_width = 4096,
+ .step_width = 64,
+ .min_height = 64,
+ .max_height = 2304,
+ .step_height = 16,
+ },
+ .ctrls = &rkvdec_hevc_ctrls,
+ .ops = &rkvdec_hevc_fmt_ops,
+ .num_decoded_fmts = ARRAY_SIZE(rkvdec_hevc_decoded_fmts),
+ .decoded_fmts = rkvdec_hevc_decoded_fmts,
+ }
+};
static const struct rkvdec_coded_fmt_desc *
rkvdec_enum_coded_fmt_desc(struct rkvdec_ctx *ctx, int index)
{
+ const struct rkvdec_variant *variant = ctx->dev->variant;
int fmt_idx = -1;
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) {
- if (!rkvdec_is_capable(ctx, rkvdec_coded_fmts[i].capability))
- continue;
+ for (i = 0; i < variant->num_coded_fmts; i++) {
fmt_idx++;
if (index == fmt_idx)
- return &rkvdec_coded_fmts[i];
+ return &variant->coded_fmts[i];
}
return NULL;
static const struct rkvdec_coded_fmt_desc *
rkvdec_find_coded_fmt_desc(struct rkvdec_ctx *ctx, u32 fourcc)
{
+ const struct rkvdec_variant *variant = ctx->dev->variant;
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) {
- if (rkvdec_is_capable(ctx, rkvdec_coded_fmts[i].capability) &&
- rkvdec_coded_fmts[i].fourcc == fourcc)
- return &rkvdec_coded_fmts[i];
+ for (i = 0; i < variant->num_coded_fmts; i++) {
+ if (variant->coded_fmts[i].fourcc == fourcc)
+ return &variant->coded_fmts[i];
}
return NULL;
static int rkvdec_init_ctrls(struct rkvdec_ctx *ctx)
{
+ const struct rkvdec_variant *variant = ctx->dev->variant;
unsigned int i, nctrls = 0;
int ret;
- for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++)
- if (rkvdec_is_capable(ctx, rkvdec_coded_fmts[i].capability))
- nctrls += rkvdec_coded_fmts[i].ctrls->num_ctrls;
+ for (i = 0; i < variant->num_coded_fmts; i++)
+ nctrls += variant->coded_fmts[i].ctrls->num_ctrls;
v4l2_ctrl_handler_init(&ctx->ctrl_hdl, nctrls);
- for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) {
- if (rkvdec_is_capable(ctx, rkvdec_coded_fmts[i].capability)) {
- ret = rkvdec_add_ctrls(ctx, rkvdec_coded_fmts[i].ctrls);
- if (ret)
- goto err_free_handler;
- }
+ for (i = 0; i < variant->num_coded_fmts; i++) {
+ ret = rkvdec_add_ctrls(ctx, variant->coded_fmts[i].ctrls);
+ if (ret)
+ goto err_free_handler;
}
ret = v4l2_ctrl_handler_setup(&ctx->ctrl_hdl);
static const struct rkvdec_variant rk3288_rkvdec_variant = {
.num_regs = 68,
- .capabilities = RKVDEC_CAPABILITY_HEVC,
+ .coded_fmts = rk3288_coded_fmts,
+ .num_coded_fmts = ARRAY_SIZE(rk3288_coded_fmts),
};
static const struct rkvdec_variant rk3328_rkvdec_variant = {
.num_regs = 109,
- .capabilities = RKVDEC_CAPABILITY_HEVC |
- RKVDEC_CAPABILITY_H264 |
- RKVDEC_CAPABILITY_VP9,
+ .coded_fmts = rkvdec_coded_fmts,
+ .num_coded_fmts = ARRAY_SIZE(rkvdec_coded_fmts),
.quirks = RKVDEC_QUIRK_DISABLE_QOS,
};
static const struct rkvdec_variant rk3399_rkvdec_variant = {
.num_regs = 78,
- .capabilities = RKVDEC_CAPABILITY_HEVC |
- RKVDEC_CAPABILITY_H264 |
- RKVDEC_CAPABILITY_VP9,
+ .coded_fmts = rkvdec_coded_fmts,
+ .num_coded_fmts = ARRAY_SIZE(rkvdec_coded_fmts),
};
static const struct of_device_id of_rkvdec_match[] = {