From d6d0364d591aaad8ea00258d65864a8c6442767b Mon Sep 17 00:00:00 2001 From: Chen Shunqing Date: Sat, 19 Mar 2022 11:20:47 +0800 Subject: [PATCH] media: rockchip: hdmirx: filter the abnormal frames If the color is YUV format, when resume or change resolution or plugin, the first few frames of DMA is zero, Cause green screen display. Signed-off-by: Chen Shunqing Change-Id: I8084e1c0b3c9b0e763fa8aae24994da6875b2f32 --- drivers/media/platform/rockchip/hdmirx/rk_hdmirx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/rockchip/hdmirx/rk_hdmirx.c b/drivers/media/platform/rockchip/hdmirx/rk_hdmirx.c index 192e32e3a103..3718e594252a 100644 --- a/drivers/media/platform/rockchip/hdmirx/rk_hdmirx.c +++ b/drivers/media/platform/rockchip/hdmirx/rk_hdmirx.c @@ -61,6 +61,7 @@ MODULE_PARM_DESC(debug, "debug level (0-3)"); #define HDMIRX_PLANE_CBCR 1 #define INIT_FIFO_STATE 64 #define RK_IRQ_HDMIRX_HDMI 210 +#define FILTER_FRAME_CNT 6 #define is_validfs(x) (x == 32000 || \ x == 44100 || \ @@ -2066,6 +2067,9 @@ static void dma_idle_int_handler(struct rk_hdmirx_dev *hdmirx_dev, bool *handled v4l2_dbg(1, debug, v4l2_dev, "%s: last time have no line_flag_irq\n", __func__); + if (stream->line_flag_int_cnt <= FILTER_FRAME_CNT) + goto DMA_IDLE_OUT; + if ((bt->interlaced != V4L2_DV_INTERLACED) || (stream->line_flag_int_cnt % 2 == 0)) { if (stream->next_buf) { @@ -2090,6 +2094,7 @@ static void dma_idle_int_handler(struct rk_hdmirx_dev *hdmirx_dev, bool *handled } } +DMA_IDLE_OUT: *handled = true; } @@ -2111,6 +2116,9 @@ static void line_flag_int_handler(struct rk_hdmirx_dev *hdmirx_dev, bool *handle goto LINE_FLAG_OUT; } + if (stream->line_flag_int_cnt <= FILTER_FRAME_CNT) + goto LINE_FLAG_OUT; + if ((bt->interlaced != V4L2_DV_INTERLACED) || (stream->line_flag_int_cnt % 2 == 0)) { if (!stream->next_buf) {