vpp: create a variable for cm input size [1/2]
authorBrian Zhu <brian.zhu@amlogic.com>
Wed, 29 May 2019 09:44:03 +0000 (17:44 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 4 Jun 2019 02:23:19 +0000 (19:23 -0700)
PD#TV-5968

Problem:
Too many case for cm input size with differnet chips.
SR0+SR1+PPS.

Solution:
Add a variable to indicate the cm input size.

Verify:
on r311

Change-Id: I5f1024340c67edbdf646c1b5bb7cad95b93b7b92
Signed-off-by: Brian Zhu <brian.zhu@amlogic.com>
drivers/amlogic/media/video_sink/vpp.c
include/linux/amlogic/media/video_sink/vpp.h

index 63ef98a..c1c4ef2 100644 (file)
@@ -2268,6 +2268,31 @@ static void vpp_set_super_scaler(
                        next_frame_par->sr0_position = 1;
                        next_frame_par->sr1_position = 1;
                }
+               if (next_frame_par->sr1_position) {
+                       /* sr core 1 output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->spsc1_w_in <<
+                               next_frame_par->supsc1_hori_ratio;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->spsc1_h_in <<
+                               next_frame_par->supsc1_vert_ratio;
+               } else if (!next_frame_par->sr0_position) {
+                       /* sr core 0 output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->spsc0_w_in <<
+                               next_frame_par->supsc0_hori_ratio;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->spsc0_h_in <<
+                               next_frame_par->supsc0_vert_ratio;
+               } else {
+                       /* pps output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->VPP_hsc_endp -
+                               next_frame_par->VPP_hsc_startp + 1;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->VPP_vsc_endp -
+                               next_frame_par->VPP_vsc_startp + 1;
+               }
        } else if (is_meson_txhd_cpu()
                || is_meson_g12a_cpu()
                || is_meson_g12b_cpu()
@@ -2279,6 +2304,23 @@ static void vpp_set_super_scaler(
                else
                        next_frame_par->sr0_position = 1;
                next_frame_par->sr1_position = 0;
+               if (!next_frame_par->sr0_position) {
+                       /* sr core 0 output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->spsc0_w_in <<
+                               next_frame_par->supsc0_hori_ratio;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->spsc0_h_in <<
+                               next_frame_par->supsc0_vert_ratio;
+               } else {
+                       /* pps output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->VPP_hsc_endp -
+                               next_frame_par->VPP_hsc_startp + 1;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->VPP_vsc_endp -
+                               next_frame_par->VPP_vsc_startp + 1;
+               }
        } else if (is_meson_gxlx_cpu()) {
                if (sr_path == CORE1_BEFORE_PPS)
                        next_frame_par->sr1_position = 1;
@@ -2287,6 +2329,23 @@ static void vpp_set_super_scaler(
                else
                        next_frame_par->sr1_position = 1;
                next_frame_par->sr0_position = 0;
+               if (!next_frame_par->sr1_position) {
+                       /* sr core 1 output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->spsc1_w_in <<
+                               next_frame_par->supsc1_hori_ratio;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->spsc1_h_in <<
+                               next_frame_par->supsc1_vert_ratio;
+               } else {
+                       /* pps output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->VPP_hsc_endp -
+                               next_frame_par->VPP_hsc_startp + 1;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->VPP_vsc_endp -
+                               next_frame_par->VPP_vsc_startp + 1;
+               }
        } else if (is_meson_txlx_cpu()
                || is_meson_txl_cpu()
                || is_meson_gxtvbb_cpu()) {
@@ -2301,6 +2360,23 @@ static void vpp_set_super_scaler(
                        next_frame_par->sr0_position = 1;
                        next_frame_par->sr1_position = 1;
                }
+               if (next_frame_par->sr1_position) {
+                       /* sr core 1 output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->spsc1_w_in <<
+                               next_frame_par->supsc1_hori_ratio;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->spsc1_h_in <<
+                               next_frame_par->supsc1_vert_ratio;
+               } else {
+                       /* pps output */
+                       next_frame_par->cm_input_w =
+                               next_frame_par->VPP_hsc_endp -
+                               next_frame_par->VPP_hsc_startp + 1;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->VPP_vsc_endp -
+                               next_frame_par->VPP_vsc_startp + 1;
+               }
        }
 
        if (super_debug) {
@@ -2323,6 +2399,11 @@ static void vpp_set_super_scaler(
                         next_frame_par->VPP_hsc_linear_endp,
                         next_frame_par->VPP_vsc_startp,
                         next_frame_par->VPP_vsc_endp);
+               pr_info("layer0: cm_input_w=%u, cm_input_h=%u, sr0_position=%u, sr1_position=%u.\n",
+                       next_frame_par->cm_input_w,
+                       next_frame_par->cm_input_h,
+                       next_frame_par->sr0_position,
+                       next_frame_par->sr1_position);
        }
 }
 
@@ -3154,12 +3235,28 @@ int vpp_set_filters(
        if (ret == VppFilter_Changed_but_Hold)
                bypass_sr = true;
        /*config super scaler after set next_frame_par is calc ok for pps*/
-       if (local_input.layer_id == 0)
+       if (local_input.layer_id == 0) {
                vpp_set_super_scaler(
                        wide_mode,
                        vinfo, next_frame_par,
                        (bypass_sr | bypass_spscl0),
                        (bypass_sr | bypass_spscl1));
+               /* cm input size will be set in super scaler function */
+       } else {
+               if (local_input.pps_support) {
+                       next_frame_par->cm_input_w =
+                               next_frame_par->VPP_hsc_endp
+                               - next_frame_par->VPP_hsc_startp + 1;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->VPP_vsc_endp
+                               - next_frame_par->VPP_vsc_startp + 1;
+               } else {
+                       next_frame_par->cm_input_w =
+                               next_frame_par->video_input_w;
+                       next_frame_par->cm_input_h =
+                               next_frame_par->video_input_h;
+               }
+       }
        return ret;
 }
 
index d33a3ea..95088bb 100644 (file)
@@ -149,6 +149,8 @@ struct vpp_frame_par_s {
        u32 spsc1_h_in;
        u32 video_input_w;
        u32 video_input_h;
+       u32 cm_input_w;
+       u32 cm_input_h;
        u32 clk_in_pps;
 
        bool nocomp;