All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/gpu/drm/i915/intel_pm.c:4467: bad comparison ?
@ 2017-07-17  7:46 David Binderman
  2017-07-17  9:52 ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: David Binderman @ 2017-07-17  7:46 UTC (permalink / raw)
  To: daniel.vetter@intel.com, jani.nikula@linux.intel.com,
	airlied@linux.ie, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org


Hello there,

drivers/gpu/drm/i915/intel_pm.c:4467]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.

Source code is

        else if ((ddb_allocation && ddb_allocation /
            fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1)

Regards

David Binderman
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: drivers/gpu/drm/i915/intel_pm.c:4467: bad comparison ?
  2017-07-17  7:46 drivers/gpu/drm/i915/intel_pm.c:4467: bad comparison ? David Binderman
@ 2017-07-17  9:52 ` Jani Nikula
  2017-07-17 10:32   ` Mahesh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2017-07-17  9:52 UTC (permalink / raw)
  To: David Binderman, daniel.vetter@intel.com,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
  Cc: mahesh1.kumar

On Mon, 17 Jul 2017, David Binderman <dcb314@hotmail.com> wrote:
> Hello there,

Hello. No need to include LKML for stuff like this. But Cc'd the folks
from the broken commit.

> drivers/gpu/drm/i915/intel_pm.c:4467]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.
>
> Source code is
>
>         else if ((ddb_allocation && ddb_allocation /
>             fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1)

Broken by

commit d555cb5827d603244969e08444340e3db78c8a37
Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
Date:   Wed May 17 17:28:29 2017 +0530

    drm/i915/skl+: use linetime latency if ddb size is not available

The broken code has since been removed by bb9d85f6e9de ("drm/i915/skl:
New ddb allocation algorithm") but restored by 9a30a26122c3 ("Revert
"drm/i915/skl: New ddb allocation algorithm""). *sigh*.

Mahesh et al, please figure it out.


BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: drivers/gpu/drm/i915/intel_pm.c:4467: bad comparison ?
  2017-07-17 10:32   ` Mahesh Kumar
@ 2017-07-17 10:31     ` Maarten Lankhorst
  2017-07-17 10:40       ` Mahesh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Maarten Lankhorst @ 2017-07-17 10:31 UTC (permalink / raw)
  To: Mahesh Kumar, Jani Nikula, David Binderman,
	daniel.vetter@intel.com, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org

Op 17-07-17 om 12:32 schreef Mahesh Kumar:
> Hi,
>
>
> On Monday 17 July 2017 03:22 PM, Jani Nikula wrote:
>> On Mon, 17 Jul 2017, David Binderman <dcb314@hotmail.com> wrote:
>>> Hello there,
>> Hello. No need to include LKML for stuff like this. But Cc'd the folks
>> from the broken commit.
>>
>>> drivers/gpu/drm/i915/intel_pm.c:4467]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.
>>>
>>> Source code is
>>>
>>>          else if ((ddb_allocation && ddb_allocation /
>>>              fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1)
> ddb_allocation being integer was intentional.
> Other than that code has improper parentheses as well.
> intention was if ddb_allocation is not 0 & (ddb_allocation / plane_blocks_per_line >= 1) then execute the condition.
> it should have been
>     else if (ddb_allocation && (ddb_allocation / fixed_16_16_to_u32_round_up(plane_blocks_per_line) >= 1))
>
> will post a fix.
>
> thanks.
>
> -Mahesh
>> Broken by
>>
>> commit d555cb5827d603244969e08444340e3db78c8a37
>> Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
>> Date:   Wed May 17 17:28:29 2017 +0530
>>
>>      drm/i915/skl+: use linetime latency if ddb size is not available
>>
>> The broken code has since been removed by bb9d85f6e9de ("drm/i915/skl:
>> New ddb allocation algorithm") but restored by 9a30a26122c3 ("Revert
>> "drm/i915/skl: New ddb allocation algorithm""). *sigh*.
>>
>> Mahesh et al, please figure it out.
>>
>>
>> BR,
>> Jani.
>>
>>
>
Would this work?

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 78b9acfc64c0..b9b3d8d45016 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4681,8 +4681,8 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 		if ((cpp * cstate->base.adjusted_mode.crtc_htotal / 512 < 1) &&
 		    (plane_bytes_per_line / 512 < 1))
 			selected_result = method2;
-		else if ((ddb_allocation && ddb_allocation /
-			fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1)
+		else if (ddb_allocation >=
+			 fixed_16_16_to_u32_round_up(plane_blocks_per_line))
 			selected_result = min_fixed_16_16(method1, method2);
 		else if (latency >= linetime_us)
 			selected_result = min_fixed_16_16(method1, method2);

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: drivers/gpu/drm/i915/intel_pm.c:4467: bad comparison ?
  2017-07-17  9:52 ` Jani Nikula
@ 2017-07-17 10:32   ` Mahesh Kumar
  2017-07-17 10:31     ` Maarten Lankhorst
  0 siblings, 1 reply; 5+ messages in thread
From: Mahesh Kumar @ 2017-07-17 10:32 UTC (permalink / raw)
  To: Jani Nikula, David Binderman, daniel.vetter@intel.com,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org

Hi,


On Monday 17 July 2017 03:22 PM, Jani Nikula wrote:
> On Mon, 17 Jul 2017, David Binderman <dcb314@hotmail.com> wrote:
>> Hello there,
> Hello. No need to include LKML for stuff like this. But Cc'd the folks
> from the broken commit.
>
>> drivers/gpu/drm/i915/intel_pm.c:4467]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.
>>
>> Source code is
>>
>>          else if ((ddb_allocation && ddb_allocation /
>>              fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1)
ddb_allocation being integer was intentional.
Other than that code has improper parentheses as well.
intention was if ddb_allocation is not 0 & (ddb_allocation / 
plane_blocks_per_line >= 1) then execute the condition.
it should have been
     else if (ddb_allocation && (ddb_allocation / 
fixed_16_16_to_u32_round_up(plane_blocks_per_line) >= 1))

will post a fix.

thanks.

-Mahesh
> Broken by
>
> commit d555cb5827d603244969e08444340e3db78c8a37
> Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
> Date:   Wed May 17 17:28:29 2017 +0530
>
>      drm/i915/skl+: use linetime latency if ddb size is not available
>
> The broken code has since been removed by bb9d85f6e9de ("drm/i915/skl:
> New ddb allocation algorithm") but restored by 9a30a26122c3 ("Revert
> "drm/i915/skl: New ddb allocation algorithm""). *sigh*.
>
> Mahesh et al, please figure it out.
>
>
> BR,
> Jani.
>
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: drivers/gpu/drm/i915/intel_pm.c:4467: bad comparison ?
  2017-07-17 10:31     ` Maarten Lankhorst
@ 2017-07-17 10:40       ` Mahesh Kumar
  0 siblings, 0 replies; 5+ messages in thread
From: Mahesh Kumar @ 2017-07-17 10:40 UTC (permalink / raw)
  To: Maarten Lankhorst, Jani Nikula, David Binderman,
	daniel.vetter@intel.com, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org

Hi,


On Monday 17 July 2017 04:01 PM, Maarten Lankhorst wrote:
> Op 17-07-17 om 12:32 schreef Mahesh Kumar:
>> Hi,
>>
>>
>> On Monday 17 July 2017 03:22 PM, Jani Nikula wrote:
>>> On Mon, 17 Jul 2017, David Binderman <dcb314@hotmail.com> wrote:
>>>> Hello there,
>>> Hello. No need to include LKML for stuff like this. But Cc'd the folks
>>> from the broken commit.
>>>
>>>> drivers/gpu/drm/i915/intel_pm.c:4467]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.
>>>>
>>>> Source code is
>>>>
>>>>           else if ((ddb_allocation && ddb_allocation /
>>>>               fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1)
>> ddb_allocation being integer was intentional.
>> Other than that code has improper parentheses as well.
>> intention was if ddb_allocation is not 0 & (ddb_allocation / plane_blocks_per_line >= 1) then execute the condition.
>> it should have been
>>      else if (ddb_allocation && (ddb_allocation / fixed_16_16_to_u32_round_up(plane_blocks_per_line) >= 1))
>>
>> will post a fix.
>>
>> thanks.
>>
>> -Mahesh
>>> Broken by
>>>
>>> commit d555cb5827d603244969e08444340e3db78c8a37
>>> Author: Kumar, Mahesh <mahesh1.kumar@intel.com>
>>> Date:   Wed May 17 17:28:29 2017 +0530
>>>
>>>       drm/i915/skl+: use linetime latency if ddb size is not available
>>>
>>> The broken code has since been removed by bb9d85f6e9de ("drm/i915/skl:
>>> New ddb allocation algorithm") but restored by 9a30a26122c3 ("Revert
>>> "drm/i915/skl: New ddb allocation algorithm""). *sigh*.
>>>
>>> Mahesh et al, please figure it out.
>>>
>>>
>>> BR,
>>> Jani.
>>>
>>>
> Would this work?
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 78b9acfc64c0..b9b3d8d45016 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4681,8 +4681,8 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
>   		if ((cpp * cstate->base.adjusted_mode.crtc_htotal / 512 < 1) &&
>   		    (plane_bytes_per_line / 512 < 1))
>   			selected_result = method2;
> -		else if ((ddb_allocation && ddb_allocation /
> -			fixed_16_16_to_u32_round_up(plane_blocks_per_line)) >= 1)
> +		else if (ddb_allocation >=
> +			 fixed_16_16_to_u32_round_up(plane_blocks_per_line))
yes, this would even simplify the condition :)
-Mahesh
>   			selected_result = min_fixed_16_16(method1, method2);
>   		else if (latency >= linetime_us)
>   			selected_result = min_fixed_16_16(method1, method2);
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-17 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-17  7:46 drivers/gpu/drm/i915/intel_pm.c:4467: bad comparison ? David Binderman
2017-07-17  9:52 ` Jani Nikula
2017-07-17 10:32   ` Mahesh Kumar
2017-07-17 10:31     ` Maarten Lankhorst
2017-07-17 10:40       ` Mahesh Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.