drm/i915/skl: Correctly align skl_compute_plane_wm() arguments
[deliverable/linux.git] / drivers / gpu / drm / i915 / intel_pm.c
index 858029878d3857091baac49704085558fc46d2e2..176e9ef9b2668ec2813f57d0e305a331e6968b2b 100644 (file)
@@ -3217,28 +3217,6 @@ static uint32_t skl_wm_method2(uint32_t pixel_rate, uint32_t pipe_htotal,
        return ret;
 }
 
-static void skl_compute_transition_wm(struct drm_crtc *crtc,
-                                 struct skl_pipe_wm_parameters *params,
-                                 struct skl_pipe_wm *pipe_wm)
-{
-       /*
-        * For now it is suggested to use the LP0 wm val of corresponding
-        * plane as transition wm val. This is done while computing results.
-        */
-       if (!params->active)
-               return;
-}
-
-static uint32_t
-skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p)
-{
-       if (!intel_crtc_active(crtc))
-               return 0;
-
-       return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate);
-
-}
-
 static bool skl_ddb_allocation_changed(const struct skl_ddb_allocation *new_ddb,
                                       const struct intel_crtc *intel_crtc)
 {
@@ -3314,11 +3292,11 @@ static void skl_compute_wm_pipe_parameters(struct drm_crtc *crtc,
 }
 
 static bool skl_compute_plane_wm(struct skl_pipe_wm_parameters *p,
-                                  struct intel_plane_wm_parameters *p_params,
-                                  uint16_t ddb_allocation,
-                                  uint32_t mem_value,
-                                  uint16_t *out_blocks, /* out */
-                                  uint8_t *out_lines /* out */)
+                                struct intel_plane_wm_parameters *p_params,
+                                uint16_t ddb_allocation,
+                                uint32_t mem_value,
+                                uint16_t *out_blocks, /* out */
+                                uint8_t *out_lines /* out */)
 {
        uint32_t method1, method2, plane_bytes_per_line, res_blocks, res_lines;
        uint32_t result_bytes;
@@ -3384,6 +3362,32 @@ static void skl_compute_wm_level(const struct drm_i915_private *dev_priv,
                                                 &result->cursor_res_l);
 }
 
+static uint32_t
+skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p)
+{
+       if (!intel_crtc_active(crtc))
+               return 0;
+
+       return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate);
+
+}
+
+static void skl_compute_transition_wm(struct drm_crtc *crtc,
+                                     struct skl_pipe_wm_parameters *params,
+                                     struct skl_wm_level *trans_wm /* out */)
+{
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+       int i;
+
+       if (!params->active)
+               return;
+
+       /* Until we know more, just disable transition WMs */
+       for (i = 0; i < intel_num_planes(intel_crtc); i++)
+               trans_wm->plane_en[i] = false;
+       trans_wm->cursor_en = false;
+}
+
 static void skl_compute_pipe_wm(struct drm_crtc *crtc,
                                struct skl_ddb_allocation *ddb,
                                struct skl_pipe_wm_parameters *params,
@@ -3401,7 +3405,7 @@ static void skl_compute_pipe_wm(struct drm_crtc *crtc,
        }
        pipe_wm->linetime = skl_compute_linetime_wm(crtc, params);
 
-       skl_compute_transition_wm(crtc, params, pipe_wm);
+       skl_compute_transition_wm(crtc, params, &pipe_wm->trans_wm);
 }
 
 static void skl_compute_wm_results(struct drm_device *dev,
@@ -3412,11 +3416,10 @@ static void skl_compute_wm_results(struct drm_device *dev,
 {
        int level, max_level = ilk_wm_max_level(dev);
        enum pipe pipe = intel_crtc->pipe;
+       uint32_t temp;
+       int i;
 
        for (level = 0; level <= max_level; level++) {
-               uint32_t temp;
-               int i;
-
                for (i = 0; i < intel_num_planes(intel_crtc); i++) {
                        temp = 0;
 
@@ -3427,9 +3430,6 @@ static void skl_compute_wm_results(struct drm_device *dev,
                                temp |= PLANE_WM_EN;
 
                        r->plane[pipe][i][level] = temp;
-                       /* Use the LP0 WM value for transition WM for now. */
-                       if (level == 0)
-                               r->plane_trans[pipe][i] = temp;
                }
 
                temp = 0;
@@ -3441,12 +3441,28 @@ static void skl_compute_wm_results(struct drm_device *dev,
                        temp |= PLANE_WM_EN;
 
                r->cursor[pipe][level] = temp;
-               /* Use the LP0 WM value for transition WM for now. */
-               if (level == 0)
-                       r->cursor_trans[pipe] = temp;
 
        }
 
+       /* transition WMs */
+       for (i = 0; i < intel_num_planes(intel_crtc); i++) {
+               temp = 0;
+               temp |= p_wm->trans_wm.plane_res_l[i] << PLANE_WM_LINES_SHIFT;
+               temp |= p_wm->trans_wm.plane_res_b[i];
+               if (p_wm->trans_wm.plane_en[i])
+                       temp |= PLANE_WM_EN;
+
+               r->plane_trans[pipe][i] = temp;
+       }
+
+       temp = 0;
+       temp |= p_wm->trans_wm.cursor_res_l << PLANE_WM_LINES_SHIFT;
+       temp |= p_wm->trans_wm.cursor_res_b;
+       if (p_wm->trans_wm.cursor_en)
+               temp |= PLANE_WM_EN;
+
+       r->cursor_trans[pipe] = temp;
+
        r->wm_linetime[pipe] = p_wm->linetime;
 }
 
This page took 0.027956 seconds and 5 git commands to generate.