]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/gpu/drm/armada/armada_crtc.c
Merge tag 'drm-misc-next-2017-03-06' of git://anongit.freedesktop.org/git/drm-misc...
[mirror_ubuntu-artful-kernel.git] / drivers / gpu / drm / armada / armada_crtc.c
index 95cb3966b2ca9ba9eb437cbeaa3d89c5f0f50b87..1341e0b9368a4f796afcb654284e9043b9d7cfd0 100644 (file)
@@ -169,8 +169,7 @@ void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb,
        int x, int y)
 {
        u32 addr = drm_fb_obj(fb)->dev_addr;
-       u32 pixel_format = fb->pixel_format;
-       int num_planes = drm_format_num_planes(pixel_format);
+       int num_planes = fb->format->num_planes;
        int i;
 
        if (num_planes > 3)
@@ -178,7 +177,7 @@ void armada_drm_plane_calc_addrs(u32 *addrs, struct drm_framebuffer *fb,
 
        for (i = 0; i < num_planes; i++)
                addrs[i] = addr + fb->offsets[i] + y * fb->pitches[i] +
-                            x * drm_format_plane_cpp(pixel_format, i);
+                            x * fb->format->cpp[i];
        for (; i < 3; i++)
                addrs[i] = 0;
 }
@@ -191,7 +190,7 @@ static unsigned armada_drm_crtc_calc_fb(struct drm_framebuffer *fb,
        unsigned i = 0;
 
        DRM_DEBUG_DRIVER("pitch %u x %d y %d bpp %d\n",
-               pitch, x, y, fb->bits_per_pixel);
+               pitch, x, y, fb->format->cpp[0] * 8);
 
        armada_drm_plane_calc_addrs(addrs, fb, x, y);
 
@@ -419,6 +418,25 @@ static bool armada_drm_crtc_mode_fixup(struct drm_crtc *crtc,
        return true;
 }
 
+/* These are locked by dev->vbl_lock */
+static void armada_drm_crtc_disable_irq(struct armada_crtc *dcrtc, u32 mask)
+{
+       if (dcrtc->irq_ena & mask) {
+               dcrtc->irq_ena &= ~mask;
+               writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
+       }
+}
+
+static void armada_drm_crtc_enable_irq(struct armada_crtc *dcrtc, u32 mask)
+{
+       if ((dcrtc->irq_ena & mask) != mask) {
+               dcrtc->irq_ena |= mask;
+               writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
+               if (readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR) & mask)
+                       writel(0, dcrtc->base + LCD_SPU_IRQ_ISR);
+       }
+}
+
 static void armada_drm_crtc_irq(struct armada_crtc *dcrtc, u32 stat)
 {
        void __iomem *base = dcrtc->base;
@@ -492,25 +510,6 @@ static irqreturn_t armada_drm_irq(int irq, void *arg)
        return IRQ_NONE;
 }
 
-/* These are locked by dev->vbl_lock */
-void armada_drm_crtc_disable_irq(struct armada_crtc *dcrtc, u32 mask)
-{
-       if (dcrtc->irq_ena & mask) {
-               dcrtc->irq_ena &= ~mask;
-               writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
-       }
-}
-
-void armada_drm_crtc_enable_irq(struct armada_crtc *dcrtc, u32 mask)
-{
-       if ((dcrtc->irq_ena & mask) != mask) {
-               dcrtc->irq_ena |= mask;
-               writel(dcrtc->irq_ena, dcrtc->base + LCD_SPU_IRQ_ENA);
-               if (readl_relaxed(dcrtc->base + LCD_SPU_IRQ_ISR) & mask)
-                       writel(0, dcrtc->base + LCD_SPU_IRQ_ISR);
-       }
-}
-
 static uint32_t armada_drm_crtc_calculate_csc(struct armada_crtc *dcrtc)
 {
        struct drm_display_mode *adj = &dcrtc->crtc.mode;
@@ -1036,7 +1035,7 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc,
        int ret;
 
        /* We don't support changing the pixel format */
-       if (fb->pixel_format != crtc->primary->fb->pixel_format)
+       if (fb->format != crtc->primary->fb->format)
                return -EINVAL;
 
        work = kmalloc(sizeof(*work), GFP_KERNEL);
@@ -1110,6 +1109,22 @@ armada_drm_crtc_set_property(struct drm_crtc *crtc,
        return 0;
 }
 
+/* These are called under the vbl_lock. */
+static int armada_drm_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+       struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
+
+       armada_drm_crtc_enable_irq(dcrtc, VSYNC_IRQ_ENA);
+       return 0;
+}
+
+static void armada_drm_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+       struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
+
+       armada_drm_crtc_disable_irq(dcrtc, VSYNC_IRQ_ENA);
+}
+
 static const struct drm_crtc_funcs armada_crtc_funcs = {
        .cursor_set     = armada_drm_crtc_cursor_set,
        .cursor_move    = armada_drm_crtc_cursor_move,
@@ -1117,6 +1132,8 @@ static const struct drm_crtc_funcs armada_crtc_funcs = {
        .set_config     = drm_crtc_helper_set_config,
        .page_flip      = armada_drm_crtc_page_flip,
        .set_property   = armada_drm_crtc_set_property,
+       .enable_vblank  = armada_drm_crtc_enable_vblank,
+       .disable_vblank = armada_drm_crtc_disable_vblank,
 };
 
 static const struct drm_plane_funcs armada_primary_plane_funcs = {