[COMMON] media: mfc: parse supported version of each feature
authorJeonghee Kim <jhhhh.kim@samsung.com>
Fri, 25 May 2018 06:57:55 +0000 (15:57 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:23 +0000 (20:22 +0300)
Added to check the supported F/W version of each feature.

It is possible to check whether each feature is supported by using the command below.
echo 1 > d/mfc/mfc_info

Change-Id: I7b28ac5136951c8bac0c4ae5856bb9e9c37a0b3f
Signed-off-by: Jeonghee Kim <jhhhh.kim@samsung.com>
drivers/media/platform/exynos/mfc/s5p_mfc.c
drivers/media/platform/exynos/mfc/s5p_mfc_common.h
drivers/media/platform/exynos/mfc/s5p_mfc_data_struct.h
drivers/media/platform/exynos/mfc/s5p_mfc_debugfs.c
drivers/media/platform/exynos/mfc/s5p_mfc_dec.c
drivers/media/platform/exynos/mfc/s5p_mfc_enc.c
drivers/media/platform/exynos/mfc/s5p_mfc_enc_param.c
drivers/media/platform/exynos/mfc/s5p_mfc_inst.c
drivers/media/platform/exynos/mfc/s5p_mfc_irq.c
drivers/media/platform/exynos/mfc/s5p_mfc_nal_q.c
drivers/media/platform/exynos/mfc/s5p_mfc_reg.c

index 2b1fd66771d950ecfb1fc7d2201334c288992b93..a5956c130c49dea7406096ed085171bbff346862 100644 (file)
@@ -393,7 +393,7 @@ static int mfc_init_instance(struct s5p_mfc_dev *dev, struct s5p_mfc_ctx *ctx)
 
        s5p_mfc_release_hwlock_dev(dev);
 
-       if (dev->pdata->nal_q) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->nal_q)) {
                dev->nal_q_handle = s5p_mfc_nal_q_create(dev);
                if (dev->nal_q_handle == NULL)
                        mfc_err_dev("NAL Q: Can't create nal q\n");
@@ -951,26 +951,37 @@ static void mfc_parse_dt(struct device_node *np, struct s5p_mfc_dev *mfc)
        if (!np)
                return;
 
+       /* MFC version */
        of_property_read_u32(np, "ip_ver", &pdata->ip_ver);
+
+       /* Debug mode */
        of_property_read_u32(np, "debug_mode", &pdata->debug_mode);
+
+       /* Sysmmu check */
        of_property_read_u32(np, "share_sysmmu", &pdata->share_sysmmu);
        of_property_read_u32(np, "axid_mask", &pdata->axid_mask);
        of_property_read_u32(np, "mfc_fault_num", &pdata->mfc_fault_num);
-       of_property_read_u32(np, "nal_q", &pdata->nal_q);
-       of_property_read_u32(np, "skype", &pdata->skype);
-       of_property_read_u32(np, "black_bar", &pdata->black_bar);
-       of_property_read_u32(np, "color_aspect_dec", &pdata->color_aspect_dec);
-       of_property_read_u32(np, "static_info_dec", &pdata->static_info_dec);
-       of_property_read_u32(np, "color_aspect_enc", &pdata->color_aspect_enc);
-       of_property_read_u32(np, "static_info_enc", &pdata->static_info_enc);
+
+       /* Features */
+       of_property_read_u32_array(np, "nal_q", &pdata->nal_q.support, 2);
+       of_property_read_u32_array(np, "skype", &pdata->skype.support, 2);
+       of_property_read_u32_array(np, "black_bar", &pdata->black_bar.support, 2);
+       of_property_read_u32_array(np, "color_aspect_dec", &pdata->color_aspect_dec.support, 2);
+       of_property_read_u32_array(np, "static_info_dec", &pdata->static_info_dec.support, 2);
+       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);
+
+       /* Encoder default parameter */
        of_property_read_u32(np, "enc_param_num", &pdata->enc_param_num);
        if (pdata->enc_param_num) {
                of_property_read_u32_array(np, "enc_param_addr",
-                               &pdata->enc_param_addr[0], pdata->enc_param_num);
+                               pdata->enc_param_addr, pdata->enc_param_num);
                of_property_read_u32_array(np, "enc_param_val",
-                               &pdata->enc_param_val[0], pdata->enc_param_num);
+                               pdata->enc_param_val, pdata->enc_param_num);
        }
+
 #ifdef CONFIG_MFC_USE_BUS_DEVFREQ
+       /* QoS */
        of_property_read_u32(np, "num_qos_steps", &pdata->num_qos_steps);
        of_property_read_u32(np, "max_qos_steps", &pdata->max_qos_steps);
        of_property_read_u32(np, "max_mb", &pdata->max_mb);
