On Sun, Jan 23, 2022 at 10:34:17PM +0200, Lisovskiy, Stanislav wrote: > On Fri, Jan 21, 2022 at 02:06:12PM +0200, Ville Syrjälä wrote: > > On Fri, Jan 21, 2022 at 10:06:15AM +0200, Stanislav Lisovskiy wrote: > > > In terms of async flip optimization we don't to allocate > > > extra ddb space, so lets skip it. > > > > > > v2: - Extracted min ddb async flip check to separate function > > > (Ville Syrjälä) > > > - Used this function to prevent false positive WARN > > > to be triggered(Ville Syrjälä) > > > > > > v3: - Renamed dg2_need_min_ddb to need_min_ddb thus making > > > it more universal. > > > - Also used DISPLAY_VER instead of IS_DG2(Ville Syrjälä) > > > - Use rate = 0 instead of just setting extra = 0, thus > > > letting other planes to use extra ddb and avoiding WARN > > > (Ville Syrjälä) > > > > > > Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@xxxxxxxxx> > > > --- > > > drivers/gpu/drm/i915/intel_pm.c | 17 +++++++++++++++++ > > > 1 file changed, 17 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c > > > index 5fb022a2a4d7..18fb35c480ef 100644 > > > --- a/drivers/gpu/drm/i915/intel_pm.c > > > +++ b/drivers/gpu/drm/i915/intel_pm.c > > > @@ -5118,6 +5118,12 @@ static bool icl_need_wm1_wa(struct drm_i915_private *i915, > > > (IS_DISPLAY_VER(i915, 12, 13) && plane_id == PLANE_CURSOR); > > > } > > > > > > +static bool needs_min_ddb(struct drm_i915_private *i915, > > > + struct intel_crtc_state *crtc_state) > > > > s/needs/use/ to match the wm0 counterpart? > > > > Could use a comment as well perhaps, or maybe just put this right > > next to the wm0 counterpart so the reader can see both together and > > make the connection. > > > > Hmm. Actually I think this would also need the plane->async_flip > > check here too or else we'll drop all the planes to min ddb > > instead of just the plane doing async flips. > > > > Oh, and I think we need this same thing when calculating the > > total_data_rate or else the numbers won't match. > > Yes, there seems to be a problem with that approach, we use ratio > from data plane_data_rate/total_data_rate to determine how we split > extra ddb blocks, however if plane data rate can be just set as 0 > here localle, total_data_rate is obtained from crtc_state->plane_data_rate, > which is being calculated first. > So if we trick icl_get_total_relative_data_rate function to calculate > total_data_rate corresponding to rate = 0, we will then have > crtc_state->plane_data_rate[plane_id] set to 0, which is probably > not what we want. These are just the relative data rates so they're not actually used for anything else. So I guess we could even set them to 0. Though I don't even recall if the current code really works or not. I think there might have been some problem with calculating these that I perhaps fixed with my latest ddb series (or maybe I already fixed it with some earlier series, can't remember anymore). > > Or should I just edit icl_get_total_relative_data_rate so that it > still calculates crtc_state->plane_data_rate properly however, the > doesn't add those to total_data_rate, if use_min_ddb(plane) is set? This should work too. Can't immediately think why one approach would be strictly better than the other. -- Ville Syrjälä Intel