Make the code a bit clearer by using a switch-case to check the tiling
mode in skl_compute_plane_wm(), because all the possible states and
the calculations they use are explicitly handled.

v2: - Remove useless comment (Gustavo)
    - Move the default case above linear as a fallthrough (Gustavo)

Signed-off-by: Luca Coelho <[email protected]>
---
 drivers/gpu/drm/i915/display/skl_watermark.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c 
b/drivers/gpu/drm/i915/display/skl_watermark.c
index f3af372767d0..35a73ddc282b 100644
--- a/drivers/gpu/drm/i915/display/skl_watermark.c
+++ b/drivers/gpu/drm/i915/display/skl_watermark.c
@@ -1833,7 +1833,7 @@ static void skl_compute_plane_wm(const struct 
intel_crtc_state *crtc_state,
                 */
                if ((wp->cpp * crtc_state->hw.pipe_mode.crtc_htotal /
                     wp->dbuf_block_size < 1) &&
-                    (wp->plane_bytes_per_line / wp->dbuf_block_size < 1)) {
+                   (wp->plane_bytes_per_line / wp->dbuf_block_size < 1)) {
                        selected_result = method2;
                } else if (latency >= wp->linetime_us) {
                        if (DISPLAY_VER(display) == 9)
@@ -1841,8 +1841,11 @@ static void skl_compute_plane_wm(const struct 
intel_crtc_state *crtc_state,
                        else
                                selected_result = method2;
                } else {
+                       /* everything else with linear/X-tiled uses method 1 */
                        selected_result = method1;
                }
+               break;
+
        }
 
        blocks = fixed16_to_u32_round_up(selected_result);
-- 
2.51.0

Reply via email to