BACKPORT: drm/i915: Reorder skl+ scaler vs. plane updates

When scanning out NV12 if we at any time have the plane enabled
while the scaler is disabled we get a pretty catastrophics
underrun.

Let's reorder the operations so that we try to avoid that happening
even if our vblank evade fails and the scaler enable/disable and
the plane enable/disable get latched during two diffent frames.

This takes care of the most common cases. I suppose there is still
at least a theoretical possibility of hitting this if one plane
takes the scaler away from another plane before the second plane
had a chance to set up another scaler for its use. But that
is starting to get a bit complicated, especially since the plane
commit order already has to be carefully sequenced to avoid any
dbuf overlaps. So plugging this 100% may prove somewhat hard...

Cc: Cooper Chiou <cooper.chiou@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210506073836.14848-1-ville.syrjala@linux.intel.com
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
(cherry picked from commit 7c653e15e2ba4c476ea9aa1f5ddf14ca3ccacc17)

Conflicts:
  drivers/gpu/drm/i915/display/intel_display.c
  - remove skl_detach_scalers() in intel_begin_crtc_commit()
  - use INTEL_GEN() instead of DISPLAY_VER()
  - use needs_modeset() instead of intel_crtc_needs_modeset()
  - add commit_pipe_post_plane_update() in intel_finish_crtc_commit()

  drivers/gpu/drm/i915/display/skl_universal_plane.c
  - no need to add skl_program_plane_scaler() in skl_program_plane()
    since code was in skl_update_plane()

BUG= b:180139522
TEST=boot-up fizz, youtube/local video playback, scale window

Signed-off-by: Cooper Chiou <cooper.chiou@intel.com>
Change-Id: I773e500eb7777ac42a43dcdeea2bcc39dcabd55c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3139398
Reviewed-by: Rajat Jain <rajatja@google.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Commit-Queue: Rajat Jain <rajatja@google.com>
1 file changed