drm/i915: Don't check for wm changes until we've compute the wms fully
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 28 Feb 2020 20:35:50 +0000 (22:35 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 5 Mar 2020 13:53:33 +0000 (15:53 +0200)
commit23baedd217effd594bdf4620c1fea4d27febe090
tree8d20d93656a4736d88db324bff12ce4ab15bcb29
parente7f54e6c198159ff593f1d52707d40a82899cfc7
drm/i915: Don't check for wm changes until we've compute the wms fully

Currently we're comparing the watermarks between the old and new states
before we've fully computed the new watermarks. In particular
skl_build_pipe_wm() will not account for the amount of ddb space we'll
have. That information is only available during skl_compute_ddb()
which will proceed to zero out any watermark level exceeding the
ddb allocation. If we're short on ddb space this will end up
adding the plane to the state due erronously determining that the
watermarks have changed. Fix the problem by deferring
skl_wm_add_affected_planes() until we have the final watermarks
computed.

Noticed this when trying enable transition watermarks on glk.
We now computed the trans_wm as 28, but we only had 14 blocks
of ddb, and thus skl_compute_ddb() ended up disabling the cursor
trans_wm every time. Thus we ended up adding the cursor to every
commit that didn't actually affect the cursor at all.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200228203552.30273-2-ville.syrjala@linux.intel.com
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
drivers/gpu/drm/i915/intel_pm.c