index 42208d97aa1021c4befcb6a7770efc07a490144c..ae107bf7bf7a7ec9c4640b457a265da9479d3836 100644 (file)
 #define MFC_VER_MAJOR(dev)     ((dev->pdata->ip_ver >> 8) & 0xFF)
 #define MFC_VER_MINOR(dev)     (dev->pdata->ip_ver & 0xFF)
 
+#define MFC_FEATURE_SUPPORT(dev, f)    ((f).support && ((dev)->fw.date >= (f).version))
+
 #endif /* __S5P_MFC_COMMON_H */
index 6e6b14f5bc82ff80b94c8c831eb61e490d2d4048..297dca3ddabfe4c13dc2565e891228707b906077 100644 (file)
@@ -370,23 +370,34 @@ struct s5p_mfc_qos {
 };
 #endif
 
+struct s5p_mfc_feature {
+       unsigned int support;
+       unsigned int version;
+};
+
 struct s5p_mfc_platdata {
+       /* MFC version */
        unsigned int ip_ver;
+       /* Debug mode */
        unsigned int debug_mode;
+       /* Sysmmu check */
        unsigned int share_sysmmu;
        unsigned int axid_mask;
        unsigned int mfc_fault_num;
-       unsigned int nal_q;
-       unsigned int skype;
-       unsigned int black_bar;
-       unsigned int color_aspect_dec;
-       unsigned int static_info_dec;
-       unsigned int color_aspect_enc;
-       unsigned int static_info_enc;
+       /* Features */
+       struct s5p_mfc_feature nal_q;
+       struct s5p_mfc_feature skype;
+       struct s5p_mfc_feature black_bar;
+       struct s5p_mfc_feature color_aspect_dec;
+       struct s5p_mfc_feature static_info_dec;
+       struct s5p_mfc_feature color_aspect_enc;
+       struct s5p_mfc_feature static_info_enc;
+       /* Encoder default parameter */
        unsigned int enc_param_num;
        unsigned int enc_param_addr[MFC_MAX_DEFAULT_PARAM];
        unsigned int enc_param_val[MFC_MAX_DEFAULT_PARAM];
 #ifdef CONFIG_MFC_USE_BUS_DEVFREQ
+       /* QoS */
        unsigned int num_qos_steps;
        unsigned int max_qos_steps;
        unsigned int max_mb;
index dba5337e52f9efa55f8a96aec7b87554220d1a4c..5341b4995130c5e28be2f1a50e2c3bbce646d5b9 100644 (file)
@@ -50,9 +50,20 @@ static int mfc_info_show(struct seq_file *s, void *unused)
        seq_printf(s, "[HWLOCK] bits: %#lx, dev: %#lx, owned_by_irq = %d, wl_count = %d\n",
                        dev->hwlock.bits, dev->hwlock.dev,
                        dev->hwlock.owned_by_irq, dev->hwlock.wl_count);
+       seq_printf(s, "[DEBUG MODE] %s\n", dev->pdata->debug_mode ? "enabled" : "disabled");
        seq_printf(s, "[MMCACHE] %s(%s)\n",
                        dev->has_mmcache ? "supported" : "not supported",
                        dev->mmcache.is_on_status ? "enabled" : "disabled");
+       seq_printf(s, "[FEATURES] nal_q: %d(0x%x), skype: %d(0x%x), black_bar: %d(0x%x)\n",
+                       dev->pdata->nal_q.support, dev->pdata->nal_q.version,
+                       dev->pdata->skype.support, dev->pdata->skype.version,
+                       dev->pdata->black_bar.support, dev->pdata->black_bar.version);
+       seq_printf(s, "           color_aspect_dec: %d(0x%x), enc: %d(0x%x)\n",
+                       dev->pdata->color_aspect_dec.support, dev->pdata->color_aspect_dec.version,
+                       dev->pdata->color_aspect_enc.support, dev->pdata->color_aspect_enc.version);
+       seq_printf(s, "           static_info_dec: %d(0x%x), enc: %d(0x%x)\n",
+                       dev->pdata->static_info_dec.support, dev->pdata->static_info_dec.version,
+                       dev->pdata->static_info_enc.support, dev->pdata->static_info_enc.version);
        if (dev->nal_q_handle)
                seq_printf(s, "[NAL-Q] state: %d\n", dev->nal_q_handle->nal_q_state);
 
index 93ee7343626477070a632091e4d547c62d926fcb..8de947ab54701e2d783a705bbe16254f3d894c5c 100644 (file)
@@ -880,7 +880,7 @@ static int mfc_dec_ext_info(struct s5p_mfc_ctx *ctx)
        int val = 0;
 
        val |= DEC_SET_DYNAMIC_DPB;
-       if (dev->pdata->skype)
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->skype))
                val |= DEC_SET_SKYPE_FLAG;
 
        return val;
index 66805a33459839798f7430c3d41a62ff0f25e7a3..dc6687270164baa39d2b89bee72c3ca544823b78 100644 (file)
@@ -805,7 +805,7 @@ static int mfc_enc_ext_info(struct s5p_mfc_ctx *ctx)
        val |= ENC_SET_SPARE_SIZE;
        val |= ENC_SET_TEMP_SVC_CH;
 
-       if (dev->pdata->skype)
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->skype))
                val |= ENC_SET_SKYPE_FLAG;
 
        val |= ENC_SET_ROI_CONTROL;
@@ -814,12 +814,12 @@ static int mfc_enc_ext_info(struct s5p_mfc_ctx *ctx)
        val |= ENC_SET_PVC_MODE;
        val |= ENC_SET_RATIO_OF_INTRA;
 
-       if (dev->pdata->color_aspect_enc)
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->color_aspect_enc))
                val |= ENC_SET_COLOR_ASPECT;
 
        val |= ENC_SET_HP_BITRATE_CONTROL;
 
-       if (dev->pdata->static_info_enc)
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_enc))
                val |= ENC_SET_STATIC_INFO;
 
        return val;
index 5305bd460d38803e0b41147e0a0be8e3c7b486b9..618bbc26d1a99b0898acbdfadf77f04da06842a9 100644 (file)
@@ -581,7 +581,7 @@ void s5p_mfc_set_enc_params_h264(struct s5p_mfc_ctx *ctx)
                MFC_WRITEL(reg, S5P_FIMV_E_H264_FRAME_PACKING_SEI_INFO);
        }
 
-       if (dev->pdata->color_aspect_enc && p->check_color_range) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->color_aspect_enc) && p->check_color_range) {
                reg = MFC_READL(S5P_FIMV_E_VIDEO_SIGNAL_TYPE);
                /* VIDEO_SIGNAL_TYPE_FLAG */
                reg |= 0x1 << 31;
@@ -1048,7 +1048,7 @@ void s5p_mfc_set_enc_params_vp9(struct s5p_mfc_ctx *ctx)
        reg |= p_vp9->rc_min_qp_p & 0xFF;
        MFC_WRITEL(reg, S5P_FIMV_E_RC_QP_BOUND_PB);
 
-       if (dev->pdata->color_aspect_enc && p->check_color_range) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->color_aspect_enc) && p->check_color_range) {
                reg = MFC_READL(S5P_FIMV_E_VIDEO_SIGNAL_TYPE);
                /* VIDEO_SIGNAL_TYPE_FLAG */
                reg |= 0x1 << 31;
@@ -1294,7 +1294,7 @@ void s5p_mfc_set_enc_params_hevc(struct s5p_mfc_ctx *ctx)
        MFC_WRITEL(reg, S5P_FIMV_E_RC_ROI_CTRL);
        mfc_debug(3, "ROI: HEVC ROI enable\n");
 
-       if (dev->pdata->color_aspect_enc && p->check_color_range) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->color_aspect_enc) && p->check_color_range) {
                reg = MFC_READL(S5P_FIMV_E_VIDEO_SIGNAL_TYPE);
                /* VIDEO_SIGNAL_TYPE_FLAG */
                reg |= 0x1 << 31;
@@ -1325,7 +1325,8 @@ void s5p_mfc_set_enc_params_hevc(struct s5p_mfc_ctx *ctx)
                MFC_WRITEL(0, S5P_FIMV_E_VIDEO_SIGNAL_TYPE);
        }
 
-       if (dev->pdata->static_info_enc && p->static_info_enable && ctx->is_10bit) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_enc) &&
+                       p->static_info_enable && ctx->is_10bit) {
                reg = MFC_READL(S5P_FIMV_E_HEVC_OPTIONS_2);
                /* HDR_STATIC_INFO_ENABLE */
                reg |= p->static_info_enable;
index 2542044835b40847248e874f6d778fe8cc84a9bb..b1c675c3038597f5eeea23e4c5f7bb98f4e556d4 100644 (file)
@@ -177,7 +177,7 @@ int s5p_mfc_init_decode(struct s5p_mfc_ctx *ctx)
        /* Enable realloc interface if SEI is enabled */
        if (dec->sei_parse)
                reg |= (0x1 << S5P_FIMV_D_SEI_ENABLE_NEED_INIT_BUFFER_SHIFT);
-       if (dev->pdata->static_info_dec) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_dec)) {
                reg |= (0x1 << S5P_FIMV_D_SEI_ENABLE_CONTENT_LIGHT_SHIFT);
                reg |= (0x1 << S5P_FIMV_D_SEI_ENABLE_MASTERING_DISPLAY_SHIFT);
        }
index f900a9280e1964d88890e5fe3bb164c11601137d..38811af55fb1207b74da909d04e115039e771789 100644 (file)
@@ -224,17 +224,17 @@ static void mfc_handle_frame_output_del(struct s5p_mfc_ctx *ctx,
        unsigned int is_content_light = 0, is_display_colour = 0;
        unsigned int i, index;
 
-       if (dev->pdata->color_aspect_dec) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->color_aspect_dec)) {
                is_video_signal_type = s5p_mfc_get_video_signal_type();
                is_colour_description = s5p_mfc_get_colour_description();
        }
 
-       if (dev->pdata->static_info_dec) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_dec)) {
                is_content_light = s5p_mfc_get_sei_avail_content_light();
                is_display_colour = s5p_mfc_get_sei_avail_mastering_display();
        }
 
-       if (dev->pdata->black_bar && dec->detect_black_bar)
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->black_bar) && dec->detect_black_bar)
                mfc_handle_black_bar_info(dev, ctx);
        else
                dec->black_bar_updated = 0;
@@ -284,7 +284,7 @@ static void mfc_handle_frame_output_del(struct s5p_mfc_ctx *ctx,
                        }
                }
 
-               if (IS_VP9_DEC(ctx) && dev->pdata->color_aspect_dec) {
+               if (IS_VP9_DEC(ctx) && MFC_FEATURE_SUPPORT(dev, dev->pdata->color_aspect_dec)) {
                        if (dec->color_space != S5P_FIMV_D_COLOR_UNKNOWN) {
                                ref_mb->vb.reserved2 |= (1 << 3);
                                mfc_debug(2, "color space parsed\n");
index a88e2ae227e83a172355b6c02e0dded9b2ea5801..af2a9a9f06be923576e73d1c74c7338c521fef3f 100644 (file)
@@ -1231,7 +1231,7 @@ static void mfc_nal_q_handle_frame_output_del(struct s5p_mfc_ctx *ctx,
        unsigned int disp_err;
        int i, index;
 
-       if (dev->pdata->color_aspect_dec) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->color_aspect_dec)) {
                is_video_signal_type = ((pOutStr->VideoSignalType
                                        >> S5P_FIMV_D_VIDEO_SIGNAL_TYPE_FLAG_SHIFT)
                                        & S5P_FIMV_D_VIDEO_SIGNAL_TYPE_FLAG_MASK);
@@ -1240,7 +1240,7 @@ static void mfc_nal_q_handle_frame_output_del(struct s5p_mfc_ctx *ctx,
                                        & S5P_FIMV_D_COLOUR_DESCRIPTION_FLAG_MASK);
        }
 
-       if (dev->pdata->static_info_dec) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->static_info_dec)) {
                is_content_light = ((pOutStr->SeiAvail >> S5P_FIMV_D_SEI_AVAIL_CONTENT_LIGHT_SHIFT)
                                        & S5P_FIMV_D_SEI_AVAIL_CONTENT_LIGHT_MASK);
                is_display_colour = ((pOutStr->SeiAvail >> S5P_FIMV_D_SEI_AVAIL_MASTERING_DISPLAY_SHIFT)
@@ -1288,7 +1288,7 @@ static void mfc_nal_q_handle_frame_output_del(struct s5p_mfc_ctx *ctx,
                        }
                }
 
-               if (IS_VP9_DEC(ctx) && dev->pdata->color_aspect_dec) {
+               if (IS_VP9_DEC(ctx) && MFC_FEATURE_SUPPORT(dev, dev->pdata->color_aspect_dec)) {
                        if (dec->color_space != S5P_FIMV_D_COLOR_UNKNOWN) {
                                ref_mb->vb.reserved2 |= (1 << 3);
                                mfc_debug(2, "NAL Q: color space parsed\n");
index 8b21e3271f4b23076fdcf637402b1749288c5ecb..e4af9d98922a8cc6f7d16f35bdc4d4ca1d5bc7f9 100644 (file)
@@ -459,7 +459,7 @@ int s5p_mfc_set_dynamic_dpb(struct s5p_mfc_ctx *ctx, struct s5p_mfc_buf *dst_mb)
        mfc_debug(2, "Dst addr [%d] = 0x%08llx\n", dst_index, dst_mb->addr[0][0]);
 
        /* for debugging about black bar detection */
-       if (dev->pdata->black_bar && dec->detect_black_bar) {
+       if (MFC_FEATURE_SUPPORT(dev, dev->pdata->black_bar) && dec->detect_black_bar) {
                for (i = 0; i < raw->num_planes; i++) {
                        dec->frame_vaddr[i][dec->frame_cnt] = vb2_plane_vaddr(&dst_mb->vb.vb2_buf, i);
                        dec->frame_daddr[i][dec->frame_cnt] = dst_mb->addr[0][i];