From 1d2569d954cac81f4aec51a583886c28ae63b7cd Mon Sep 17 00:00:00 2001 From: Yong Qin Date: Fri, 31 May 2019 10:29:33 +0800 Subject: [PATCH] vdin: Flash blurre screen when change hdmi 4k timing [1/1] PD#SWPL-8153 Problem: Flash blurre screen when change all 4K format Solution: if no video buffer resouce, needn't set afbce regiter when need switch afbc mode. Verify: tl1 Change-Id: Ifb867cdeda2b6d3536246b79531a5bf9027e01a1 Signed-off-by: Yong Qin --- MAINTAINERS | 4 ++ drivers/amlogic/media/vin/tvin/vdin/vdin_debug.c | 1 + drivers/amlogic/media/vin/tvin/vdin/vdin_drv.c | 9 ++- drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h | 4 +- drivers/amlogic/media/vin/tvin/vdin/vdin_trace.h | 78 ++++++++++++++++++++++++ 5 files changed, 89 insertions(+), 7 deletions(-) create mode 100644 drivers/amlogic/media/vin/tvin/vdin/vdin_trace.h diff --git a/MAINTAINERS b/MAINTAINERS index ea44e65..144d8b0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14725,6 +14725,10 @@ M: Xuhua Zhang F: drivers/amlogic/media/vin/tvin/vdin/vdin_afbce.c F: drivers/amlogic/media/vin/tvin/vdin/vdin_afbce.h +AMLOGIC VDIN DRIVERS +M: Yong Qin +F: drivers/amlogic/media/vin/tvin/vdin/vdin_trace.h + AMLOGIC MESONAXG S400 DTS M: Yuegui He F: arch/arm64/boot/dts/amlogic/axg_s400_v03.dts diff --git a/drivers/amlogic/media/vin/tvin/vdin/vdin_debug.c b/drivers/amlogic/media/vin/tvin/vdin/vdin_debug.c index 475106b..515d985 100644 --- a/drivers/amlogic/media/vin/tvin/vdin/vdin_debug.c +++ b/drivers/amlogic/media/vin/tvin/vdin/vdin_debug.c @@ -808,6 +808,7 @@ static void vdin_dump_state(struct vdin_dev_s *devp) pr_info("vdin_irq_flag: %d, vdin_rest_flag: %d, irq_cnt: %d, rdma_irq_cnt: %d\n", devp->vdin_irq_flag, devp->vdin_reset_flag, devp->irq_cnt, devp->rdma_irq_cnt); + pr_info("vdin_drop_cnt: %d\n", vdin_drop_cnt); pr_info("game_mode : %d\n", devp->game_mode); pr_info("dolby_input : %d\n", devp->dv.dolby_input); if ((devp->cma_config_en != 1) || !(devp->cma_config_flag & 0x100)) diff --git a/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.c b/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.c index d421deb..2154233 100644 --- a/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.c +++ b/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.c @@ -149,7 +149,7 @@ static unsigned int isr_flag; module_param(isr_flag, uint, 0664); MODULE_PARM_DESC(isr_flag, "flag which affect the skip field"); -static unsigned int vdin_drop_cnt; +unsigned int vdin_drop_cnt; module_param(vdin_drop_cnt, uint, 0664); MODULE_PARM_DESC(vdin_drop_cnt, "vdin_drop_cnt"); @@ -1430,9 +1430,7 @@ irqreturn_t vdin_isr(int irq, void *dev_id) * this code about system time must be outside of spinlock. * because the spinlock may affect the system time. */ - spin_lock_irqsave(&devp->isr_lock, flags); - if (devp->afbce_mode == 1) { /* no need reset mif under afbc mode */ devp->vdin_reset_flag = 0; @@ -1599,8 +1597,10 @@ irqreturn_t vdin_isr(int irq, void *dev_id) curr_wr_vfe = devp->curr_wr_vfe; curr_wr_vf = &curr_wr_vfe->vf; + next_wr_vfe = provider_vf_peek(devp->vfp); + /* change afbce mode */ - if (devp->afbce_mode_pre != devp->afbce_mode) + if (next_wr_vfe && (devp->afbce_mode_pre != devp->afbce_mode)) vdin_afbce_mode_update(devp); /* change color matrix */ @@ -1707,7 +1707,6 @@ irqreturn_t vdin_isr(int irq, void *dev_id) goto irq_handled; } - next_wr_vfe = provider_vf_peek(devp->vfp); if (!next_wr_vfe) { /*add for force vdin buffer recycle*/ if (devp->flags & VDIN_FLAG_FORCE_RECYCLE) { diff --git a/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h b/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h index c8bc046..11dde0c 100644 --- a/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h +++ b/drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h @@ -48,7 +48,7 @@ /* Ref.2019/04/25: tl1 vdin0 afbce dynamically switch support, * vpp also should support this function */ -#define VDIN_VER "Ref.2019/05/14" +#define VDIN_VER "Ref.2019/05/31" /*the counter of vdin*/ #define VDIN_MAX_DEVS 2 @@ -412,7 +412,7 @@ struct vdin_v4l2_param_s { extern unsigned int max_recycle_frame_cnt; extern unsigned int max_ignore_frame_cnt; extern unsigned int skip_frame_debug; - +extern unsigned int vdin_drop_cnt; extern unsigned int vdin0_afbce_debug_force; extern struct vframe_provider_s *vf_get_provider_by_name( diff --git a/drivers/amlogic/media/vin/tvin/vdin/vdin_trace.h b/drivers/amlogic/media/vin/tvin/vdin/vdin_trace.h new file mode 100644 index 0000000..3cdefc4 --- /dev/null +++ b/drivers/amlogic/media/vin/tvin/vdin/vdin_trace.h @@ -0,0 +1,78 @@ +/* + * drivers/amlogic/media/vin/tvin/vdin/vdin_trace.h + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM vdin + +#if !defined(_VDIN_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _VDIN_TRACE_H + +#include + +/* single lifecycle events */ +DECLARE_EVENT_CLASS(vdin_event_class, + TP_PROTO(const char *name, int field_cnt, unsigned long time), + TP_ARGS(name, field_cnt, time), + TP_STRUCT__entry( + __string(name, name) + __field(int, field_cnt) + __field(unsigned long, time) + ), + TP_fast_assign( + __assign_str(name, name); + __entry->field_cnt = field_cnt; + __entry->time = time; + ), + TP_printk("[%s-%dth-%lums]", __get_str(name), + __entry->field_cnt, __entry->time) +); + +#define DEFINE_VDIN_EVENT(name) \ +DEFINE_EVENT(vdin_event_class, name, \ + TP_PROTO(const char *name, int field_cnt, unsigned long time), \ + TP_ARGS(name, field_cnt, time)) + +DEFINE_VDIN_EVENT(vdin_afbc); +#endif /* _VDEC_TRACE_H */ + +#if 0 +#define CREATE_TRACE_POINTS +#include "vdin_trace.h" +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH . +#define TRACE_INCLUDE_FILE vdin_trace +#include + +#define VDIN_TRACE +#ifdef VDIN_TRACE +trace_vdin_afbc("vdin-afbc", devp->afbce_mode, devp->frame_cnt); +#endif + +#endif + +/* + * a. clear pipe + * cat /sys/kernel/debug/tracing/trace_pipe + * b. enable trace di: + * echo 1 >/sys/kernel/debug/tracing/events/vdin/vdin_afbc/enable + * echo 1 >/sys/kernel/debug/tracing/tracing_on + * c. disable trace + * echo 0 >/sys/kernel/debug/tracing/tracing_on + * cat /sys/kernel/debug/tracing/trace_pipe + */ + -- 2.7.4