]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/vc4: Don't check plane state more than once
authorBoris Brezillon <boris.brezillon@bootlin.com>
Fri, 30 Nov 2018 09:02:51 +0000 (10:02 +0100)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Fri, 30 Nov 2018 09:34:36 +0000 (10:34 +0100)
We are about to use vc4_plane_mode_set() in the async check path, but
async check can decide that async update is not possible and force the
driver to fallback to a sync update.

All the checks that have been done on the plane state during async check
stay valid, and checking it again is not necessary. Add a ->checked
field to vc4_plane_state, and use it to track the status of the state
(checked or not).

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181130090254.594-3-boris.brezillon@bootlin.com
drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_plane.c

index 9ed05fb61eb674700e6b6e51adbceaa992d7a46d..4f87b03f837d11d547ef649b16de99ec4c764658 100644 (file)
@@ -370,6 +370,11 @@ struct vc4_plane_state {
         * to enable background color fill.
         */
        bool needs_bg_fill;
+
+       /* Mark the dlist as initialized. Useful to avoid initializing it twice
+        * when async update is not possible.
+        */
+       bool dlist_initialized;
 };
 
 static inline struct vc4_plane_state *
index 2db021f2d0aefea63e23af6de65fdaff4faaf5ab..a4faa5854a859be7036b8ce7427fdfdfa8b41af9 100644 (file)
@@ -154,6 +154,7 @@ static struct drm_plane_state *vc4_plane_duplicate_state(struct drm_plane *plane
                return NULL;
 
        memset(&vc4_state->lbm, 0, sizeof(vc4_state->lbm));
+       vc4_state->dlist_initialized = 0;
 
        __drm_atomic_helper_plane_duplicate_state(plane, &vc4_state->base);
 
@@ -510,6 +511,9 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
        u32 hvs_format = format->hvs;
        int ret, i;
 
+       if (vc4_state->dlist_initialized)
+               return 0;
+
        ret = vc4_plane_setup_clipping_and_scaling(state);
        if (ret)
                return ret;
@@ -791,6 +795,13 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
        vc4_state->needs_bg_fill = fb->format->has_alpha || !covers_screen ||
                                   state->alpha != DRM_BLEND_ALPHA_OPAQUE;
 
+       /* Flag the dlist as initialized to avoid checking it twice in case
+        * the async update check already called vc4_plane_mode_set() and
+        * decided to fallback to sync update because async update was not
+        * possible.
+        */
+       vc4_state->dlist_initialized = 1;
+
        return 0;
 }