From: Jeonghee Kim Date: Fri, 8 Jun 2018 05:44:18 +0000 (+0900) Subject: [COMMON] media: mfc: parse default 10bit format for decoding X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7c6a2de00104c4a2f75aa11d548f9cf9748577ba;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] media: mfc: parse default 10bit format for decoding Change-Id: I991532cd6f68a434109af8f84c66570c1f09498c Signed-off-by: Jeonghee Kim --- diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc.c b/drivers/media/platform/exynos/mfc/s5p_mfc.c index 28018fa038c0..e458dda19962 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc.c @@ -972,6 +972,9 @@ static void mfc_parse_dt(struct device_node *np, struct s5p_mfc_dev *mfc) of_property_read_u32_array(np, "color_aspect_enc", &pdata->color_aspect_enc.support, 2); of_property_read_u32_array(np, "static_info_enc", &pdata->static_info_enc.support, 2); + /* Default 10bit format for decoding */ + of_property_read_u32(np, "P010_decoding", &pdata->P010_decoding); + /* Encoder default parameter */ of_property_read_u32(np, "enc_param_num", &pdata->enc_param_num); if (pdata->enc_param_num) { diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h index 47d02b6761eb..1d238b533f41 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h @@ -392,6 +392,8 @@ struct s5p_mfc_platdata { struct s5p_mfc_feature static_info_dec; struct s5p_mfc_feature color_aspect_enc; struct s5p_mfc_feature static_info_enc; + /* Default 10bit format for decoding */ + unsigned int P010_decoding; /* Encoder default parameter */ unsigned int enc_param_num; unsigned int enc_param_addr[MFC_MAX_DEFAULT_PARAM]; diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_dec.c b/drivers/media/platform/exynos/mfc/s5p_mfc_dec.c index 3ed7ad86fc9e..bc5a400c0f8a 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_dec.c @@ -144,6 +144,7 @@ static int vidioc_enum_fmt_vid_out_mplane(struct file *file, void *prov, static void mfc_dec_change_format(struct s5p_mfc_ctx *ctx) { + struct s5p_mfc_dev *dev = ctx->dev; u32 org_fmt = ctx->dst_fmt->fourcc; if (ctx->is_10bit && ctx->is_422format) { @@ -187,7 +188,10 @@ static void mfc_dec_change_format(struct s5p_mfc_ctx *ctx) case V4L2_PIX_FMT_NV16M: case V4L2_PIX_FMT_NV16M_S10B: case V4L2_PIX_FMT_NV16M_P210: - ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010); + if (dev->pdata->P010_decoding) + ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010); + else + ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_S10B); break; case V4L2_PIX_FMT_NV21M: case V4L2_PIX_FMT_NV61M: @@ -196,7 +200,10 @@ static void mfc_dec_change_format(struct s5p_mfc_ctx *ctx) ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV21M_S10B); break; default: - ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010); + if (dev->pdata->P010_decoding) + ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_P010); + else + ctx->dst_fmt = mfc_dec_find_format(V4L2_PIX_FMT_NV12M_S10B); break; } } diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_dec_internal.h b/drivers/media/platform/exynos/mfc/s5p_mfc_dec_internal.h index 0a19cb38c63a..7e471795789d 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_dec_internal.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_dec_internal.h @@ -57,7 +57,7 @@ struct s5p_mfc_fmt dec_formats[] = { .mem_planes = 1, }, { - .name = "4:2:0 2 Planes Y/CbCr 10bit", + .name = "4:2:0 2 Planes Y/CbCr 8+2 10bit", .fourcc = V4L2_PIX_FMT_NV12M_S10B, .codec_mode = MFC_FORMATS_NO_CODEC, .type = MFC_FMT_RAW, @@ -89,7 +89,7 @@ struct s5p_mfc_fmt dec_formats[] = { .mem_planes = 2, }, { - .name = "4:2:0 2 Planes Y/CrCb 10bit", + .name = "4:2:0 2 Planes Y/CrCb 8+2 10bit", .fourcc = V4L2_PIX_FMT_NV21M_S10B, .codec_mode = MFC_FORMATS_NO_CODEC, .type = MFC_FMT_RAW, @@ -113,7 +113,7 @@ struct s5p_mfc_fmt dec_formats[] = { .mem_planes = 2, }, { - .name = "4:2:2 2 Planes Y/CbCr 10bit", + .name = "4:2:2 2 Planes Y/CbCr 8+2 10bit", .fourcc = V4L2_PIX_FMT_NV16M_S10B, .codec_mode = MFC_FORMATS_NO_CODEC, .type = MFC_FMT_RAW, @@ -137,7 +137,7 @@ struct s5p_mfc_fmt dec_formats[] = { .mem_planes = 2, }, { - .name = "4:2:2 2 Planes Y/CrCb 10bit", + .name = "4:2:2 2 Planes Y/CrCb 8+2 10bit", .fourcc = V4L2_PIX_FMT_NV61M_S10B, .codec_mode = MFC_FORMATS_NO_CODEC, .type = MFC_FMT_RAW, diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_enc_internal.h b/drivers/media/platform/exynos/mfc/s5p_mfc_enc_internal.h index b21397bcb1bf..6a176b86c940 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_enc_internal.h +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_enc_internal.h @@ -66,7 +66,7 @@ struct s5p_mfc_fmt enc_formats[] = { .mem_planes = 1, }, { - .name = "4:2:0 2 Planes Y/CbCr 10bit", + .name = "4:2:0 2 Planes Y/CbCr 8+2 10bit", .fourcc = V4L2_PIX_FMT_NV12M_S10B, .codec_mode = MFC_FORMATS_NO_CODEC, .type = MFC_FMT_RAW, @@ -90,7 +90,7 @@ struct s5p_mfc_fmt enc_formats[] = { .mem_planes = 2, }, { - .name = "4:2:0 2 Planes Y/CrCb 10bit", + .name = "4:2:0 2 Planes Y/CrCb 8+2 10bit", .fourcc = V4L2_PIX_FMT_NV21M_S10B, .codec_mode = MFC_FORMATS_NO_CODEC, .type = MFC_FMT_RAW, @@ -114,7 +114,7 @@ struct s5p_mfc_fmt enc_formats[] = { .mem_planes = 2, }, { - .name = "4:2:2 2 Planes Y/CbCr 10bit", + .name = "4:2:2 2 Planes Y/CbCr 8+2 10bit", .fourcc = V4L2_PIX_FMT_NV16M_S10B, .codec_mode = MFC_FORMATS_NO_CODEC, .type = MFC_FMT_RAW, @@ -122,7 +122,7 @@ struct s5p_mfc_fmt enc_formats[] = { .mem_planes = 2, }, { - .name = "4:2:2 2 Planes Y/CrCb 10bit", + .name = "4:2:2 2 Planes Y/CrCb 8+2 10bit", .fourcc = V4L2_PIX_FMT_NV61M_S10B, .codec_mode = MFC_FORMATS_NO_CODEC, .type = MFC_FMT_RAW, diff --git a/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c b/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c index 09ad25ffca01..7a525e15d05d 100644 --- a/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c +++ b/drivers/media/platform/exynos/mfc/s5p_mfc_reg.c @@ -495,7 +495,10 @@ int s5p_mfc_set_dynamic_dpb(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *dst_mb) void s5p_mfc_set_pixel_format(struct s5p_mfc_dev *dev, unsigned int format) { unsigned int reg = 0; - unsigned int pix_val, mem_type_10bit = 1; + unsigned int pix_val, mem_type_10bit = 0; + + if (dev->pdata->P010_decoding) + mem_type_10bit = 1; switch (format) { case V4L2_PIX_FMT_NV12M: @@ -524,6 +527,7 @@ void s5p_mfc_set_pixel_format(struct s5p_mfc_dev *dev, unsigned int format) break; case V4L2_PIX_FMT_NV12M_P010: case V4L2_PIX_FMT_NV16M_P210: + mem_type_10bit = 1; pix_val = 0; break; case V4L2_PIX_FMT_NV21M_S10B: @@ -533,6 +537,7 @@ void s5p_mfc_set_pixel_format(struct s5p_mfc_dev *dev, unsigned int format) break; case V4L2_PIX_FMT_NV21M_P010: case V4L2_PIX_FMT_NV61M_P210: + mem_type_10bit = 1; pix_val = 1; break; default: