video_composer: add in the uvm type to check whether has vframe. [1/1]
authorjintao xu <jintao.xu@amlogic.com>
Mon, 21 Jun 2021 06:43:18 +0000 (14:43 +0800)
committerMax Zhang <zhangmax@google.com>
Tue, 6 Jul 2021 23:21:13 +0000 (23:21 +0000)
PD#SWPL-52333

Problem:
hdmitx audio setting function is called on TV
platform and cause crash

Solution:
if hdmitx driver is not enabled, export function
just return

Verify:
pb

Signed-off-by: jintao xu <jintao.xu@amlogic.com>
Change-Id: Ic87135d8621a2a37e74c2ac8ddc6d7096e3d75d1

drivers/amlogic/media/video_processor/video_composer/video_composer.c
include/linux/amlogic/meson_uvm_core.h

index f4eb66facb098d08026e88a792821a4f69067af0..f5ac7a6da2cf557bf37389f8c63f9f8a42a7efdd 100644 (file)
@@ -326,6 +326,12 @@ static struct file_private_data *vc_get_file_private(struct composer_dev *dev,
 
        uhmod = uvm_get_hook_mod((struct dma_buf *)(file_vf->private_data),
                                 VF_PROCESS_V4LVIDEO);
+       if (!uhmod) {
+               vc_print(dev->index, PRINT_ERROR,
+                        "dma file file_private_data is NULL\n");
+               return NULL;
+       }
+
        if (IS_ERR_VALUE(uhmod) || !uhmod->arg) {
                vc_print(dev->index, PRINT_ERROR,
                         "dma file file_private_data is NULL\n");
@@ -644,6 +650,131 @@ static struct output_axis output_axis_adjust(
        return axis;
 }
 
+static int config_ge2d_data(struct composer_dev *dev,
+                           struct vframe_s *src_vf,
+                           unsigned long addr,
+                           struct frame_info_t *info,
+                           struct src_data_para *data)
+{
+       struct vframe_s *vf = NULL;
+
+       if (src_vf) {
+               if (src_vf->canvas0_config[0].phy_addr == 0) {
+                       if ((src_vf->flag &  VFRAME_FLAG_DOUBLE_FRAM) &&
+                           src_vf->vf_ext) {
+                               vf = src_vf->vf_ext;
+                       } else {
+                               vc_print(dev->index, PRINT_PATTERN,
+                                        "vf no yuv data, composer fail\n");
+                               return -1;
+                       }
+               } else {
+                       vf = src_vf;
+               }
+               data->canvas0Addr = vf->canvas0Addr;
+               data->canvas1Addr = vf->canvas1Addr;
+               data->canvas0_config[0] = vf->canvas0_config[0];
+               data->canvas0_config[1] = vf->canvas0_config[1];
+               data->canvas0_config[2] = vf->canvas0_config[2];
+               data->canvas1_config[0] = vf->canvas1_config[0];
+               data->canvas1_config[1] = vf->canvas1_config[1];
+               data->canvas1_config[2] = vf->canvas1_config[2];
+               data->bitdepth = vf->bitdepth;
+               data->source_type = vf->source_type;
+               data->type = vf->type;
+               data->plane_num = vf->plane_num;
+               data->width = vf->width;
+               data->height = vf->height;
+               if (vf->flag & VFRAME_FLAG_VIDEO_LINEAR)
+                       data->is_vframe = false;
+               else
+                       data->is_vframe = true;
+       } else {
+               data->canvas0Addr = -1;
+               data->canvas1Addr = -1;
+               data->canvas0_config[0].phy_addr = addr;
+               if (info->buffer_w > info->reserved[0]) {
+                       vc_print(dev->index, PRINT_PATTERN,
+                                "buffer_w(%d) > deal_w(%d)\n",
+                                info->buffer_w, info->reserved[0]);
+                       data->canvas0_config[0].width = info->buffer_w;
+               } else {
+                       vc_print(dev->index, PRINT_PATTERN,
+                                "buffer_w:%d, deal_w: %d\n",
+                                info->buffer_w, info->reserved[0]);
+                       data->canvas0_config[0].width = info->reserved[0];
+               }
+               if (info->buffer_h > info->reserved[1]) {
+                       vc_print(dev->index, PRINT_PATTERN,
+                                "buffer_h(%d) > deal_h(%d)\n",
+                                info->buffer_h, info->reserved[1]);
+                       data->canvas0_config[0].height = info->buffer_h;
+               } else {
+                       vc_print(dev->index, PRINT_PATTERN,
+                                "buffer_h: %d, deal_h: %d\n",
+                                info->buffer_h, info->reserved[1]);
+                       data->canvas0_config[0].height = info->reserved[1];
+               }
+               data->canvas0_config[0].block_mode = CANVAS_BLKMODE_LINEAR;
+               data->canvas0_config[0].endian = 0;
+               data->canvas0_config[1].phy_addr =
+                       (u32)(addr + (data->canvas0_config[0].width)
+                             * (data->canvas0_config[0].height));
+               data->canvas0_config[1].width =
+                       data->canvas0_config[0].width;
+               data->canvas0_config[1].height =
+                       data->canvas0_config[0].height / 2;
+               data->canvas0_config[1].block_mode =
+                       CANVAS_BLKMODE_LINEAR;
+               data->canvas0_config[1].endian = 0;
+               data->bitdepth = BITDEPTH_Y8
+                                   | BITDEPTH_U8
+                                   | BITDEPTH_V8;
+               data->source_type = 0;
+               data->type = VIDTYPE_PROGRESSIVE
+                               | VIDTYPE_VIU_FIELD
+                               | VIDTYPE_VIU_NV21;
+               data->plane_num = 2;
+               data->width = info->buffer_w;
+               data->height = info->buffer_h;
+               data->is_vframe = false;
+       }
+       return 0;
+}
+
+static struct vframe_s *get_vf_from_file(struct composer_dev *dev,
+                                        struct file *file_vf)
+{
+       struct vframe_s *vf = NULL;
+       bool is_dec_vf = false;
+       struct file_private_data *file_private_data = NULL;
+
+       is_dec_vf = is_valid_mod_type(file_vf->private_data, VF_SRC_DECODER);
+
+       if (is_dec_vf) {
+               vf =
+               dmabuf_get_vframe((struct dma_buf *)(file_vf->private_data));
+               if (vf->vf_ext && (vf->flag & VFRAME_FLAG_CONTAIN_POST_FRAME))
+                       vf = vf->vf_ext;
+               dmabuf_put_vframe((struct dma_buf *)(file_vf->private_data));
+               vc_print(dev->index, PRINT_OTHER, "vf is from decoder\n");
+       } else {
+               file_private_data = vc_get_file_private(dev, file_vf);
+               if (!file_private_data) {
+                       vc_print(dev->index, PRINT_ERROR,
+                                "invalid fd: no uvm, no v4lvideo!!\n");
+               } else {
+                       vf = &file_private_data->vf;
+                       if (vf->vf_ext &&
+                               (vf->flag & VFRAME_FLAG_CONTAIN_POST_FRAME))
+                               vf = vf->vf_ext;
+                       vc_print(dev->index, PRINT_OTHER,
+                                "vf is from v4lvideo\n");
+               }
+       }
+       return vf;
+}
+
 static void vframe_composer(struct composer_dev *dev)
 {
        struct received_frames_t *received_frames = NULL;
@@ -655,7 +786,6 @@ static void vframe_composer(struct composer_dev *dev)
        struct frame_info_t *vframe_info[MXA_LAYER_COUNT];
        int i, j, tmp;
        u32 zd1, zd2;
-       struct file_private_data *file_private_data;
        struct config_para_ex_s ge2d_config;
        struct timeval begin_time;
        struct timeval end_time;
@@ -667,10 +797,12 @@ static void vframe_composer(struct composer_dev *dev)
        u32 cur_transform = 0;
        struct src_data_para src_data;
        u32 drop_count = 0;
+       unsigned long addr = 0;
        struct output_axis dst_axis;
        int min_left = 0, min_top = 0;
        int max_right = 0, max_bottom = 0;
        struct componser_info_t *componser_info;
+       bool is_dec_vf = false, is_v4l_vf = false;
 
        do_gettimeofday(&begin_time);
 
@@ -751,80 +883,54 @@ static void vframe_composer(struct composer_dev *dev)
        min_left = vframe_info[0]->dst_x;
        min_top = vframe_info[0]->dst_y;
        for (i = 0; i < count; i++) {
+               file_vf = received_frames->file_vf[vf_dev[i]];
+               is_dec_vf =
+               is_valid_mod_type(file_vf->private_data, VF_SRC_DECODER);
+               is_v4l_vf =
+               is_valid_mod_type(file_vf->private_data, VF_PROCESS_V4LVIDEO) ||
+                       is_v4lvideo_buf_file(file_vf);
                if (vframe_info[vf_dev[i]]->type == 1) {
-                       src_data.canvas0Addr = -1;
-                       src_data.canvas1Addr = -1;
-                       src_data.canvas0_config[0].phy_addr = (u32)(
-                               received_frames->phy_addr[vf_dev[i]]);
-                       src_data.canvas0_config[0].width =
-                               (vframe_info[vf_dev[i]]->buffer_w
-                                + 0x1f) & ~0x1f;
-                       src_data.canvas0_config[0].height =
-                               vframe_info[vf_dev[i]]->buffer_h;
-                       src_data.canvas0_config[0].block_mode =
-                               CANVAS_BLKMODE_LINEAR;
-                       src_data.canvas0_config[0].endian = 0;
-                       src_data.canvas0_config[1].phy_addr =
-                               (u32)(received_frames->phy_addr[vf_dev[i]]
-                                     + (src_data.canvas0_config[0].width)
-                                     * (src_data.canvas0_config[0].height));
-
-                       src_data.canvas0_config[1].width =
-                               (vframe_info[vf_dev[i]]->buffer_w
-                                + 0x1f) & ~0x1f;
-                       src_data.canvas0_config[1].height =
-                               (vframe_info[vf_dev[i]]->buffer_h) / 2;
-                       src_data.canvas0_config[1].block_mode =
-                               CANVAS_BLKMODE_LINEAR;
-                       src_data.canvas0_config[1].endian = 0;
-
-                       src_data.bitdepth = BITDEPTH_Y8
-                                           | BITDEPTH_U8
-                                           | BITDEPTH_V8;
-                       src_data.source_type = 0;
-                       src_data.type = VIDTYPE_PROGRESSIVE
-                                       | VIDTYPE_VIU_FIELD
-                                       | VIDTYPE_VIU_NV21;
-                       src_data.plane_num = 2;
-                       src_data.width = vframe_info[vf_dev[i]]->buffer_w;
-                       src_data.height = vframe_info[vf_dev[i]]->buffer_h;
-                       src_data.is_vframe = false;
-               } else {
-                       file_vf = received_frames->file_vf[vf_dev[i]];
-                       if (is_valid_mod_type(file_vf->private_data,
-                                             VF_SRC_DECODER)) {
-                               scr_vf = dmabuf_get_vframe((struct dma_buf *)
-                                       (file_vf->private_data));
+                       if (is_dec_vf || is_v4l_vf) {
+                               vc_print(dev->index, PRINT_OTHER,
+                                        "%s dma buffer is vf\n", __func__);
+                               scr_vf = get_vf_from_file(dev, file_vf);
+                               if (!scr_vf) {
+                                       vc_print(dev->index,
+                                                PRINT_ERROR, "get vf NULL\n");
+                                       continue;
+                               }
+                               if (scr_vf->type & VIDTYPE_V4L_EOS) {
+                                       vc_print(dev->index,
+                                                PRINT_ERROR, "eos vf\n");
+                                       continue;
+                               }
                        } else {
-                               file_private_data =
-                                       vc_get_file_private(dev, file_vf);
-                               scr_vf = &file_private_data->vf;
+                               addr = received_frames->phy_addr[vf_dev[i]];
+                               vc_print(dev->index, PRINT_OTHER,
+                                        "%s dma buffer not vf\n",
+                                        __func__);
+                       }
+               } else if (vframe_info[vf_dev[i]]->type == 0) {
+                       if (is_dec_vf || is_v4l_vf) {
+                               vc_print(dev->index, PRINT_OTHER,
+                                        "%s type 0 is vf\n", __func__);
+                               scr_vf = get_vf_from_file(dev, file_vf);
+                       }
+                       if (!scr_vf) {
+                               vc_print(dev->index,
+                                        PRINT_ERROR, "get vf NULL\n");
+                               continue;
                        }
 
                        if (scr_vf->type & VIDTYPE_V4L_EOS) {
                                vc_print(dev->index, PRINT_ERROR, "eos vf\n");
                                continue;
                        }
-
-                       src_data.canvas0Addr = scr_vf->canvas0Addr;
-                       src_data.canvas1Addr = scr_vf->canvas1Addr;
-                       src_data.canvas0_config[0] = scr_vf->canvas0_config[0];
-                       src_data.canvas0_config[1] = scr_vf->canvas0_config[1];
-                       src_data.canvas0_config[2] = scr_vf->canvas0_config[2];
-                       src_data.canvas1_config[0] = scr_vf->canvas1_config[0];
-                       src_data.canvas1_config[1] = scr_vf->canvas1_config[1];
-                       src_data.canvas1_config[2] = scr_vf->canvas1_config[2];
-                       src_data.bitdepth = scr_vf->bitdepth;
-                       src_data.source_type = scr_vf->source_type;
-                       src_data.type = scr_vf->type;
-                       src_data.plane_num = scr_vf->plane_num;
-                       src_data.width = scr_vf->width;
-                       src_data.height = scr_vf->height;
-                       if (scr_vf->flag & VFRAME_FLAG_VIDEO_LINEAR)
-                               src_data.is_vframe = false;
-                       else
-                               src_data.is_vframe = true;
                }
+               ret = config_ge2d_data(dev, scr_vf, addr,
+                                      vframe_info[vf_dev[i]], &src_data);
+               if (ret < 0)
+                       continue;
                cur_transform = vframe_info[vf_dev[i]]->transform;
                dev->ge2d_para.position_left =
                        vframe_info[vf_dev[i]]->dst_x;
@@ -966,7 +1072,7 @@ static void vframe_composer(struct composer_dev *dev)
                dst_vf->canvas0_config[1].phy_addr = dst_buf->phy_addr
                        + dst_vf->width * dst_vf->height;
                dst_vf->canvas0_config[1].width = dst_vf->width;
-               dst_vf->canvas0_config[1].height = dst_vf->height;
+               dst_vf->canvas0_config[1].height = dst_vf->height >> 1;
                dst_vf->canvas0_config[1].block_mode = 0;
                dst_vf->plane_num = 2;
        }
@@ -1058,7 +1164,6 @@ static void video_composer_task(struct composer_dev *dev)
        struct vframe_s *vf = NULL;
        struct file *file_vf = NULL;
        struct frame_info_t *frame_info = NULL;
-       struct file_private_data *file_private_data;
        struct received_frames_t *received_frames = NULL;
        struct frames_info_t *frames_info = NULL;
        int count;
@@ -1069,6 +1174,7 @@ static void video_composer_task(struct composer_dev *dev)
        struct vframe_s *vf_ext = NULL;
        u32 pic_w;
        u32 pic_h;
+       bool is_dec_vf = false, is_v4l_vf = false;
 
        if (!kfifo_peek(&dev->receive_q, &received_frames)) {
                vc_print(dev->index, PRINT_ERROR, "task: peek failed\n");
@@ -1088,8 +1194,8 @@ static void video_composer_task(struct composer_dev *dev)
                if (transform)
                        received_frames->frames_info.frame_info[0].transform =
                                transform;
-               if (((dev->index == 0) && force_composer) ||
-                   ((dev->index == 1) && force_composer_pip))
+               if ((dev->index == 0 && force_composer) ||
+                   (dev->index == 1 && force_composer_pip))
                        need_composer = true;
                if (received_frames->frames_info.frame_info[0].transform) {
                        need_composer = true;
@@ -1109,32 +1215,51 @@ static void video_composer_task(struct composer_dev *dev)
                         dev->index,
                         kfifo_len(&dev->receive_q));
                file_vf = received_frames->file_vf[0];
+               is_dec_vf =
+               is_valid_mod_type(file_vf->private_data, VF_SRC_DECODER);
+               is_v4l_vf =
+               is_valid_mod_type(file_vf->private_data, VF_PROCESS_V4LVIDEO) ||
+                       is_v4lvideo_buf_file(file_vf);
                if (frame_info->type == 0) {
-                       if (is_valid_mod_type(file_vf->private_data,
-                                             VF_SRC_DECODER)) {
-                               vf = dmabuf_get_vframe((struct dma_buf *)
-                                       (file_vf->private_data));
-                       } else {
-                               file_private_data =
-                                       vc_get_file_private(dev, file_vf);
-                               vf = &file_private_data->vf;
+                       if (is_dec_vf || is_v4l_vf)
+                               vf = get_vf_from_file(dev, file_vf);
+                       vc_print(dev->index, PRINT_OTHER,
+                                "%s type 0 is vf\n", __func__);
+                       if (!vf) {
+                               vc_print(dev->index, PRINT_ERROR,
+                                        "%s get vf is NULL\n", __func__);
+                               return;
                        }
-
                        video_wait_decode_fence(dev, vf);
                } else if (frame_info->type == 1) {
-                       if (!kfifo_get(&dev->dma_free_q, &vf)) {
-                               vc_print(dev->index, PRINT_ERROR,
-                                        "task: get dma_free_q failed\n");
-                               return;
+                       if (is_dec_vf || is_v4l_vf) {
+                               vf = get_vf_from_file(dev, file_vf);
+                               vc_print(dev->index, PRINT_OTHER,
+                                        "%s dma is vf\n", __func__);
+                               if (!vf) {
+                                       vc_print(dev->index, PRINT_ERROR,
+                                                "%s get vf is NULL\n",
+                                                __func__);
+                                       return;
+                               }
+                               video_wait_decode_fence(dev, vf);
+                       } else {
+                               vc_print(dev->index, PRINT_OTHER,
+                                        "%s dma buffer not vf\n", __func__);
+                               if (!kfifo_get(&dev->dma_free_q, &vf)) {
+                                       vc_print(dev->index, PRINT_ERROR,
+                                                "task: get dma_free_q failed\n");
+                                       return;
+                               }
+                               memset(vf, 0, sizeof(struct vframe_s));
                        }
-                       memset(vf, 0, sizeof(struct vframe_s));
                }
                if (!kfifo_get(&dev->receive_q, &received_frames)) {
                        vc_print(dev->index, PRINT_ERROR,
                                 "task: get failed\n");
                        return;
                }
-               if (vf == NULL) {
+               if (!vf) {
                        vc_print(dev->index, PRINT_ERROR,
                                 "vf is NULL\n");
                        return;
@@ -1145,7 +1270,8 @@ static void video_composer_task(struct composer_dev *dev)
                vf->axis[3] = frame_info->dst_h + frame_info->dst_y - 1;
                vf->crop[0] = frame_info->crop_y;
                vf->crop[1] = frame_info->crop_x;
-               if (frame_info->type == 0) {
+
+               if (is_dec_vf || is_v4l_vf) {
                        if ((vf->type & VIDTYPE_COMPRESS) != 0) {
                                pic_w = vf->compWidth;
                                pic_h = vf->compHeight;
@@ -1169,13 +1295,15 @@ static void video_composer_task(struct composer_dev *dev)
                                vc_print(dev->index, PRINT_AXIS,
                                        "crop info is error!\n");
                        }
-               } else if (frame_info->type == 1) {
-                       vf->crop[2] = frame_info->buffer_h
-                               - frame_info->crop_h
-                               - frame_info->crop_y;
-                       vf->crop[3] = frame_info->buffer_w
-                               - frame_info->crop_w
-                               - frame_info->crop_x;
+               } else {
+                       if (frame_info->type == 1) {
+                               vf->crop[2] = frame_info->buffer_h
+                                       - frame_info->crop_h
+                                       - frame_info->crop_y;
+                               vf->crop[3] = frame_info->buffer_w
+                                       - frame_info->crop_w
+                                       - frame_info->crop_x;
+                       }
                }
                vf->zorder = frames_info->disp_zorder;
                vf->file_vf = file_vf;
@@ -1185,21 +1313,49 @@ static void video_composer_task(struct composer_dev *dev)
                vf->pts_us64 = time_us64;
                vf->disp_pts = 0;
 
-               if (frame_info->type == 1) {
+               if (frame_info->type == 1 && !(is_dec_vf || is_v4l_vf)) {
                        vf->flag |= VFRAME_FLAG_VIDEO_COMPOSER_DMA;
                        vf->flag |= VFRAME_FLAG_VIDEO_LINEAR;
                        vf->canvas0Addr = -1;
                        vf->canvas0_config[0].phy_addr = phy_addr;
-                       vf->canvas0_config[0].width = (frame_info->buffer_w
-                                                      + 0x1f) & ~0x1f;
-                       vf->canvas0_config[0].height = frame_info->buffer_h;
+                       if (frame_info->buffer_w > frame_info->reserved[0]) {
+                               vf->canvas0_config[0].width =
+                                               frame_info->buffer_w;
+                               vc_print(dev->index, PRINT_PATTERN,
+                                        "buffer_w(%d) > deal_w(%d)\n",
+                                        frame_info->buffer_w,
+                                        frame_info->reserved[0]);
+                       } else {
+                               vf->canvas0_config[0].width =
+                                               frame_info->reserved[0];
+                               vc_print(dev->index, PRINT_PATTERN,
+                                        "buffer_w: %d, deal_w: %d\n",
+                                        frame_info->buffer_w,
+                                        frame_info->reserved[0]);
+                       }
+                       if (frame_info->buffer_h > frame_info->reserved[1]) {
+                               vf->canvas0_config[0].height =
+                                               frame_info->buffer_h;
+                               vc_print(dev->index, PRINT_PATTERN,
+                                        "buffer_h(%d) > deal_h(%d)\n",
+                                        frame_info->buffer_h,
+                                        frame_info->reserved[1]);
+                       } else {
+                               vf->canvas0_config[0].height =
+                                               frame_info->reserved[1];
+                               vc_print(dev->index, PRINT_PATTERN,
+                                        "buffer_h: %d, deal_h: %d\n",
+                                        frame_info->buffer_h,
+                                        frame_info->reserved[1]);
+                       }
                        vf->canvas1Addr = -1;
                        vf->canvas0_config[1].phy_addr = phy_addr
                                + vf->canvas0_config[0].width
                                * vf->canvas0_config[0].height;
-                       vf->canvas0_config[1].width = (frame_info->buffer_w
-                                                      + 0x1f) & ~0x1f;
-                       vf->canvas0_config[1].height = frame_info->buffer_h;
+                       vf->canvas0_config[1].width =
+                               vf->canvas0_config[0].width;
+                       vf->canvas0_config[1].height =
+                               vf->canvas0_config[0].height;
                        vf->width = frame_info->buffer_w;
                        vf->height = frame_info->buffer_h;
                        vf->plane_num = 2;
@@ -1228,7 +1384,8 @@ static void video_composer_task(struct composer_dev *dev)
                         frame_info->crop_h, frame_info->crop_w);
                vc_print(dev->index, PRINT_AXIS,
                         "frame buffer Width X Height: %d X %d\n",
-                        frame_info->buffer_w, frame_info->buffer_h);
+                        vf->canvas0_config[0].width,
+                        vf->canvas0_config[0].height);
                vc_print(dev->index, PRINT_AXIS,
                         "===============================\n");
 
@@ -1246,12 +1403,13 @@ static void video_composer_task(struct composer_dev *dev)
                                vf_ext->zorder = vf->zorder;
                                vf_ext->flag |= VFRAME_FLAG_VIDEO_COMPOSER
                                        | VFRAME_FLAG_VIDEO_COMPOSER_BYPASS;
-                       } else
+                       } else {
                                vc_print(dev->index, PRINT_ERROR,
                                         "vf_ext is null\n");
+                       }
                }
 
-               if (dev->last_file == file_vf && frame_info->type == 0) {
+               if (dev->last_file == file_vf && (is_dec_vf || is_v4l_vf)) {
                        vf->repeat_count[dev->index]++;
                        vc_print(dev->index, PRINT_FENCE,
                                 "repeat =%d, omx_index=%d\n",
@@ -1482,9 +1640,9 @@ static void set_frames_info(struct composer_dev *dev,
        u32 fence_fd;
        int i = 0;
        int j = 0;
+       int type = -1;
        struct file *file_vf = NULL;
        struct vframe_s *vf = NULL;
-       struct file_private_data *file_private_data;
        struct timeval time1;
        struct timeval time2;
        u64 time_us64;
@@ -1492,6 +1650,7 @@ static void set_frames_info(struct composer_dev *dev,
        int axis[4];
        int ready_len = 0;
        bool current_is_sideband = false;
+       bool is_dec_vf = false, is_v4l_vf = false;
        s32 sideband_type = -1;
 
        if (!dev->composer_enabled) {
@@ -1632,29 +1791,42 @@ static void set_frames_info(struct composer_dev *dev,
                }
                total_get_count++;
                dev->received_frames[i].file_vf[j] = file_vf;
-               if (frames_info->frame_info[j].type == 0) {
-                       if (is_valid_mod_type(file_vf->private_data,
-                                             VF_SRC_DECODER)) {
-                               vf = dmabuf_get_vframe((struct dma_buf *)
-                                       (file_vf->private_data));
-                       } else {
-                               file_private_data =
-                                       vc_get_file_private(dev, file_vf);
-                               if (!file_private_data) {
+               type = frames_info->frame_info[j].type;
+               is_dec_vf =
+               is_valid_mod_type(file_vf->private_data, VF_SRC_DECODER);
+               is_v4l_vf =
+               is_valid_mod_type(file_vf->private_data, VF_PROCESS_V4LVIDEO) ||
+                       is_v4lvideo_buf_file(file_vf);
+               if (type == 0 || type == 1) {
+                       vc_print(dev->index, PRINT_FENCE,
+                                "received_cnt=%lld,i=%d,z=%d,DMA_fd=%d\n",
+                                dev->received_count + 1,
+                                i,
+                                frames_info->frame_info[j].zorder,
+                                frames_info->frame_info[j].fd);
+                       if (!(is_dec_vf || is_v4l_vf)) {
+                               if (type == 0) {
                                        vc_print(dev->index, PRINT_ERROR,
-                                                "invalid fd: no uvm, no v4lvideo!!\n");
+                                                "%s type is %d but not vf\n",
+                                                __func__, type);
                                        return;
                                }
-                               vf = &file_private_data->vf;
+                               dev->received_frames[i].phy_addr[j] =
+                               get_dma_phy_addr(frames_info->frame_info[j].fd,
+                                                dev->index);
+                               vc_print(dev->index, PRINT_OTHER,
+                                        "%s dma buffer not vf\n", __func__);
+                               continue;
                        }
+                       vf = get_vf_from_file(dev, file_vf);
+                       vc_print(dev->index, PRINT_OTHER,
+                                "%s type is %d and get vf\n",
+                                __func__, type);
 
-                       if (vf && dev->index == 0) {
-                               drop_cnt = vf->omx_index - dev->received_count;
-                               receive_count = dev->received_count;
-                       } else if (vf && dev->index == 1) {
-                               drop_cnt_pip = vf->omx_index
-                                       - dev->received_count;
-                               receive_count_pip = dev->received_count;
+                       if (!vf) {
+                               vc_print(dev->index, PRINT_ERROR,
+                                        "received NULL vf!!\n");
+                               return;
                        }
                        vc_print(dev->index, PRINT_FENCE | PRINT_PATTERN,
                                 "received_cnt=%lld,i=%d,z=%d,omx_index=%d, fence_fd=%d, fc_no=%d, index_disp=%d,pts=%lld\n",
@@ -1666,17 +1838,9 @@ static void set_frames_info(struct composer_dev *dev,
                                 dev->cur_streamline_val,
                                 vf->index_disp,
                                 vf->pts_us64);
+#ifdef CONFIG_AMLOGIC_DEBUG_ATRACE
                        ATRACE_COUNTER("video_composer", vf->index_disp);
-               } else if (frames_info->frame_info[j].type == 1) {
-                       vc_print(dev->index, PRINT_FENCE,
-                                "received_cnt=%lld,i=%d,z=%d,DMA_fd=%d\n",
-                                dev->received_count + 1,
-                                i,
-                                frames_info->frame_info[j].zorder,
-                                frames_info->frame_info[j].fd);
-                       dev->received_frames[i].phy_addr[j] =
-                       get_dma_phy_addr(frames_info->frame_info[j].fd,
-                                        dev->index);
+#endif
                } else {
                        vc_print(dev->index, PRINT_ERROR,
                                 "unsupport type=%d\n",
index 030e425ee8ce04903e53c898e6e7a53946d26c82..5b973d8f387c298c47ded223ac9e05ca9e820e10 100644 (file)
@@ -134,6 +134,7 @@ enum uvm_hook_mod_type {
        VF_PROCESS_V4LVIDEO,
        VF_PROCESS_DI,
        VF_PROCESS_VIDEOCOMPOSER,
+       VF_PROCESS_DECODER
 };
 
 /**