@@ -4782,6 +4782,36 @@ skl_plane_trans_wm(const struct skl_pipe_wm *pipe_wm,
4782
4782
return & wm -> trans_wm ;
4783
4783
}
4784
4784
4785
+ /*
4786
+ * We only disable the watermarks for each plane if
4787
+ * they exceed the ddb allocation of said plane. This
4788
+ * is done so that we don't end up touching cursor
4789
+ * watermarks needlessly when some other plane reduces
4790
+ * our max possible watermark level.
4791
+ *
4792
+ * Bspec has this to say about the PLANE_WM enable bit:
4793
+ * "All the watermarks at this level for all enabled
4794
+ * planes must be enabled before the level will be used."
4795
+ * So this is actually safe to do.
4796
+ */
4797
+ static void
4798
+ skl_check_wm_level (struct skl_wm_level * wm , u64 total )
4799
+ {
4800
+ if (wm -> min_ddb_alloc > total )
4801
+ memset (wm , 0 , sizeof (* wm ));
4802
+ }
4803
+
4804
+ static void
4805
+ skl_check_nv12_wm_level (struct skl_wm_level * wm , struct skl_wm_level * uv_wm ,
4806
+ u64 total , u64 uv_total )
4807
+ {
4808
+ if (wm -> min_ddb_alloc > total ||
4809
+ uv_wm -> min_ddb_alloc > uv_total ) {
4810
+ memset (wm , 0 , sizeof (* wm ));
4811
+ memset (uv_wm , 0 , sizeof (* uv_wm ));
4812
+ }
4813
+ }
4814
+
4785
4815
static int
4786
4816
skl_allocate_plane_ddb (struct intel_atomic_state * state ,
4787
4817
struct intel_crtc * crtc )
@@ -4949,21 +4979,8 @@ skl_allocate_plane_ddb(struct intel_atomic_state *state,
4949
4979
struct skl_plane_wm * wm =
4950
4980
& crtc_state -> wm .skl .optimal .planes [plane_id ];
4951
4981
4952
- /*
4953
- * We only disable the watermarks for each plane if
4954
- * they exceed the ddb allocation of said plane. This
4955
- * is done so that we don't end up touching cursor
4956
- * watermarks needlessly when some other plane reduces
4957
- * our max possible watermark level.
4958
- *
4959
- * Bspec has this to say about the PLANE_WM enable bit:
4960
- * "All the watermarks at this level for all enabled
4961
- * planes must be enabled before the level will be used."
4962
- * So this is actually safe to do.
4963
- */
4964
- if (wm -> wm [level ].min_ddb_alloc > total [plane_id ] ||
4965
- wm -> uv_wm [level ].min_ddb_alloc > uv_total [plane_id ])
4966
- memset (& wm -> wm [level ], 0 , sizeof (wm -> wm [level ]));
4982
+ skl_check_nv12_wm_level (& wm -> wm [level ], & wm -> uv_wm [level ],
4983
+ total [plane_id ], uv_total [plane_id ]);
4967
4984
4968
4985
/*
4969
4986
* Wa_1408961008:icl, ehl
@@ -4986,14 +5003,9 @@ skl_allocate_plane_ddb(struct intel_atomic_state *state,
4986
5003
struct skl_plane_wm * wm =
4987
5004
& crtc_state -> wm .skl .optimal .planes [plane_id ];
4988
5005
4989
- if (wm -> trans_wm .min_ddb_alloc > total [plane_id ])
4990
- memset (& wm -> trans_wm , 0 , sizeof (wm -> trans_wm ));
4991
-
4992
- if (wm -> sagv .wm0 .min_ddb_alloc > total [plane_id ])
4993
- memset (& wm -> sagv .wm0 , 0 , sizeof (wm -> sagv .wm0 ));
4994
-
4995
- if (wm -> sagv .trans_wm .min_ddb_alloc > total [plane_id ])
4996
- memset (& wm -> sagv .trans_wm , 0 , sizeof (wm -> sagv .trans_wm ));
5006
+ skl_check_wm_level (& wm -> trans_wm , total [plane_id ]);
5007
+ skl_check_wm_level (& wm -> sagv .wm0 , total [plane_id ]);
5008
+ skl_check_wm_level (& wm -> sagv .trans_wm , total [plane_id ]);
4997
5009
}
4998
5010
4999
5011
return 0 ;
0 commit comments