drm/i915: Track logically enabled planes for hw state
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 24 Nov 2020 20:11:53 +0000 (22:11 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 4 Dec 2020 17:06:18 +0000 (19:06 +0200)
Currently crtc_state->uapi.plane_mask only tracks logically
enabled planes on the uapi level. For bigjoiner purposes
we want to do the same for the hw state. Let's follow the
pattern established by active_planes & co. here.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201124201156.17095-1-ville.syrjala@linux.intel.com
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
drivers/gpu/drm/i915/display/intel_atomic_plane.c
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display_types.h

index 7e9f84b008596be42c1dc8020096903a75e09b13..b5e1ee99535cfe4cdf7774bb61bec3df10ee6c89 100644 (file)
@@ -312,10 +312,13 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
        int ret;
 
        intel_plane_set_invisible(new_crtc_state, new_plane_state);
+       new_crtc_state->enabled_planes &= ~BIT(plane->id);
 
        if (!new_plane_state->hw.crtc && !old_plane_state->hw.crtc)
                return 0;
 
+       new_crtc_state->enabled_planes |= BIT(plane->id);
+
        ret = plane->check_plane(new_crtc_state, new_plane_state);
        if (ret)
                return ret;
index 6e5b93f6a25edcfbe79d9682f9700f6d36fb4783..2d0d1b2ef957ab93694a4172fb5c441a96b45d0e 100644 (file)
@@ -3552,7 +3552,7 @@ intel_set_plane_visible(struct intel_crtc_state *crtc_state,
                crtc_state->uapi.plane_mask &= ~drm_plane_mask(&plane->base);
 }
 
-static void fixup_active_planes(struct intel_crtc_state *crtc_state)
+static void fixup_plane_bitmasks(struct intel_crtc_state *crtc_state)
 {
        struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
        struct drm_plane *plane;
@@ -3562,11 +3562,14 @@ static void fixup_active_planes(struct intel_crtc_state *crtc_state)
         * have been used on the same (or wrong) pipe. plane_mask uses
         * unique ids, hence we can use that to reconstruct active_planes.
         */
+       crtc_state->enabled_planes = 0;
        crtc_state->active_planes = 0;
 
        drm_for_each_plane_mask(plane, &dev_priv->drm,
-                               crtc_state->uapi.plane_mask)
+                               crtc_state->uapi.plane_mask) {
+               crtc_state->enabled_planes |= BIT(to_intel_plane(plane)->id);
                crtc_state->active_planes |= BIT(to_intel_plane(plane)->id);
+       }
 }
 
 static void intel_plane_disable_noatomic(struct intel_crtc *crtc,
@@ -3584,7 +3587,7 @@ static void intel_plane_disable_noatomic(struct intel_crtc *crtc,
                    crtc->base.base.id, crtc->base.name);
 
        intel_set_plane_visible(crtc_state, plane_state, false);
-       fixup_active_planes(crtc_state);
+       fixup_plane_bitmasks(crtc_state);
        crtc_state->data_rate[plane->id] = 0;
        crtc_state->min_cdclk[plane->id] = 0;
 
@@ -12804,6 +12807,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
 
                plane_state->planar_linked_plane = NULL;
                if (plane_state->planar_slave && !plane_state->uapi.visible) {
+                       crtc_state->enabled_planes &= ~BIT(plane->id);
                        crtc_state->active_planes &= ~BIT(plane->id);
                        crtc_state->update_planes |= BIT(plane->id);
                }
@@ -12847,6 +12851,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
 
                linked_state->planar_slave = true;
                linked_state->planar_linked_plane = plane;
+               crtc_state->enabled_planes |= BIT(linked->id);
                crtc_state->active_planes |= BIT(linked->id);
                crtc_state->update_planes |= BIT(linked->id);
                drm_dbg_kms(&dev_priv->drm, "Using %s as Y plane for %s\n",
@@ -19133,7 +19138,7 @@ static void readout_plane_state(struct drm_i915_private *dev_priv)
                struct intel_crtc_state *crtc_state =
                        to_intel_crtc_state(crtc->base.state);
 
-               fixup_active_planes(crtc_state);
+               fixup_plane_bitmasks(crtc_state);
        }
 }
 
index 1fa0246b3a8243777765533226e6e561882783d0..5bc5bfbc455146573689149144c9af6cebe8cbb1 100644 (file)
@@ -1053,7 +1053,10 @@ struct intel_crtc_state {
                u32 cgm_mode;
        };
 
-       /* bitmask of visible planes (enum plane_id) */
+       /* bitmask of logically enabled planes (enum plane_id) */
+       u8 enabled_planes;
+
+       /* bitmask of actually visible planes (enum plane_id) */
        u8 active_planes;
        u8 nv12_planes;
        u8 c8_planes;