#include "mfc_utils.h"
#include "mfc_buf.h"
-int mfc_cmd_sys_init(struct mfc_dev *dev,
+void mfc_cmd_sys_init(struct mfc_dev *dev,
enum mfc_buf_usage_type buf_type)
{
struct mfc_ctx_buf_size *buf_size;
mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_SYS_INIT);
mfc_debug_leave();
-
- return 0;
}
void mfc_cmd_sleep(struct mfc_dev *dev)
}
/* Open a new instance and get its number */
-int mfc_cmd_open_inst(struct mfc_ctx *ctx)
+void mfc_cmd_open_inst(struct mfc_ctx *ctx)
{
struct mfc_dev *dev = ctx->dev;
unsigned int reg;
mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_OPEN_INSTANCE);
mfc_debug_leave();
-
- return 0;
}
/* Close instance */
return 0;
}
-int mfc_cmd_abort_inst(struct mfc_ctx *ctx)
+void mfc_cmd_abort_inst(struct mfc_ctx *ctx)
{
struct mfc_dev *dev = ctx->dev;
MFC_WRITEL(ctx->inst_no, MFC_REG_INSTANCE_ID);
mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_NAL_ABORT);
-
- return 0;
}
-int mfc_cmd_dpb_flush(struct mfc_ctx *ctx)
+void mfc_cmd_dpb_flush(struct mfc_ctx *ctx)
{
struct mfc_dev *dev = ctx->dev;
MFC_WRITEL(ctx->inst_no, MFC_REG_INSTANCE_ID);
mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_DPB_FLUSH);
-
- return 0;
}
-int mfc_cmd_cache_flush(struct mfc_dev *dev)
+void mfc_cmd_cache_flush(struct mfc_dev *dev)
{
mfc_clean_dev_int_flags(dev);
mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_CACHE_FLUSH);
+}
+
+/* Initialize decoding */
+void mfc_cmd_dec_seq_header(struct mfc_ctx *ctx)
+{
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
+ unsigned int reg = 0;
+ int fmo_aso_ctrl = 0;
+
+ mfc_debug_enter();
+
+ mfc_debug(2, "InstNo: %d/%d\n", ctx->inst_no, MFC_REG_H2R_CMD_SEQ_HEADER);
+ mfc_debug(2, "BUFs: %08x\n", MFC_READL(MFC_REG_D_CPB_BUFFER_ADDR));
+
+ /*
+ * When user sets desplay_delay to 0,
+ * It works as "display_delay enable" and delay set to 0.
+ * If user wants display_delay disable, It should be
+ * set to negative value.
+ */
+ if (dec->display_delay >= 0) {
+ reg |= (0x1 << MFC_REG_D_DEC_OPT_DISPLAY_DELAY_EN_SHIFT);
+ MFC_WRITEL(dec->display_delay, MFC_REG_D_DISPLAY_DELAY);
+ }
+
+ /* FMO_ASO_CTRL - 0: Enable, 1: Disable */
+ reg |= ((fmo_aso_ctrl & MFC_REG_D_DEC_OPT_FMO_ASO_CTRL_MASK)
+ << MFC_REG_D_DEC_OPT_FMO_ASO_CTRL_SHIFT);
+
+ reg |= ((dec->idr_decoding & MFC_REG_D_DEC_OPT_IDR_DECODING_MASK)
+ << MFC_REG_D_DEC_OPT_IDR_DECODING_SHIFT);
+
+ /* VC1 RCV: Discard to parse additional header as default */
+ if (IS_VC1_RCV_DEC(ctx))
+ reg |= (0x1 << MFC_REG_D_DEC_OPT_DISCARD_RCV_HEADER_SHIFT);
+
+ /* conceal control to specific color */
+ reg |= (0x4 << MFC_REG_D_DEC_OPT_CONCEAL_CONTROL_SHIFT);
+
+ /* Disable parallel processing if nal_q_parallel_disable was set */
+ if (nal_q_parallel_disable)
+ reg |= (0x2 << MFC_REG_D_DEC_OPT_PARALLEL_DISABLE_SHIFT);
+
+ /* Realloc buffer for resolution decrease case in NAL QUEUE mode */
+ reg |= (0x1 << MFC_REG_D_DEC_OPT_REALLOC_CONTROL_SHIFT);
+
+ /* Parsing all including PPS */
+ reg |= (0x1 << MFC_REG_D_DEC_OPT_SPECIAL_PARSING_SHIFT);
+
+ MFC_WRITEL(reg, MFC_REG_D_DEC_OPTIONS);
+
+ MFC_WRITEL(MFC_CONCEAL_COLOR, MFC_REG_D_FORCE_PIXEL_VAL);
+
+ if (IS_FIMV1_DEC(ctx)) {
+ mfc_debug(2, "Setting FIMV1 resolution to %dx%d\n",
+ ctx->img_width, ctx->img_height);
+ MFC_WRITEL(ctx->img_width, MFC_REG_D_SET_FRAME_WIDTH);
+ MFC_WRITEL(ctx->img_height, MFC_REG_D_SET_FRAME_HEIGHT);
+ }
+
+ mfc_set_pixel_format(dev, ctx->dst_fmt->fourcc);
+
+ reg = 0;
+ /* Enable realloc interface if SEI is enabled */
+ if (dec->sei_parse)
+ reg |= (0x1 << MFC_REG_D_SEI_ENABLE_NEED_INIT_BUFFER_SHIFT);
+ if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_dec)) {
+ reg |= (0x1 << MFC_REG_D_SEI_ENABLE_CONTENT_LIGHT_SHIFT);
+ reg |= (0x1 << MFC_REG_D_SEI_ENABLE_MASTERING_DISPLAY_SHIFT);
+ }
+ reg |= (0x1 << MFC_REG_D_SEI_ENABLE_RECOVERY_PARSING_SHIFT);
+
+ MFC_WRITEL(reg, MFC_REG_D_SEI_ENABLE);
+ mfc_debug(2, "SEI enable was set, 0x%x\n", MFC_READL(MFC_REG_D_SEI_ENABLE));
+
+ MFC_WRITEL(ctx->inst_no, MFC_REG_INSTANCE_ID);
+
+ if (sfr_dump & MFC_DUMP_DEC_SEQ_START)
+ call_dop(dev, dump_regs, dev);
+
+ mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_SEQ_HEADER);
+
+ mfc_debug_leave();
+}
+
+int mfc_cmd_enc_seq_header(struct mfc_ctx *ctx)
+{
+ struct mfc_dev *dev = ctx->dev;
+ int ret;
+
+ mfc_debug(2, "++\n");
+
+ ret = mfc_set_enc_params(ctx);
+ if (ret) {
+ mfc_debug(2, "fail to set enc params\n");
+ return ret;
+ }
+
+ MFC_WRITEL(ctx->inst_no, MFC_REG_INSTANCE_ID);
+
+ if (sfr_dump & MFC_DUMP_ENC_SEQ_START)
+ call_dop(dev, dump_regs, dev);
+
+ mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_SEQ_HEADER);
+
+ mfc_debug(2, "--\n");
return 0;
}
return ret;
}
-/* Initialize decoding */
-int mfc_cmd_init_decode(struct mfc_ctx *ctx)
-{
- struct mfc_dev *dev = ctx->dev;
- struct mfc_dec *dec = ctx->dec_priv;
- unsigned int reg = 0;
- int fmo_aso_ctrl = 0;
-
- mfc_debug_enter();
-
- mfc_debug(2, "InstNo: %d/%d\n", ctx->inst_no, MFC_REG_H2R_CMD_SEQ_HEADER);
- mfc_debug(2, "BUFs: %08x\n", MFC_READL(MFC_REG_D_CPB_BUFFER_ADDR));
-
- /*
- * When user sets desplay_delay to 0,
- * It works as "display_delay enable" and delay set to 0.
- * If user wants display_delay disable, It should be
- * set to negative value.
- */
- if (dec->display_delay >= 0) {
- reg |= (0x1 << MFC_REG_D_DEC_OPT_DISPLAY_DELAY_EN_SHIFT);
- MFC_WRITEL(dec->display_delay, MFC_REG_D_DISPLAY_DELAY);
- }
-
- /* FMO_ASO_CTRL - 0: Enable, 1: Disable */
- reg |= ((fmo_aso_ctrl & MFC_REG_D_DEC_OPT_FMO_ASO_CTRL_MASK)
- << MFC_REG_D_DEC_OPT_FMO_ASO_CTRL_SHIFT);
-
- reg |= ((dec->idr_decoding & MFC_REG_D_DEC_OPT_IDR_DECODING_MASK)
- << MFC_REG_D_DEC_OPT_IDR_DECODING_SHIFT);
-
- /* VC1 RCV: Discard to parse additional header as default */
- if (IS_VC1_RCV_DEC(ctx))
- reg |= (0x1 << MFC_REG_D_DEC_OPT_DISCARD_RCV_HEADER_SHIFT);
-
- /* conceal control to specific color */
- reg |= (0x4 << MFC_REG_D_DEC_OPT_CONCEAL_CONTROL_SHIFT);
-
- /* Disable parallel processing if nal_q_parallel_disable was set */
- if (nal_q_parallel_disable)
- reg |= (0x2 << MFC_REG_D_DEC_OPT_PARALLEL_DISABLE_SHIFT);
-
- /* Realloc buffer for resolution decrease case in NAL QUEUE mode */
- reg |= (0x1 << MFC_REG_D_DEC_OPT_REALLOC_CONTROL_SHIFT);
-
- /* Parsing all including PPS */
- reg |= (0x1 << MFC_REG_D_DEC_OPT_SPECIAL_PARSING_SHIFT);
-
- MFC_WRITEL(reg, MFC_REG_D_DEC_OPTIONS);
-
- MFC_WRITEL(MFC_CONCEAL_COLOR, MFC_REG_D_FORCE_PIXEL_VAL);
-
- if (IS_FIMV1_DEC(ctx)) {
- mfc_debug(2, "Setting FIMV1 resolution to %dx%d\n",
- ctx->img_width, ctx->img_height);
- MFC_WRITEL(ctx->img_width, MFC_REG_D_SET_FRAME_WIDTH);
- MFC_WRITEL(ctx->img_height, MFC_REG_D_SET_FRAME_HEIGHT);
- }
-
- mfc_set_pixel_format(dev, ctx->dst_fmt->fourcc);
-
- reg = 0;
- /* Enable realloc interface if SEI is enabled */
- if (dec->sei_parse)
- reg |= (0x1 << MFC_REG_D_SEI_ENABLE_NEED_INIT_BUFFER_SHIFT);
- if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_dec)) {
- reg |= (0x1 << MFC_REG_D_SEI_ENABLE_CONTENT_LIGHT_SHIFT);
- reg |= (0x1 << MFC_REG_D_SEI_ENABLE_MASTERING_DISPLAY_SHIFT);
- }
- reg |= (0x1 << MFC_REG_D_SEI_ENABLE_RECOVERY_PARSING_SHIFT);
-
- MFC_WRITEL(reg, MFC_REG_D_SEI_ENABLE);
- mfc_debug(2, "[HDR] SEI enable was set, 0x%x\n", MFC_READL(MFC_REG_D_SEI_ENABLE));
-
- MFC_WRITEL(ctx->inst_no, MFC_REG_INSTANCE_ID);
-
- if (sfr_dump & MFC_DUMP_DEC_SEQ_START)
- call_dop(dev, dump_regs, dev);
-
- mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_SEQ_HEADER);
-
- mfc_debug_leave();
- return 0;
-}
-
/* Decode a single frame */
-int mfc_cmd_dec_one_frame(struct mfc_ctx *ctx, int last_frame)
+void mfc_cmd_dec_one_frame(struct mfc_ctx *ctx, int last_frame)
{
struct mfc_dev *dev = ctx->dev;
struct mfc_dec *dec = ctx->dec_priv;
}
mfc_debug(2, "Decoding a usual frame\n");
- return 0;
-}
-
-int mfc_cmd_init_encode(struct mfc_ctx *ctx)
-{
- struct mfc_dev *dev = ctx->dev;
- int ret;
-
- mfc_debug(2, "++\n");
-
- ret = mfc_set_enc_params(ctx);
- if (ret) {
- mfc_debug(2, "fail to set enc params\n");
- return ret;
- }
-
- MFC_WRITEL(ctx->inst_no, MFC_REG_INSTANCE_ID);
-
- if (sfr_dump & MFC_DUMP_ENC_SEQ_START)
- call_dop(dev, dump_regs, dev);
-
- mfc_cmd_host2risc(dev, MFC_REG_H2R_CMD_SEQ_HEADER);
-
- mfc_debug(2, "--\n");
-
- return 0;
}
/* Encode a single frame */
-int mfc_cmd_enc_one_frame(struct mfc_ctx *ctx, int last_frame)
+void mfc_cmd_enc_one_frame(struct mfc_ctx *ctx, int last_frame)
{
struct mfc_dev *dev = ctx->dev;
}
mfc_debug(2, "--\n");
-
- return 0;
}