media: vsp1: dl: Allow chained display lists for display pipelines
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Mon, 11 Mar 2019 18:16:33 +0000 (20:16 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Mon, 18 Mar 2019 15:23:59 +0000 (17:23 +0200)
Refactor the display list header setup to allow chained display lists
with display pipelines. Chain the display lists as for mem-to-mem
pipelines, but enable the frame end interrupt for every list as display
pipelines have a single list per frame.

This feature will be used to disable writeback exactly one frame after
enabling it by chaining a writeback disable display list.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vsp1/vsp1_dl.c

index 886b3a69d329356ce640d949414de3134af61fe7..ed7cda4130f220bdde47960939b19b623a15fa4f 100644 (file)
@@ -770,17 +770,35 @@ static void vsp1_dl_list_fill_header(struct vsp1_dl_list *dl, bool is_last)
        }
 
        dl->header->num_lists = num_lists;
+       dl->header->flags = 0;
 
-       if (!list_empty(&dl->chain) && !is_last) {
+       /*
+        * Enable the interrupt for the end of each frame. In continuous mode
+        * chained lists are used with one list per frame, so enable the
+        * interrupt for each list. In singleshot mode chained lists are used
+        * to partition a single frame, so enable the interrupt for the last
+        * list only.
+        */
+       if (!dlm->singleshot || is_last)
+               dl->header->flags |= VSP1_DLH_INT_ENABLE;
+
+       /*
+        * In continuous mode enable auto-start for all lists, as the VSP must
+        * loop on the same list until a new one is queued. In singleshot mode
+        * enable auto-start for all lists but the last to chain processing of
+        * partitions without software intervention.
+        */
+       if (!dlm->singleshot || !is_last)
+               dl->header->flags |= VSP1_DLH_AUTO_START;
+
+       if (!is_last) {
                /*
-                * If this display list's chain is not empty, we are on a list,
-                * and the next item is the display list that we must queue for
-                * automatic processing by the hardware.
+                * If this is not the last display list in the chain, queue the
+                * next item for automatic processing by the hardware.
                 */
                struct vsp1_dl_list *next = list_next_entry(dl, chain);
 
                dl->header->next_header = next->dma;
-               dl->header->flags = VSP1_DLH_AUTO_START;
        } else if (!dlm->singleshot) {
                /*
                 * if the display list manager works in continuous mode, the VSP
@@ -788,13 +806,6 @@ static void vsp1_dl_list_fill_header(struct vsp1_dl_list *dl, bool is_last)
                 * instructed to do otherwise.
                 */
                dl->header->next_header = dl->dma;
-               dl->header->flags = VSP1_DLH_INT_ENABLE | VSP1_DLH_AUTO_START;
-       } else {
-               /*
-                * Otherwise, in mem-to-mem mode, we work in single-shot mode
-                * and the next display list must not be started automatically.
-                */
-               dl->header->flags = VSP1_DLH_INT_ENABLE;
        }
 
        if (!dl->extension)