drm/i915: Keep plane watermarks enabled more aggressively
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 12 Mar 2019 20:58:41 +0000 (22:58 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 20 Mar 2019 15:16:16 +0000 (17:16 +0200)
Currently we disable all the watermarks above the selected max
level for every plane. That would mean that the cursor's watermarks
may also get modified when another plane causes the selected
max watermark level to change. That is not so great as we would
like to keep the cursor as indepenedent as possible to avoid
having to throttle it in resposne to other plane activity.

To avoid that let's keep the watermarks enabled even for levels
above the max selected watermark level, iff the plane has enough
ddb for that particular level. This way the cursor's enabled
watermarks only depend on the cursor itself. This is safe because
the hardware will never choose to use a watermark level unless
all enabled planes have also enabled that level.

Cc: Neel Desai <neel.desai@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190312205844.6339-7-ville.syrjala@linux.intel.com
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/i915/intel_pm.c

index d54b70db3f2089e03bc7abf14e5db62e6bc4e631..e7bc38fc4f9d916069910cbb25668214c0216822 100644 (file)
@@ -4508,7 +4508,22 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
        for (level++; level <= ilk_wm_max_level(dev_priv); level++) {
                for_each_plane_id_on_crtc(intel_crtc, plane_id) {
                        wm = &cstate->wm.skl.optimal.planes[plane_id];
-                       memset(&wm->wm[level], 0, sizeof(wm->wm[level]));
+
+                       /*
+                        * We only disable the watermarks for each plane if
+                        * they exceed the ddb allocation of said plane. This
+                        * is done so that we don't end up touching cursor
+                        * watermarks needlessly when some other plane reduces
+                        * our max possible watermark level.
+                        *
+                        * Bspec has this to say about the PLANE_WM enable bit:
+                        * "All the watermarks at this level for all enabled
+                        *  planes must be enabled before the level will be used."
+                        * So this is actually safe to do.
+                        */
+                       if (wm->wm[level].min_ddb_alloc > total[plane_id] ||
+                           wm->uv_wm[level].min_ddb_alloc > uv_total[plane_id])
+                               memset(&wm->wm[level], 0, sizeof(wm->wm[level]));
 
                        /*
                         * Wa_1408961008:icl