On Thu, Aug 21, 2025 at 4:05 PM Ville Syrjälä <[email protected]> wrote: > > On Wed, Aug 20, 2025 at 04:29:13PM +0300, Juha-Pekka Heikkila wrote: > > skl_crtc_allocate_plane_ddb allow iter.data_rate to be zero > > which could cause divide by zero in skl_allocate_plane_ddb, > > check against that. > > > > Signed-off-by: Juha-Pekka Heikkila <[email protected]> > > --- > > drivers/gpu/drm/i915/display/skl_watermark.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c > > b/drivers/gpu/drm/i915/display/skl_watermark.c > > index def5150231a4..403783504ab3 100644 > > --- a/drivers/gpu/drm/i915/display/skl_watermark.c > > +++ b/drivers/gpu/drm/i915/display/skl_watermark.c > > @@ -1388,7 +1388,7 @@ skl_allocate_plane_ddb(struct skl_plane_ddb_iter > > *iter, > > { > > u16 size, extra = 0; > > > > - if (data_rate) { > > + if (data_rate && iter->data_rate) { > > I don't think it should be possible to have iter_data->data_rate==0 > and data_rate!=0, with iter->data_rate being the sum of all the > planes' data_rates. >
But I see there in calling function skl_crtc_allocate_plane_ddb(..) just before arriving here, check you've left there few years ago that says /* avoid the WARN later when we don't allocate any extra DDB */ if (iter.data_rate == 0) iter.size = 0; hence I had idea to add this check also > > extra = min_t(u16, iter->size, > > DIV64_U64_ROUND_UP(iter->size * data_rate, > > iter->data_rate)); > > -- > > 2.43.0 > > -- > Ville Syrjälä > Intel
