From 4d3139f1dddf7f418631327f7afc3ac3c25feb54 Mon Sep 17 00:00:00 2001 From: rongrong zhou Date: Wed, 4 Dec 2019 15:04:22 +0800 Subject: [PATCH] v4l2: drop frames [1/3] PD#SWPL-17328 Problem: drop frames Solution: 1. add trace for debug 2. less than 256K, do not use codec_mm allocation 3. osd fence crash Verify: local Change-Id: I3df0a1532b920570365e66cc48d81253831897c0 Signed-off-by: rongrong zhou --- drivers/amlogic/debug/meson_atrace.c | 2 ++ drivers/amlogic/media/osd/osd_hw.c | 3 +++ .../video_processor/video_composer/video_composer.c | 13 ++++++++++--- drivers/staging/android/ion/ion.c | 3 +++ include/trace/events/meson_atrace.h | 2 ++ 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/amlogic/debug/meson_atrace.c b/drivers/amlogic/debug/meson_atrace.c index 28fe0694e177..f43c89a2399d 100644 --- a/drivers/amlogic/debug/meson_atrace.c +++ b/drivers/amlogic/debug/meson_atrace.c @@ -34,6 +34,8 @@ struct { TAG_INFO(TSYNC), TAG_INFO(IONVIDEO), TAG_INFO(AMLVIDEO), + TAG_INFO(VIDEO_COMPOSER), + TAG_INFO(V4L2), { NULL, 0 } }; diff --git a/drivers/amlogic/media/osd/osd_hw.c b/drivers/amlogic/media/osd/osd_hw.c index 66c6b5d4c647..727773fa75b6 100644 --- a/drivers/amlogic/media/osd/osd_hw.c +++ b/drivers/amlogic/media/osd/osd_hw.c @@ -1530,6 +1530,9 @@ static int osd_wait_buf_ready_combine(struct layer_fence_map_s *layer_map) if (layer_map->in_fd <= 0) return -1; buf_ready_fence = layer_map->in_fence; + if (buf_ready_fence == NULL) { + return -1;/* no fence ,output directly. */ + } ret = osd_wait_fenceobj(buf_ready_fence, 4000); if (ret < 0) osd_log_err("osd%d: Sync Fence wait error:%d\n", diff --git a/drivers/amlogic/media/video_processor/video_composer/video_composer.c b/drivers/amlogic/media/video_processor/video_composer/video_composer.c index 7520e317491d..a4bef7f2f57d 100644 --- a/drivers/amlogic/media/video_processor/video_composer/video_composer.c +++ b/drivers/amlogic/media/video_processor/video_composer/video_composer.c @@ -30,6 +30,9 @@ #include #include "video_composer.h" +#define KERNEL_ATRACE_TAG KERNEL_ATRACE_TAG_VIDEO_COMPOSER +#include + #define VIDEO_COMPOSER_VERSION "1.0" #define VIDEO_COMPOSER_NAME_SIZE 32 @@ -114,6 +117,7 @@ static struct class video_composer_class = { #define PRINT_FENCE 0X0002 #define PRINT_PERFORMANCE 0X0004 #define PRINT_OTHER 0X0008 +#define PRINT_INDEX_DISP 0X0010 #define to_dst_buf(vf) \ container_of(vf, struct dst_buf_t, frame) @@ -1398,12 +1402,15 @@ static void set_frames_info(struct composer_dev *dev, file_private_data = (struct file_private_data *)(file_vf->private_data); vf = &file_private_data->vf; - vc_print(dev->index, PRINT_OTHER, - "received_cnt=%lld,i=%d,z=%d,omx_index=%d\n", + vc_print(dev->index, PRINT_INDEX_DISP, + "received_cnt=%lld,i=%d,z=%d,omx_index=%d, fence_fd=%d, index_disp=%d\n", dev->received_count + 1, i, frames_info->frame_info[j].zorder, - vf->omx_index); + vf->omx_index, + fence_fd, + vf->index_disp); + ATRACE_COUNTER("video_composer", vf->index_disp); } else if (frames_info->frame_info[j].type == 1) { vc_print(dev->index, PRINT_OTHER, "received_cnt=%lld,i=%d,z=%d,DMA_fd=%d\n", diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 6e2fbfc07d7d..ab0b40f7aace 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c @@ -432,6 +432,9 @@ struct ion_handle *ion_alloc(struct ion_client *client, size_t len, /* if the caller didn't specify this heap id */ if (!((1 << heap->id) & heap_id_mask)) continue; + if (len < SZ_256K && heap->id == ION_HEAP_TYPE_CUSTOM && + heap_id_mask == -1) + continue; buffer = ion_buffer_create(heap, dev, len, align, flags); if (!IS_ERR(buffer)) break; diff --git a/include/trace/events/meson_atrace.h b/include/trace/events/meson_atrace.h index ec5d50255c95..cb277a4f28d6 100644 --- a/include/trace/events/meson_atrace.h +++ b/include/trace/events/meson_atrace.h @@ -44,6 +44,8 @@ enum { KERNEL_ATRACE_TAG_TSYNC, KERNEL_ATRACE_TAG_IONVIDEO, KERNEL_ATRACE_TAG_AMLVIDEO, + KERNEL_ATRACE_TAG_VIDEO_COMPOSER, + KERNEL_ATRACE_TAG_V4L2, KERNEL_ATRACE_TAG_MAX = 64, KERNEL_ATRACE_TAG_ALL }; -- 2.20.1