Re: [PATCH 02/13] drm/sun4i: vi scaler: Fix coefficient selection
Chen-Yu Tsai <[email protected]> Tue, 4 Aug 2026 10:13:29 +0800
| Newsgroups | dev.linux.lists.linux-sunxi,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAGb2v66x0gt665ZKGTvi37j5quYLpn1YMhrRcd-naD4j83tZ4Q@mail.gmail.com> |
On Tue, Aug 4, 2026 at 12:11=E2=80=AFAM Jernej Skrabec <jernej.skrabec@gmai=
l.com> wrote:
>
> Currently, vertical coefficients are selected based on horizontal
> scaling, which is wrong. Additionally, chroma coefficients should be
> selected based on format subsampling.
>
> Fix all that.
>
> Fixes: b862a648de3b ("drm/sun4i: Add support for HW scaling to DE2")
> Signed-off-by: Jernej Skrabec <[email protected]>
Reviewed-by: Chen-Yu Tsai <[email protected]>
Somehow having the two fixes together made the diff much harder for me
to understand.
> ---
> drivers/gpu/drm/sun4i/sun8i_vi_scaler.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c b/drivers/gpu/drm/su=
n4i/sun8i_vi_scaler.c
> index 3dec4eeb1ba2..d4412a62c2f0 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_vi_scaler.c
> @@ -894,20 +894,26 @@ static void sun8i_vi_scaler_set_coeff(struct regmap=
*map, u32 base,
> lan3coefftab32_left[offset + i]);
> regmap_write(map, SUN8I_SCALER_VSU_YHCOEFF1(base, i),
> lan3coefftab32_right[offset + i]);
> + }
> + offset =3D sun8i_vi_scaler_coef_index(vstep) *
> + SUN8I_VI_SCALER_COEFF_COUNT;
> + for (i =3D 0; i < SUN8I_VI_SCALER_COEFF_COUNT; i++)
> + regmap_write(map, SUN8I_SCALER_VSU_YVCOEFF(base, i),
> + lan2coefftab32[offset + i]);
> +
> + offset =3D sun8i_vi_scaler_coef_index(hstep / format->hsub) *
> + SUN8I_VI_SCALER_COEFF_COUNT;
> + for (i =3D 0; i < SUN8I_VI_SCALER_COEFF_COUNT; i++) {
> regmap_write(map, SUN8I_SCALER_VSU_CHCOEFF0(base, i),
> ch_left[offset + i]);
> regmap_write(map, SUN8I_SCALER_VSU_CHCOEFF1(base, i),
> ch_right[offset + i]);
> }
> -
> - offset =3D sun8i_vi_scaler_coef_index(hstep) *
> + offset =3D sun8i_vi_scaler_coef_index(vstep / format->vsub) *
> SUN8I_VI_SCALER_COEFF_COUNT;
> - for (i =3D 0; i < SUN8I_VI_SCALER_COEFF_COUNT; i++) {
> - regmap_write(map, SUN8I_SCALER_VSU_YVCOEFF(base, i),
> - lan2coefftab32[offset + i]);
> + for (i =3D 0; i < SUN8I_VI_SCALER_COEFF_COUNT; i++)
> regmap_write(map, SUN8I_SCALER_VSU_CVCOEFF(base, i),
> cy[offset + i]);
> - }
> }
>
> void sun8i_vi_scaler_enable(struct sun8i_layer *layer, bool enable)
> --
> 2.43.0
>