drm/i915: Introduce crtc_state->update_planes bitmask
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 27 Nov 2018 16:37:42 +0000 (18:37 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 28 Nov 2018 19:51:50 +0000 (21:51 +0200)
Keep track which planes need updating during the commit. For now
we set the bit for any plane that was or will be visible (including
icl+ nv12 slave planes). In the future I'll have need to update
invisible planes as well, for skl plane ddbs and for pre-skl pipe
gamma/csc control (which lives in the primary plane control register).

v2: Pimp the commit message to mention icl+ nv12 slave planes (Matt)

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181127163742.30215-1-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/intel_atomic.c
drivers/gpu/drm/i915/intel_atomic_plane.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h

index a5a2c8fe58a760a63703892018874f34a98e4d1e..8cb02f28d30cf6b12fe002c13c8bd9d17f9fa6f2 100644 (file)
@@ -184,6 +184,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
        crtc_state->fifo_changed = false;
        crtc_state->wm.need_postvbl_update = false;
        crtc_state->fb_bits = 0;
+       crtc_state->update_planes = 0;
 
        return &crtc_state->base;
 }
index 905f8ef3ba4fce9fb7a34e757e168c4440c63774..026a115119410b722b5bc4c89a45ed00c89ac41d 100644 (file)
@@ -139,6 +139,9 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
        if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
                crtc_state->nv12_planes |= BIT(intel_plane->id);
 
+       if (state->visible || old_plane_state->base.visible)
+               crtc_state->update_planes |= BIT(intel_plane->id);
+
        return intel_plane_atomic_calc_changes(old_crtc_state,
                                               &crtc_state->base,
                                               old_plane_state,
@@ -173,14 +176,11 @@ void intel_update_planes_on_crtc(struct intel_atomic_state *old_state,
                                 struct intel_crtc_state *old_crtc_state,
                                 struct intel_crtc_state *new_crtc_state)
 {
+       u32 update_mask = new_crtc_state->update_planes;
        struct intel_plane_state *new_plane_state;
        struct intel_plane *plane;
-       u32 update_mask;
        int i;
 
-       update_mask = old_crtc_state->active_planes;
-       update_mask |= new_crtc_state->active_planes;
-
        for_each_new_intel_plane_in_state(old_state, plane, new_plane_state, i) {
                if (crtc->pipe != plane->pipe ||
                    !(update_mask & BIT(plane->id)))
index 3516b3d04787ee338de6c1236fdc0b55042daa95..4469b4511c9248727c370fb2eb4268177188331d 100644 (file)
@@ -10839,8 +10839,10 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
                        continue;
 
                plane_state->linked_plane = NULL;
-               if (plane_state->slave && !plane_state->base.visible)
+               if (plane_state->slave && !plane_state->base.visible) {
                        crtc_state->active_planes &= ~BIT(plane->id);
+                       crtc_state->update_planes |= BIT(plane->id);
+               }
 
                plane_state->slave = false;
        }
@@ -10881,6 +10883,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
                linked_state->slave = true;
                linked_state->linked_plane = plane;
                crtc_state->active_planes |= BIT(linked->id);
+               crtc_state->update_planes |= BIT(linked->id);
                DRM_DEBUG_KMS("Using %s as Y plane for %s\n", linked->base.name, plane->base.name);
        }
 
index a62d77b762919628c19892751fe78bd641ccf6c6..1f29061cefa1534c257807694fa6080474fec068 100644 (file)
@@ -926,6 +926,9 @@ struct intel_crtc_state {
        u8 active_planes;
        u8 nv12_planes;
 
+       /* bitmask of planes that will be updated during the commit */
+       u8 update_planes;
+
        /* HDMI scrambling status */
        bool hdmi_scrambling;