drm: rcar-du: Register a completion callback with VSP1
authorKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Sat, 4 Mar 2017 02:01:19 +0000 (02:01 +0000)
committerKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Mon, 22 May 2017 15:15:41 +0000 (16:15 +0100)
Currently we process page flip events on every display interrupt,
however this does not take into consideration the processing time needed
by the VSP1 utilised in the pipeline.

Register a callback with the VSP driver to obtain completion events, and
track them so that we only perform page flips when the full display
pipeline has completed for the frame.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_crtc.c
drivers/gpu/drm/rcar-du/rcar_du_crtc.h
drivers/gpu/drm/rcar-du/rcar_du_vsp.c

index 5f0664bcd12d6b0a503c8f2cfb26dd76f42fe7fb..345eff72f581943a6d7b25c63644e274cc2cf394 100644 (file)
@@ -378,7 +378,7 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
  * Page Flip
  */
 
-static void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc)
+void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc)
 {
        struct drm_pending_vblank_event *event;
        struct drm_device *dev = rcrtc->crtc.dev;
@@ -650,6 +650,7 @@ static const struct drm_crtc_funcs crtc_funcs = {
 static irqreturn_t rcar_du_crtc_irq(int irq, void *arg)
 {
        struct rcar_du_crtc *rcrtc = arg;
+       struct rcar_du_device *rcdu = rcrtc->group->dev;
        irqreturn_t ret = IRQ_NONE;
        u32 status;
 
@@ -658,7 +659,10 @@ static irqreturn_t rcar_du_crtc_irq(int irq, void *arg)
 
        if (status & DSSR_FRM) {
                drm_crtc_handle_vblank(&rcrtc->crtc);
-               rcar_du_crtc_finish_page_flip(rcrtc);
+
+               if (rcdu->info->gen < 3)
+                       rcar_du_crtc_finish_page_flip(rcrtc);
+
                ret = IRQ_HANDLED;
        }
 
index 15871fae7445f645eb0f8c7ff02d823040c11dcd..b199ed5adf3638303371838a321215b68940f1c1 100644 (file)
@@ -73,5 +73,6 @@ void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc);
 
 void rcar_du_crtc_route_output(struct drm_crtc *crtc,
                               enum rcar_du_output output);
+void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc);
 
 #endif /* __RCAR_DU_CRTC_H__ */
index b0ff304ce3dc4a9ac18f359a73498efede18cbd4..c7bb96fbfab1a12fbb7299a86a9badaf4be50fee 100644 (file)
 #include "rcar_du_kms.h"
 #include "rcar_du_vsp.h"
 
+static void rcar_du_vsp_complete(void *private)
+{
+       struct rcar_du_crtc *crtc = private;
+
+       rcar_du_crtc_finish_page_flip(crtc);
+}
+
 void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
 {
        const struct drm_display_mode *mode = &crtc->crtc.state->adjusted_mode;
@@ -35,6 +42,8 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
        struct vsp1_du_lif_config cfg = {
                .width = mode->hdisplay,
                .height = mode->vdisplay,
+               .callback = rcar_du_vsp_complete,
+               .callback_data = crtc,
        };
        struct rcar_du_plane_state state = {
                .state = {