[Intel-gfx] [PATCH] drm/i915: Fix divide by zero on watermark update

Jani Nikula jani.nikula at linux.intel.com
Wed Aug 12 07:26:59 PDT 2015


On Thu, 16 Jul 2015, Damien Lespiau <damien.lespiau at intel.com> wrote:
> On Thu, Jul 16, 2015 at 07:36:51PM +0300, Mika Kuoppala wrote:
>> Fix divide by zero if we end up updating the watermarks
>> with zero dotclock.
>> 
>> This is a stop gap measure to allow module load in cases
>> where our state keeping fails.
>> 
>> v2: WARN_ON added (Paulo)
>> 
>> Cc: Paulo Zanoni <przanoni at gmail.com>
>> Cc: Damien Lespiau <damien.lespiau at intel.com>
>> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
>
> I want to say a loading module is more important than a proper fix, so:

Any ideas on the proper fix? Patches on the list, sketches on a post-it,
anything? I've got a machine here hitting this.

BR,
Jani.


>
> Reviewed-by: Damien Lespiau <damien.lespiau at intel.com>
>
> -- 
> Damien
>
>> ---
>>  drivers/gpu/drm/i915/intel_pm.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
>> index 5eeddc9..0d3e014 100644
>> --- a/drivers/gpu/drm/i915/intel_pm.c
>> +++ b/drivers/gpu/drm/i915/intel_pm.c
>> @@ -3316,8 +3316,10 @@ skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p)
>>  	if (!to_intel_crtc(crtc)->active)
>>  		return 0;
>>  
>> -	return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate);
>> +	if (WARN_ON(p->pixel_rate == 0))
>> +		return 0;
>>  
>> +	return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate);
>>  }
>>  
>>  static void skl_compute_transition_wm(struct drm_crtc *crtc,
>> -- 
>> 2.1.4
>> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list