From: Ayoung Sim Date: Fri, 13 Jul 2018 08:37:01 +0000 (+0900) Subject: [COMMON] media: mfc: support various VP9 level X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=41fb51ad5f40f94298673ec806e8662f9902dcd1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] media: mfc: support various VP9 level Change-Id: I97836c2c0df644d83467998049734a7a55e3af3a Signed-off-by: Ayoung Sim --- diff --git a/drivers/media/platform/exynos/mfc/exynos_mfc_media.h b/drivers/media/platform/exynos/mfc/exynos_mfc_media.h index d032b0c0be46..02d26f4bfec1 100644 --- a/drivers/media/platform/exynos/mfc/exynos_mfc_media.h +++ b/drivers/media/platform/exynos/mfc/exynos_mfc_media.h @@ -405,6 +405,8 @@ enum v4l2_mpeg_video_hevc_hierarchical_coding_type { (V4L2_CID_MPEG_MFC_BASE + 181) #define V4L2_CID_MPEG_VIDEO_VP9_PROFILE \ (V4L2_CID_MPEG_MFC_BASE + 182) +#define V4L2_CID_MPEG_VIDEO_VP9_LEVEL \ + (V4L2_CID_MPEG_MFC_BASE + 183) /* CIDs for new common interface */ #define V4L2_CID_MPEG_VIDEO_ROI_CONTROL \ diff --git a/drivers/media/platform/exynos/mfc/mfc_common.h b/drivers/media/platform/exynos/mfc/mfc_common.h index 33481ca6aa86..cc0287ad64d1 100644 --- a/drivers/media/platform/exynos/mfc/mfc_common.h +++ b/drivers/media/platform/exynos/mfc/mfc_common.h @@ -179,6 +179,7 @@ #define ENC_SET_COLOR_ASPECT (1 << 9) #define ENC_SET_HP_BITRATE_CONTROL (1 << 10) #define ENC_SET_STATIC_INFO (1 << 11) +#define ENC_SET_VP9_PROFILE_LEVEL (1 << 13) #define MFC_VER_MAJOR(dev) ((dev->pdata->ip_ver >> 8) & 0xFF) #define MFC_VER_MINOR(dev) (dev->pdata->ip_ver & 0xFF) diff --git a/drivers/media/platform/exynos/mfc/mfc_data_struct.h b/drivers/media/platform/exynos/mfc/mfc_data_struct.h index b82b7e391dc5..a579c58ac6bd 100644 --- a/drivers/media/platform/exynos/mfc/mfc_data_struct.h +++ b/drivers/media/platform/exynos/mfc/mfc_data_struct.h @@ -910,8 +910,8 @@ struct mfc_mpeg4_enc_params { */ struct mfc_vp9_enc_params { /* VP9 Only */ - u8 vp9_version; u8 profile; + u8 level; u8 rc_min_qp; u8 rc_max_qp; u8 rc_min_qp_p; diff --git a/drivers/media/platform/exynos/mfc/mfc_enc_internal.h b/drivers/media/platform/exynos/mfc/mfc_enc_internal.h index f3b7eb606989..0e02c5df1af1 100644 --- a/drivers/media/platform/exynos/mfc/mfc_enc_internal.h +++ b/drivers/media/platform/exynos/mfc/mfc_enc_internal.h @@ -1087,6 +1087,24 @@ static struct v4l2_queryctrl controls[] = { .step = 1, .default_value = 0, }, + { + .id = V4L2_CID_MPEG_VIDEO_VP9_PROFILE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "VP9 profile", + .minimum = 0, + .maximum = 3, + .step = 1, + .default_value = 0, + }, + { + .id = V4L2_CID_MPEG_VIDEO_VP9_LEVEL, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "VP9 level", + .minimum = 10, + .maximum = 62, + .step = 1, + .default_value = 10, + }, { .id = V4L2_CID_MPEG_VIDEO_VP9_I_FRAME_QP, .type = V4L2_CTRL_TYPE_INTEGER, diff --git a/drivers/media/platform/exynos/mfc/mfc_enc_param.c b/drivers/media/platform/exynos/mfc/mfc_enc_param.c index d4b903c31600..e57d6f6693b4 100644 --- a/drivers/media/platform/exynos/mfc/mfc_enc_param.c +++ b/drivers/media/platform/exynos/mfc/mfc_enc_param.c @@ -852,7 +852,9 @@ void mfc_set_enc_params_vp9(struct mfc_ctx *ctx) /* profile*/ reg = 0; - mfc_set_bits(reg, 0xF, 0, p_vp9->vp9_version); + mfc_set_bits(reg, 0xF, 0, p_vp9->profile); + /* level */ + mfc_set_bits(reg, 0xFF, 8, p_vp9->level); /* bit depth minus8 */ if (ctx->is_10bit) { mfc_set_bits(reg, 0x3F, 17, 0x2); @@ -862,17 +864,17 @@ void mfc_set_enc_params_vp9(struct mfc_ctx *ctx) /* for only information about wrong setting */ if (ctx->is_422) { - if ((p_vp9->vp9_version != MFC_REG_E_PROFILE_VP9_PROFILE1) && - (p_vp9->vp9_version != MFC_REG_E_PROFILE_VP9_PROFILE3)) { + if ((p_vp9->profile != MFC_REG_E_PROFILE_VP9_PROFILE1) && + (p_vp9->profile != MFC_REG_E_PROFILE_VP9_PROFILE3)) { mfc_err_ctx("4:2:2 format is not matched with profile(%d)\n", - p_vp9->vp9_version); + p_vp9->profile); } } if (ctx->is_10bit) { - if ((p_vp9->vp9_version != MFC_REG_E_PROFILE_VP9_PROFILE2) && - (p_vp9->vp9_version != MFC_REG_E_PROFILE_VP9_PROFILE3)) { + if ((p_vp9->profile != MFC_REG_E_PROFILE_VP9_PROFILE2) && + (p_vp9->profile != MFC_REG_E_PROFILE_VP9_PROFILE3)) { mfc_err_ctx("[10BIT] format is not matched with profile(%d)\n", - p_vp9->vp9_version); + p_vp9->profile); } } diff --git a/drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c b/drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c index 4a216c0a2236..b8553692199a 100644 --- a/drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c +++ b/drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c @@ -892,6 +892,9 @@ static int __mfc_enc_ext_info(struct mfc_ctx *ctx) if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_enc)) val |= ENC_SET_STATIC_INFO; + if (dev->pdata->support_422) + val |= ENC_SET_VP9_PROFILE_LEVEL; + mfc_debug(5, "[CTRLS] ext info val: %#x\n", val); return val; @@ -1456,7 +1459,7 @@ static int __mfc_enc_set_param(struct mfc_ctx *ctx, struct v4l2_control *ctrl) p->codec.vp8.num_hier_layer = ctrl->value; break; case V4L2_CID_MPEG_VIDEO_VP9_VERSION: - p->codec.vp9.vp9_version = ctrl->value; + p->codec.vp9.profile = ctrl->value; break; case V4L2_CID_MPEG_VIDEO_VP9_RC_FRAME_RATE: p->rc_framerate = ctrl->value; @@ -1519,6 +1522,9 @@ static int __mfc_enc_set_param(struct mfc_ctx *ctx, struct v4l2_control *ctrl) case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: p->codec.vp9.profile = ctrl->value; break; + case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: + p->codec.vp9.level = ctrl->value; + break; case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP: p->codec.hevc.rc_frame_qp = ctrl->value; break;