Re: [PATCH] drm/i915/: Initialise trans_min for skl_compute_transition_wm()

Mahesh Kumar
2017-11-09T14:13:21Z

On Thursday 09 November 2017 09:19 AM, Mahesh Kumar wrote:
> Hi,
>
>
> On Thursday 09 November 2017 01:30 AM, Ville Syrjälä wrote:
>> On Wed, Nov 08, 2017 at 10:39:59AM +0530, Mahesh Kumar wrote:
>>> Hi,
>>>
>>>
>>> On Tuesday 07 November 2017 11:57 PM, Chris Wilson wrote:
>>>> clang spots
>>>>
>>>> drivers/gpu/drm/i915/intel_pm.c:4655:6: warning: variable
>>>> 'trans_min' is used uninitialized whenever 'if' condition is false
>>>> [-Wsometimes-uninitialized]
>>>>           if (INTEL_GEN(dev_priv) >= 10)
>>>>
>>>> but fortunately for us we skip the function unless on a gen10+ device.
>>>> However, to keep the function generic in case we do want to
>>>> re-enable it
>>>> for gen9 again, initialise trans_min to 0.
>>>>
>>>> References: ca47667f523e ("drm/i915/gen10: Calculate and enable
>>>> transition WM")
>>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>>> Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
>>>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>>>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>> ---
>>>>    drivers/gpu/drm/i915/intel_pm.c | 1 +
>>>>    1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/intel_pm.c
>>>> b/drivers/gpu/drm/i915/intel_pm.c
>>>> index b75c4cf074ff..40da5001be28 100644
>>>> --- a/drivers/gpu/drm/i915/intel_pm.c
>>>> +++ b/drivers/gpu/drm/i915/intel_pm.c
>>>> @@ -4652,6 +4652,7 @@ static void skl_compute_transition_wm(struct
>>>> intel_crtc_state *cstate,
>>>>        if (!dev_priv->ipc_enabled)
>>>>            goto exit;
>>>>    +    trans_min = 0;
>>>>        if (INTEL_GEN(dev_priv) >= 10)
>>>>            trans_min = 4;
>>> BSpec WA section tells not to enable transition watermark for any GEN-9
>>> platforms (that was the assumption with this patch)
>>> But anyway trans_min value for GEN9 is 14 blocks, IMO adding else case
>>> with trans_min = 14; will be logical solution to this.
>> Bspec is telling me that 14 is the correct value for gen10 as well.
>> Looks like the 4 came back from the future.
> Thanks Ville for correcting this, I checked the BSpec again, yes for
> gen-10 as well value is 14, looks like I read 4 instead of 14 earlier.
> So we can always init trans_min = 14.
Further debugging reveals this is a nasty BSpec update, until GEN9/10 WM
programming was is same page this value was 4 for GEN-10 but after
moving it to new page the value is updated to 14.
anyway I sent a query to HW team regarding same.
>
> -Mahesh
>>