]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/armada: provide pitches from armada_drm_plane_calc_addrs()
authorRussell King <rmk+kernel@armlinux.org.uk>
Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Mon, 30 Jul 2018 10:52:34 +0000 (11:52 +0100)
Provide the framebuffer pitches from armada_drm_plane_calc_addrs() as
well as the base addresses for each plane.  Since this is now about
more than just addresses, rename to armada_drm_plane_calc().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
drivers/gpu/drm/armada/armada_overlay.c
drivers/gpu/drm/armada/armada_plane.c
drivers/gpu/drm/armada/armada_plane.h

index e8c3bcc09d5ca478fe71d8b3822997474ca89b33..f36f6fb919e7cf6f950d4a6687f0003a9fdf059d 100644 (file)
@@ -130,10 +130,10 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,
            old_state->src.y1 != state->src.y1 ||
            old_state->fb != state->fb) {
                const struct drm_format_info *format;
-               u16 src_x;
+               u16 src_x, pitches[3];
                u32 addrs[3];
 
-               armada_drm_plane_calc_addrs(state, addrs);
+               armada_drm_plane_calc(state, addrs, pitches);
 
                armada_reg_queue_set(regs, idx, addrs[0],
                                     LCD_SPU_DMA_START_ADDR_Y0);
@@ -148,9 +148,9 @@ static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,
                armada_reg_queue_set(regs, idx, addrs[2],
                                     LCD_SPU_DMA_START_ADDR_V1);
 
-               val = state->fb->pitches[0] << 16 | state->fb->pitches[0];
+               val = pitches[0] << 16 | pitches[0];
                armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_PITCH_YC);
-               val = state->fb->pitches[1] << 16 | state->fb->pitches[2];
+               val = pitches[1] << 16 | pitches[2];
                armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_PITCH_UV);
 
                cfg = CFG_DMA_FMT(drm_fb_to_armada_fb(state->fb)->fmt) |
index c426c92c79d9508f69b22fc3bba229f1f2d67ad0..3c9414c56acac2399c5f01160adde4ce0008eaa5 100644 (file)
@@ -35,7 +35,8 @@ static const uint32_t armada_primary_formats[] = {
        DRM_FORMAT_BGR565,
 };
 
-void armada_drm_plane_calc_addrs(struct drm_plane_state *state, u32 addrs[3])
+void armada_drm_plane_calc(struct drm_plane_state *state, u32 addrs[3],
+       u16 pitches[3])
 {
        struct drm_framebuffer *fb = state->fb;
        const struct drm_format_info *format = fb->format;
@@ -53,37 +54,42 @@ void armada_drm_plane_calc_addrs(struct drm_plane_state *state, u32 addrs[3])
 
        addrs[0] = addr + fb->offsets[0] + y * fb->pitches[0] +
                   x * format->cpp[0];
+       pitches[0] = fb->pitches[0];
 
        y /= format->vsub;
        x /= format->hsub;
 
-       for (i = 1; i < num_planes; i++)
+       for (i = 1; i < num_planes; i++) {
                addrs[i] = addr + fb->offsets[i] + y * fb->pitches[i] +
                             x * format->cpp[i];
-       for (; i < 3; i++)
+               pitches[i] = fb->pitches[i];
+       }
+       for (; i < 3; i++) {
                addrs[i] = 0;
+               pitches[i] = 0;
+       }
 }
 
 static unsigned armada_drm_crtc_calc_fb(struct drm_plane_state *state,
        struct armada_regs *regs, bool interlaced)
 {
-       unsigned pitch = state->fb->pitches[0];
+       u16 pitches[3];
        u32 addrs[3], addr_odd, addr_even;
        unsigned i = 0;
 
-       armada_drm_plane_calc_addrs(state, addrs);
+       armada_drm_plane_calc(state, addrs, pitches);
 
        addr_odd = addr_even = addrs[0];
 
        if (interlaced) {
-               addr_even += pitch;
-               pitch *= 2;
+               addr_even += pitches[0];
+               pitches[0] *= 2;
        }
 
        /* write offset, base, and pitch */
        armada_reg_queue_set(regs, i, addr_odd, LCD_CFG_GRA_START_ADDR0);
        armada_reg_queue_set(regs, i, addr_even, LCD_CFG_GRA_START_ADDR1);
-       armada_reg_queue_mod(regs, i, pitch, 0xffff, LCD_CFG_GRA_PITCH);
+       armada_reg_queue_mod(regs, i, pitches[0], 0xffff, LCD_CFG_GRA_PITCH);
 
        return i;
 }
index 999a0bd3e51248765b6cd05611ac82e18b0644f9..98280beaaa44028419d89016d2543a46d64a9acb 100644 (file)
@@ -1,7 +1,8 @@
 #ifndef ARMADA_PLANE_H
 #define ARMADA_PLANE_H
 
-void armada_drm_plane_calc_addrs(struct drm_plane_state *state, u32 addrs[3]);
+void armada_drm_plane_calc(struct drm_plane_state *state, u32 addrs[3],
+       u16 pitches[3]);
 int armada_drm_plane_prepare_fb(struct drm_plane *plane,
        struct drm_plane_state *state);
 void armada_drm_plane_cleanup_fb(struct drm_plane *plane,