video: timming gets error when switching channels [1/1]
authorXiaoming Sui <xiaoming.sui@amlogic.com>
Mon, 11 Mar 2019 09:03:06 +0000 (17:03 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 18 Mar 2019 01:59:37 +0000 (17:59 -0800)
PD#TV-3062

Problem:
When switching channels, Hisense platform needs hold video,
and the timming obtained at this time is wrong

Solution:
because we have add hold video function, so get width and
height interface give the last video frame width and height,
and so on change the video

Verify:
X301

Change-Id: I331a4589dcb5f5785dce7eea6d8cd03c92d733d2
Signed-off-by: Xiaoming Sui <xiaoming.sui@amlogic.com>
drivers/amlogic/media/video_sink/video.c

index 46f3636..79a0a96 100644 (file)
@@ -213,6 +213,9 @@ static int _videopip_set_disable(u32 val);
 static struct device *amvideo_dev;
 static struct device *amvideo_poll_dev;
 
+static u32 cur_width;
+static u32 cur_height;
+
 #define DRIVER_NAME "amvideo"
 #define MODULE_NAME "amvideo"
 #define DEVICE_NAME "amvideo"
@@ -3674,6 +3677,13 @@ static void vsync_toggle_frame(struct vframe_s *vf, int line)
                                        timestamp_vpts_inc(-1);
                                }
                        }
+                       if (vf->type & VIDTYPE_COMPRESS) {
+                               cur_width = vf->compWidth;
+                               cur_height = vf->compHeight;
+                       } else {
+                               cur_width = vf->width;
+                               cur_height = vf->height;
+                       }
                        video_vf_put(vf);
                        ATRACE_COUNTER(__func__,  __LINE__);
                        return;
@@ -10591,7 +10601,8 @@ static ssize_t video_hold_store(struct class *cla,
                                   const char *buf, size_t count)
 {
        int r;
-
+       cur_width = 0;
+       cur_height = 0;
        if (debug_flag & DEBUG_FLAG_BLACKOUT)
                pr_info("%s(%s)\n", __func__, buf);
 
@@ -10756,6 +10767,8 @@ static ssize_t frame_width_show(struct class *cla,
                        struct class_attribute *attr,
                        char *buf)
 {
+       if (hold_video == 1)
+               return sprintf(buf, "%d\n", cur_width);
        if (cur_dispbuf) {
                if (cur_dispbuf->type & VIDTYPE_COMPRESS)
                        return sprintf(buf, "%d\n", cur_dispbuf->compWidth);
@@ -10769,6 +10782,8 @@ static ssize_t frame_width_show(struct class *cla,
 static ssize_t frame_height_show(struct class *cla,
                                 struct class_attribute *attr, char *buf)
 {
+       if (hold_video == 1)
+               return sprintf(buf, "%d\n", cur_height);
        if (cur_dispbuf) {
                if (cur_dispbuf->type & VIDTYPE_COMPRESS)
                        return sprintf(buf, "%d\n", cur_dispbuf->compHeight);