ge2d: enhanced hsc adv num
authorzhilei.wu <zhilei.wu@amlogic.com>
Thu, 7 Jun 2018 11:10:14 +0000 (19:10 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Fri, 29 Jun 2018 07:35:05 +0000 (00:35 -0700)
PD#165090: ge2d: enhanced hsc adv num

Change-Id: Ib4026d6883e70ddf38ab4d093fd37827b98f6c5e
Signed-off-by: zhilei.wu <zhilei.wu@amlogic.com>
drivers/amlogic/media/common/ge2d/bitblt.c
drivers/amlogic/media/common/ge2d/blend.c
drivers/amlogic/media/common/ge2d/fillrect.c
drivers/amlogic/media/common/ge2d/ge2d_hw.c
drivers/amlogic/media/common/ge2d/stretchblt.c
include/linux/amlogic/media/ge2d/ge2d.h

index 58655c5cd6934f1571c8b9ad3a361e556ce97563..06363531b7d7f3a46fa8e490992b0d0d2adcb17c 100644 (file)
@@ -39,6 +39,7 @@ static void _bitblt(struct ge2d_context_s *wq,
        ge2d_cmd_cfg->hsc_rpt_p0_num = 0;
        ge2d_cmd_cfg->vsc_rpt_l0_num = 0;
        ge2d_cmd_cfg->hsc_div_en = 0;
+       ge2d_cmd_cfg->hsc_adv_num = 0;
 
        ge2d_cmd_cfg->color_blend_mode = OPERATION_LOGIC;
        ge2d_cmd_cfg->color_logic_op   = LOGIC_OPERATION_COPY;
@@ -75,6 +76,7 @@ static void _bitblt_noalpha(struct ge2d_context_s *wq,
        ge2d_cmd_cfg->hsc_rpt_p0_num = 0;
        ge2d_cmd_cfg->vsc_rpt_l0_num = 0;
        ge2d_cmd_cfg->hsc_div_en = 0;
+       ge2d_cmd_cfg->hsc_adv_num = 0;
 
        ge2d_cmd_cfg->color_blend_mode = OPERATION_LOGIC;
        ge2d_cmd_cfg->color_logic_op   = LOGIC_OPERATION_COPY;
index c75ac3af001a7b1a5835dd811e13a3cc423196c3..0f3c3840c0dcfa2fce67f376b543ccfd138c2975 100644 (file)
@@ -51,12 +51,19 @@ void blend(struct ge2d_context_s *wq,
                ge2d_cmd_cfg->hsc_rpt_p0_num = 1;
                ge2d_cmd_cfg->vsc_rpt_l0_num = 1;
                ge2d_cmd_cfg->hsc_div_en = 1;
+#ifdef CONFIG_GE2D_ADV_NUM
+               ge2d_cmd_cfg->hsc_adv_num =
+                       ((dst_w - 1) < 1024) ? (dst_w - 1) : 0;
+#else
+               ge2d_cmd_cfg->hsc_adv_num = 0;
+#endif
        } else {
                ge2d_cmd_cfg->sc_hsc_en = 0;
                ge2d_cmd_cfg->sc_vsc_en = 0;
                ge2d_cmd_cfg->hsc_rpt_p0_num = 0;
                ge2d_cmd_cfg->vsc_rpt_l0_num = 0;
                ge2d_cmd_cfg->hsc_div_en = 0;
+               ge2d_cmd_cfg->hsc_adv_num = 0;
        }
 
        ge2d_cmd_cfg->color_blend_mode = (op >> 24) & 0xff;
@@ -115,12 +122,19 @@ void blend_noblk(struct ge2d_context_s *wq,
                ge2d_cmd_cfg->hsc_rpt_p0_num = 1;
                ge2d_cmd_cfg->vsc_rpt_l0_num = 1;
                ge2d_cmd_cfg->hsc_div_en = 1;
+#ifdef CONFIG_GE2D_ADV_NUM
+               ge2d_cmd_cfg->hsc_adv_num =
+                       ((dst_w - 1) < 1024) ? (dst_w - 1) : 0;
+#else
+               ge2d_cmd_cfg->hsc_adv_num = 0;
+#endif
        } else {
                ge2d_cmd_cfg->sc_hsc_en = 0;
                ge2d_cmd_cfg->sc_vsc_en = 0;
                ge2d_cmd_cfg->hsc_rpt_p0_num = 0;
                ge2d_cmd_cfg->vsc_rpt_l0_num = 0;
                ge2d_cmd_cfg->hsc_div_en = 0;
+               ge2d_cmd_cfg->hsc_adv_num = 0;
        }
 
        ge2d_cmd_cfg->color_blend_mode = (op >> 24) & 0xff;
@@ -177,12 +191,19 @@ void blend_noalpha(struct ge2d_context_s *wq,
                ge2d_cmd_cfg->hsc_rpt_p0_num = 1;
                ge2d_cmd_cfg->vsc_rpt_l0_num = 1;
                ge2d_cmd_cfg->hsc_div_en = 1;
+#ifdef CONFIG_GE2D_ADV_NUM
+               ge2d_cmd_cfg->hsc_adv_num =
+                       ((dst_w - 1) < 1024) ? (dst_w - 1) : 0;
+#else
+               ge2d_cmd_cfg->hsc_adv_num = 0;
+#endif
        } else {
                ge2d_cmd_cfg->sc_hsc_en = 0;
                ge2d_cmd_cfg->sc_vsc_en = 0;
                ge2d_cmd_cfg->hsc_rpt_p0_num = 0;
                ge2d_cmd_cfg->vsc_rpt_l0_num = 0;
                ge2d_cmd_cfg->hsc_div_en = 0;
+               ge2d_cmd_cfg->hsc_adv_num = 0;
        }
 
        ge2d_cmd_cfg->color_blend_mode = (op >> 24) & 0xff;
@@ -238,12 +259,19 @@ void blend_noalpha_noblk(struct ge2d_context_s *wq,
                ge2d_cmd_cfg->hsc_rpt_p0_num = 1;
                ge2d_cmd_cfg->vsc_rpt_l0_num = 1;
                ge2d_cmd_cfg->hsc_div_en = 1;
+#ifdef CONFIG_GE2D_ADV_NUM
+               ge2d_cmd_cfg->hsc_adv_num =
+                       ((dst_w - 1) < 1024) ? (dst_w - 1) : 0;
+#else
+               ge2d_cmd_cfg->hsc_adv_num = 0;
+#endif
        } else {
                ge2d_cmd_cfg->sc_hsc_en = 0;
                ge2d_cmd_cfg->sc_vsc_en = 0;
                ge2d_cmd_cfg->hsc_rpt_p0_num = 0;
                ge2d_cmd_cfg->vsc_rpt_l0_num = 0;
                ge2d_cmd_cfg->hsc_div_en = 0;
+               ge2d_cmd_cfg->hsc_adv_num = 0;
        }
 
        ge2d_cmd_cfg->color_blend_mode = (op >> 24) & 0xff;
index c5b77824606a597b3a13c9bdcb1635a3e79d93d5..00d56101d79bbf5ec613c40117e8f534d3be4f72 100644 (file)
@@ -45,6 +45,7 @@ static void _fillrect(struct ge2d_context_s *wq,
        ge2d_cmd_cfg->hsc_rpt_p0_num = 0;
        ge2d_cmd_cfg->vsc_rpt_l0_num = 0;
        ge2d_cmd_cfg->hsc_div_en = 0;
+       ge2d_cmd_cfg->hsc_adv_num = 0;
 
        ge2d_cmd_cfg->src1_fill_color_en = 1;
 
index 78e141ef38e22907fbdafce1a66441a84bbd946b..85d5657f00810eccd54cad1bb7db5b6511c808c8 100644 (file)
@@ -894,7 +894,9 @@ void ge2d_set_cmd(struct ge2d_cmd_s *cfg)
                cfg->hsc_div_length = (124 << 24) / cfg->hsc_phase_step;
 
                multo = cfg->hsc_phase_step * cfg->hsc_div_length;
+#ifndef CONFIG_GE2D_ADV_NUM
                cfg->hsc_adv_num   = multo >> 24;
+#endif
                cfg->hsc_adv_phase = multo & 0xffffff;
        }
 
@@ -961,20 +963,32 @@ void ge2d_set_cmd(struct ge2d_cmd_s *cfg)
                            (cfg->sc_vsc_en << 1) |
                            (cfg->sc_hsc_en << 0)), 11, 18);
 
-       ge2d_reg_write(GE2D_HSC_ADV_CTRL,
-                       (cfg->hsc_adv_num << 24) |
-                       (cfg->hsc_adv_phase << 0)
-                      );
-
        ge2d_reg_write(GE2D_HSC_START_PHASE_STEP, cfg->hsc_phase_step);
 
        ge2d_reg_write(GE2D_HSC_PHASE_SLOPE, cfg->hsc_phase_slope);
 
+#ifdef CONFIG_GE2D_ADV_NUM
+       ge2d_reg_write(GE2D_HSC_ADV_CTRL,
+                       (cfg->hsc_adv_num << 24) |
+                       (cfg->hsc_adv_phase << 0)
+                      );
+       if (cfg->hsc_adv_num > 255)
+               cfg->hsc_adv_num = cfg->hsc_adv_num >> 8;
        ge2d_reg_write(GE2D_HSC_INI_CTRL,
                        (cfg->hsc_rpt_p0_num << 29) |
+                       (cfg->hsc_adv_num << 24) |
                        (cfg->hsc_ini_phase << 0)
                       );
-
+#else
+       ge2d_reg_write(GE2D_HSC_ADV_CTRL,
+                       (cfg->hsc_adv_num << 24) |
+                       (cfg->hsc_adv_phase << 0)
+                      );
+       ge2d_reg_write(GE2D_HSC_INI_CTRL,
+                       (cfg->hsc_rpt_p0_num << 29) |
+                       (cfg->hsc_ini_phase << 0)
+                      );
+#endif
 
        ge2d_reg_write(GE2D_VSC_START_PHASE_STEP, cfg->vsc_phase_step);
 
index ebef36b01e1c683b99fdbdc65b8a1b315fb629c4..0c04197185afe58c58700c690f7d444639d68b49 100644 (file)
@@ -40,7 +40,12 @@ static void _stretchblt(struct ge2d_context_s *wq,
        ge2d_cmd_cfg->hsc_rpt_p0_num = 1;
        ge2d_cmd_cfg->vsc_rpt_l0_num = 1;
        ge2d_cmd_cfg->hsc_div_en = 1;
-
+#ifdef CONFIG_GE2D_ADV_NUM
+       ge2d_cmd_cfg->hsc_adv_num =
+               ((dst_w - 1) < 1024) ? (dst_w - 1) : 0;
+#else
+       ge2d_cmd_cfg->hsc_adv_num = 0;
+#endif
        ge2d_cmd_cfg->color_blend_mode = OPERATION_LOGIC;
        ge2d_cmd_cfg->color_logic_op   = LOGIC_OPERATION_COPY;
        ge2d_cmd_cfg->alpha_blend_mode = OPERATION_LOGIC;
@@ -100,7 +105,12 @@ static void _stretchblt_noalpha(struct ge2d_context_s *wq,
        ge2d_cmd_cfg->hsc_rpt_p0_num = 1;
        ge2d_cmd_cfg->vsc_rpt_l0_num = 1;
        ge2d_cmd_cfg->hsc_div_en = 1;
-
+#ifdef CONFIG_GE2D_ADV_NUM
+       ge2d_cmd_cfg->hsc_adv_num =
+               ((dst_w - 1) < 1024) ? (dst_w - 1) : 0;
+#else
+       ge2d_cmd_cfg->hsc_adv_num = 0;
+#endif
        ge2d_cmd_cfg->color_blend_mode = OPERATION_LOGIC;
        ge2d_cmd_cfg->color_logic_op   = LOGIC_OPERATION_COPY;
        ge2d_cmd_cfg->alpha_blend_mode = OPERATION_LOGIC;
index 3d458ca94d861e74686a4f8c6cdd04fd50bbcb89..dbd935ad61dc5a9028c8ee742ae903aede4f4fe9 100644 (file)
@@ -31,6 +31,7 @@
 #define MAX_BITBLT_WORK_CONFIG 4
 #define MAX_GE2D_CMD  32   /* 64 */
 
+/* #define CONFIG_GE2D_ADV_NUM */
 #define CONFIG_GE2D_SRC2
 #define GE2D_STATE_IDLE                 0
 #define GE2D_STATE_RUNNING              1