di: fix dumy buffer dismatch with normal buffer
authorkele bai <kele.bai@amlogic.com>
Fri, 16 Mar 2018 02:11:19 +0000 (10:11 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 19 Mar 2018 04:38:34 +0000 (20:38 -0800)
PD#161859: di: fix dummy buffer dismatch with normal buffer

1) fix dummy buffer dismatch with normal buffer
2) add debug print support

Change-Id: I304f93f4ef7883928fbd9fa237fb2dfd24ef557a
Signed-off-by: kele bai <kele.bai@amlogic.com>
drivers/amlogic/media/deinterlace/Makefile
drivers/amlogic/media/deinterlace/deinterlace.c

index 1e2e5de..04ce7e8 100644 (file)
@@ -1,6 +1,9 @@
 # # Makefile for the Post Process Manager device #
 ifeq ($(TARGET_BUILD_VARIANT),userdebug)
 ccflags-y := -D DEBUG_SUPPORT
+ccflags-y := -DDEBUG
+else
+ccflags-y := -DDEBUG
 endif
 CFLAGS_deinterlace.o := -I$(src)
 obj-$(CONFIG_AMLOGIC_MEDIA_DEINTERLACE) += di.o
index fb4b427..5441639 100644 (file)
@@ -1273,6 +1273,7 @@ store_dump_mem(struct device *dev, struct device_attribute *attr,
 #define is_from_vdin(vframe) (vframe->type & VIDTYPE_VIU_422)
 static void recycle_vframe_type_pre(struct di_buf_s *di_buf);
 static void recycle_vframe_type_post(struct di_buf_s *di_buf);
+static void add_dummy_vframe_type_pre(struct di_buf_s *src_buf);
 #ifdef DI_BUFFER_DEBUG
 static void
 recycle_vframe_type_post_print(struct di_buf_s *di_buf,
@@ -2987,29 +2988,7 @@ static void pre_de_done_buf_config(void)
 
                        if (di_pre_stru.source_change_flag) {
                                /* add dummy buf, will not be displayed */
-                               if (!queue_empty(QUEUE_LOCAL_FREE)) {
-                                       struct di_buf_s *di_buf_tmp;
-
-                                       di_buf_tmp =
-                                       get_di_buf_head(QUEUE_LOCAL_FREE);
-                                       if (di_buf_tmp) {
-                                               queue_out(di_buf_tmp);
-                                               di_buf_tmp->pre_ref_count = 0;
-                                               di_buf_tmp->post_ref_count = 0;
-                                               di_buf_tmp->post_proc_flag = 3;
-                                               di_buf_tmp->new_format_flag = 0;
-                                               queue_in(
-                                                       di_buf_tmp,
-                                                       QUEUE_PRE_READY);
-#ifdef DI_BUFFER_DEBUG
-                                       di_print(
-                                       "%s: dummy %s[%d] => pre_ready_list\n",
-                                       __func__,
-                                       vframe_type_name[di_buf_tmp->type],
-                                       di_buf_tmp->index);
-#endif
-                                       }
-                               }
+                               add_dummy_vframe_type_pre(post_wr_buf);
                        }
                        di_pre_stru.di_wr_buf->seq =
                                di_pre_stru.pre_ready_seq++;
@@ -3094,6 +3073,34 @@ static void recycle_vframe_type_pre(struct di_buf_s *di_buf)
        di_unlock_irqfiq_restore(irq_flag2);
 }
 /*
+ * add dummy buffer to pre ready queue
+ */
+static void add_dummy_vframe_type_pre(struct di_buf_s *src_buf)
+{
+       struct di_buf_s *di_buf_tmp = NULL;
+
+       if (!queue_empty(QUEUE_LOCAL_FREE)) {
+               di_buf_tmp = get_di_buf_head(QUEUE_LOCAL_FREE);
+               if (di_buf_tmp) {
+                       queue_out(di_buf_tmp);
+                       di_buf_tmp->pre_ref_count = 0;
+                       di_buf_tmp->post_ref_count = 0;
+                       di_buf_tmp->post_proc_flag = 3;
+                       di_buf_tmp->new_format_flag = 0;
+                       if (!IS_ERR_OR_NULL(src_buf))
+                               memcpy(di_buf_tmp->vframe, src_buf->vframe,
+                                       sizeof(vframe_t));
+                       queue_in(di_buf_tmp, QUEUE_PRE_READY);
+                       #ifdef DI_BUFFER_DEBUG
+                       di_print("%s: dummy %s[%d] => pre_ready_list\n",
+                               __func__,
+                               vframe_type_name[di_buf_tmp->type],
+                               di_buf_tmp->index);
+                       #endif
+               }
+       }
+}
+/*
  * it depend on local buffer queue type is 2
  */
 static int peek_free_linked_buf(void)