If we want to have vblank on both pipelines at the same time, we need
to call drm_vblank_init with num_crtcs = 2.
Instead, since the crtc init calls correctly set mode_config.num_crtc,
we can move the drm_vblank_init call to after the crtc init code is
called, which is the component bind part. Then we can just pass
mode_config.num_crtc in.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170908075016.18657-8-wens@csie.org
                goto free_drm;
        }
 
-       /* drm_vblank_init calls kcalloc, which can fail */
-       ret = drm_vblank_init(drm, 1);
-       if (ret)
-               goto free_mem_region;
-
        drm_mode_config_init(drm);
 
        ret = component_bind_all(drm->dev, drm);
                goto cleanup_mode_config;
        }
 
+       /* drm_vblank_init calls kcalloc, which can fail */
+       ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
+       if (ret)
+               goto free_mem_region;
+
        drm->irq_enabled = true;
 
        /* Remove early framebuffers (ie. simplefb) */