]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm: sun4i: de33: vi_scaler: add Display Engine 3.3 (DE33) support
authorJernej Skrabec <jernej.skrabec@gmail.com>
Wed, 28 May 2025 09:22:12 +0000 (21:22 +1200)
committerMaxime Ripard <mripard@kernel.org>
Mon, 2 Jun 2025 07:59:10 +0000 (09:59 +0200)
The vi_scaler appears to be used in preference to the ui_scaler module
for hardware video scaling in the DE33.

Enable support for this scaler.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Ryan Walklin <ryan@testtoast.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20250528092431.28825-8-ryan@testtoast.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/sun4i/sun8i_ui_layer.c
drivers/gpu/drm/sun4i/sun8i_vi_scaler.c

index 7a21d32ff1e4aa2a247aefb6ed20549211aa0826..f97be0040aab29cb4e138fcceb20e90c72db0252 100644 (file)
@@ -94,12 +94,24 @@ static int sun8i_ui_layer_update_coord(struct sun8i_mixer *mixer, int channel,
                hscale = state->src_w / state->crtc_w;
                vscale = state->src_h / state->crtc_h;
 
-               sun8i_ui_scaler_setup(mixer, channel, src_w, src_h, dst_w,
-                                     dst_h, hscale, vscale, hphase, vphase);
-               sun8i_ui_scaler_enable(mixer, channel, true);
+               if (mixer->cfg->de_type == SUN8I_MIXER_DE33) {
+                       sun8i_vi_scaler_setup(mixer, channel, src_w, src_h,
+                                             dst_w, dst_h, hscale, vscale,
+                                             hphase, vphase,
+                                             state->fb->format);
+                       sun8i_vi_scaler_enable(mixer, channel, true);
+               } else {
+                       sun8i_ui_scaler_setup(mixer, channel, src_w, src_h,
+                                             dst_w, dst_h, hscale, vscale,
+                                             hphase, vphase);
+                       sun8i_ui_scaler_enable(mixer, channel, true);
+               }
        } else {
                DRM_DEBUG_DRIVER("HW scaling is not needed\n");
-               sun8i_ui_scaler_enable(mixer, channel, false);
+               if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+                       sun8i_vi_scaler_enable(mixer, channel, false);
+               else
+                       sun8i_ui_scaler_enable(mixer, channel, false);
        }
 
        /* Set base coordinates */
index bd03607c8b7fa6b3560fca9c1ebad58304b26218..82df6244af885be3d50a85eb667c9e68822d3668 100644 (file)
@@ -835,7 +835,9 @@ static const u32 bicubic4coefftab32[480] = {
 
 static u32 sun8i_vi_scaler_base(struct sun8i_mixer *mixer, int channel)
 {
-       if (mixer->cfg->de_type == SUN8I_MIXER_DE3)
+       if (mixer->cfg->de_type == SUN8I_MIXER_DE33)
+               return sun8i_channel_base(mixer, channel) + 0x3000;
+       else if (mixer->cfg->de_type == SUN8I_MIXER_DE3)
                return DE3_VI_SCALER_UNIT_BASE +
                       DE3_VI_SCALER_UNIT_SIZE * channel;
        else